@developer.notchatbot/webchat 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(Oe,ye){typeof exports=="object"&&typeof module!="undefined"?module.exports=ye():typeof define=="function"&&define.amd?define(ye):(Oe=typeof globalThis!="undefined"?globalThis:Oe||self,Oe.WebChat=ye())})(this,function(){"use strict";var cp=Object.defineProperty,fp=Object.defineProperties;var dp=Object.getOwnPropertyDescriptors;var rf=Object.getOwnPropertySymbols;var hp=Object.prototype.hasOwnProperty,pp=Object.prototype.propertyIsEnumerable;var of=(Oe,ye,ne)=>ye in Oe?cp(Oe,ye,{enumerable:!0,configurable:!0,writable:!0,value:ne}):Oe[ye]=ne,yt=(Oe,ye)=>{for(var ne in ye||(ye={}))hp.call(ye,ne)&&of(Oe,ne,ye[ne]);if(rf)for(var ne of rf(ye))pp.call(ye,ne)&&of(Oe,ne,ye[ne]);return Oe},Zt=(Oe,ye)=>fp(Oe,dp(ye));var dt=(Oe,ye,ne)=>new Promise((qt,Lr)=>{var ti=wt=>{try{Wn(ne.next(wt))}catch(Vn){Lr(Vn)}},ni=wt=>{try{Wn(ne.throw(wt))}catch(Vn){Lr(Vn)}},Wn=wt=>wt.done?qt(wt.value):Promise.resolve(wt.value).then(ti,ni);Wn((ne=ne.apply(Oe,ye)).next())});function Oe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ye={exports:{}},ne={};/**
1
+ (function(Oe,ye){typeof exports=="object"&&typeof module!="undefined"?module.exports=ye():typeof define=="function"&&define.amd?define(ye):(Oe=typeof globalThis!="undefined"?globalThis:Oe||self,Oe.WebChat=ye())})(this,function(){"use strict";var fp=Object.defineProperty,dp=Object.defineProperties;var hp=Object.getOwnPropertyDescriptors;var af=Object.getOwnPropertySymbols;var pp=Object.prototype.hasOwnProperty,mp=Object.prototype.propertyIsEnumerable;var sf=(Oe,ye,ne)=>ye in Oe?fp(Oe,ye,{enumerable:!0,configurable:!0,writable:!0,value:ne}):Oe[ye]=ne,yt=(Oe,ye)=>{for(var ne in ye||(ye={}))pp.call(ye,ne)&&sf(Oe,ne,ye[ne]);if(af)for(var ne of af(ye))mp.call(ye,ne)&&sf(Oe,ne,ye[ne]);return Oe},Zt=(Oe,ye)=>dp(Oe,hp(ye));var dt=(Oe,ye,ne)=>new Promise((qt,jr)=>{var ni=wt=>{try{Wn(ne.next(wt))}catch(Vn){jr(Vn)}},ri=wt=>{try{Wn(ne.throw(wt))}catch(Vn){jr(Vn)}},Wn=wt=>wt.done?qt(wt.value):Promise.resolve(wt.value).then(ni,ri);Wn((ne=ne.apply(Oe,ye)).next())});function Oe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ye={exports:{}},ne={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var qt=Symbol.for("react.element"),Lr=Symbol.for("react.portal"),ti=Symbol.for("react.fragment"),ni=Symbol.for("react.strict_mode"),Wn=Symbol.for("react.profiler"),wt=Symbol.for("react.provider"),Vn=Symbol.for("react.context"),af=Symbol.for("react.forward_ref"),sf=Symbol.for("react.suspense"),lf=Symbol.for("react.memo"),uf=Symbol.for("react.lazy"),Cs=Symbol.iterator;function cf(e){return e===null||typeof e!="object"?null:(e=Cs&&e[Cs]||e["@@iterator"],typeof e=="function"?e:null)}var xs={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Es=Object.assign,Os={};function mn(e,t,n){this.props=e,this.context=t,this.refs=Os,this.updater=n||xs}mn.prototype.isReactComponent={},mn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},mn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Rs(){}Rs.prototype=mn.prototype;function ri(e,t,n){this.props=e,this.context=t,this.refs=Os,this.updater=n||xs}var oi=ri.prototype=new Rs;oi.constructor=ri,Es(oi,mn.prototype),oi.isPureReactComponent=!0;var Ts=Array.isArray,bs=Object.prototype.hasOwnProperty,ii={current:null},As={key:!0,ref:!0,__self:!0,__source:!0};function Is(e,t,n){var r,o={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)bs.call(t,r)&&!As.hasOwnProperty(r)&&(o[r]=t[r]);var m=arguments.length-2;if(m===1)o.children=n;else if(1<m){for(var v=Array(m),S=0;S<m;S++)v[S]=arguments[S+2];o.children=v}if(e&&e.defaultProps)for(r in m=e.defaultProps,m)o[r]===void 0&&(o[r]=m[r]);return{$$typeof:qt,type:e,key:i,ref:a,props:o,_owner:ii.current}}function ff(e,t){return{$$typeof:qt,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ai(e){return typeof e=="object"&&e!==null&&e.$$typeof===qt}function df(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Ms=/\/+/g;function si(e,t){return typeof e=="object"&&e!==null&&e.key!=null?df(""+e.key):t.toString(36)}function jr(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case qt:case Lr:a=!0}}if(a)return a=e,o=o(a),e=r===""?"."+si(a,0):r,Ts(o)?(n="",e!=null&&(n=e.replace(Ms,"$&/")+"/"),jr(o,t,n,"",function(S){return S})):o!=null&&(ai(o)&&(o=ff(o,n+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(Ms,"$&/")+"/")+e)),t.push(o)),1;if(a=0,r=r===""?".":r+":",Ts(e))for(var m=0;m<e.length;m++){i=e[m];var v=r+si(i,m);a+=jr(i,t,n,v,o)}else if(v=cf(e),typeof v=="function")for(e=v.call(e),m=0;!(i=e.next()).done;)i=i.value,v=r+si(i,m++),a+=jr(i,t,n,v,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Ur(e,t,n){if(e==null)return e;var r=[],o=0;return jr(e,r,"","",function(i){return t.call(n,i,o++)}),r}function hf(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Le={current:null},Br={transition:null},pf={ReactCurrentDispatcher:Le,ReactCurrentBatchConfig:Br,ReactCurrentOwner:ii};function Ps(){throw Error("act(...) is not supported in production builds of React.")}ne.Children={map:Ur,forEach:function(e,t,n){Ur(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ur(e,function(){t++}),t},toArray:function(e){return Ur(e,function(t){return t})||[]},only:function(e){if(!ai(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},ne.Component=mn,ne.Fragment=ti,ne.Profiler=Wn,ne.PureComponent=ri,ne.StrictMode=ni,ne.Suspense=sf,ne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=pf,ne.act=Ps,ne.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Es({},e.props),o=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=ii.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var m=e.type.defaultProps;for(v in t)bs.call(t,v)&&!As.hasOwnProperty(v)&&(r[v]=t[v]===void 0&&m!==void 0?m[v]:t[v])}var v=arguments.length-2;if(v===1)r.children=n;else if(1<v){m=Array(v);for(var S=0;S<v;S++)m[S]=arguments[S+2];r.children=m}return{$$typeof:qt,type:e.type,key:o,ref:i,props:r,_owner:a}},ne.createContext=function(e){return e={$$typeof:Vn,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:wt,_context:e},e.Consumer=e},ne.createElement=Is,ne.createFactory=function(e){var t=Is.bind(null,e);return t.type=e,t},ne.createRef=function(){return{current:null}},ne.forwardRef=function(e){return{$$typeof:af,render:e}},ne.isValidElement=ai,ne.lazy=function(e){return{$$typeof:uf,_payload:{_status:-1,_result:e},_init:hf}},ne.memo=function(e,t){return{$$typeof:lf,type:e,compare:t===void 0?null:t}},ne.startTransition=function(e){var t=Br.transition;Br.transition={};try{e()}finally{Br.transition=t}},ne.unstable_act=Ps,ne.useCallback=function(e,t){return Le.current.useCallback(e,t)},ne.useContext=function(e){return Le.current.useContext(e)},ne.useDebugValue=function(){},ne.useDeferredValue=function(e){return Le.current.useDeferredValue(e)},ne.useEffect=function(e,t){return Le.current.useEffect(e,t)},ne.useId=function(){return Le.current.useId()},ne.useImperativeHandle=function(e,t,n){return Le.current.useImperativeHandle(e,t,n)},ne.useInsertionEffect=function(e,t){return Le.current.useInsertionEffect(e,t)},ne.useLayoutEffect=function(e,t){return Le.current.useLayoutEffect(e,t)},ne.useMemo=function(e,t){return Le.current.useMemo(e,t)},ne.useReducer=function(e,t,n){return Le.current.useReducer(e,t,n)},ne.useRef=function(e){return Le.current.useRef(e)},ne.useState=function(e){return Le.current.useState(e)},ne.useSyncExternalStore=function(e,t,n){return Le.current.useSyncExternalStore(e,t,n)},ne.useTransition=function(){return Le.current.useTransition()},ne.version="18.3.1",ye.exports=ne;var oe=ye.exports;const mf=Oe(oe);var ks={exports:{}},$e={},Ns={exports:{}},Ds={};/**
9
+ */var qt=Symbol.for("react.element"),jr=Symbol.for("react.portal"),ni=Symbol.for("react.fragment"),ri=Symbol.for("react.strict_mode"),Wn=Symbol.for("react.profiler"),wt=Symbol.for("react.provider"),Vn=Symbol.for("react.context"),lf=Symbol.for("react.forward_ref"),uf=Symbol.for("react.suspense"),cf=Symbol.for("react.memo"),ff=Symbol.for("react.lazy"),xs=Symbol.iterator;function df(e){return e===null||typeof e!="object"?null:(e=xs&&e[xs]||e["@@iterator"],typeof e=="function"?e:null)}var Es={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Os=Object.assign,Rs={};function mn(e,t,n){this.props=e,this.context=t,this.refs=Rs,this.updater=n||Es}mn.prototype.isReactComponent={},mn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},mn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ts(){}Ts.prototype=mn.prototype;function oi(e,t,n){this.props=e,this.context=t,this.refs=Rs,this.updater=n||Es}var ii=oi.prototype=new Ts;ii.constructor=oi,Os(ii,mn.prototype),ii.isPureReactComponent=!0;var bs=Array.isArray,As=Object.prototype.hasOwnProperty,ai={current:null},Is={key:!0,ref:!0,__self:!0,__source:!0};function Ms(e,t,n){var r,o={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)As.call(t,r)&&!Is.hasOwnProperty(r)&&(o[r]=t[r]);var m=arguments.length-2;if(m===1)o.children=n;else if(1<m){for(var v=Array(m),S=0;S<m;S++)v[S]=arguments[S+2];o.children=v}if(e&&e.defaultProps)for(r in m=e.defaultProps,m)o[r]===void 0&&(o[r]=m[r]);return{$$typeof:qt,type:e,key:i,ref:a,props:o,_owner:ai.current}}function hf(e,t){return{$$typeof:qt,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function si(e){return typeof e=="object"&&e!==null&&e.$$typeof===qt}function pf(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Ps=/\/+/g;function li(e,t){return typeof e=="object"&&e!==null&&e.key!=null?pf(""+e.key):t.toString(36)}function Ur(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case qt:case jr:a=!0}}if(a)return a=e,o=o(a),e=r===""?"."+li(a,0):r,bs(o)?(n="",e!=null&&(n=e.replace(Ps,"$&/")+"/"),Ur(o,t,n,"",function(S){return S})):o!=null&&(si(o)&&(o=hf(o,n+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(Ps,"$&/")+"/")+e)),t.push(o)),1;if(a=0,r=r===""?".":r+":",bs(e))for(var m=0;m<e.length;m++){i=e[m];var v=r+li(i,m);a+=Ur(i,t,n,v,o)}else if(v=df(e),typeof v=="function")for(e=v.call(e),m=0;!(i=e.next()).done;)i=i.value,v=r+li(i,m++),a+=Ur(i,t,n,v,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Br(e,t,n){if(e==null)return e;var r=[],o=0;return Ur(e,r,"","",function(i){return t.call(n,i,o++)}),r}function mf(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Le={current:null},_r={transition:null},vf={ReactCurrentDispatcher:Le,ReactCurrentBatchConfig:_r,ReactCurrentOwner:ai};function ks(){throw Error("act(...) is not supported in production builds of React.")}ne.Children={map:Br,forEach:function(e,t,n){Br(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Br(e,function(){t++}),t},toArray:function(e){return Br(e,function(t){return t})||[]},only:function(e){if(!si(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},ne.Component=mn,ne.Fragment=ni,ne.Profiler=Wn,ne.PureComponent=oi,ne.StrictMode=ri,ne.Suspense=uf,ne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vf,ne.act=ks,ne.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Os({},e.props),o=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=ai.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var m=e.type.defaultProps;for(v in t)As.call(t,v)&&!Is.hasOwnProperty(v)&&(r[v]=t[v]===void 0&&m!==void 0?m[v]:t[v])}var v=arguments.length-2;if(v===1)r.children=n;else if(1<v){m=Array(v);for(var S=0;S<v;S++)m[S]=arguments[S+2];r.children=m}return{$$typeof:qt,type:e.type,key:o,ref:i,props:r,_owner:a}},ne.createContext=function(e){return e={$$typeof:Vn,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:wt,_context:e},e.Consumer=e},ne.createElement=Ms,ne.createFactory=function(e){var t=Ms.bind(null,e);return t.type=e,t},ne.createRef=function(){return{current:null}},ne.forwardRef=function(e){return{$$typeof:lf,render:e}},ne.isValidElement=si,ne.lazy=function(e){return{$$typeof:ff,_payload:{_status:-1,_result:e},_init:mf}},ne.memo=function(e,t){return{$$typeof:cf,type:e,compare:t===void 0?null:t}},ne.startTransition=function(e){var t=_r.transition;_r.transition={};try{e()}finally{_r.transition=t}},ne.unstable_act=ks,ne.useCallback=function(e,t){return Le.current.useCallback(e,t)},ne.useContext=function(e){return Le.current.useContext(e)},ne.useDebugValue=function(){},ne.useDeferredValue=function(e){return Le.current.useDeferredValue(e)},ne.useEffect=function(e,t){return Le.current.useEffect(e,t)},ne.useId=function(){return Le.current.useId()},ne.useImperativeHandle=function(e,t,n){return Le.current.useImperativeHandle(e,t,n)},ne.useInsertionEffect=function(e,t){return Le.current.useInsertionEffect(e,t)},ne.useLayoutEffect=function(e,t){return Le.current.useLayoutEffect(e,t)},ne.useMemo=function(e,t){return Le.current.useMemo(e,t)},ne.useReducer=function(e,t,n){return Le.current.useReducer(e,t,n)},ne.useRef=function(e){return Le.current.useRef(e)},ne.useState=function(e){return Le.current.useState(e)},ne.useSyncExternalStore=function(e,t,n){return Le.current.useSyncExternalStore(e,t,n)},ne.useTransition=function(){return Le.current.useTransition()},ne.version="18.3.1",ye.exports=ne;var oe=ye.exports;const gf=Oe(oe);var Ns={exports:{}},$e={},Ds={exports:{}},Ls={};/**
10
10
  * @license React
11
11
  * scheduler.production.min.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */(function(e){function t(j,U){var z=j.length;j.push(U);e:for(;0<z;){var V=z-1>>>1,G=j[V];if(0<o(G,U))j[V]=U,j[z]=G,z=V;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var U=j[0],z=j.pop();if(z!==U){j[0]=z;e:for(var V=0,G=j.length,F=G>>>1;V<F;){var b=2*(V+1)-1,L=j[b],B=b+1,_=j[B];if(0>o(L,z))B<G&&0>o(_,L)?(j[V]=_,j[B]=z,V=B):(j[V]=L,j[b]=z,V=b);else if(B<G&&0>o(_,z))j[V]=_,j[B]=z,V=B;else break e}}return U}function o(j,U){var z=j.sortIndex-U.sortIndex;return z!==0?z:j.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,m=a.now();e.unstable_now=function(){return a.now()-m}}var v=[],S=[],T=1,R=null,C=3,O=!1,f=!1,E=!1,P=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(j){for(var U=n(S);U!==null;){if(U.callback===null)r(S);else if(U.startTime<=j)r(S),U.sortIndex=U.expirationTime,t(v,U);else break;U=n(S)}}function w(j){if(E=!1,h(j),!f)if(n(v)!==null)f=!0,M(c);else{var U=n(S);U!==null&&A(w,U.startTime-j)}}function c(j,U){f=!1,E&&(E=!1,y(s),s=-1),O=!0;var z=C;try{for(h(U),R=n(v);R!==null&&(!(R.expirationTime>U)||j&&!x());){var V=R.callback;if(typeof V=="function"){R.callback=null,C=R.priorityLevel;var G=V(R.expirationTime<=U);U=e.unstable_now(),typeof G=="function"?R.callback=G:R===n(v)&&r(v),h(U)}else r(v);R=n(v)}if(R!==null)var F=!0;else{var b=n(S);b!==null&&A(w,b.startTime-U),F=!1}return F}finally{R=null,C=z,O=!1}}var u=!1,l=null,s=-1,g=5,p=-1;function x(){return!(e.unstable_now()-p<g)}function D(){if(l!==null){var j=e.unstable_now();p=j;var U=!0;try{U=l(!0,j)}finally{U?N():(u=!1,l=null)}}else u=!1}var N;if(typeof d=="function")N=function(){d(D)};else if(typeof MessageChannel!="undefined"){var k=new MessageChannel,I=k.port2;k.port1.onmessage=D,N=function(){I.postMessage(null)}}else N=function(){P(D,0)};function M(j){l=j,u||(u=!0,N())}function A(j,U){s=P(function(){j(e.unstable_now())},U)}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(j){j.callback=null},e.unstable_continueExecution=function(){f||O||(f=!0,M(c))},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):g=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return C},e.unstable_getFirstCallbackNode=function(){return n(v)},e.unstable_next=function(j){switch(C){case 1:case 2:case 3:var U=3;break;default:U=C}var z=C;C=U;try{return j()}finally{C=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(j,U){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var z=C;C=j;try{return U()}finally{C=z}},e.unstable_scheduleCallback=function(j,U,z){var V=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?V+z:V):z=V,j){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=z+G,j={id:T++,callback:U,priorityLevel:j,startTime:z,expirationTime:G,sortIndex:-1},z>V?(j.sortIndex=z,t(S,j),n(v)===null&&j===n(S)&&(E?(y(s),s=-1):E=!0,A(w,z-V))):(j.sortIndex=G,t(v,j),f||O||(f=!0,M(c))),j},e.unstable_shouldYield=x,e.unstable_wrapCallback=function(j){var U=C;return function(){var z=C;C=U;try{return j.apply(this,arguments)}finally{C=z}}}})(Ds),Ns.exports=Ds;var vf=Ns.exports;/**
17
+ */(function(e){function t(j,U){var z=j.length;j.push(U);e:for(;0<z;){var W=z-1>>>1,G=j[W];if(0<o(G,U))j[W]=U,j[z]=G,z=W;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var U=j[0],z=j.pop();if(z!==U){j[0]=z;e:for(var W=0,G=j.length,F=G>>>1;W<F;){var b=2*(W+1)-1,L=j[b],B=b+1,_=j[B];if(0>o(L,z))B<G&&0>o(_,L)?(j[W]=_,j[B]=z,W=B):(j[W]=L,j[b]=z,W=b);else if(B<G&&0>o(_,z))j[W]=_,j[B]=z,W=B;else break e}}return U}function o(j,U){var z=j.sortIndex-U.sortIndex;return z!==0?z:j.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,m=a.now();e.unstable_now=function(){return a.now()-m}}var v=[],S=[],T=1,R=null,C=3,O=!1,f=!1,E=!1,P=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(j){for(var U=n(S);U!==null;){if(U.callback===null)r(S);else if(U.startTime<=j)r(S),U.sortIndex=U.expirationTime,t(v,U);else break;U=n(S)}}function w(j){if(E=!1,h(j),!f)if(n(v)!==null)f=!0,M(c);else{var U=n(S);U!==null&&A(w,U.startTime-j)}}function c(j,U){f=!1,E&&(E=!1,y(s),s=-1),O=!0;var z=C;try{for(h(U),R=n(v);R!==null&&(!(R.expirationTime>U)||j&&!x());){var W=R.callback;if(typeof W=="function"){R.callback=null,C=R.priorityLevel;var G=W(R.expirationTime<=U);U=e.unstable_now(),typeof G=="function"?R.callback=G:R===n(v)&&r(v),h(U)}else r(v);R=n(v)}if(R!==null)var F=!0;else{var b=n(S);b!==null&&A(w,b.startTime-U),F=!1}return F}finally{R=null,C=z,O=!1}}var u=!1,l=null,s=-1,g=5,p=-1;function x(){return!(e.unstable_now()-p<g)}function D(){if(l!==null){var j=e.unstable_now();p=j;var U=!0;try{U=l(!0,j)}finally{U?N():(u=!1,l=null)}}else u=!1}var N;if(typeof d=="function")N=function(){d(D)};else if(typeof MessageChannel!="undefined"){var k=new MessageChannel,I=k.port2;k.port1.onmessage=D,N=function(){I.postMessage(null)}}else N=function(){P(D,0)};function M(j){l=j,u||(u=!0,N())}function A(j,U){s=P(function(){j(e.unstable_now())},U)}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(j){j.callback=null},e.unstable_continueExecution=function(){f||O||(f=!0,M(c))},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):g=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return C},e.unstable_getFirstCallbackNode=function(){return n(v)},e.unstable_next=function(j){switch(C){case 1:case 2:case 3:var U=3;break;default:U=C}var z=C;C=U;try{return j()}finally{C=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(j,U){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var z=C;C=j;try{return U()}finally{C=z}},e.unstable_scheduleCallback=function(j,U,z){var W=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?W+z:W):z=W,j){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=z+G,j={id:T++,callback:U,priorityLevel:j,startTime:z,expirationTime:G,sortIndex:-1},z>W?(j.sortIndex=z,t(S,j),n(v)===null&&j===n(S)&&(E?(y(s),s=-1):E=!0,A(w,z-W))):(j.sortIndex=G,t(v,j),f||O||(f=!0,M(c))),j},e.unstable_shouldYield=x,e.unstable_wrapCallback=function(j){var U=C;return function(){var z=C;C=U;try{return j.apply(this,arguments)}finally{C=z}}}})(Ls),Ds.exports=Ls;var yf=Ds.exports;/**
18
18
  * @license React
19
19
  * react-dom.production.min.js
20
20
  *
@@ -22,14 +22,14 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var gf=oe,Ke=vf;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Ls=new Set,$n={};function en(e,t){vn(e,t),vn(e+"Capture",t)}function vn(e,t){for($n[e]=t,e=0;e<t.length;e++)Ls.add(t[e])}var St=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),li=Object.prototype.hasOwnProperty,yf=/^[: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]*$/,js={},Us={};function wf(e){return li.call(Us,e)?!0:li.call(js,e)?!1:yf.test(e)?Us[e]=!0:(js[e]=!0,!1)}function Sf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Cf(e,t,n,r){if(t===null||typeof t=="undefined"||Sf(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function je(e,t,n,r,o,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var be={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){be[e]=new je(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];be[t]=new je(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){be[e]=new je(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){be[e]=new je(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){be[e]=new je(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){be[e]=new je(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){be[e]=new je(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){be[e]=new je(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){be[e]=new je(e,5,!1,e.toLowerCase(),null,!1,!1)});var ui=/[\-:]([a-z])/g;function ci(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ui,ci);be[t]=new je(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ui,ci);be[t]=new je(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ui,ci);be[t]=new je(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){be[e]=new je(e,1,!1,e.toLowerCase(),null,!1,!1)}),be.xlinkHref=new je("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){be[e]=new je(e,1,!1,e.toLowerCase(),null,!0,!0)});function fi(e,t,n,r){var o=be.hasOwnProperty(t)?be[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Cf(t,n,o,r)&&(n=null),r||o===null?wf(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ct=gf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,_r=Symbol.for("react.element"),gn=Symbol.for("react.portal"),yn=Symbol.for("react.fragment"),di=Symbol.for("react.strict_mode"),hi=Symbol.for("react.profiler"),Bs=Symbol.for("react.provider"),_s=Symbol.for("react.context"),pi=Symbol.for("react.forward_ref"),mi=Symbol.for("react.suspense"),vi=Symbol.for("react.suspense_list"),gi=Symbol.for("react.memo"),Pt=Symbol.for("react.lazy"),zs=Symbol.for("react.offscreen"),Hs=Symbol.iterator;function Kn(e){return e===null||typeof e!="object"?null:(e=Hs&&e[Hs]||e["@@iterator"],typeof e=="function"?e:null)}var pe=Object.assign,yi;function Qn(e){if(yi===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);yi=t&&t[1]||""}return`
26
- `+yi+e}var wi=!1;function Si(e,t){if(!e||wi)return"";wi=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(S){var r=S}Reflect.construct(e,[],t)}else{try{t.call()}catch(S){r=S}e.call(t.prototype)}else{try{throw Error()}catch(S){r=S}e()}}catch(S){if(S&&r&&typeof S.stack=="string"){for(var o=S.stack.split(`
25
+ */var wf=oe,Ke=yf;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var js=new Set,$n={};function en(e,t){vn(e,t),vn(e+"Capture",t)}function vn(e,t){for($n[e]=t,e=0;e<t.length;e++)js.add(t[e])}var St=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),ui=Object.prototype.hasOwnProperty,Sf=/^[: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]*$/,Us={},Bs={};function Cf(e){return ui.call(Bs,e)?!0:ui.call(Us,e)?!1:Sf.test(e)?Bs[e]=!0:(Us[e]=!0,!1)}function xf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Ef(e,t,n,r){if(t===null||typeof t=="undefined"||xf(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function je(e,t,n,r,o,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var be={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){be[e]=new je(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];be[t]=new je(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){be[e]=new je(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){be[e]=new je(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){be[e]=new je(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){be[e]=new je(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){be[e]=new je(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){be[e]=new je(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){be[e]=new je(e,5,!1,e.toLowerCase(),null,!1,!1)});var ci=/[\-:]([a-z])/g;function fi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ci,fi);be[t]=new je(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ci,fi);be[t]=new je(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ci,fi);be[t]=new je(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){be[e]=new je(e,1,!1,e.toLowerCase(),null,!1,!1)}),be.xlinkHref=new je("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){be[e]=new je(e,1,!1,e.toLowerCase(),null,!0,!0)});function di(e,t,n,r){var o=be.hasOwnProperty(t)?be[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Ef(t,n,o,r)&&(n=null),r||o===null?Cf(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ct=wf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,zr=Symbol.for("react.element"),gn=Symbol.for("react.portal"),yn=Symbol.for("react.fragment"),hi=Symbol.for("react.strict_mode"),pi=Symbol.for("react.profiler"),_s=Symbol.for("react.provider"),zs=Symbol.for("react.context"),mi=Symbol.for("react.forward_ref"),vi=Symbol.for("react.suspense"),gi=Symbol.for("react.suspense_list"),yi=Symbol.for("react.memo"),Pt=Symbol.for("react.lazy"),Hs=Symbol.for("react.offscreen"),Fs=Symbol.iterator;function Kn(e){return e===null||typeof e!="object"?null:(e=Fs&&e[Fs]||e["@@iterator"],typeof e=="function"?e:null)}var pe=Object.assign,wi;function Qn(e){if(wi===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);wi=t&&t[1]||""}return`
26
+ `+wi+e}var Si=!1;function Ci(e,t){if(!e||Si)return"";Si=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(S){var r=S}Reflect.construct(e,[],t)}else{try{t.call()}catch(S){r=S}e.call(t.prototype)}else{try{throw Error()}catch(S){r=S}e()}}catch(S){if(S&&r&&typeof S.stack=="string"){for(var o=S.stack.split(`
27
27
  `),i=r.stack.split(`
28
28
  `),a=o.length-1,m=i.length-1;1<=a&&0<=m&&o[a]!==i[m];)m--;for(;1<=a&&0<=m;a--,m--)if(o[a]!==i[m]){if(a!==1||m!==1)do if(a--,m--,0>m||o[a]!==i[m]){var v=`
29
- `+o[a].replace(" at new "," at ");return e.displayName&&v.includes("<anonymous>")&&(v=v.replace("<anonymous>",e.displayName)),v}while(1<=a&&0<=m);break}}}finally{wi=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qn(e):""}function xf(e){switch(e.tag){case 5:return Qn(e.type);case 16:return Qn("Lazy");case 13:return Qn("Suspense");case 19:return Qn("SuspenseList");case 0:case 2:case 15:return e=Si(e.type,!1),e;case 11:return e=Si(e.type.render,!1),e;case 1:return e=Si(e.type,!0),e;default:return""}}function Ci(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yn:return"Fragment";case gn:return"Portal";case hi:return"Profiler";case di:return"StrictMode";case mi:return"Suspense";case vi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case _s:return(e.displayName||"Context")+".Consumer";case Bs:return(e._context.displayName||"Context")+".Provider";case pi:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case gi:return t=e.displayName||null,t!==null?t:Ci(e.type)||"Memo";case Pt:t=e._payload,e=e._init;try{return Ci(e(t))}catch(n){}}return null}function Ef(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ci(t);case 8:return t===di?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function kt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fs(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Of(e){var t=Fs(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n!="undefined"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function zr(e){e._valueTracker||(e._valueTracker=Of(e))}function Gs(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Fs(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Hr(e){if(e=e||(typeof document!="undefined"?document:void 0),typeof e=="undefined")return null;try{return e.activeElement||e.body}catch(t){return e.body}}function xi(e,t){var n=t.checked;return pe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n!=null?n:e._wrapperState.initialChecked})}function Ws(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=kt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Vs(e,t){t=t.checked,t!=null&&fi(e,"checked",t,!1)}function Ei(e,t){Vs(e,t);var n=kt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Oi(e,t.type,n):t.hasOwnProperty("defaultValue")&&Oi(e,t.type,kt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $s(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Oi(e,t,n){(t!=="number"||Hr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Jn=Array.isArray;function wn(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+kt(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Ri(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return pe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ks(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Q(92));if(Jn(n)){if(1<n.length)throw Error(Q(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:kt(n)}}function Qs(e,t){var n=kt(t.value),r=kt(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Js(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Ys(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ti(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Ys(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Fr,Xs=function(e){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Fr=Fr||document.createElement("div"),Fr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Fr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Xn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Rf=["Webkit","ms","Moz","O"];Object.keys(Xn).forEach(function(e){Rf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Xn[t]=Xn[e]})});function Zs(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Xn.hasOwnProperty(e)&&Xn[e]?(""+t).trim():t+"px"}function qs(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Zs(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var Tf=pe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function bi(e,t){if(t){if(Tf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function Ai(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Ii=null;function Mi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pi=null,Sn=null,Cn=null;function el(e){if(e=wr(e)){if(typeof Pi!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=fo(t),Pi(e.stateNode,e.type,t))}}function tl(e){Sn?Cn?Cn.push(e):Cn=[e]:Sn=e}function nl(){if(Sn){var e=Sn,t=Cn;if(Cn=Sn=null,el(e),t)for(e=0;e<t.length;e++)el(t[e])}}function rl(e,t){return e(t)}function ol(){}var ki=!1;function il(e,t,n){if(ki)return e(t,n);ki=!0;try{return rl(e,t,n)}finally{ki=!1,(Sn!==null||Cn!==null)&&(ol(),nl())}}function Zn(e,t){var n=e.stateNode;if(n===null)return null;var r=fo(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Q(231,t,typeof n));return n}var Ni=!1;if(St)try{var qn={};Object.defineProperty(qn,"passive",{get:function(){Ni=!0}}),window.addEventListener("test",qn,qn),window.removeEventListener("test",qn,qn)}catch(e){Ni=!1}function bf(e,t,n,r,o,i,a,m,v){var S=Array.prototype.slice.call(arguments,3);try{t.apply(n,S)}catch(T){this.onError(T)}}var er=!1,Gr=null,Wr=!1,Di=null,Af={onError:function(e){er=!0,Gr=e}};function If(e,t,n,r,o,i,a,m,v){er=!1,Gr=null,bf.apply(Af,arguments)}function Mf(e,t,n,r,o,i,a,m,v){if(If.apply(this,arguments),er){if(er){var S=Gr;er=!1,Gr=null}else throw Error(Q(198));Wr||(Wr=!0,Di=S)}}function tn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function al(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function sl(e){if(tn(e)!==e)throw Error(Q(188))}function Pf(e){var t=e.alternate;if(!t){if(t=tn(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return sl(o),e;if(i===r)return sl(o),t;i=i.sibling}throw Error(Q(188))}if(n.return!==r.return)n=o,r=i;else{for(var a=!1,m=o.child;m;){if(m===n){a=!0,n=o,r=i;break}if(m===r){a=!0,r=o,n=i;break}m=m.sibling}if(!a){for(m=i.child;m;){if(m===n){a=!0,n=i,r=o;break}if(m===r){a=!0,r=i,n=o;break}m=m.sibling}if(!a)throw Error(Q(189))}}if(n.alternate!==r)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function ll(e){return e=Pf(e),e!==null?ul(e):null}function ul(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ul(e);if(t!==null)return t;e=e.sibling}return null}var cl=Ke.unstable_scheduleCallback,fl=Ke.unstable_cancelCallback,kf=Ke.unstable_shouldYield,Nf=Ke.unstable_requestPaint,we=Ke.unstable_now,Df=Ke.unstable_getCurrentPriorityLevel,Li=Ke.unstable_ImmediatePriority,dl=Ke.unstable_UserBlockingPriority,Vr=Ke.unstable_NormalPriority,Lf=Ke.unstable_LowPriority,hl=Ke.unstable_IdlePriority,$r=null,ht=null;function jf(e){if(ht&&typeof ht.onCommitFiberRoot=="function")try{ht.onCommitFiberRoot($r,e,void 0,(e.current.flags&128)===128)}catch(t){}}var ot=Math.clz32?Math.clz32:_f,Uf=Math.log,Bf=Math.LN2;function _f(e){return e>>>=0,e===0?32:31-(Uf(e)/Bf|0)|0}var Kr=64,Qr=4194304;function tr(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Jr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var m=a&~o;m!==0?r=tr(m):(i&=a,i!==0&&(r=tr(i)))}else a=n&~o,a!==0?r=tr(a):i!==0&&(r=tr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ot(t),o=1<<n,r|=e[n],t&=~o;return r}function zf(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Hf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-ot(i),m=1<<a,v=o[a];v===-1?(!(m&n)||m&r)&&(o[a]=zf(m,t)):v<=t&&(e.expiredLanes|=m),i&=~m}}function ji(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function pl(){var e=Kr;return Kr<<=1,!(Kr&4194240)&&(Kr=64),e}function Ui(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ot(t),e[t]=n}function Ff(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-ot(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Bi(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ot(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var se=0;function ml(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var vl,_i,gl,yl,wl,zi=!1,Yr=[],Nt=null,Dt=null,Lt=null,rr=new Map,or=new Map,jt=[],Gf="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 submit".split(" ");function Sl(e,t){switch(e){case"focusin":case"focusout":Nt=null;break;case"dragenter":case"dragleave":Dt=null;break;case"mouseover":case"mouseout":Lt=null;break;case"pointerover":case"pointerout":rr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":or.delete(t.pointerId)}}function ir(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=wr(t),t!==null&&_i(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Wf(e,t,n,r,o){switch(t){case"focusin":return Nt=ir(Nt,e,t,n,r,o),!0;case"dragenter":return Dt=ir(Dt,e,t,n,r,o),!0;case"mouseover":return Lt=ir(Lt,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return rr.set(i,ir(rr.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,or.set(i,ir(or.get(i)||null,e,t,n,r,o)),!0}return!1}function Cl(e){var t=nn(e.target);if(t!==null){var n=tn(t);if(n!==null){if(t=n.tag,t===13){if(t=al(n),t!==null){e.blockedOn=t,wl(e.priority,function(){gl(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Xr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Fi(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ii=r,n.target.dispatchEvent(r),Ii=null}else return t=wr(n),t!==null&&_i(t),e.blockedOn=n,!1;t.shift()}return!0}function xl(e,t,n){Xr(e)&&n.delete(t)}function Vf(){zi=!1,Nt!==null&&Xr(Nt)&&(Nt=null),Dt!==null&&Xr(Dt)&&(Dt=null),Lt!==null&&Xr(Lt)&&(Lt=null),rr.forEach(xl),or.forEach(xl)}function ar(e,t){e.blockedOn===t&&(e.blockedOn=null,zi||(zi=!0,Ke.unstable_scheduleCallback(Ke.unstable_NormalPriority,Vf)))}function sr(e){function t(o){return ar(o,e)}if(0<Yr.length){ar(Yr[0],e);for(var n=1;n<Yr.length;n++){var r=Yr[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Nt!==null&&ar(Nt,e),Dt!==null&&ar(Dt,e),Lt!==null&&ar(Lt,e),rr.forEach(t),or.forEach(t),n=0;n<jt.length;n++)r=jt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<jt.length&&(n=jt[0],n.blockedOn===null);)Cl(n),n.blockedOn===null&&jt.shift()}var xn=Ct.ReactCurrentBatchConfig,Zr=!0;function $f(e,t,n,r){var o=se,i=xn.transition;xn.transition=null;try{se=1,Hi(e,t,n,r)}finally{se=o,xn.transition=i}}function Kf(e,t,n,r){var o=se,i=xn.transition;xn.transition=null;try{se=4,Hi(e,t,n,r)}finally{se=o,xn.transition=i}}function Hi(e,t,n,r){if(Zr){var o=Fi(e,t,n,r);if(o===null)ia(e,t,r,qr,n),Sl(e,r);else if(Wf(o,e,t,n,r))r.stopPropagation();else if(Sl(e,r),t&4&&-1<Gf.indexOf(e)){for(;o!==null;){var i=wr(o);if(i!==null&&vl(i),i=Fi(e,t,n,r),i===null&&ia(e,t,r,qr,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else ia(e,t,r,null,n)}}var qr=null;function Fi(e,t,n,r){if(qr=null,e=Mi(r),e=nn(e),e!==null)if(t=tn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=al(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return qr=e,null}function El(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Df()){case Li:return 1;case dl:return 4;case Vr:case Lf:return 16;case hl:return 536870912;default:return 16}default:return 16}}var Ut=null,Gi=null,eo=null;function Ol(){if(eo)return eo;var e,t=Gi,n=t.length,r,o="value"in Ut?Ut.value:Ut.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===o[i-r];r++);return eo=o.slice(e,1<r?1-r:void 0)}function to(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function no(){return!0}function Rl(){return!1}function Qe(e){function t(n,r,o,i,a){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var m in e)e.hasOwnProperty(m)&&(n=e[m],this[m]=n?n(i):i[m]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?no:Rl,this.isPropagationStopped=Rl,this}return pe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=no)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=no)},persist:function(){},isPersistent:no}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wi=Qe(En),lr=pe({},En,{view:0,detail:0}),Qf=Qe(lr),Vi,$i,ur,ro=pe({},lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qi,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ur&&(ur&&e.type==="mousemove"?(Vi=e.screenX-ur.screenX,$i=e.screenY-ur.screenY):$i=Vi=0,ur=e),Vi)},movementY:function(e){return"movementY"in e?e.movementY:$i}}),Tl=Qe(ro),Jf=pe({},ro,{dataTransfer:0}),Yf=Qe(Jf),Xf=pe({},lr,{relatedTarget:0}),Ki=Qe(Xf),Zf=pe({},En,{animationName:0,elapsedTime:0,pseudoElement:0}),qf=Qe(Zf),ed=pe({},En,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),td=Qe(ed),nd=pe({},En,{data:0}),bl=Qe(nd),rd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},od={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"},id={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ad(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=id[e])?!!t[e]:!1}function Qi(){return ad}var sd=pe({},lr,{key:function(e){if(e.key){var t=rd[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=to(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?od[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qi,charCode:function(e){return e.type==="keypress"?to(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?to(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ld=Qe(sd),ud=pe({},ro,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Al=Qe(ud),cd=pe({},lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qi}),fd=Qe(cd),dd=pe({},En,{propertyName:0,elapsedTime:0,pseudoElement:0}),hd=Qe(dd),pd=pe({},ro,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),md=Qe(pd),vd=[9,13,27,32],Ji=St&&"CompositionEvent"in window,cr=null;St&&"documentMode"in document&&(cr=document.documentMode);var gd=St&&"TextEvent"in window&&!cr,Il=St&&(!Ji||cr&&8<cr&&11>=cr),Ml=" ",Pl=!1;function kl(e,t){switch(e){case"keyup":return vd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nl(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var On=!1;function yd(e,t){switch(e){case"compositionend":return Nl(t);case"keypress":return t.which!==32?null:(Pl=!0,Ml);case"textInput":return e=t.data,e===Ml&&Pl?null:e;default:return null}}function wd(e,t){if(On)return e==="compositionend"||!Ji&&kl(e,t)?(e=Ol(),eo=Gi=Ut=null,On=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Il&&t.locale!=="ko"?null:t.data;default:return null}}var Sd={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 Dl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Sd[e.type]:t==="textarea"}function Ll(e,t,n,r){tl(r),t=lo(t,"onChange"),0<t.length&&(n=new Wi("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var fr=null,dr=null;function Cd(e){ql(e,0)}function oo(e){var t=In(e);if(Gs(t))return e}function xd(e,t){if(e==="change")return t}var jl=!1;if(St){var Yi;if(St){var Xi="oninput"in document;if(!Xi){var Ul=document.createElement("div");Ul.setAttribute("oninput","return;"),Xi=typeof Ul.oninput=="function"}Yi=Xi}else Yi=!1;jl=Yi&&(!document.documentMode||9<document.documentMode)}function Bl(){fr&&(fr.detachEvent("onpropertychange",_l),dr=fr=null)}function _l(e){if(e.propertyName==="value"&&oo(dr)){var t=[];Ll(t,dr,e,Mi(e)),il(Cd,t)}}function Ed(e,t,n){e==="focusin"?(Bl(),fr=t,dr=n,fr.attachEvent("onpropertychange",_l)):e==="focusout"&&Bl()}function Od(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return oo(dr)}function Rd(e,t){if(e==="click")return oo(t)}function Td(e,t){if(e==="input"||e==="change")return oo(t)}function bd(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var it=typeof Object.is=="function"?Object.is:bd;function hr(e,t){if(it(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!li.call(t,o)||!it(e[o],t[o]))return!1}return!0}function zl(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hl(e,t){var n=zl(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=zl(n)}}function Fl(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fl(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gl(){for(var e=window,t=Hr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch(r){n=!1}if(n)e=t.contentWindow;else break;t=Hr(e.document)}return t}function Zi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Ad(e){var t=Gl(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Fl(n.ownerDocument.documentElement,n)){if(r!==null&&Zi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=Hl(n,i);var a=Hl(n,r);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Id=St&&"documentMode"in document&&11>=document.documentMode,Rn=null,qi=null,pr=null,ea=!1;function Wl(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ea||Rn==null||Rn!==Hr(r)||(r=Rn,"selectionStart"in r&&Zi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),pr&&hr(pr,r)||(pr=r,r=lo(qi,"onSelect"),0<r.length&&(t=new Wi("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Rn)))}function io(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Tn={animationend:io("Animation","AnimationEnd"),animationiteration:io("Animation","AnimationIteration"),animationstart:io("Animation","AnimationStart"),transitionend:io("Transition","TransitionEnd")},ta={},Vl={};St&&(Vl=document.createElement("div").style,"AnimationEvent"in window||(delete Tn.animationend.animation,delete Tn.animationiteration.animation,delete Tn.animationstart.animation),"TransitionEvent"in window||delete Tn.transitionend.transition);function ao(e){if(ta[e])return ta[e];if(!Tn[e])return e;var t=Tn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Vl)return ta[e]=t[n];return e}var $l=ao("animationend"),Kl=ao("animationiteration"),Ql=ao("animationstart"),Jl=ao("transitionend"),Yl=new Map,Xl="abort auxClick 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(" ");function Bt(e,t){Yl.set(e,t),en(t,[e])}for(var na=0;na<Xl.length;na++){var ra=Xl[na],Md=ra.toLowerCase(),Pd=ra[0].toUpperCase()+ra.slice(1);Bt(Md,"on"+Pd)}Bt($l,"onAnimationEnd"),Bt(Kl,"onAnimationIteration"),Bt(Ql,"onAnimationStart"),Bt("dblclick","onDoubleClick"),Bt("focusin","onFocus"),Bt("focusout","onBlur"),Bt(Jl,"onTransitionEnd"),vn("onMouseEnter",["mouseout","mouseover"]),vn("onMouseLeave",["mouseout","mouseover"]),vn("onPointerEnter",["pointerout","pointerover"]),vn("onPointerLeave",["pointerout","pointerover"]),en("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),en("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),en("onBeforeInput",["compositionend","keypress","textInput","paste"]),en("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),en("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),en("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mr="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(" "),kd=new Set("cancel close invalid load scroll toggle".split(" ").concat(mr));function Zl(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Mf(r,t,void 0,e),e.currentTarget=null}function ql(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var m=r[a],v=m.instance,S=m.currentTarget;if(m=m.listener,v!==i&&o.isPropagationStopped())break e;Zl(o,m,S),i=v}else for(a=0;a<r.length;a++){if(m=r[a],v=m.instance,S=m.currentTarget,m=m.listener,v!==i&&o.isPropagationStopped())break e;Zl(o,m,S),i=v}}}if(Wr)throw e=Di,Wr=!1,Di=null,e}function ce(e,t){var n=t[fa];n===void 0&&(n=t[fa]=new Set);var r=e+"__bubble";n.has(r)||(eu(t,e,2,!1),n.add(r))}function oa(e,t,n){var r=0;t&&(r|=4),eu(n,e,r,t)}var so="_reactListening"+Math.random().toString(36).slice(2);function vr(e){if(!e[so]){e[so]=!0,Ls.forEach(function(n){n!=="selectionchange"&&(kd.has(n)||oa(n,!1,e),oa(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[so]||(t[so]=!0,oa("selectionchange",!1,t))}}function eu(e,t,n,r){switch(El(t)){case 1:var o=$f;break;case 4:o=Kf;break;default:o=Hi}n=o.bind(null,t,n,e),o=void 0,!Ni||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function ia(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var m=r.stateNode.containerInfo;if(m===o||m.nodeType===8&&m.parentNode===o)break;if(a===4)for(a=r.return;a!==null;){var v=a.tag;if((v===3||v===4)&&(v=a.stateNode.containerInfo,v===o||v.nodeType===8&&v.parentNode===o))return;a=a.return}for(;m!==null;){if(a=nn(m),a===null)return;if(v=a.tag,v===5||v===6){r=i=a;continue e}m=m.parentNode}}r=r.return}il(function(){var S=i,T=Mi(n),R=[];e:{var C=Yl.get(e);if(C!==void 0){var O=Wi,f=e;switch(e){case"keypress":if(to(n)===0)break e;case"keydown":case"keyup":O=ld;break;case"focusin":f="focus",O=Ki;break;case"focusout":f="blur",O=Ki;break;case"beforeblur":case"afterblur":O=Ki;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":O=Tl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":O=Yf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":O=fd;break;case $l:case Kl:case Ql:O=qf;break;case Jl:O=hd;break;case"scroll":O=Qf;break;case"wheel":O=md;break;case"copy":case"cut":case"paste":O=td;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":O=Al}var E=(t&4)!==0,P=!E&&e==="scroll",y=E?C!==null?C+"Capture":null:C;E=[];for(var d=S,h;d!==null;){h=d;var w=h.stateNode;if(h.tag===5&&w!==null&&(h=w,y!==null&&(w=Zn(d,y),w!=null&&E.push(gr(d,w,h)))),P)break;d=d.return}0<E.length&&(C=new O(C,f,null,n,T),R.push({event:C,listeners:E}))}}if(!(t&7)){e:{if(C=e==="mouseover"||e==="pointerover",O=e==="mouseout"||e==="pointerout",C&&n!==Ii&&(f=n.relatedTarget||n.fromElement)&&(nn(f)||f[xt]))break e;if((O||C)&&(C=T.window===T?T:(C=T.ownerDocument)?C.defaultView||C.parentWindow:window,O?(f=n.relatedTarget||n.toElement,O=S,f=f?nn(f):null,f!==null&&(P=tn(f),f!==P||f.tag!==5&&f.tag!==6)&&(f=null)):(O=null,f=S),O!==f)){if(E=Tl,w="onMouseLeave",y="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(E=Al,w="onPointerLeave",y="onPointerEnter",d="pointer"),P=O==null?C:In(O),h=f==null?C:In(f),C=new E(w,d+"leave",O,n,T),C.target=P,C.relatedTarget=h,w=null,nn(T)===S&&(E=new E(y,d+"enter",f,n,T),E.target=h,E.relatedTarget=P,w=E),P=w,O&&f)t:{for(E=O,y=f,d=0,h=E;h;h=bn(h))d++;for(h=0,w=y;w;w=bn(w))h++;for(;0<d-h;)E=bn(E),d--;for(;0<h-d;)y=bn(y),h--;for(;d--;){if(E===y||y!==null&&E===y.alternate)break t;E=bn(E),y=bn(y)}E=null}else E=null;O!==null&&tu(R,C,O,E,!1),f!==null&&P!==null&&tu(R,P,f,E,!0)}}e:{if(C=S?In(S):window,O=C.nodeName&&C.nodeName.toLowerCase(),O==="select"||O==="input"&&C.type==="file")var c=xd;else if(Dl(C))if(jl)c=Td;else{c=Od;var u=Ed}else(O=C.nodeName)&&O.toLowerCase()==="input"&&(C.type==="checkbox"||C.type==="radio")&&(c=Rd);if(c&&(c=c(e,S))){Ll(R,c,n,T);break e}u&&u(e,C,S),e==="focusout"&&(u=C._wrapperState)&&u.controlled&&C.type==="number"&&Oi(C,"number",C.value)}switch(u=S?In(S):window,e){case"focusin":(Dl(u)||u.contentEditable==="true")&&(Rn=u,qi=S,pr=null);break;case"focusout":pr=qi=Rn=null;break;case"mousedown":ea=!0;break;case"contextmenu":case"mouseup":case"dragend":ea=!1,Wl(R,n,T);break;case"selectionchange":if(Id)break;case"keydown":case"keyup":Wl(R,n,T)}var l;if(Ji)e:{switch(e){case"compositionstart":var s="onCompositionStart";break e;case"compositionend":s="onCompositionEnd";break e;case"compositionupdate":s="onCompositionUpdate";break e}s=void 0}else On?kl(e,n)&&(s="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(s="onCompositionStart");s&&(Il&&n.locale!=="ko"&&(On||s!=="onCompositionStart"?s==="onCompositionEnd"&&On&&(l=Ol()):(Ut=T,Gi="value"in Ut?Ut.value:Ut.textContent,On=!0)),u=lo(S,s),0<u.length&&(s=new bl(s,e,null,n,T),R.push({event:s,listeners:u}),l?s.data=l:(l=Nl(n),l!==null&&(s.data=l)))),(l=gd?yd(e,n):wd(e,n))&&(S=lo(S,"onBeforeInput"),0<S.length&&(T=new bl("onBeforeInput","beforeinput",null,n,T),R.push({event:T,listeners:S}),T.data=l))}ql(R,t)})}function gr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function lo(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Zn(e,n),i!=null&&r.unshift(gr(e,i,o)),i=Zn(e,t),i!=null&&r.push(gr(e,i,o))),e=e.return}return r}function bn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function tu(e,t,n,r,o){for(var i=t._reactName,a=[];n!==null&&n!==r;){var m=n,v=m.alternate,S=m.stateNode;if(v!==null&&v===r)break;m.tag===5&&S!==null&&(m=S,o?(v=Zn(n,i),v!=null&&a.unshift(gr(n,v,m))):o||(v=Zn(n,i),v!=null&&a.push(gr(n,v,m)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var Nd=/\r\n?/g,Dd=/\u0000|\uFFFD/g;function nu(e){return(typeof e=="string"?e:""+e).replace(Nd,`
30
- `).replace(Dd,"")}function uo(e,t,n){if(t=nu(t),nu(e)!==t&&n)throw Error(Q(425))}function co(){}var aa=null,sa=null;function la(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ua=typeof setTimeout=="function"?setTimeout:void 0,Ld=typeof clearTimeout=="function"?clearTimeout:void 0,ru=typeof Promise=="function"?Promise:void 0,jd=typeof queueMicrotask=="function"?queueMicrotask:typeof ru!="undefined"?function(e){return ru.resolve(null).then(e).catch(Ud)}:ua;function Ud(e){setTimeout(function(){throw e})}function ca(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),sr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);sr(t)}function _t(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function ou(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var An=Math.random().toString(36).slice(2),pt="__reactFiber$"+An,yr="__reactProps$"+An,xt="__reactContainer$"+An,fa="__reactEvents$"+An,Bd="__reactListeners$"+An,_d="__reactHandles$"+An;function nn(e){var t=e[pt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[xt]||n[pt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ou(e);e!==null;){if(n=e[pt])return n;e=ou(e)}return t}e=n,n=e.parentNode}return null}function wr(e){return e=e[pt]||e[xt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function In(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function fo(e){return e[yr]||null}var da=[],Mn=-1;function zt(e){return{current:e}}function fe(e){0>Mn||(e.current=da[Mn],da[Mn]=null,Mn--)}function ue(e,t){Mn++,da[Mn]=e.current,e.current=t}var Ht={},Pe=zt(Ht),ze=zt(!1),rn=Ht;function Pn(e,t){var n=e.type.contextTypes;if(!n)return Ht;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function He(e){return e=e.childContextTypes,e!=null}function ho(){fe(ze),fe(Pe)}function iu(e,t,n){if(Pe.current!==Ht)throw Error(Q(168));ue(Pe,t),ue(ze,n)}function au(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(Q(108,Ef(e)||"Unknown",o));return pe({},n,r)}function po(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ht,rn=Pe.current,ue(Pe,e),ue(ze,ze.current),!0}function su(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=au(e,t,rn),r.__reactInternalMemoizedMergedChildContext=e,fe(ze),fe(Pe),ue(Pe,e)):fe(ze),ue(ze,n)}var Et=null,mo=!1,ha=!1;function lu(e){Et===null?Et=[e]:Et.push(e)}function zd(e){mo=!0,lu(e)}function Ft(){if(!ha&&Et!==null){ha=!0;var e=0,t=se;try{var n=Et;for(se=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Et=null,mo=!1}catch(o){throw Et!==null&&(Et=Et.slice(e+1)),cl(Li,Ft),o}finally{se=t,ha=!1}}return null}var kn=[],Nn=0,vo=null,go=0,Ze=[],qe=0,on=null,Ot=1,Rt="";function an(e,t){kn[Nn++]=go,kn[Nn++]=vo,vo=e,go=t}function uu(e,t,n){Ze[qe++]=Ot,Ze[qe++]=Rt,Ze[qe++]=on,on=e;var r=Ot;e=Rt;var o=32-ot(r)-1;r&=~(1<<o),n+=1;var i=32-ot(t)+o;if(30<i){var a=o-o%5;i=(r&(1<<a)-1).toString(32),r>>=a,o-=a,Ot=1<<32-ot(t)+o|n<<o|r,Rt=i+e}else Ot=1<<i|n<<o|r,Rt=e}function pa(e){e.return!==null&&(an(e,1),uu(e,1,0))}function ma(e){for(;e===vo;)vo=kn[--Nn],kn[Nn]=null,go=kn[--Nn],kn[Nn]=null;for(;e===on;)on=Ze[--qe],Ze[qe]=null,Rt=Ze[--qe],Ze[qe]=null,Ot=Ze[--qe],Ze[qe]=null}var Je=null,Ye=null,de=!1,at=null;function cu(e,t){var n=rt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function fu(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Je=e,Ye=_t(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Je=e,Ye=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=on!==null?{id:Ot,overflow:Rt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Je=e,Ye=null,!0):!1;default:return!1}}function va(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ga(e){if(de){var t=Ye;if(t){var n=t;if(!fu(e,t)){if(va(e))throw Error(Q(418));t=_t(n.nextSibling);var r=Je;t&&fu(e,t)?cu(r,n):(e.flags=e.flags&-4097|2,de=!1,Je=e)}}else{if(va(e))throw Error(Q(418));e.flags=e.flags&-4097|2,de=!1,Je=e}}}function du(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Je=e}function yo(e){if(e!==Je)return!1;if(!de)return du(e),de=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!la(e.type,e.memoizedProps)),t&&(t=Ye)){if(va(e))throw hu(),Error(Q(418));for(;t;)cu(e,t),t=_t(t.nextSibling)}if(du(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ye=_t(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ye=null}}else Ye=Je?_t(e.stateNode.nextSibling):null;return!0}function hu(){for(var e=Ye;e;)e=_t(e.nextSibling)}function Dn(){Ye=Je=null,de=!1}function ya(e){at===null?at=[e]:at.push(e)}var Hd=Ct.ReactCurrentBatchConfig;function Sr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Q(309));var r=n.stateNode}if(!r)throw Error(Q(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var m=o.refs;a===null?delete m[i]:m[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(Q(284));if(!n._owner)throw Error(Q(290,e))}return e}function wo(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function pu(e){var t=e._init;return t(e._payload)}function mu(e){function t(y,d){if(e){var h=y.deletions;h===null?(y.deletions=[d],y.flags|=16):h.push(d)}}function n(y,d){if(!e)return null;for(;d!==null;)t(y,d),d=d.sibling;return null}function r(y,d){for(y=new Map;d!==null;)d.key!==null?y.set(d.key,d):y.set(d.index,d),d=d.sibling;return y}function o(y,d){return y=Yt(y,d),y.index=0,y.sibling=null,y}function i(y,d,h){return y.index=h,e?(h=y.alternate,h!==null?(h=h.index,h<d?(y.flags|=2,d):h):(y.flags|=2,d)):(y.flags|=1048576,d)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function m(y,d,h,w){return d===null||d.tag!==6?(d=us(h,y.mode,w),d.return=y,d):(d=o(d,h),d.return=y,d)}function v(y,d,h,w){var c=h.type;return c===yn?T(y,d,h.props.children,w,h.key):d!==null&&(d.elementType===c||typeof c=="object"&&c!==null&&c.$$typeof===Pt&&pu(c)===d.type)?(w=o(d,h.props),w.ref=Sr(y,d,h),w.return=y,w):(w=Go(h.type,h.key,h.props,null,y.mode,w),w.ref=Sr(y,d,h),w.return=y,w)}function S(y,d,h,w){return d===null||d.tag!==4||d.stateNode.containerInfo!==h.containerInfo||d.stateNode.implementation!==h.implementation?(d=cs(h,y.mode,w),d.return=y,d):(d=o(d,h.children||[]),d.return=y,d)}function T(y,d,h,w,c){return d===null||d.tag!==7?(d=pn(h,y.mode,w,c),d.return=y,d):(d=o(d,h),d.return=y,d)}function R(y,d,h){if(typeof d=="string"&&d!==""||typeof d=="number")return d=us(""+d,y.mode,h),d.return=y,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case _r:return h=Go(d.type,d.key,d.props,null,y.mode,h),h.ref=Sr(y,null,d),h.return=y,h;case gn:return d=cs(d,y.mode,h),d.return=y,d;case Pt:var w=d._init;return R(y,w(d._payload),h)}if(Jn(d)||Kn(d))return d=pn(d,y.mode,h,null),d.return=y,d;wo(y,d)}return null}function C(y,d,h,w){var c=d!==null?d.key:null;if(typeof h=="string"&&h!==""||typeof h=="number")return c!==null?null:m(y,d,""+h,w);if(typeof h=="object"&&h!==null){switch(h.$$typeof){case _r:return h.key===c?v(y,d,h,w):null;case gn:return h.key===c?S(y,d,h,w):null;case Pt:return c=h._init,C(y,d,c(h._payload),w)}if(Jn(h)||Kn(h))return c!==null?null:T(y,d,h,w,null);wo(y,h)}return null}function O(y,d,h,w,c){if(typeof w=="string"&&w!==""||typeof w=="number")return y=y.get(h)||null,m(d,y,""+w,c);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case _r:return y=y.get(w.key===null?h:w.key)||null,v(d,y,w,c);case gn:return y=y.get(w.key===null?h:w.key)||null,S(d,y,w,c);case Pt:var u=w._init;return O(y,d,h,u(w._payload),c)}if(Jn(w)||Kn(w))return y=y.get(h)||null,T(d,y,w,c,null);wo(d,w)}return null}function f(y,d,h,w){for(var c=null,u=null,l=d,s=d=0,g=null;l!==null&&s<h.length;s++){l.index>s?(g=l,l=null):g=l.sibling;var p=C(y,l,h[s],w);if(p===null){l===null&&(l=g);break}e&&l&&p.alternate===null&&t(y,l),d=i(p,d,s),u===null?c=p:u.sibling=p,u=p,l=g}if(s===h.length)return n(y,l),de&&an(y,s),c;if(l===null){for(;s<h.length;s++)l=R(y,h[s],w),l!==null&&(d=i(l,d,s),u===null?c=l:u.sibling=l,u=l);return de&&an(y,s),c}for(l=r(y,l);s<h.length;s++)g=O(l,y,s,h[s],w),g!==null&&(e&&g.alternate!==null&&l.delete(g.key===null?s:g.key),d=i(g,d,s),u===null?c=g:u.sibling=g,u=g);return e&&l.forEach(function(x){return t(y,x)}),de&&an(y,s),c}function E(y,d,h,w){var c=Kn(h);if(typeof c!="function")throw Error(Q(150));if(h=c.call(h),h==null)throw Error(Q(151));for(var u=c=null,l=d,s=d=0,g=null,p=h.next();l!==null&&!p.done;s++,p=h.next()){l.index>s?(g=l,l=null):g=l.sibling;var x=C(y,l,p.value,w);if(x===null){l===null&&(l=g);break}e&&l&&x.alternate===null&&t(y,l),d=i(x,d,s),u===null?c=x:u.sibling=x,u=x,l=g}if(p.done)return n(y,l),de&&an(y,s),c;if(l===null){for(;!p.done;s++,p=h.next())p=R(y,p.value,w),p!==null&&(d=i(p,d,s),u===null?c=p:u.sibling=p,u=p);return de&&an(y,s),c}for(l=r(y,l);!p.done;s++,p=h.next())p=O(l,y,s,p.value,w),p!==null&&(e&&p.alternate!==null&&l.delete(p.key===null?s:p.key),d=i(p,d,s),u===null?c=p:u.sibling=p,u=p);return e&&l.forEach(function(D){return t(y,D)}),de&&an(y,s),c}function P(y,d,h,w){if(typeof h=="object"&&h!==null&&h.type===yn&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case _r:e:{for(var c=h.key,u=d;u!==null;){if(u.key===c){if(c=h.type,c===yn){if(u.tag===7){n(y,u.sibling),d=o(u,h.props.children),d.return=y,y=d;break e}}else if(u.elementType===c||typeof c=="object"&&c!==null&&c.$$typeof===Pt&&pu(c)===u.type){n(y,u.sibling),d=o(u,h.props),d.ref=Sr(y,u,h),d.return=y,y=d;break e}n(y,u);break}else t(y,u);u=u.sibling}h.type===yn?(d=pn(h.props.children,y.mode,w,h.key),d.return=y,y=d):(w=Go(h.type,h.key,h.props,null,y.mode,w),w.ref=Sr(y,d,h),w.return=y,y=w)}return a(y);case gn:e:{for(u=h.key;d!==null;){if(d.key===u)if(d.tag===4&&d.stateNode.containerInfo===h.containerInfo&&d.stateNode.implementation===h.implementation){n(y,d.sibling),d=o(d,h.children||[]),d.return=y,y=d;break e}else{n(y,d);break}else t(y,d);d=d.sibling}d=cs(h,y.mode,w),d.return=y,y=d}return a(y);case Pt:return u=h._init,P(y,d,u(h._payload),w)}if(Jn(h))return f(y,d,h,w);if(Kn(h))return E(y,d,h,w);wo(y,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,d!==null&&d.tag===6?(n(y,d.sibling),d=o(d,h),d.return=y,y=d):(n(y,d),d=us(h,y.mode,w),d.return=y,y=d),a(y)):n(y,d)}return P}var Ln=mu(!0),vu=mu(!1),So=zt(null),Co=null,jn=null,wa=null;function Sa(){wa=jn=Co=null}function Ca(e){var t=So.current;fe(So),e._currentValue=t}function xa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Un(e,t){Co=e,wa=jn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Fe=!0),e.firstContext=null)}function et(e){var t=e._currentValue;if(wa!==e)if(e={context:e,memoizedValue:t,next:null},jn===null){if(Co===null)throw Error(Q(308));jn=e,Co.dependencies={lanes:0,firstContext:e}}else jn=jn.next=e;return t}var sn=null;function Ea(e){sn===null?sn=[e]:sn.push(e)}function gu(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Ea(t)):(n.next=o.next,o.next=n),t.interleaved=n,Tt(e,r)}function Tt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Gt=!1;function Oa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function bt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Wt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ae&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Tt(e,n)}return o=r.interleaved,o===null?(t.next=t,Ea(r)):(t.next=o.next,o.next=t),r.interleaved=t,Tt(e,n)}function xo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bi(e,n)}}function wu(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Eo(e,t,n,r){var o=e.updateQueue;Gt=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,m=o.shared.pending;if(m!==null){o.shared.pending=null;var v=m,S=v.next;v.next=null,a===null?i=S:a.next=S,a=v;var T=e.alternate;T!==null&&(T=T.updateQueue,m=T.lastBaseUpdate,m!==a&&(m===null?T.firstBaseUpdate=S:m.next=S,T.lastBaseUpdate=v))}if(i!==null){var R=o.baseState;a=0,T=S=v=null,m=i;do{var C=m.lane,O=m.eventTime;if((r&C)===C){T!==null&&(T=T.next={eventTime:O,lane:0,tag:m.tag,payload:m.payload,callback:m.callback,next:null});e:{var f=e,E=m;switch(C=t,O=n,E.tag){case 1:if(f=E.payload,typeof f=="function"){R=f.call(O,R,C);break e}R=f;break e;case 3:f.flags=f.flags&-65537|128;case 0:if(f=E.payload,C=typeof f=="function"?f.call(O,R,C):f,C==null)break e;R=pe({},R,C);break e;case 2:Gt=!0}}m.callback!==null&&m.lane!==0&&(e.flags|=64,C=o.effects,C===null?o.effects=[m]:C.push(m))}else O={eventTime:O,lane:C,tag:m.tag,payload:m.payload,callback:m.callback,next:null},T===null?(S=T=O,v=R):T=T.next=O,a|=C;if(m=m.next,m===null){if(m=o.shared.pending,m===null)break;C=m,m=C.next,C.next=null,o.lastBaseUpdate=C,o.shared.pending=null}}while(!0);if(T===null&&(v=R),o.baseState=v,o.firstBaseUpdate=S,o.lastBaseUpdate=T,t=o.shared.interleaved,t!==null){o=t;do a|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);cn|=a,e.lanes=a,e.memoizedState=R}}function Su(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(Q(191,o));o.call(r)}}}var Cr={},mt=zt(Cr),xr=zt(Cr),Er=zt(Cr);function ln(e){if(e===Cr)throw Error(Q(174));return e}function Ra(e,t){switch(ue(Er,t),ue(xr,e),ue(mt,Cr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ti(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ti(t,e)}fe(mt),ue(mt,t)}function Bn(){fe(mt),fe(xr),fe(Er)}function Cu(e){ln(Er.current);var t=ln(mt.current),n=Ti(t,e.type);t!==n&&(ue(xr,e),ue(mt,n))}function Ta(e){xr.current===e&&(fe(mt),fe(xr))}var me=zt(0);function Oo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ba=[];function Aa(){for(var e=0;e<ba.length;e++)ba[e]._workInProgressVersionPrimary=null;ba.length=0}var Ro=Ct.ReactCurrentDispatcher,Ia=Ct.ReactCurrentBatchConfig,un=0,ve=null,Ce=null,Re=null,To=!1,Or=!1,Rr=0,Fd=0;function ke(){throw Error(Q(321))}function Ma(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!it(e[n],t[n]))return!1;return!0}function Pa(e,t,n,r,o,i){if(un=i,ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ro.current=e===null||e.memoizedState===null?$d:Kd,e=n(r,o),Or){i=0;do{if(Or=!1,Rr=0,25<=i)throw Error(Q(301));i+=1,Re=Ce=null,t.updateQueue=null,Ro.current=Qd,e=n(r,o)}while(Or)}if(Ro.current=Io,t=Ce!==null&&Ce.next!==null,un=0,Re=Ce=ve=null,To=!1,t)throw Error(Q(300));return e}function ka(){var e=Rr!==0;return Rr=0,e}function vt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Re===null?ve.memoizedState=Re=e:Re=Re.next=e,Re}function tt(){if(Ce===null){var e=ve.alternate;e=e!==null?e.memoizedState:null}else e=Ce.next;var t=Re===null?ve.memoizedState:Re.next;if(t!==null)Re=t,Ce=e;else{if(e===null)throw Error(Q(310));Ce=e,e={memoizedState:Ce.memoizedState,baseState:Ce.baseState,baseQueue:Ce.baseQueue,queue:Ce.queue,next:null},Re===null?ve.memoizedState=Re=e:Re=Re.next=e}return Re}function Tr(e,t){return typeof t=="function"?t(e):t}function Na(e){var t=tt(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var r=Ce,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var a=o.next;o.next=i.next,i.next=a}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var m=a=null,v=null,S=i;do{var T=S.lane;if((un&T)===T)v!==null&&(v=v.next={lane:0,action:S.action,hasEagerState:S.hasEagerState,eagerState:S.eagerState,next:null}),r=S.hasEagerState?S.eagerState:e(r,S.action);else{var R={lane:T,action:S.action,hasEagerState:S.hasEagerState,eagerState:S.eagerState,next:null};v===null?(m=v=R,a=r):v=v.next=R,ve.lanes|=T,cn|=T}S=S.next}while(S!==null&&S!==i);v===null?a=r:v.next=m,it(r,t.memoizedState)||(Fe=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=v,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,ve.lanes|=i,cn|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Da(e){var t=tt(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var a=o=o.next;do i=e(i,a.action),a=a.next;while(a!==o);it(i,t.memoizedState)||(Fe=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function xu(){}function Eu(e,t){var n=ve,r=tt(),o=t(),i=!it(r.memoizedState,o);if(i&&(r.memoizedState=o,Fe=!0),r=r.queue,La(Tu.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Re!==null&&Re.memoizedState.tag&1){if(n.flags|=2048,br(9,Ru.bind(null,n,r,o,t),void 0,null),Te===null)throw Error(Q(349));un&30||Ou(n,t,o)}return o}function Ou(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ve.updateQueue,t===null?(t={lastEffect:null,stores:null},ve.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ru(e,t,n,r){t.value=n,t.getSnapshot=r,bu(t)&&Au(e)}function Tu(e,t,n){return n(function(){bu(t)&&Au(e)})}function bu(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!it(e,n)}catch(r){return!0}}function Au(e){var t=Tt(e,1);t!==null&&ct(t,e,1,-1)}function Iu(e){var t=vt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Tr,lastRenderedState:e},t.queue=e,e=e.dispatch=Vd.bind(null,ve,e),[t.memoizedState,e]}function br(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=ve.updateQueue,t===null?(t={lastEffect:null,stores:null},ve.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Mu(){return tt().memoizedState}function bo(e,t,n,r){var o=vt();ve.flags|=e,o.memoizedState=br(1|t,n,void 0,r===void 0?null:r)}function Ao(e,t,n,r){var o=tt();r=r===void 0?null:r;var i=void 0;if(Ce!==null){var a=Ce.memoizedState;if(i=a.destroy,r!==null&&Ma(r,a.deps)){o.memoizedState=br(t,n,i,r);return}}ve.flags|=e,o.memoizedState=br(1|t,n,i,r)}function Pu(e,t){return bo(8390656,8,e,t)}function La(e,t){return Ao(2048,8,e,t)}function ku(e,t){return Ao(4,2,e,t)}function Nu(e,t){return Ao(4,4,e,t)}function Du(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Lu(e,t,n){return n=n!=null?n.concat([e]):null,Ao(4,4,Du.bind(null,t,e),n)}function ja(){}function ju(e,t){var n=tt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ma(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Uu(e,t){var n=tt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ma(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Bu(e,t,n){return un&21?(it(n,t)||(n=pl(),ve.lanes|=n,cn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Fe=!0),e.memoizedState=n)}function Gd(e,t){var n=se;se=n!==0&&4>n?n:4,e(!0);var r=Ia.transition;Ia.transition={};try{e(!1),t()}finally{se=n,Ia.transition=r}}function _u(){return tt().memoizedState}function Wd(e,t,n){var r=Qt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},zu(e))Hu(t,n);else if(n=gu(e,t,n,r),n!==null){var o=Be();ct(n,e,r,o),Fu(n,t,r)}}function Vd(e,t,n){var r=Qt(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(zu(e))Hu(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,m=i(a,n);if(o.hasEagerState=!0,o.eagerState=m,it(m,a)){var v=t.interleaved;v===null?(o.next=o,Ea(t)):(o.next=v.next,v.next=o),t.interleaved=o;return}}catch(S){}finally{}n=gu(e,t,o,r),n!==null&&(o=Be(),ct(n,e,r,o),Fu(n,t,r))}}function zu(e){var t=e.alternate;return e===ve||t!==null&&t===ve}function Hu(e,t){Or=To=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fu(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bi(e,n)}}var Io={readContext:et,useCallback:ke,useContext:ke,useEffect:ke,useImperativeHandle:ke,useInsertionEffect:ke,useLayoutEffect:ke,useMemo:ke,useReducer:ke,useRef:ke,useState:ke,useDebugValue:ke,useDeferredValue:ke,useTransition:ke,useMutableSource:ke,useSyncExternalStore:ke,useId:ke,unstable_isNewReconciler:!1},$d={readContext:et,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:et,useEffect:Pu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,bo(4194308,4,Du.bind(null,t,e),n)},useLayoutEffect:function(e,t){return bo(4194308,4,e,t)},useInsertionEffect:function(e,t){return bo(4,2,e,t)},useMemo:function(e,t){var n=vt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=vt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Wd.bind(null,ve,e),[r.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:Iu,useDebugValue:ja,useDeferredValue:function(e){return vt().memoizedState=e},useTransition:function(){var e=Iu(!1),t=e[0];return e=Gd.bind(null,e[1]),vt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ve,o=vt();if(de){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),Te===null)throw Error(Q(349));un&30||Ou(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,Pu(Tu.bind(null,r,i,e),[e]),r.flags|=2048,br(9,Ru.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=vt(),t=Te.identifierPrefix;if(de){var n=Rt,r=Ot;n=(r&~(1<<32-ot(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Rr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Fd++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Kd={readContext:et,useCallback:ju,useContext:et,useEffect:La,useImperativeHandle:Lu,useInsertionEffect:ku,useLayoutEffect:Nu,useMemo:Uu,useReducer:Na,useRef:Mu,useState:function(){return Na(Tr)},useDebugValue:ja,useDeferredValue:function(e){var t=tt();return Bu(t,Ce.memoizedState,e)},useTransition:function(){var e=Na(Tr)[0],t=tt().memoizedState;return[e,t]},useMutableSource:xu,useSyncExternalStore:Eu,useId:_u,unstable_isNewReconciler:!1},Qd={readContext:et,useCallback:ju,useContext:et,useEffect:La,useImperativeHandle:Lu,useInsertionEffect:ku,useLayoutEffect:Nu,useMemo:Uu,useReducer:Da,useRef:Mu,useState:function(){return Da(Tr)},useDebugValue:ja,useDeferredValue:function(e){var t=tt();return Ce===null?t.memoizedState=e:Bu(t,Ce.memoizedState,e)},useTransition:function(){var e=Da(Tr)[0],t=tt().memoizedState;return[e,t]},useMutableSource:xu,useSyncExternalStore:Eu,useId:_u,unstable_isNewReconciler:!1};function st(e,t){if(e&&e.defaultProps){t=pe({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ua(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:pe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Mo={isMounted:function(e){return(e=e._reactInternals)?tn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Be(),o=Qt(e),i=bt(r,o);i.payload=t,n!=null&&(i.callback=n),t=Wt(e,i,o),t!==null&&(ct(t,e,o,r),xo(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Be(),o=Qt(e),i=bt(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Wt(e,i,o),t!==null&&(ct(t,e,o,r),xo(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Be(),r=Qt(e),o=bt(n,r);o.tag=2,t!=null&&(o.callback=t),t=Wt(e,o,r),t!==null&&(ct(t,e,r,n),xo(t,e,r))}};function Gu(e,t,n,r,o,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!hr(n,r)||!hr(o,i):!0}function Wu(e,t,n){var r=!1,o=Ht,i=t.contextType;return typeof i=="object"&&i!==null?i=et(i):(o=He(t)?rn:Pe.current,r=t.contextTypes,i=(r=r!=null)?Pn(e,o):Ht),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Mo,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function Vu(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Mo.enqueueReplaceState(t,t.state,null)}function Ba(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Oa(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=et(i):(i=He(t)?rn:Pe.current,o.context=Pn(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Ua(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Mo.enqueueReplaceState(o,o.state,null),Eo(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function _n(e,t){try{var n="",r=t;do n+=xf(r),r=r.return;while(r);var o=n}catch(i){o=`
29
+ `+o[a].replace(" at new "," at ");return e.displayName&&v.includes("<anonymous>")&&(v=v.replace("<anonymous>",e.displayName)),v}while(1<=a&&0<=m);break}}}finally{Si=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qn(e):""}function Of(e){switch(e.tag){case 5:return Qn(e.type);case 16:return Qn("Lazy");case 13:return Qn("Suspense");case 19:return Qn("SuspenseList");case 0:case 2:case 15:return e=Ci(e.type,!1),e;case 11:return e=Ci(e.type.render,!1),e;case 1:return e=Ci(e.type,!0),e;default:return""}}function xi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yn:return"Fragment";case gn:return"Portal";case pi:return"Profiler";case hi:return"StrictMode";case vi:return"Suspense";case gi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case zs:return(e.displayName||"Context")+".Consumer";case _s:return(e._context.displayName||"Context")+".Provider";case mi:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case yi:return t=e.displayName||null,t!==null?t:xi(e.type)||"Memo";case Pt:t=e._payload,e=e._init;try{return xi(e(t))}catch(n){}}return null}function Rf(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xi(t);case 8:return t===hi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function kt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Gs(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Tf(e){var t=Gs(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n!="undefined"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Hr(e){e._valueTracker||(e._valueTracker=Tf(e))}function Ws(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Gs(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Fr(e){if(e=e||(typeof document!="undefined"?document:void 0),typeof e=="undefined")return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Ei(e,t){var n=t.checked;return pe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n!=null?n:e._wrapperState.initialChecked})}function Vs(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=kt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function $s(e,t){t=t.checked,t!=null&&di(e,"checked",t,!1)}function Oi(e,t){$s(e,t);var n=kt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ri(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ri(e,t.type,kt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ks(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ri(e,t,n){(t!=="number"||Fr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Jn=Array.isArray;function wn(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+kt(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Ti(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return pe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Qs(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Q(92));if(Jn(n)){if(1<n.length)throw Error(Q(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:kt(n)}}function Js(e,t){var n=kt(t.value),r=kt(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Ys(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Xs(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function bi(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Xs(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Gr,Zs=function(e){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Gr=Gr||document.createElement("div"),Gr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Gr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Xn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},bf=["Webkit","ms","Moz","O"];Object.keys(Xn).forEach(function(e){bf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Xn[t]=Xn[e]})});function qs(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Xn.hasOwnProperty(e)&&Xn[e]?(""+t).trim():t+"px"}function el(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=qs(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var Af=pe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ai(e,t){if(t){if(Af[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function Ii(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Mi=null;function Pi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ki=null,Sn=null,Cn=null;function tl(e){if(e=wr(e)){if(typeof ki!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=ho(t),ki(e.stateNode,e.type,t))}}function nl(e){Sn?Cn?Cn.push(e):Cn=[e]:Sn=e}function rl(){if(Sn){var e=Sn,t=Cn;if(Cn=Sn=null,tl(e),t)for(e=0;e<t.length;e++)tl(t[e])}}function ol(e,t){return e(t)}function il(){}var Ni=!1;function al(e,t,n){if(Ni)return e(t,n);Ni=!0;try{return ol(e,t,n)}finally{Ni=!1,(Sn!==null||Cn!==null)&&(il(),rl())}}function Zn(e,t){var n=e.stateNode;if(n===null)return null;var r=ho(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Q(231,t,typeof n));return n}var Di=!1;if(St)try{var qn={};Object.defineProperty(qn,"passive",{get:function(){Di=!0}}),window.addEventListener("test",qn,qn),window.removeEventListener("test",qn,qn)}catch(e){Di=!1}function If(e,t,n,r,o,i,a,m,v){var S=Array.prototype.slice.call(arguments,3);try{t.apply(n,S)}catch(T){this.onError(T)}}var er=!1,Wr=null,Vr=!1,Li=null,Mf={onError:function(e){er=!0,Wr=e}};function Pf(e,t,n,r,o,i,a,m,v){er=!1,Wr=null,If.apply(Mf,arguments)}function kf(e,t,n,r,o,i,a,m,v){if(Pf.apply(this,arguments),er){if(er){var S=Wr;er=!1,Wr=null}else throw Error(Q(198));Vr||(Vr=!0,Li=S)}}function tn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function sl(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function ll(e){if(tn(e)!==e)throw Error(Q(188))}function Nf(e){var t=e.alternate;if(!t){if(t=tn(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return ll(o),e;if(i===r)return ll(o),t;i=i.sibling}throw Error(Q(188))}if(n.return!==r.return)n=o,r=i;else{for(var a=!1,m=o.child;m;){if(m===n){a=!0,n=o,r=i;break}if(m===r){a=!0,r=o,n=i;break}m=m.sibling}if(!a){for(m=i.child;m;){if(m===n){a=!0,n=i,r=o;break}if(m===r){a=!0,r=i,n=o;break}m=m.sibling}if(!a)throw Error(Q(189))}}if(n.alternate!==r)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function ul(e){return e=Nf(e),e!==null?cl(e):null}function cl(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=cl(e);if(t!==null)return t;e=e.sibling}return null}var fl=Ke.unstable_scheduleCallback,dl=Ke.unstable_cancelCallback,Df=Ke.unstable_shouldYield,Lf=Ke.unstable_requestPaint,we=Ke.unstable_now,jf=Ke.unstable_getCurrentPriorityLevel,ji=Ke.unstable_ImmediatePriority,hl=Ke.unstable_UserBlockingPriority,$r=Ke.unstable_NormalPriority,Uf=Ke.unstable_LowPriority,pl=Ke.unstable_IdlePriority,Kr=null,ht=null;function Bf(e){if(ht&&typeof ht.onCommitFiberRoot=="function")try{ht.onCommitFiberRoot(Kr,e,void 0,(e.current.flags&128)===128)}catch(t){}}var ot=Math.clz32?Math.clz32:Hf,_f=Math.log,zf=Math.LN2;function Hf(e){return e>>>=0,e===0?32:31-(_f(e)/zf|0)|0}var Qr=64,Jr=4194304;function tr(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Yr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var m=a&~o;m!==0?r=tr(m):(i&=a,i!==0&&(r=tr(i)))}else a=n&~o,a!==0?r=tr(a):i!==0&&(r=tr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ot(t),o=1<<n,r|=e[n],t&=~o;return r}function Ff(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-ot(i),m=1<<a,v=o[a];v===-1?(!(m&n)||m&r)&&(o[a]=Ff(m,t)):v<=t&&(e.expiredLanes|=m),i&=~m}}function Ui(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ml(){var e=Qr;return Qr<<=1,!(Qr&4194240)&&(Qr=64),e}function Bi(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ot(t),e[t]=n}function Wf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-ot(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function _i(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ot(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var se=0;function vl(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var gl,zi,yl,wl,Sl,Hi=!1,Xr=[],Nt=null,Dt=null,Lt=null,rr=new Map,or=new Map,jt=[],Vf="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 submit".split(" ");function Cl(e,t){switch(e){case"focusin":case"focusout":Nt=null;break;case"dragenter":case"dragleave":Dt=null;break;case"mouseover":case"mouseout":Lt=null;break;case"pointerover":case"pointerout":rr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":or.delete(t.pointerId)}}function ir(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=wr(t),t!==null&&zi(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function $f(e,t,n,r,o){switch(t){case"focusin":return Nt=ir(Nt,e,t,n,r,o),!0;case"dragenter":return Dt=ir(Dt,e,t,n,r,o),!0;case"mouseover":return Lt=ir(Lt,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return rr.set(i,ir(rr.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,or.set(i,ir(or.get(i)||null,e,t,n,r,o)),!0}return!1}function xl(e){var t=nn(e.target);if(t!==null){var n=tn(t);if(n!==null){if(t=n.tag,t===13){if(t=sl(n),t!==null){e.blockedOn=t,Sl(e.priority,function(){yl(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Zr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Gi(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Mi=r,n.target.dispatchEvent(r),Mi=null}else return t=wr(n),t!==null&&zi(t),e.blockedOn=n,!1;t.shift()}return!0}function El(e,t,n){Zr(e)&&n.delete(t)}function Kf(){Hi=!1,Nt!==null&&Zr(Nt)&&(Nt=null),Dt!==null&&Zr(Dt)&&(Dt=null),Lt!==null&&Zr(Lt)&&(Lt=null),rr.forEach(El),or.forEach(El)}function ar(e,t){e.blockedOn===t&&(e.blockedOn=null,Hi||(Hi=!0,Ke.unstable_scheduleCallback(Ke.unstable_NormalPriority,Kf)))}function sr(e){function t(o){return ar(o,e)}if(0<Xr.length){ar(Xr[0],e);for(var n=1;n<Xr.length;n++){var r=Xr[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Nt!==null&&ar(Nt,e),Dt!==null&&ar(Dt,e),Lt!==null&&ar(Lt,e),rr.forEach(t),or.forEach(t),n=0;n<jt.length;n++)r=jt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<jt.length&&(n=jt[0],n.blockedOn===null);)xl(n),n.blockedOn===null&&jt.shift()}var xn=Ct.ReactCurrentBatchConfig,qr=!0;function Qf(e,t,n,r){var o=se,i=xn.transition;xn.transition=null;try{se=1,Fi(e,t,n,r)}finally{se=o,xn.transition=i}}function Jf(e,t,n,r){var o=se,i=xn.transition;xn.transition=null;try{se=4,Fi(e,t,n,r)}finally{se=o,xn.transition=i}}function Fi(e,t,n,r){if(qr){var o=Gi(e,t,n,r);if(o===null)aa(e,t,r,eo,n),Cl(e,r);else if($f(o,e,t,n,r))r.stopPropagation();else if(Cl(e,r),t&4&&-1<Vf.indexOf(e)){for(;o!==null;){var i=wr(o);if(i!==null&&gl(i),i=Gi(e,t,n,r),i===null&&aa(e,t,r,eo,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else aa(e,t,r,null,n)}}var eo=null;function Gi(e,t,n,r){if(eo=null,e=Pi(r),e=nn(e),e!==null)if(t=tn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=sl(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return eo=e,null}function Ol(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(jf()){case ji:return 1;case hl:return 4;case $r:case Uf:return 16;case pl:return 536870912;default:return 16}default:return 16}}var Ut=null,Wi=null,to=null;function Rl(){if(to)return to;var e,t=Wi,n=t.length,r,o="value"in Ut?Ut.value:Ut.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===o[i-r];r++);return to=o.slice(e,1<r?1-r:void 0)}function no(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ro(){return!0}function Tl(){return!1}function Qe(e){function t(n,r,o,i,a){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var m in e)e.hasOwnProperty(m)&&(n=e[m],this[m]=n?n(i):i[m]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ro:Tl,this.isPropagationStopped=Tl,this}return pe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ro)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ro)},persist:function(){},isPersistent:ro}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vi=Qe(En),lr=pe({},En,{view:0,detail:0}),Yf=Qe(lr),$i,Ki,ur,oo=pe({},lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ji,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ur&&(ur&&e.type==="mousemove"?($i=e.screenX-ur.screenX,Ki=e.screenY-ur.screenY):Ki=$i=0,ur=e),$i)},movementY:function(e){return"movementY"in e?e.movementY:Ki}}),bl=Qe(oo),Xf=pe({},oo,{dataTransfer:0}),Zf=Qe(Xf),qf=pe({},lr,{relatedTarget:0}),Qi=Qe(qf),ed=pe({},En,{animationName:0,elapsedTime:0,pseudoElement:0}),td=Qe(ed),nd=pe({},En,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),rd=Qe(nd),od=pe({},En,{data:0}),Al=Qe(od),id={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ad={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"},sd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ld(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=sd[e])?!!t[e]:!1}function Ji(){return ld}var ud=pe({},lr,{key:function(e){if(e.key){var t=id[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=no(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ad[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ji,charCode:function(e){return e.type==="keypress"?no(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?no(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),cd=Qe(ud),fd=pe({},oo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Il=Qe(fd),dd=pe({},lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ji}),hd=Qe(dd),pd=pe({},En,{propertyName:0,elapsedTime:0,pseudoElement:0}),md=Qe(pd),vd=pe({},oo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),gd=Qe(vd),yd=[9,13,27,32],Yi=St&&"CompositionEvent"in window,cr=null;St&&"documentMode"in document&&(cr=document.documentMode);var wd=St&&"TextEvent"in window&&!cr,Ml=St&&(!Yi||cr&&8<cr&&11>=cr),Pl=" ",kl=!1;function Nl(e,t){switch(e){case"keyup":return yd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dl(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var On=!1;function Sd(e,t){switch(e){case"compositionend":return Dl(t);case"keypress":return t.which!==32?null:(kl=!0,Pl);case"textInput":return e=t.data,e===Pl&&kl?null:e;default:return null}}function Cd(e,t){if(On)return e==="compositionend"||!Yi&&Nl(e,t)?(e=Rl(),to=Wi=Ut=null,On=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ml&&t.locale!=="ko"?null:t.data;default:return null}}var xd={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ll(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!xd[e.type]:t==="textarea"}function jl(e,t,n,r){nl(r),t=uo(t,"onChange"),0<t.length&&(n=new Vi("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var fr=null,dr=null;function Ed(e){eu(e,0)}function io(e){var t=In(e);if(Ws(t))return e}function Od(e,t){if(e==="change")return t}var Ul=!1;if(St){var Xi;if(St){var Zi="oninput"in document;if(!Zi){var Bl=document.createElement("div");Bl.setAttribute("oninput","return;"),Zi=typeof Bl.oninput=="function"}Xi=Zi}else Xi=!1;Ul=Xi&&(!document.documentMode||9<document.documentMode)}function _l(){fr&&(fr.detachEvent("onpropertychange",zl),dr=fr=null)}function zl(e){if(e.propertyName==="value"&&io(dr)){var t=[];jl(t,dr,e,Pi(e)),al(Ed,t)}}function Rd(e,t,n){e==="focusin"?(_l(),fr=t,dr=n,fr.attachEvent("onpropertychange",zl)):e==="focusout"&&_l()}function Td(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return io(dr)}function bd(e,t){if(e==="click")return io(t)}function Ad(e,t){if(e==="input"||e==="change")return io(t)}function Id(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var it=typeof Object.is=="function"?Object.is:Id;function hr(e,t){if(it(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!ui.call(t,o)||!it(e[o],t[o]))return!1}return!0}function Hl(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Fl(e,t){var n=Hl(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Hl(n)}}function Gl(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Gl(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wl(){for(var e=window,t=Fr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch(r){n=!1}if(n)e=t.contentWindow;else break;t=Fr(e.document)}return t}function qi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Md(e){var t=Wl(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Gl(n.ownerDocument.documentElement,n)){if(r!==null&&qi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=Fl(n,i);var a=Fl(n,r);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Pd=St&&"documentMode"in document&&11>=document.documentMode,Rn=null,ea=null,pr=null,ta=!1;function Vl(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ta||Rn==null||Rn!==Fr(r)||(r=Rn,"selectionStart"in r&&qi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),pr&&hr(pr,r)||(pr=r,r=uo(ea,"onSelect"),0<r.length&&(t=new Vi("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Rn)))}function ao(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Tn={animationend:ao("Animation","AnimationEnd"),animationiteration:ao("Animation","AnimationIteration"),animationstart:ao("Animation","AnimationStart"),transitionend:ao("Transition","TransitionEnd")},na={},$l={};St&&($l=document.createElement("div").style,"AnimationEvent"in window||(delete Tn.animationend.animation,delete Tn.animationiteration.animation,delete Tn.animationstart.animation),"TransitionEvent"in window||delete Tn.transitionend.transition);function so(e){if(na[e])return na[e];if(!Tn[e])return e;var t=Tn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in $l)return na[e]=t[n];return e}var Kl=so("animationend"),Ql=so("animationiteration"),Jl=so("animationstart"),Yl=so("transitionend"),Xl=new Map,Zl="abort auxClick 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(" ");function Bt(e,t){Xl.set(e,t),en(t,[e])}for(var ra=0;ra<Zl.length;ra++){var oa=Zl[ra],kd=oa.toLowerCase(),Nd=oa[0].toUpperCase()+oa.slice(1);Bt(kd,"on"+Nd)}Bt(Kl,"onAnimationEnd"),Bt(Ql,"onAnimationIteration"),Bt(Jl,"onAnimationStart"),Bt("dblclick","onDoubleClick"),Bt("focusin","onFocus"),Bt("focusout","onBlur"),Bt(Yl,"onTransitionEnd"),vn("onMouseEnter",["mouseout","mouseover"]),vn("onMouseLeave",["mouseout","mouseover"]),vn("onPointerEnter",["pointerout","pointerover"]),vn("onPointerLeave",["pointerout","pointerover"]),en("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),en("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),en("onBeforeInput",["compositionend","keypress","textInput","paste"]),en("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),en("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),en("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mr="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(" "),Dd=new Set("cancel close invalid load scroll toggle".split(" ").concat(mr));function ql(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,kf(r,t,void 0,e),e.currentTarget=null}function eu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var m=r[a],v=m.instance,S=m.currentTarget;if(m=m.listener,v!==i&&o.isPropagationStopped())break e;ql(o,m,S),i=v}else for(a=0;a<r.length;a++){if(m=r[a],v=m.instance,S=m.currentTarget,m=m.listener,v!==i&&o.isPropagationStopped())break e;ql(o,m,S),i=v}}}if(Vr)throw e=Li,Vr=!1,Li=null,e}function ce(e,t){var n=t[da];n===void 0&&(n=t[da]=new Set);var r=e+"__bubble";n.has(r)||(tu(t,e,2,!1),n.add(r))}function ia(e,t,n){var r=0;t&&(r|=4),tu(n,e,r,t)}var lo="_reactListening"+Math.random().toString(36).slice(2);function vr(e){if(!e[lo]){e[lo]=!0,js.forEach(function(n){n!=="selectionchange"&&(Dd.has(n)||ia(n,!1,e),ia(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[lo]||(t[lo]=!0,ia("selectionchange",!1,t))}}function tu(e,t,n,r){switch(Ol(t)){case 1:var o=Qf;break;case 4:o=Jf;break;default:o=Fi}n=o.bind(null,t,n,e),o=void 0,!Di||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function aa(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var m=r.stateNode.containerInfo;if(m===o||m.nodeType===8&&m.parentNode===o)break;if(a===4)for(a=r.return;a!==null;){var v=a.tag;if((v===3||v===4)&&(v=a.stateNode.containerInfo,v===o||v.nodeType===8&&v.parentNode===o))return;a=a.return}for(;m!==null;){if(a=nn(m),a===null)return;if(v=a.tag,v===5||v===6){r=i=a;continue e}m=m.parentNode}}r=r.return}al(function(){var S=i,T=Pi(n),R=[];e:{var C=Xl.get(e);if(C!==void 0){var O=Vi,f=e;switch(e){case"keypress":if(no(n)===0)break e;case"keydown":case"keyup":O=cd;break;case"focusin":f="focus",O=Qi;break;case"focusout":f="blur",O=Qi;break;case"beforeblur":case"afterblur":O=Qi;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":O=bl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":O=Zf;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":O=hd;break;case Kl:case Ql:case Jl:O=td;break;case Yl:O=md;break;case"scroll":O=Yf;break;case"wheel":O=gd;break;case"copy":case"cut":case"paste":O=rd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":O=Il}var E=(t&4)!==0,P=!E&&e==="scroll",y=E?C!==null?C+"Capture":null:C;E=[];for(var d=S,h;d!==null;){h=d;var w=h.stateNode;if(h.tag===5&&w!==null&&(h=w,y!==null&&(w=Zn(d,y),w!=null&&E.push(gr(d,w,h)))),P)break;d=d.return}0<E.length&&(C=new O(C,f,null,n,T),R.push({event:C,listeners:E}))}}if(!(t&7)){e:{if(C=e==="mouseover"||e==="pointerover",O=e==="mouseout"||e==="pointerout",C&&n!==Mi&&(f=n.relatedTarget||n.fromElement)&&(nn(f)||f[xt]))break e;if((O||C)&&(C=T.window===T?T:(C=T.ownerDocument)?C.defaultView||C.parentWindow:window,O?(f=n.relatedTarget||n.toElement,O=S,f=f?nn(f):null,f!==null&&(P=tn(f),f!==P||f.tag!==5&&f.tag!==6)&&(f=null)):(O=null,f=S),O!==f)){if(E=bl,w="onMouseLeave",y="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(E=Il,w="onPointerLeave",y="onPointerEnter",d="pointer"),P=O==null?C:In(O),h=f==null?C:In(f),C=new E(w,d+"leave",O,n,T),C.target=P,C.relatedTarget=h,w=null,nn(T)===S&&(E=new E(y,d+"enter",f,n,T),E.target=h,E.relatedTarget=P,w=E),P=w,O&&f)t:{for(E=O,y=f,d=0,h=E;h;h=bn(h))d++;for(h=0,w=y;w;w=bn(w))h++;for(;0<d-h;)E=bn(E),d--;for(;0<h-d;)y=bn(y),h--;for(;d--;){if(E===y||y!==null&&E===y.alternate)break t;E=bn(E),y=bn(y)}E=null}else E=null;O!==null&&nu(R,C,O,E,!1),f!==null&&P!==null&&nu(R,P,f,E,!0)}}e:{if(C=S?In(S):window,O=C.nodeName&&C.nodeName.toLowerCase(),O==="select"||O==="input"&&C.type==="file")var c=Od;else if(Ll(C))if(Ul)c=Ad;else{c=Td;var u=Rd}else(O=C.nodeName)&&O.toLowerCase()==="input"&&(C.type==="checkbox"||C.type==="radio")&&(c=bd);if(c&&(c=c(e,S))){jl(R,c,n,T);break e}u&&u(e,C,S),e==="focusout"&&(u=C._wrapperState)&&u.controlled&&C.type==="number"&&Ri(C,"number",C.value)}switch(u=S?In(S):window,e){case"focusin":(Ll(u)||u.contentEditable==="true")&&(Rn=u,ea=S,pr=null);break;case"focusout":pr=ea=Rn=null;break;case"mousedown":ta=!0;break;case"contextmenu":case"mouseup":case"dragend":ta=!1,Vl(R,n,T);break;case"selectionchange":if(Pd)break;case"keydown":case"keyup":Vl(R,n,T)}var l;if(Yi)e:{switch(e){case"compositionstart":var s="onCompositionStart";break e;case"compositionend":s="onCompositionEnd";break e;case"compositionupdate":s="onCompositionUpdate";break e}s=void 0}else On?Nl(e,n)&&(s="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(s="onCompositionStart");s&&(Ml&&n.locale!=="ko"&&(On||s!=="onCompositionStart"?s==="onCompositionEnd"&&On&&(l=Rl()):(Ut=T,Wi="value"in Ut?Ut.value:Ut.textContent,On=!0)),u=uo(S,s),0<u.length&&(s=new Al(s,e,null,n,T),R.push({event:s,listeners:u}),l?s.data=l:(l=Dl(n),l!==null&&(s.data=l)))),(l=wd?Sd(e,n):Cd(e,n))&&(S=uo(S,"onBeforeInput"),0<S.length&&(T=new Al("onBeforeInput","beforeinput",null,n,T),R.push({event:T,listeners:S}),T.data=l))}eu(R,t)})}function gr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function uo(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Zn(e,n),i!=null&&r.unshift(gr(e,i,o)),i=Zn(e,t),i!=null&&r.push(gr(e,i,o))),e=e.return}return r}function bn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function nu(e,t,n,r,o){for(var i=t._reactName,a=[];n!==null&&n!==r;){var m=n,v=m.alternate,S=m.stateNode;if(v!==null&&v===r)break;m.tag===5&&S!==null&&(m=S,o?(v=Zn(n,i),v!=null&&a.unshift(gr(n,v,m))):o||(v=Zn(n,i),v!=null&&a.push(gr(n,v,m)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var Ld=/\r\n?/g,jd=/\u0000|\uFFFD/g;function ru(e){return(typeof e=="string"?e:""+e).replace(Ld,`
30
+ `).replace(jd,"")}function co(e,t,n){if(t=ru(t),ru(e)!==t&&n)throw Error(Q(425))}function fo(){}var sa=null,la=null;function ua(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ca=typeof setTimeout=="function"?setTimeout:void 0,Ud=typeof clearTimeout=="function"?clearTimeout:void 0,ou=typeof Promise=="function"?Promise:void 0,Bd=typeof queueMicrotask=="function"?queueMicrotask:typeof ou!="undefined"?function(e){return ou.resolve(null).then(e).catch(_d)}:ca;function _d(e){setTimeout(function(){throw e})}function fa(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),sr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);sr(t)}function _t(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function iu(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var An=Math.random().toString(36).slice(2),pt="__reactFiber$"+An,yr="__reactProps$"+An,xt="__reactContainer$"+An,da="__reactEvents$"+An,zd="__reactListeners$"+An,Hd="__reactHandles$"+An;function nn(e){var t=e[pt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[xt]||n[pt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=iu(e);e!==null;){if(n=e[pt])return n;e=iu(e)}return t}e=n,n=e.parentNode}return null}function wr(e){return e=e[pt]||e[xt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function In(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function ho(e){return e[yr]||null}var ha=[],Mn=-1;function zt(e){return{current:e}}function fe(e){0>Mn||(e.current=ha[Mn],ha[Mn]=null,Mn--)}function ue(e,t){Mn++,ha[Mn]=e.current,e.current=t}var Ht={},Pe=zt(Ht),ze=zt(!1),rn=Ht;function Pn(e,t){var n=e.type.contextTypes;if(!n)return Ht;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function He(e){return e=e.childContextTypes,e!=null}function po(){fe(ze),fe(Pe)}function au(e,t,n){if(Pe.current!==Ht)throw Error(Q(168));ue(Pe,t),ue(ze,n)}function su(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(Q(108,Rf(e)||"Unknown",o));return pe({},n,r)}function mo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ht,rn=Pe.current,ue(Pe,e),ue(ze,ze.current),!0}function lu(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=su(e,t,rn),r.__reactInternalMemoizedMergedChildContext=e,fe(ze),fe(Pe),ue(Pe,e)):fe(ze),ue(ze,n)}var Et=null,vo=!1,pa=!1;function uu(e){Et===null?Et=[e]:Et.push(e)}function Fd(e){vo=!0,uu(e)}function Ft(){if(!pa&&Et!==null){pa=!0;var e=0,t=se;try{var n=Et;for(se=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Et=null,vo=!1}catch(o){throw Et!==null&&(Et=Et.slice(e+1)),fl(ji,Ft),o}finally{se=t,pa=!1}}return null}var kn=[],Nn=0,go=null,yo=0,Ze=[],qe=0,on=null,Ot=1,Rt="";function an(e,t){kn[Nn++]=yo,kn[Nn++]=go,go=e,yo=t}function cu(e,t,n){Ze[qe++]=Ot,Ze[qe++]=Rt,Ze[qe++]=on,on=e;var r=Ot;e=Rt;var o=32-ot(r)-1;r&=~(1<<o),n+=1;var i=32-ot(t)+o;if(30<i){var a=o-o%5;i=(r&(1<<a)-1).toString(32),r>>=a,o-=a,Ot=1<<32-ot(t)+o|n<<o|r,Rt=i+e}else Ot=1<<i|n<<o|r,Rt=e}function ma(e){e.return!==null&&(an(e,1),cu(e,1,0))}function va(e){for(;e===go;)go=kn[--Nn],kn[Nn]=null,yo=kn[--Nn],kn[Nn]=null;for(;e===on;)on=Ze[--qe],Ze[qe]=null,Rt=Ze[--qe],Ze[qe]=null,Ot=Ze[--qe],Ze[qe]=null}var Je=null,Ye=null,de=!1,at=null;function fu(e,t){var n=rt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function du(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Je=e,Ye=_t(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Je=e,Ye=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=on!==null?{id:Ot,overflow:Rt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Je=e,Ye=null,!0):!1;default:return!1}}function ga(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ya(e){if(de){var t=Ye;if(t){var n=t;if(!du(e,t)){if(ga(e))throw Error(Q(418));t=_t(n.nextSibling);var r=Je;t&&du(e,t)?fu(r,n):(e.flags=e.flags&-4097|2,de=!1,Je=e)}}else{if(ga(e))throw Error(Q(418));e.flags=e.flags&-4097|2,de=!1,Je=e}}}function hu(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Je=e}function wo(e){if(e!==Je)return!1;if(!de)return hu(e),de=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!ua(e.type,e.memoizedProps)),t&&(t=Ye)){if(ga(e))throw pu(),Error(Q(418));for(;t;)fu(e,t),t=_t(t.nextSibling)}if(hu(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ye=_t(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ye=null}}else Ye=Je?_t(e.stateNode.nextSibling):null;return!0}function pu(){for(var e=Ye;e;)e=_t(e.nextSibling)}function Dn(){Ye=Je=null,de=!1}function wa(e){at===null?at=[e]:at.push(e)}var Gd=Ct.ReactCurrentBatchConfig;function Sr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Q(309));var r=n.stateNode}if(!r)throw Error(Q(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var m=o.refs;a===null?delete m[i]:m[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(Q(284));if(!n._owner)throw Error(Q(290,e))}return e}function So(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function mu(e){var t=e._init;return t(e._payload)}function vu(e){function t(y,d){if(e){var h=y.deletions;h===null?(y.deletions=[d],y.flags|=16):h.push(d)}}function n(y,d){if(!e)return null;for(;d!==null;)t(y,d),d=d.sibling;return null}function r(y,d){for(y=new Map;d!==null;)d.key!==null?y.set(d.key,d):y.set(d.index,d),d=d.sibling;return y}function o(y,d){return y=Yt(y,d),y.index=0,y.sibling=null,y}function i(y,d,h){return y.index=h,e?(h=y.alternate,h!==null?(h=h.index,h<d?(y.flags|=2,d):h):(y.flags|=2,d)):(y.flags|=1048576,d)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function m(y,d,h,w){return d===null||d.tag!==6?(d=cs(h,y.mode,w),d.return=y,d):(d=o(d,h),d.return=y,d)}function v(y,d,h,w){var c=h.type;return c===yn?T(y,d,h.props.children,w,h.key):d!==null&&(d.elementType===c||typeof c=="object"&&c!==null&&c.$$typeof===Pt&&mu(c)===d.type)?(w=o(d,h.props),w.ref=Sr(y,d,h),w.return=y,w):(w=Wo(h.type,h.key,h.props,null,y.mode,w),w.ref=Sr(y,d,h),w.return=y,w)}function S(y,d,h,w){return d===null||d.tag!==4||d.stateNode.containerInfo!==h.containerInfo||d.stateNode.implementation!==h.implementation?(d=fs(h,y.mode,w),d.return=y,d):(d=o(d,h.children||[]),d.return=y,d)}function T(y,d,h,w,c){return d===null||d.tag!==7?(d=pn(h,y.mode,w,c),d.return=y,d):(d=o(d,h),d.return=y,d)}function R(y,d,h){if(typeof d=="string"&&d!==""||typeof d=="number")return d=cs(""+d,y.mode,h),d.return=y,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case zr:return h=Wo(d.type,d.key,d.props,null,y.mode,h),h.ref=Sr(y,null,d),h.return=y,h;case gn:return d=fs(d,y.mode,h),d.return=y,d;case Pt:var w=d._init;return R(y,w(d._payload),h)}if(Jn(d)||Kn(d))return d=pn(d,y.mode,h,null),d.return=y,d;So(y,d)}return null}function C(y,d,h,w){var c=d!==null?d.key:null;if(typeof h=="string"&&h!==""||typeof h=="number")return c!==null?null:m(y,d,""+h,w);if(typeof h=="object"&&h!==null){switch(h.$$typeof){case zr:return h.key===c?v(y,d,h,w):null;case gn:return h.key===c?S(y,d,h,w):null;case Pt:return c=h._init,C(y,d,c(h._payload),w)}if(Jn(h)||Kn(h))return c!==null?null:T(y,d,h,w,null);So(y,h)}return null}function O(y,d,h,w,c){if(typeof w=="string"&&w!==""||typeof w=="number")return y=y.get(h)||null,m(d,y,""+w,c);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case zr:return y=y.get(w.key===null?h:w.key)||null,v(d,y,w,c);case gn:return y=y.get(w.key===null?h:w.key)||null,S(d,y,w,c);case Pt:var u=w._init;return O(y,d,h,u(w._payload),c)}if(Jn(w)||Kn(w))return y=y.get(h)||null,T(d,y,w,c,null);So(d,w)}return null}function f(y,d,h,w){for(var c=null,u=null,l=d,s=d=0,g=null;l!==null&&s<h.length;s++){l.index>s?(g=l,l=null):g=l.sibling;var p=C(y,l,h[s],w);if(p===null){l===null&&(l=g);break}e&&l&&p.alternate===null&&t(y,l),d=i(p,d,s),u===null?c=p:u.sibling=p,u=p,l=g}if(s===h.length)return n(y,l),de&&an(y,s),c;if(l===null){for(;s<h.length;s++)l=R(y,h[s],w),l!==null&&(d=i(l,d,s),u===null?c=l:u.sibling=l,u=l);return de&&an(y,s),c}for(l=r(y,l);s<h.length;s++)g=O(l,y,s,h[s],w),g!==null&&(e&&g.alternate!==null&&l.delete(g.key===null?s:g.key),d=i(g,d,s),u===null?c=g:u.sibling=g,u=g);return e&&l.forEach(function(x){return t(y,x)}),de&&an(y,s),c}function E(y,d,h,w){var c=Kn(h);if(typeof c!="function")throw Error(Q(150));if(h=c.call(h),h==null)throw Error(Q(151));for(var u=c=null,l=d,s=d=0,g=null,p=h.next();l!==null&&!p.done;s++,p=h.next()){l.index>s?(g=l,l=null):g=l.sibling;var x=C(y,l,p.value,w);if(x===null){l===null&&(l=g);break}e&&l&&x.alternate===null&&t(y,l),d=i(x,d,s),u===null?c=x:u.sibling=x,u=x,l=g}if(p.done)return n(y,l),de&&an(y,s),c;if(l===null){for(;!p.done;s++,p=h.next())p=R(y,p.value,w),p!==null&&(d=i(p,d,s),u===null?c=p:u.sibling=p,u=p);return de&&an(y,s),c}for(l=r(y,l);!p.done;s++,p=h.next())p=O(l,y,s,p.value,w),p!==null&&(e&&p.alternate!==null&&l.delete(p.key===null?s:p.key),d=i(p,d,s),u===null?c=p:u.sibling=p,u=p);return e&&l.forEach(function(D){return t(y,D)}),de&&an(y,s),c}function P(y,d,h,w){if(typeof h=="object"&&h!==null&&h.type===yn&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case zr:e:{for(var c=h.key,u=d;u!==null;){if(u.key===c){if(c=h.type,c===yn){if(u.tag===7){n(y,u.sibling),d=o(u,h.props.children),d.return=y,y=d;break e}}else if(u.elementType===c||typeof c=="object"&&c!==null&&c.$$typeof===Pt&&mu(c)===u.type){n(y,u.sibling),d=o(u,h.props),d.ref=Sr(y,u,h),d.return=y,y=d;break e}n(y,u);break}else t(y,u);u=u.sibling}h.type===yn?(d=pn(h.props.children,y.mode,w,h.key),d.return=y,y=d):(w=Wo(h.type,h.key,h.props,null,y.mode,w),w.ref=Sr(y,d,h),w.return=y,y=w)}return a(y);case gn:e:{for(u=h.key;d!==null;){if(d.key===u)if(d.tag===4&&d.stateNode.containerInfo===h.containerInfo&&d.stateNode.implementation===h.implementation){n(y,d.sibling),d=o(d,h.children||[]),d.return=y,y=d;break e}else{n(y,d);break}else t(y,d);d=d.sibling}d=fs(h,y.mode,w),d.return=y,y=d}return a(y);case Pt:return u=h._init,P(y,d,u(h._payload),w)}if(Jn(h))return f(y,d,h,w);if(Kn(h))return E(y,d,h,w);So(y,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,d!==null&&d.tag===6?(n(y,d.sibling),d=o(d,h),d.return=y,y=d):(n(y,d),d=cs(h,y.mode,w),d.return=y,y=d),a(y)):n(y,d)}return P}var Ln=vu(!0),gu=vu(!1),Co=zt(null),xo=null,jn=null,Sa=null;function Ca(){Sa=jn=xo=null}function xa(e){var t=Co.current;fe(Co),e._currentValue=t}function Ea(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Un(e,t){xo=e,Sa=jn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Fe=!0),e.firstContext=null)}function et(e){var t=e._currentValue;if(Sa!==e)if(e={context:e,memoizedValue:t,next:null},jn===null){if(xo===null)throw Error(Q(308));jn=e,xo.dependencies={lanes:0,firstContext:e}}else jn=jn.next=e;return t}var sn=null;function Oa(e){sn===null?sn=[e]:sn.push(e)}function yu(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Oa(t)):(n.next=o.next,o.next=n),t.interleaved=n,Tt(e,r)}function Tt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Gt=!1;function Ra(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function wu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function bt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Wt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ae&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Tt(e,n)}return o=r.interleaved,o===null?(t.next=t,Oa(r)):(t.next=o.next,o.next=t),r.interleaved=t,Tt(e,n)}function Eo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,_i(e,n)}}function Su(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Oo(e,t,n,r){var o=e.updateQueue;Gt=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,m=o.shared.pending;if(m!==null){o.shared.pending=null;var v=m,S=v.next;v.next=null,a===null?i=S:a.next=S,a=v;var T=e.alternate;T!==null&&(T=T.updateQueue,m=T.lastBaseUpdate,m!==a&&(m===null?T.firstBaseUpdate=S:m.next=S,T.lastBaseUpdate=v))}if(i!==null){var R=o.baseState;a=0,T=S=v=null,m=i;do{var C=m.lane,O=m.eventTime;if((r&C)===C){T!==null&&(T=T.next={eventTime:O,lane:0,tag:m.tag,payload:m.payload,callback:m.callback,next:null});e:{var f=e,E=m;switch(C=t,O=n,E.tag){case 1:if(f=E.payload,typeof f=="function"){R=f.call(O,R,C);break e}R=f;break e;case 3:f.flags=f.flags&-65537|128;case 0:if(f=E.payload,C=typeof f=="function"?f.call(O,R,C):f,C==null)break e;R=pe({},R,C);break e;case 2:Gt=!0}}m.callback!==null&&m.lane!==0&&(e.flags|=64,C=o.effects,C===null?o.effects=[m]:C.push(m))}else O={eventTime:O,lane:C,tag:m.tag,payload:m.payload,callback:m.callback,next:null},T===null?(S=T=O,v=R):T=T.next=O,a|=C;if(m=m.next,m===null){if(m=o.shared.pending,m===null)break;C=m,m=C.next,C.next=null,o.lastBaseUpdate=C,o.shared.pending=null}}while(!0);if(T===null&&(v=R),o.baseState=v,o.firstBaseUpdate=S,o.lastBaseUpdate=T,t=o.shared.interleaved,t!==null){o=t;do a|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);cn|=a,e.lanes=a,e.memoizedState=R}}function Cu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(Q(191,o));o.call(r)}}}var Cr={},mt=zt(Cr),xr=zt(Cr),Er=zt(Cr);function ln(e){if(e===Cr)throw Error(Q(174));return e}function Ta(e,t){switch(ue(Er,t),ue(xr,e),ue(mt,Cr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:bi(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=bi(t,e)}fe(mt),ue(mt,t)}function Bn(){fe(mt),fe(xr),fe(Er)}function xu(e){ln(Er.current);var t=ln(mt.current),n=bi(t,e.type);t!==n&&(ue(xr,e),ue(mt,n))}function ba(e){xr.current===e&&(fe(mt),fe(xr))}var me=zt(0);function Ro(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Aa=[];function Ia(){for(var e=0;e<Aa.length;e++)Aa[e]._workInProgressVersionPrimary=null;Aa.length=0}var To=Ct.ReactCurrentDispatcher,Ma=Ct.ReactCurrentBatchConfig,un=0,ve=null,Ce=null,Re=null,bo=!1,Or=!1,Rr=0,Wd=0;function ke(){throw Error(Q(321))}function Pa(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!it(e[n],t[n]))return!1;return!0}function ka(e,t,n,r,o,i){if(un=i,ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,To.current=e===null||e.memoizedState===null?Qd:Jd,e=n(r,o),Or){i=0;do{if(Or=!1,Rr=0,25<=i)throw Error(Q(301));i+=1,Re=Ce=null,t.updateQueue=null,To.current=Yd,e=n(r,o)}while(Or)}if(To.current=Mo,t=Ce!==null&&Ce.next!==null,un=0,Re=Ce=ve=null,bo=!1,t)throw Error(Q(300));return e}function Na(){var e=Rr!==0;return Rr=0,e}function vt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Re===null?ve.memoizedState=Re=e:Re=Re.next=e,Re}function tt(){if(Ce===null){var e=ve.alternate;e=e!==null?e.memoizedState:null}else e=Ce.next;var t=Re===null?ve.memoizedState:Re.next;if(t!==null)Re=t,Ce=e;else{if(e===null)throw Error(Q(310));Ce=e,e={memoizedState:Ce.memoizedState,baseState:Ce.baseState,baseQueue:Ce.baseQueue,queue:Ce.queue,next:null},Re===null?ve.memoizedState=Re=e:Re=Re.next=e}return Re}function Tr(e,t){return typeof t=="function"?t(e):t}function Da(e){var t=tt(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var r=Ce,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var a=o.next;o.next=i.next,i.next=a}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var m=a=null,v=null,S=i;do{var T=S.lane;if((un&T)===T)v!==null&&(v=v.next={lane:0,action:S.action,hasEagerState:S.hasEagerState,eagerState:S.eagerState,next:null}),r=S.hasEagerState?S.eagerState:e(r,S.action);else{var R={lane:T,action:S.action,hasEagerState:S.hasEagerState,eagerState:S.eagerState,next:null};v===null?(m=v=R,a=r):v=v.next=R,ve.lanes|=T,cn|=T}S=S.next}while(S!==null&&S!==i);v===null?a=r:v.next=m,it(r,t.memoizedState)||(Fe=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=v,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,ve.lanes|=i,cn|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function La(e){var t=tt(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var a=o=o.next;do i=e(i,a.action),a=a.next;while(a!==o);it(i,t.memoizedState)||(Fe=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Eu(){}function Ou(e,t){var n=ve,r=tt(),o=t(),i=!it(r.memoizedState,o);if(i&&(r.memoizedState=o,Fe=!0),r=r.queue,ja(bu.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Re!==null&&Re.memoizedState.tag&1){if(n.flags|=2048,br(9,Tu.bind(null,n,r,o,t),void 0,null),Te===null)throw Error(Q(349));un&30||Ru(n,t,o)}return o}function Ru(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ve.updateQueue,t===null?(t={lastEffect:null,stores:null},ve.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Tu(e,t,n,r){t.value=n,t.getSnapshot=r,Au(t)&&Iu(e)}function bu(e,t,n){return n(function(){Au(t)&&Iu(e)})}function Au(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!it(e,n)}catch(r){return!0}}function Iu(e){var t=Tt(e,1);t!==null&&ct(t,e,1,-1)}function Mu(e){var t=vt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Tr,lastRenderedState:e},t.queue=e,e=e.dispatch=Kd.bind(null,ve,e),[t.memoizedState,e]}function br(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=ve.updateQueue,t===null?(t={lastEffect:null,stores:null},ve.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Pu(){return tt().memoizedState}function Ao(e,t,n,r){var o=vt();ve.flags|=e,o.memoizedState=br(1|t,n,void 0,r===void 0?null:r)}function Io(e,t,n,r){var o=tt();r=r===void 0?null:r;var i=void 0;if(Ce!==null){var a=Ce.memoizedState;if(i=a.destroy,r!==null&&Pa(r,a.deps)){o.memoizedState=br(t,n,i,r);return}}ve.flags|=e,o.memoizedState=br(1|t,n,i,r)}function ku(e,t){return Ao(8390656,8,e,t)}function ja(e,t){return Io(2048,8,e,t)}function Nu(e,t){return Io(4,2,e,t)}function Du(e,t){return Io(4,4,e,t)}function Lu(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ju(e,t,n){return n=n!=null?n.concat([e]):null,Io(4,4,Lu.bind(null,t,e),n)}function Ua(){}function Uu(e,t){var n=tt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Pa(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Bu(e,t){var n=tt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Pa(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function _u(e,t,n){return un&21?(it(n,t)||(n=ml(),ve.lanes|=n,cn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Fe=!0),e.memoizedState=n)}function Vd(e,t){var n=se;se=n!==0&&4>n?n:4,e(!0);var r=Ma.transition;Ma.transition={};try{e(!1),t()}finally{se=n,Ma.transition=r}}function zu(){return tt().memoizedState}function $d(e,t,n){var r=Qt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Hu(e))Fu(t,n);else if(n=yu(e,t,n,r),n!==null){var o=Be();ct(n,e,r,o),Gu(n,t,r)}}function Kd(e,t,n){var r=Qt(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Hu(e))Fu(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,m=i(a,n);if(o.hasEagerState=!0,o.eagerState=m,it(m,a)){var v=t.interleaved;v===null?(o.next=o,Oa(t)):(o.next=v.next,v.next=o),t.interleaved=o;return}}catch(S){}finally{}n=yu(e,t,o,r),n!==null&&(o=Be(),ct(n,e,r,o),Gu(n,t,r))}}function Hu(e){var t=e.alternate;return e===ve||t!==null&&t===ve}function Fu(e,t){Or=bo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Gu(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,_i(e,n)}}var Mo={readContext:et,useCallback:ke,useContext:ke,useEffect:ke,useImperativeHandle:ke,useInsertionEffect:ke,useLayoutEffect:ke,useMemo:ke,useReducer:ke,useRef:ke,useState:ke,useDebugValue:ke,useDeferredValue:ke,useTransition:ke,useMutableSource:ke,useSyncExternalStore:ke,useId:ke,unstable_isNewReconciler:!1},Qd={readContext:et,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:et,useEffect:ku,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ao(4194308,4,Lu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ao(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ao(4,2,e,t)},useMemo:function(e,t){var n=vt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=vt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=$d.bind(null,ve,e),[r.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:Mu,useDebugValue:Ua,useDeferredValue:function(e){return vt().memoizedState=e},useTransition:function(){var e=Mu(!1),t=e[0];return e=Vd.bind(null,e[1]),vt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ve,o=vt();if(de){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),Te===null)throw Error(Q(349));un&30||Ru(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,ku(bu.bind(null,r,i,e),[e]),r.flags|=2048,br(9,Tu.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=vt(),t=Te.identifierPrefix;if(de){var n=Rt,r=Ot;n=(r&~(1<<32-ot(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Rr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Wd++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Jd={readContext:et,useCallback:Uu,useContext:et,useEffect:ja,useImperativeHandle:ju,useInsertionEffect:Nu,useLayoutEffect:Du,useMemo:Bu,useReducer:Da,useRef:Pu,useState:function(){return Da(Tr)},useDebugValue:Ua,useDeferredValue:function(e){var t=tt();return _u(t,Ce.memoizedState,e)},useTransition:function(){var e=Da(Tr)[0],t=tt().memoizedState;return[e,t]},useMutableSource:Eu,useSyncExternalStore:Ou,useId:zu,unstable_isNewReconciler:!1},Yd={readContext:et,useCallback:Uu,useContext:et,useEffect:ja,useImperativeHandle:ju,useInsertionEffect:Nu,useLayoutEffect:Du,useMemo:Bu,useReducer:La,useRef:Pu,useState:function(){return La(Tr)},useDebugValue:Ua,useDeferredValue:function(e){var t=tt();return Ce===null?t.memoizedState=e:_u(t,Ce.memoizedState,e)},useTransition:function(){var e=La(Tr)[0],t=tt().memoizedState;return[e,t]},useMutableSource:Eu,useSyncExternalStore:Ou,useId:zu,unstable_isNewReconciler:!1};function st(e,t){if(e&&e.defaultProps){t=pe({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ba(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:pe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Po={isMounted:function(e){return(e=e._reactInternals)?tn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Be(),o=Qt(e),i=bt(r,o);i.payload=t,n!=null&&(i.callback=n),t=Wt(e,i,o),t!==null&&(ct(t,e,o,r),Eo(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Be(),o=Qt(e),i=bt(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Wt(e,i,o),t!==null&&(ct(t,e,o,r),Eo(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Be(),r=Qt(e),o=bt(n,r);o.tag=2,t!=null&&(o.callback=t),t=Wt(e,o,r),t!==null&&(ct(t,e,r,n),Eo(t,e,r))}};function Wu(e,t,n,r,o,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!hr(n,r)||!hr(o,i):!0}function Vu(e,t,n){var r=!1,o=Ht,i=t.contextType;return typeof i=="object"&&i!==null?i=et(i):(o=He(t)?rn:Pe.current,r=t.contextTypes,i=(r=r!=null)?Pn(e,o):Ht),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Po,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function $u(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Po.enqueueReplaceState(t,t.state,null)}function _a(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Ra(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=et(i):(i=He(t)?rn:Pe.current,o.context=Pn(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Ba(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Po.enqueueReplaceState(o,o.state,null),Oo(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function _n(e,t){try{var n="",r=t;do n+=Of(r),r=r.return;while(r);var o=n}catch(i){o=`
31
31
  Error generating stack: `+i.message+`
32
- `+i.stack}return{value:e,source:t,stack:o,digest:null}}function _a(e,t,n){return{value:e,source:null,stack:n!=null?n:null,digest:t!=null?t:null}}function za(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Jd=typeof WeakMap=="function"?WeakMap:Map;function $u(e,t,n){n=bt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Uo||(Uo=!0,ts=r),za(e,t)},n}function Ku(e,t,n){n=bt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){za(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){za(e,t),typeof r!="function"&&($t===null?$t=new Set([this]):$t.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Jd;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=uh.bind(null,e,t,n),t.then(e,e))}function Ju(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Yu(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=bt(-1,1),t.tag=2,Wt(n,t,1))),n.lanes|=1),e)}var Yd=Ct.ReactCurrentOwner,Fe=!1;function Ue(e,t,n,r){t.child=e===null?vu(t,null,n,r):Ln(t,e.child,n,r)}function Xu(e,t,n,r,o){n=n.render;var i=t.ref;return Un(t,o),r=Pa(e,t,n,r,i,o),n=ka(),e!==null&&!Fe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,At(e,t,o)):(de&&n&&pa(t),t.flags|=1,Ue(e,t,r,o),t.child)}function Zu(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!ls(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,qu(e,t,i,r,o)):(e=Go(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:hr,n(a,r)&&e.ref===t.ref)return At(e,t,o)}return t.flags|=1,e=Yt(i,r),e.ref=t.ref,e.return=t,t.child=e}function qu(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(hr(i,r)&&e.ref===t.ref)if(Fe=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Fe=!0);else return t.lanes=e.lanes,At(e,t,o)}return Ha(e,t,n,r,o)}function ec(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ue(Hn,Xe),Xe|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ue(Hn,Xe),Xe|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ue(Hn,Xe),Xe|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ue(Hn,Xe),Xe|=r;return Ue(e,t,o,n),t.child}function tc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ha(e,t,n,r,o){var i=He(n)?rn:Pe.current;return i=Pn(t,i),Un(t,o),n=Pa(e,t,n,r,i,o),r=ka(),e!==null&&!Fe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,At(e,t,o)):(de&&r&&pa(t),t.flags|=1,Ue(e,t,n,o),t.child)}function nc(e,t,n,r,o){if(He(n)){var i=!0;po(t)}else i=!1;if(Un(t,o),t.stateNode===null)ko(e,t),Wu(t,n,r),Ba(t,n,r,o),r=!0;else if(e===null){var a=t.stateNode,m=t.memoizedProps;a.props=m;var v=a.context,S=n.contextType;typeof S=="object"&&S!==null?S=et(S):(S=He(n)?rn:Pe.current,S=Pn(t,S));var T=n.getDerivedStateFromProps,R=typeof T=="function"||typeof a.getSnapshotBeforeUpdate=="function";R||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(m!==r||v!==S)&&Vu(t,a,r,S),Gt=!1;var C=t.memoizedState;a.state=C,Eo(t,r,a,o),v=t.memoizedState,m!==r||C!==v||ze.current||Gt?(typeof T=="function"&&(Ua(t,n,T,r),v=t.memoizedState),(m=Gt||Gu(t,n,m,r,C,v,S))?(R||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=v),a.props=r,a.state=v,a.context=S,r=m):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,yu(e,t),m=t.memoizedProps,S=t.type===t.elementType?m:st(t.type,m),a.props=S,R=t.pendingProps,C=a.context,v=n.contextType,typeof v=="object"&&v!==null?v=et(v):(v=He(n)?rn:Pe.current,v=Pn(t,v));var O=n.getDerivedStateFromProps;(T=typeof O=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(m!==R||C!==v)&&Vu(t,a,r,v),Gt=!1,C=t.memoizedState,a.state=C,Eo(t,r,a,o);var f=t.memoizedState;m!==R||C!==f||ze.current||Gt?(typeof O=="function"&&(Ua(t,n,O,r),f=t.memoizedState),(S=Gt||Gu(t,n,S,r,C,f,v)||!1)?(T||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,f,v),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,f,v)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||m===e.memoizedProps&&C===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&C===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),a.props=r,a.state=f,a.context=v,r=S):(typeof a.componentDidUpdate!="function"||m===e.memoizedProps&&C===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&C===e.memoizedState||(t.flags|=1024),r=!1)}return Fa(e,t,n,r,i,o)}function Fa(e,t,n,r,o,i){tc(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return o&&su(t,n,!1),At(e,t,i);r=t.stateNode,Yd.current=t;var m=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Ln(t,e.child,null,i),t.child=Ln(t,null,m,i)):Ue(e,t,m,i),t.memoizedState=r.state,o&&su(t,n,!0),t.child}function rc(e){var t=e.stateNode;t.pendingContext?iu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&iu(e,t.context,!1),Ra(e,t.containerInfo)}function oc(e,t,n,r,o){return Dn(),ya(o),t.flags|=256,Ue(e,t,n,r),t.child}var Ga={dehydrated:null,treeContext:null,retryLane:0};function Wa(e){return{baseLanes:e,cachePool:null,transitions:null}}function ic(e,t,n){var r=t.pendingProps,o=me.current,i=!1,a=(t.flags&128)!==0,m;if((m=a)||(m=e!==null&&e.memoizedState===null?!1:(o&2)!==0),m?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),ue(me,o&1),e===null)return ga(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=Wo(a,r,0,null),e=pn(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Wa(n),t.memoizedState=Ga,e):Va(t,a));if(o=e.memoizedState,o!==null&&(m=o.dehydrated,m!==null))return Xd(e,t,a,r,m,o,n);if(i){i=r.fallback,a=t.mode,o=e.child,m=o.sibling;var v={mode:"hidden",children:r.children};return!(a&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=v,t.deletions=null):(r=Yt(o,v),r.subtreeFlags=o.subtreeFlags&14680064),m!==null?i=Yt(m,i):(i=pn(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?Wa(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=Ga,r}return i=e.child,e=i.sibling,r=Yt(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Va(e,t){return t=Wo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Po(e,t,n,r){return r!==null&&ya(r),Ln(t,e.child,null,n),e=Va(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xd(e,t,n,r,o,i,a){if(n)return t.flags&256?(t.flags&=-257,r=_a(Error(Q(422))),Po(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=Wo({mode:"visible",children:r.children},o,0,null),i=pn(i,o,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Ln(t,e.child,null,a),t.child.memoizedState=Wa(a),t.memoizedState=Ga,i);if(!(t.mode&1))return Po(e,t,a,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var m=r.dgst;return r=m,i=Error(Q(419)),r=_a(i,r,void 0),Po(e,t,a,r)}if(m=(a&e.childLanes)!==0,Fe||m){if(r=Te,r!==null){switch(a&-a){case 4:o=2;break;case 16:o=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|a)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Tt(e,o),ct(r,e,o,-1))}return ss(),r=_a(Error(Q(421))),Po(e,t,a,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=ch.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Ye=_t(o.nextSibling),Je=t,de=!0,at=null,e!==null&&(Ze[qe++]=Ot,Ze[qe++]=Rt,Ze[qe++]=on,Ot=e.id,Rt=e.overflow,on=t),t=Va(t,r.children),t.flags|=4096,t)}function ac(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),xa(e.return,t,n)}function $a(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function sc(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Ue(e,t,r.children,n),r=me.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ac(e,n,t);else if(e.tag===19)ac(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ue(me,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Oo(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),$a(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Oo(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}$a(t,!0,n,null,i);break;case"together":$a(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ko(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function At(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),cn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,n=Yt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Zd(e,t,n){switch(t.tag){case 3:rc(t),Dn();break;case 5:Cu(t);break;case 1:He(t.type)&&po(t);break;case 4:Ra(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;ue(So,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ue(me,me.current&1),t.flags|=128,null):n&t.child.childLanes?ic(e,t,n):(ue(me,me.current&1),e=At(e,t,n),e!==null?e.sibling:null);ue(me,me.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return sc(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),ue(me,me.current),r)break;return null;case 22:case 23:return t.lanes=0,ec(e,t,n)}return At(e,t,n)}var lc,Ka,uc,cc;lc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ka=function(){},uc=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,ln(mt.current);var i=null;switch(n){case"input":o=xi(e,o),r=xi(e,r),i=[];break;case"select":o=pe({},o,{value:void 0}),r=pe({},r,{value:void 0}),i=[];break;case"textarea":o=Ri(e,o),r=Ri(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=co)}bi(n,r);var a;n=null;for(S in o)if(!r.hasOwnProperty(S)&&o.hasOwnProperty(S)&&o[S]!=null)if(S==="style"){var m=o[S];for(a in m)m.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else S!=="dangerouslySetInnerHTML"&&S!=="children"&&S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&($n.hasOwnProperty(S)?i||(i=[]):(i=i||[]).push(S,null));for(S in r){var v=r[S];if(m=o!=null?o[S]:void 0,r.hasOwnProperty(S)&&v!==m&&(v!=null||m!=null))if(S==="style")if(m){for(a in m)!m.hasOwnProperty(a)||v&&v.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in v)v.hasOwnProperty(a)&&m[a]!==v[a]&&(n||(n={}),n[a]=v[a])}else n||(i||(i=[]),i.push(S,n)),n=v;else S==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,m=m?m.__html:void 0,v!=null&&m!==v&&(i=i||[]).push(S,v)):S==="children"?typeof v!="string"&&typeof v!="number"||(i=i||[]).push(S,""+v):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&($n.hasOwnProperty(S)?(v!=null&&S==="onScroll"&&ce("scroll",e),i||m===v||(i=[])):(i=i||[]).push(S,v))}n&&(i=i||[]).push("style",n);var S=i;(t.updateQueue=S)&&(t.flags|=4)}},cc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ar(e,t){if(!de)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ne(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function qd(e,t,n){var r=t.pendingProps;switch(ma(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ne(t),null;case 1:return He(t.type)&&ho(),Ne(t),null;case 3:return r=t.stateNode,Bn(),fe(ze),fe(Pe),Aa(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(yo(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,at!==null&&(os(at),at=null))),Ka(e,t),Ne(t),null;case 5:Ta(t);var o=ln(Er.current);if(n=t.type,e!==null&&t.stateNode!=null)uc(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Q(166));return Ne(t),null}if(e=ln(mt.current),yo(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[pt]=t,r[yr]=i,e=(t.mode&1)!==0,n){case"dialog":ce("cancel",r),ce("close",r);break;case"iframe":case"object":case"embed":ce("load",r);break;case"video":case"audio":for(o=0;o<mr.length;o++)ce(mr[o],r);break;case"source":ce("error",r);break;case"img":case"image":case"link":ce("error",r),ce("load",r);break;case"details":ce("toggle",r);break;case"input":Ws(r,i),ce("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ce("invalid",r);break;case"textarea":Ks(r,i),ce("invalid",r)}bi(n,i),o=null;for(var a in i)if(i.hasOwnProperty(a)){var m=i[a];a==="children"?typeof m=="string"?r.textContent!==m&&(i.suppressHydrationWarning!==!0&&uo(r.textContent,m,e),o=["children",m]):typeof m=="number"&&r.textContent!==""+m&&(i.suppressHydrationWarning!==!0&&uo(r.textContent,m,e),o=["children",""+m]):$n.hasOwnProperty(a)&&m!=null&&a==="onScroll"&&ce("scroll",r)}switch(n){case"input":zr(r),$s(r,i,!0);break;case"textarea":zr(r),Js(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=co)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Ys(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[pt]=t,e[yr]=r,lc(e,t,!1,!1),t.stateNode=e;e:{switch(a=Ai(n,r),n){case"dialog":ce("cancel",e),ce("close",e),o=r;break;case"iframe":case"object":case"embed":ce("load",e),o=r;break;case"video":case"audio":for(o=0;o<mr.length;o++)ce(mr[o],e);o=r;break;case"source":ce("error",e),o=r;break;case"img":case"image":case"link":ce("error",e),ce("load",e),o=r;break;case"details":ce("toggle",e),o=r;break;case"input":Ws(e,r),o=xi(e,r),ce("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=pe({},r,{value:void 0}),ce("invalid",e);break;case"textarea":Ks(e,r),o=Ri(e,r),ce("invalid",e);break;default:o=r}bi(n,o),m=o;for(i in m)if(m.hasOwnProperty(i)){var v=m[i];i==="style"?qs(e,v):i==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,v!=null&&Xs(e,v)):i==="children"?typeof v=="string"?(n!=="textarea"||v!=="")&&Yn(e,v):typeof v=="number"&&Yn(e,""+v):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&($n.hasOwnProperty(i)?v!=null&&i==="onScroll"&&ce("scroll",e):v!=null&&fi(e,i,v,a))}switch(n){case"input":zr(e),$s(e,r,!1);break;case"textarea":zr(e),Js(e);break;case"option":r.value!=null&&e.setAttribute("value",""+kt(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?wn(e,!!r.multiple,i,!1):r.defaultValue!=null&&wn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=co)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ne(t),null;case 6:if(e&&t.stateNode!=null)cc(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Q(166));if(n=ln(Er.current),ln(mt.current),yo(t)){if(r=t.stateNode,n=t.memoizedProps,r[pt]=t,(i=r.nodeValue!==n)&&(e=Je,e!==null))switch(e.tag){case 3:uo(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&uo(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[pt]=t,t.stateNode=r}return Ne(t),null;case 13:if(fe(me),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(de&&Ye!==null&&t.mode&1&&!(t.flags&128))hu(),Dn(),t.flags|=98560,i=!1;else if(i=yo(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Q(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Q(317));i[pt]=t}else Dn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ne(t),i=!1}else at!==null&&(os(at),at=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||me.current&1?xe===0&&(xe=3):ss())),t.updateQueue!==null&&(t.flags|=4),Ne(t),null);case 4:return Bn(),Ka(e,t),e===null&&vr(t.stateNode.containerInfo),Ne(t),null;case 10:return Ca(t.type._context),Ne(t),null;case 17:return He(t.type)&&ho(),Ne(t),null;case 19:if(fe(me),i=t.memoizedState,i===null)return Ne(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)Ar(i,!1);else{if(xe!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Oo(e),a!==null){for(t.flags|=128,Ar(i,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ue(me,me.current&1|2),t.child}e=e.sibling}i.tail!==null&&we()>Fn&&(t.flags|=128,r=!0,Ar(i,!1),t.lanes=4194304)}else{if(!r)if(e=Oo(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ar(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!de)return Ne(t),null}else 2*we()-i.renderingStartTime>Fn&&n!==1073741824&&(t.flags|=128,r=!0,Ar(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=we(),t.sibling=null,n=me.current,ue(me,r?n&1|2:n&1),t):(Ne(t),null);case 22:case 23:return as(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Xe&1073741824&&(Ne(t),t.subtreeFlags&6&&(t.flags|=8192)):Ne(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function eh(e,t){switch(ma(t),t.tag){case 1:return He(t.type)&&ho(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bn(),fe(ze),fe(Pe),Aa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ta(t),null;case 13:if(fe(me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Dn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fe(me),null;case 4:return Bn(),null;case 10:return Ca(t.type._context),null;case 22:case 23:return as(),null;case 24:return null;default:return null}}var No=!1,De=!1,th=typeof WeakSet=="function"?WeakSet:Set,q=null;function zn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ge(e,t,r)}else n.current=null}function Qa(e,t,n){try{n()}catch(r){ge(e,t,r)}}var fc=!1;function nh(e,t){if(aa=Zr,e=Gl(),Zi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch(w){n=null;break e}var a=0,m=-1,v=-1,S=0,T=0,R=e,C=null;t:for(;;){for(var O;R!==n||o!==0&&R.nodeType!==3||(m=a+o),R!==i||r!==0&&R.nodeType!==3||(v=a+r),R.nodeType===3&&(a+=R.nodeValue.length),(O=R.firstChild)!==null;)C=R,R=O;for(;;){if(R===e)break t;if(C===n&&++S===o&&(m=a),C===i&&++T===r&&(v=a),(O=R.nextSibling)!==null)break;R=C,C=R.parentNode}R=O}n=m===-1||v===-1?null:{start:m,end:v}}else n=null}n=n||{start:0,end:0}}else n=null;for(sa={focusedElem:e,selectionRange:n},Zr=!1,q=t;q!==null;)if(t=q,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;try{var f=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(f!==null){var E=f.memoizedProps,P=f.memoizedState,y=t.stateNode,d=y.getSnapshotBeforeUpdate(t.elementType===t.type?E:st(t.type,E),P);y.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(w){ge(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return f=fc,fc=!1,f}function Ir(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Qa(t,n,i)}o=o.next}while(o!==r)}}function Do(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ja(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function dc(e){var t=e.alternate;t!==null&&(e.alternate=null,dc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[pt],delete t[yr],delete t[fa],delete t[Bd],delete t[_d])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function hc(e){return e.tag===5||e.tag===3||e.tag===4}function pc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||hc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ya(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=co));else if(r!==4&&(e=e.child,e!==null))for(Ya(e,t,n),e=e.sibling;e!==null;)Ya(e,t,n),e=e.sibling}function Xa(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Xa(e,t,n),e=e.sibling;e!==null;)Xa(e,t,n),e=e.sibling}var Ae=null,lt=!1;function Vt(e,t,n){for(n=n.child;n!==null;)mc(e,t,n),n=n.sibling}function mc(e,t,n){if(ht&&typeof ht.onCommitFiberUnmount=="function")try{ht.onCommitFiberUnmount($r,n)}catch(m){}switch(n.tag){case 5:De||zn(n,t);case 6:var r=Ae,o=lt;Ae=null,Vt(e,t,n),Ae=r,lt=o,Ae!==null&&(lt?(e=Ae,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ae.removeChild(n.stateNode));break;case 18:Ae!==null&&(lt?(e=Ae,n=n.stateNode,e.nodeType===8?ca(e.parentNode,n):e.nodeType===1&&ca(e,n),sr(e)):ca(Ae,n.stateNode));break;case 4:r=Ae,o=lt,Ae=n.stateNode.containerInfo,lt=!0,Vt(e,t,n),Ae=r,lt=o;break;case 0:case 11:case 14:case 15:if(!De&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Qa(n,t,a),o=o.next}while(o!==r)}Vt(e,t,n);break;case 1:if(!De&&(zn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(m){ge(n,t,m)}Vt(e,t,n);break;case 21:Vt(e,t,n);break;case 22:n.mode&1?(De=(r=De)||n.memoizedState!==null,Vt(e,t,n),De=r):Vt(e,t,n);break;default:Vt(e,t,n)}}function vc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new th),t.forEach(function(r){var o=fh.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function ut(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,a=t,m=a;e:for(;m!==null;){switch(m.tag){case 5:Ae=m.stateNode,lt=!1;break e;case 3:Ae=m.stateNode.containerInfo,lt=!0;break e;case 4:Ae=m.stateNode.containerInfo,lt=!0;break e}m=m.return}if(Ae===null)throw Error(Q(160));mc(i,a,o),Ae=null,lt=!1;var v=o.alternate;v!==null&&(v.return=null),o.return=null}catch(S){ge(o,t,S)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)gc(t,e),t=t.sibling}function gc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ut(t,e),gt(e),r&4){try{Ir(3,e,e.return),Do(3,e)}catch(E){ge(e,e.return,E)}try{Ir(5,e,e.return)}catch(E){ge(e,e.return,E)}}break;case 1:ut(t,e),gt(e),r&512&&n!==null&&zn(n,n.return);break;case 5:if(ut(t,e),gt(e),r&512&&n!==null&&zn(n,n.return),e.flags&32){var o=e.stateNode;try{Yn(o,"")}catch(E){ge(e,e.return,E)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,m=e.type,v=e.updateQueue;if(e.updateQueue=null,v!==null)try{m==="input"&&i.type==="radio"&&i.name!=null&&Vs(o,i),Ai(m,a);var S=Ai(m,i);for(a=0;a<v.length;a+=2){var T=v[a],R=v[a+1];T==="style"?qs(o,R):T==="dangerouslySetInnerHTML"?Xs(o,R):T==="children"?Yn(o,R):fi(o,T,R,S)}switch(m){case"input":Ei(o,i);break;case"textarea":Qs(o,i);break;case"select":var C=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var O=i.value;O!=null?wn(o,!!i.multiple,O,!1):C!==!!i.multiple&&(i.defaultValue!=null?wn(o,!!i.multiple,i.defaultValue,!0):wn(o,!!i.multiple,i.multiple?[]:"",!1))}o[yr]=i}catch(E){ge(e,e.return,E)}}break;case 6:if(ut(t,e),gt(e),r&4){if(e.stateNode===null)throw Error(Q(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(E){ge(e,e.return,E)}}break;case 3:if(ut(t,e),gt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{sr(t.containerInfo)}catch(E){ge(e,e.return,E)}break;case 4:ut(t,e),gt(e);break;case 13:ut(t,e),gt(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(es=we())),r&4&&vc(e);break;case 22:if(T=n!==null&&n.memoizedState!==null,e.mode&1?(De=(S=De)||T,ut(t,e),De=S):ut(t,e),gt(e),r&8192){if(S=e.memoizedState!==null,(e.stateNode.isHidden=S)&&!T&&e.mode&1)for(q=e,T=e.child;T!==null;){for(R=q=T;q!==null;){switch(C=q,O=C.child,C.tag){case 0:case 11:case 14:case 15:Ir(4,C,C.return);break;case 1:zn(C,C.return);var f=C.stateNode;if(typeof f.componentWillUnmount=="function"){r=C,n=C.return;try{t=r,f.props=t.memoizedProps,f.state=t.memoizedState,f.componentWillUnmount()}catch(E){ge(r,n,E)}}break;case 5:zn(C,C.return);break;case 22:if(C.memoizedState!==null){Sc(R);continue}}O!==null?(O.return=C,q=O):Sc(R)}T=T.sibling}e:for(T=null,R=e;;){if(R.tag===5){if(T===null){T=R;try{o=R.stateNode,S?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(m=R.stateNode,v=R.memoizedProps.style,a=v!=null&&v.hasOwnProperty("display")?v.display:null,m.style.display=Zs("display",a))}catch(E){ge(e,e.return,E)}}}else if(R.tag===6){if(T===null)try{R.stateNode.nodeValue=S?"":R.memoizedProps}catch(E){ge(e,e.return,E)}}else if((R.tag!==22&&R.tag!==23||R.memoizedState===null||R===e)&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===e)break e;for(;R.sibling===null;){if(R.return===null||R.return===e)break e;T===R&&(T=null),R=R.return}T===R&&(T=null),R.sibling.return=R.return,R=R.sibling}}break;case 19:ut(t,e),gt(e),r&4&&vc(e);break;case 21:break;default:ut(t,e),gt(e)}}function gt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(hc(n)){var r=n;break e}n=n.return}throw Error(Q(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Yn(o,""),r.flags&=-33);var i=pc(e);Xa(e,i,o);break;case 3:case 4:var a=r.stateNode.containerInfo,m=pc(e);Ya(e,m,a);break;default:throw Error(Q(161))}}catch(v){ge(e,e.return,v)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function rh(e,t,n){q=e,yc(e)}function yc(e,t,n){for(var r=(e.mode&1)!==0;q!==null;){var o=q,i=o.child;if(o.tag===22&&r){var a=o.memoizedState!==null||No;if(!a){var m=o.alternate,v=m!==null&&m.memoizedState!==null||De;m=No;var S=De;if(No=a,(De=v)&&!S)for(q=o;q!==null;)a=q,v=a.child,a.tag===22&&a.memoizedState!==null?Cc(o):v!==null?(v.return=a,q=v):Cc(o);for(;i!==null;)q=i,yc(i),i=i.sibling;q=o,No=m,De=S}wc(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,q=i):wc(e)}}function wc(e){for(;q!==null;){var t=q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:De||Do(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!De)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:st(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Su(t,i,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Su(t,a,n)}break;case 5:var m=t.stateNode;if(n===null&&t.flags&4){n=m;var v=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":v.autoFocus&&n.focus();break;case"img":v.src&&(n.src=v.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var S=t.alternate;if(S!==null){var T=S.memoizedState;if(T!==null){var R=T.dehydrated;R!==null&&sr(R)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}De||t.flags&512&&Ja(t)}catch(C){ge(t,t.return,C)}}if(t===e){q=null;break}if(n=t.sibling,n!==null){n.return=t.return,q=n;break}q=t.return}}function Sc(e){for(;q!==null;){var t=q;if(t===e){q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,q=n;break}q=t.return}}function Cc(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Do(4,t)}catch(v){ge(t,n,v)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(v){ge(t,o,v)}}var i=t.return;try{Ja(t)}catch(v){ge(t,i,v)}break;case 5:var a=t.return;try{Ja(t)}catch(v){ge(t,a,v)}}}catch(v){ge(t,t.return,v)}if(t===e){q=null;break}var m=t.sibling;if(m!==null){m.return=t.return,q=m;break}q=t.return}}var oh=Math.ceil,Lo=Ct.ReactCurrentDispatcher,Za=Ct.ReactCurrentOwner,nt=Ct.ReactCurrentBatchConfig,ae=0,Te=null,Se=null,Ie=0,Xe=0,Hn=zt(0),xe=0,Mr=null,cn=0,jo=0,qa=0,Pr=null,Ge=null,es=0,Fn=1/0,It=null,Uo=!1,ts=null,$t=null,Bo=!1,Kt=null,_o=0,kr=0,ns=null,zo=-1,Ho=0;function Be(){return ae&6?we():zo!==-1?zo:zo=we()}function Qt(e){return e.mode&1?ae&2&&Ie!==0?Ie&-Ie:Hd.transition!==null?(Ho===0&&(Ho=pl()),Ho):(e=se,e!==0||(e=window.event,e=e===void 0?16:El(e.type)),e):1}function ct(e,t,n,r){if(50<kr)throw kr=0,ns=null,Error(Q(185));nr(e,n,r),(!(ae&2)||e!==Te)&&(e===Te&&(!(ae&2)&&(jo|=n),xe===4&&Jt(e,Ie)),We(e,r),n===1&&ae===0&&!(t.mode&1)&&(Fn=we()+500,mo&&Ft()))}function We(e,t){var n=e.callbackNode;Hf(e,t);var r=Jr(e,e===Te?Ie:0);if(r===0)n!==null&&fl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&fl(n),t===1)e.tag===0?zd(Ec.bind(null,e)):lu(Ec.bind(null,e)),jd(function(){!(ae&6)&&Ft()}),n=null;else{switch(ml(r)){case 1:n=Li;break;case 4:n=dl;break;case 16:n=Vr;break;case 536870912:n=hl;break;default:n=Vr}n=Pc(n,xc.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function xc(e,t){if(zo=-1,Ho=0,ae&6)throw Error(Q(327));var n=e.callbackNode;if(Gn()&&e.callbackNode!==n)return null;var r=Jr(e,e===Te?Ie:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Fo(e,r);else{t=r;var o=ae;ae|=2;var i=Rc();(Te!==e||Ie!==t)&&(It=null,Fn=we()+500,dn(e,t));do try{sh();break}catch(m){Oc(e,m)}while(!0);Sa(),Lo.current=i,ae=o,Se!==null?t=0:(Te=null,Ie=0,t=xe)}if(t!==0){if(t===2&&(o=ji(e),o!==0&&(r=o,t=rs(e,o))),t===1)throw n=Mr,dn(e,0),Jt(e,r),We(e,we()),n;if(t===6)Jt(e,r);else{if(o=e.current.alternate,!(r&30)&&!ih(o)&&(t=Fo(e,r),t===2&&(i=ji(e),i!==0&&(r=i,t=rs(e,i))),t===1))throw n=Mr,dn(e,0),Jt(e,r),We(e,we()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(Q(345));case 2:hn(e,Ge,It);break;case 3:if(Jt(e,r),(r&130023424)===r&&(t=es+500-we(),10<t)){if(Jr(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Be(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=ua(hn.bind(null,e,Ge,It),t);break}hn(e,Ge,It);break;case 4:if(Jt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var a=31-ot(r);i=1<<a,a=t[a],a>o&&(o=a),r&=~i}if(r=o,r=we()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*oh(r/1960))-r,10<r){e.timeoutHandle=ua(hn.bind(null,e,Ge,It),r);break}hn(e,Ge,It);break;case 5:hn(e,Ge,It);break;default:throw Error(Q(329))}}}return We(e,we()),e.callbackNode===n?xc.bind(null,e):null}function rs(e,t){var n=Pr;return e.current.memoizedState.isDehydrated&&(dn(e,t).flags|=256),e=Fo(e,t),e!==2&&(t=Ge,Ge=n,t!==null&&os(t)),e}function os(e){Ge===null?Ge=e:Ge.push.apply(Ge,e)}function ih(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!it(i(),o))return!1}catch(a){return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Jt(e,t){for(t&=~qa,t&=~jo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ot(t),r=1<<n;e[n]=-1,t&=~r}}function Ec(e){if(ae&6)throw Error(Q(327));Gn();var t=Jr(e,0);if(!(t&1))return We(e,we()),null;var n=Fo(e,t);if(e.tag!==0&&n===2){var r=ji(e);r!==0&&(t=r,n=rs(e,r))}if(n===1)throw n=Mr,dn(e,0),Jt(e,t),We(e,we()),n;if(n===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,hn(e,Ge,It),We(e,we()),null}function is(e,t){var n=ae;ae|=1;try{return e(t)}finally{ae=n,ae===0&&(Fn=we()+500,mo&&Ft())}}function fn(e){Kt!==null&&Kt.tag===0&&!(ae&6)&&Gn();var t=ae;ae|=1;var n=nt.transition,r=se;try{if(nt.transition=null,se=1,e)return e()}finally{se=r,nt.transition=n,ae=t,!(ae&6)&&Ft()}}function as(){Xe=Hn.current,fe(Hn)}function dn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Ld(n)),Se!==null)for(n=Se.return;n!==null;){var r=n;switch(ma(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ho();break;case 3:Bn(),fe(ze),fe(Pe),Aa();break;case 5:Ta(r);break;case 4:Bn();break;case 13:fe(me);break;case 19:fe(me);break;case 10:Ca(r.type._context);break;case 22:case 23:as()}n=n.return}if(Te=e,Se=e=Yt(e.current,null),Ie=Xe=t,xe=0,Mr=null,qa=jo=cn=0,Ge=Pr=null,sn!==null){for(t=0;t<sn.length;t++)if(n=sn[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var a=i.next;i.next=o,r.next=a}n.pending=r}sn=null}return e}function Oc(e,t){do{var n=Se;try{if(Sa(),Ro.current=Io,To){for(var r=ve.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}To=!1}if(un=0,Re=Ce=ve=null,Or=!1,Rr=0,Za.current=null,n===null||n.return===null){xe=1,Mr=t,Se=null;break}e:{var i=e,a=n.return,m=n,v=t;if(t=Ie,m.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){var S=v,T=m,R=T.tag;if(!(T.mode&1)&&(R===0||R===11||R===15)){var C=T.alternate;C?(T.updateQueue=C.updateQueue,T.memoizedState=C.memoizedState,T.lanes=C.lanes):(T.updateQueue=null,T.memoizedState=null)}var O=Ju(a);if(O!==null){O.flags&=-257,Yu(O,a,m,i,t),O.mode&1&&Qu(i,S,t),t=O,v=S;var f=t.updateQueue;if(f===null){var E=new Set;E.add(v),t.updateQueue=E}else f.add(v);break e}else{if(!(t&1)){Qu(i,S,t),ss();break e}v=Error(Q(426))}}else if(de&&m.mode&1){var P=Ju(a);if(P!==null){!(P.flags&65536)&&(P.flags|=256),Yu(P,a,m,i,t),ya(_n(v,m));break e}}i=v=_n(v,m),xe!==4&&(xe=2),Pr===null?Pr=[i]:Pr.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=$u(i,v,t);wu(i,y);break e;case 1:m=v;var d=i.type,h=i.stateNode;if(!(i.flags&128)&&(typeof d.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&($t===null||!$t.has(h)))){i.flags|=65536,t&=-t,i.lanes|=t;var w=Ku(i,m,t);wu(i,w);break e}}i=i.return}while(i!==null)}bc(n)}catch(c){t=c,Se===n&&n!==null&&(Se=n=n.return);continue}break}while(!0)}function Rc(){var e=Lo.current;return Lo.current=Io,e===null?Io:e}function ss(){(xe===0||xe===3||xe===2)&&(xe=4),Te===null||!(cn&268435455)&&!(jo&268435455)||Jt(Te,Ie)}function Fo(e,t){var n=ae;ae|=2;var r=Rc();(Te!==e||Ie!==t)&&(It=null,dn(e,t));do try{ah();break}catch(o){Oc(e,o)}while(!0);if(Sa(),ae=n,Lo.current=r,Se!==null)throw Error(Q(261));return Te=null,Ie=0,xe}function ah(){for(;Se!==null;)Tc(Se)}function sh(){for(;Se!==null&&!kf();)Tc(Se)}function Tc(e){var t=Mc(e.alternate,e,Xe);e.memoizedProps=e.pendingProps,t===null?bc(e):Se=t,Za.current=null}function bc(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=eh(n,t),n!==null){n.flags&=32767,Se=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{xe=6,Se=null;return}}else if(n=qd(n,t,Xe),n!==null){Se=n;return}if(t=t.sibling,t!==null){Se=t;return}Se=t=e}while(t!==null);xe===0&&(xe=5)}function hn(e,t,n){var r=se,o=nt.transition;try{nt.transition=null,se=1,lh(e,t,n,r)}finally{nt.transition=o,se=r}return null}function lh(e,t,n,r){do Gn();while(Kt!==null);if(ae&6)throw Error(Q(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Q(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Ff(e,i),e===Te&&(Se=Te=null,Ie=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Bo||(Bo=!0,Pc(Vr,function(){return Gn(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=nt.transition,nt.transition=null;var a=se;se=1;var m=ae;ae|=4,Za.current=null,nh(e,n),gc(n,e),Ad(sa),Zr=!!aa,sa=aa=null,e.current=n,rh(n),Nf(),ae=m,se=a,nt.transition=i}else e.current=n;if(Bo&&(Bo=!1,Kt=e,_o=o),i=e.pendingLanes,i===0&&($t=null),jf(n.stateNode),We(e,we()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(Uo)throw Uo=!1,e=ts,ts=null,e;return _o&1&&e.tag!==0&&Gn(),i=e.pendingLanes,i&1?e===ns?kr++:(kr=0,ns=e):kr=0,Ft(),null}function Gn(){if(Kt!==null){var e=ml(_o),t=nt.transition,n=se;try{if(nt.transition=null,se=16>e?16:e,Kt===null)var r=!1;else{if(e=Kt,Kt=null,_o=0,ae&6)throw Error(Q(331));var o=ae;for(ae|=4,q=e.current;q!==null;){var i=q,a=i.child;if(q.flags&16){var m=i.deletions;if(m!==null){for(var v=0;v<m.length;v++){var S=m[v];for(q=S;q!==null;){var T=q;switch(T.tag){case 0:case 11:case 15:Ir(8,T,i)}var R=T.child;if(R!==null)R.return=T,q=R;else for(;q!==null;){T=q;var C=T.sibling,O=T.return;if(dc(T),T===S){q=null;break}if(C!==null){C.return=O,q=C;break}q=O}}}var f=i.alternate;if(f!==null){var E=f.child;if(E!==null){f.child=null;do{var P=E.sibling;E.sibling=null,E=P}while(E!==null)}}q=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,q=a;else e:for(;q!==null;){if(i=q,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Ir(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,q=y;break e}q=i.return}}var d=e.current;for(q=d;q!==null;){a=q;var h=a.child;if(a.subtreeFlags&2064&&h!==null)h.return=a,q=h;else e:for(a=d;q!==null;){if(m=q,m.flags&2048)try{switch(m.tag){case 0:case 11:case 15:Do(9,m)}}catch(c){ge(m,m.return,c)}if(m===a){q=null;break e}var w=m.sibling;if(w!==null){w.return=m.return,q=w;break e}q=m.return}}if(ae=o,Ft(),ht&&typeof ht.onPostCommitFiberRoot=="function")try{ht.onPostCommitFiberRoot($r,e)}catch(c){}r=!0}return r}finally{se=n,nt.transition=t}}return!1}function Ac(e,t,n){t=_n(n,t),t=$u(e,t,1),e=Wt(e,t,1),t=Be(),e!==null&&(nr(e,1,t),We(e,t))}function ge(e,t,n){if(e.tag===3)Ac(e,e,n);else for(;t!==null;){if(t.tag===3){Ac(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&($t===null||!$t.has(r))){e=_n(n,e),e=Ku(t,e,1),t=Wt(t,e,1),e=Be(),t!==null&&(nr(t,1,e),We(t,e));break}}t=t.return}}function uh(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Be(),e.pingedLanes|=e.suspendedLanes&n,Te===e&&(Ie&n)===n&&(xe===4||xe===3&&(Ie&130023424)===Ie&&500>we()-es?dn(e,0):qa|=n),We(e,t)}function Ic(e,t){t===0&&(e.mode&1?(t=Qr,Qr<<=1,!(Qr&130023424)&&(Qr=4194304)):t=1);var n=Be();e=Tt(e,t),e!==null&&(nr(e,t,n),We(e,n))}function ch(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ic(e,n)}function fh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Q(314))}r!==null&&r.delete(t),Ic(e,n)}var Mc;Mc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ze.current)Fe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Fe=!1,Zd(e,t,n);Fe=!!(e.flags&131072)}else Fe=!1,de&&t.flags&1048576&&uu(t,go,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ko(e,t),e=t.pendingProps;var o=Pn(t,Pe.current);Un(t,n),o=Pa(null,t,r,e,o,n);var i=ka();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,He(r)?(i=!0,po(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Oa(t),o.updater=Mo,t.stateNode=o,o._reactInternals=t,Ba(t,r,e,n),t=Fa(null,t,r,!0,i,n)):(t.tag=0,de&&i&&pa(t),Ue(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ko(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=hh(r),e=st(r,e),o){case 0:t=Ha(null,t,r,e,n);break e;case 1:t=nc(null,t,r,e,n);break e;case 11:t=Xu(null,t,r,e,n);break e;case 14:t=Zu(null,t,r,st(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),Ha(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),nc(e,t,r,o,n);case 3:e:{if(rc(t),e===null)throw Error(Q(387));r=t.pendingProps,i=t.memoizedState,o=i.element,yu(e,t),Eo(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=_n(Error(Q(423)),t),t=oc(e,t,r,n,o);break e}else if(r!==o){o=_n(Error(Q(424)),t),t=oc(e,t,r,n,o);break e}else for(Ye=_t(t.stateNode.containerInfo.firstChild),Je=t,de=!0,at=null,n=vu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Dn(),r===o){t=At(e,t,n);break e}Ue(e,t,r,n)}t=t.child}return t;case 5:return Cu(t),e===null&&ga(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,a=o.children,la(r,o)?a=null:i!==null&&la(r,i)&&(t.flags|=32),tc(e,t),Ue(e,t,a,n),t.child;case 6:return e===null&&ga(t),null;case 13:return ic(e,t,n);case 4:return Ra(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ln(t,null,r,n):Ue(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),Xu(e,t,r,o,n);case 7:return Ue(e,t,t.pendingProps,n),t.child;case 8:return Ue(e,t,t.pendingProps.children,n),t.child;case 12:return Ue(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,a=o.value,ue(So,r._currentValue),r._currentValue=a,i!==null)if(it(i.value,a)){if(i.children===o.children&&!ze.current){t=At(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var m=i.dependencies;if(m!==null){a=i.child;for(var v=m.firstContext;v!==null;){if(v.context===r){if(i.tag===1){v=bt(-1,n&-n),v.tag=2;var S=i.updateQueue;if(S!==null){S=S.shared;var T=S.pending;T===null?v.next=v:(v.next=T.next,T.next=v),S.pending=v}}i.lanes|=n,v=i.alternate,v!==null&&(v.lanes|=n),xa(i.return,n,t),m.lanes|=n;break}v=v.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Q(341));a.lanes|=n,m=a.alternate,m!==null&&(m.lanes|=n),xa(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Ue(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Un(t,n),o=et(o),r=r(o),t.flags|=1,Ue(e,t,r,n),t.child;case 14:return r=t.type,o=st(r,t.pendingProps),o=st(r.type,o),Zu(e,t,r,o,n);case 15:return qu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),ko(e,t),t.tag=1,He(r)?(e=!0,po(t)):e=!1,Un(t,n),Wu(t,r,o),Ba(t,r,o,n),Fa(null,t,r,!0,e,n);case 19:return sc(e,t,n);case 22:return ec(e,t,n)}throw Error(Q(156,t.tag))};function Pc(e,t){return cl(e,t)}function dh(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rt(e,t,n,r){return new dh(e,t,n,r)}function ls(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hh(e){if(typeof e=="function")return ls(e)?1:0;if(e!=null){if(e=e.$$typeof,e===pi)return 11;if(e===gi)return 14}return 2}function Yt(e,t){var n=e.alternate;return n===null?(n=rt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Go(e,t,n,r,o,i){var a=2;if(r=e,typeof e=="function")ls(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case yn:return pn(n.children,o,i,t);case di:a=8,o|=8;break;case hi:return e=rt(12,n,t,o|2),e.elementType=hi,e.lanes=i,e;case mi:return e=rt(13,n,t,o),e.elementType=mi,e.lanes=i,e;case vi:return e=rt(19,n,t,o),e.elementType=vi,e.lanes=i,e;case zs:return Wo(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Bs:a=10;break e;case _s:a=9;break e;case pi:a=11;break e;case gi:a=14;break e;case Pt:a=16,r=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=rt(a,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function pn(e,t,n,r){return e=rt(7,e,r,t),e.lanes=n,e}function Wo(e,t,n,r){return e=rt(22,e,r,t),e.elementType=zs,e.lanes=n,e.stateNode={isHidden:!1},e}function us(e,t,n){return e=rt(6,e,null,t),e.lanes=n,e}function cs(e,t,n){return t=rt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ph(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ui(0),this.expirationTimes=Ui(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ui(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function fs(e,t,n,r,o,i,a,m,v){return e=new ph(e,t,n,m,v),t===1?(t=1,i===!0&&(t|=8)):t=0,i=rt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Oa(i),e}function mh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:gn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function kc(e){if(!e)return Ht;e=e._reactInternals;e:{if(tn(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(He(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var n=e.type;if(He(n))return au(e,n,t)}return t}function Nc(e,t,n,r,o,i,a,m,v){return e=fs(n,r,!0,e,o,i,a,m,v),e.context=kc(null),n=e.current,r=Be(),o=Qt(n),i=bt(r,o),i.callback=t!=null?t:null,Wt(n,i,o),e.current.lanes=o,nr(e,o,r),We(e,r),e}function Vo(e,t,n,r){var o=t.current,i=Be(),a=Qt(o);return n=kc(n),t.context===null?t.context=n:t.pendingContext=n,t=bt(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Wt(o,t,a),e!==null&&(ct(e,o,a,i),xo(e,o,a)),a}function $o(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Dc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ds(e,t){Dc(e,t),(e=e.alternate)&&Dc(e,t)}function vh(){return null}var Lc=typeof reportError=="function"?reportError:function(e){console.error(e)};function hs(e){this._internalRoot=e}Ko.prototype.render=hs.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));Vo(e,t,null,null)},Ko.prototype.unmount=hs.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fn(function(){Vo(null,e,null,null)}),t[xt]=null}};function Ko(e){this._internalRoot=e}Ko.prototype.unstable_scheduleHydration=function(e){if(e){var t=yl();e={blockedOn:null,target:e,priority:t};for(var n=0;n<jt.length&&t!==0&&t<jt[n].priority;n++);jt.splice(n,0,e),n===0&&Cl(e)}};function ps(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Qo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function jc(){}function gh(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var S=$o(a);i.call(S)}}var a=Nc(t,r,e,0,null,!1,!1,"",jc);return e._reactRootContainer=a,e[xt]=a.current,vr(e.nodeType===8?e.parentNode:e),fn(),a}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var m=r;r=function(){var S=$o(v);m.call(S)}}var v=fs(e,0,!1,null,null,!1,!1,"",jc);return e._reactRootContainer=v,e[xt]=v.current,vr(e.nodeType===8?e.parentNode:e),fn(function(){Vo(t,v,n,r)}),v}function Jo(e,t,n,r,o){var i=n._reactRootContainer;if(i){var a=i;if(typeof o=="function"){var m=o;o=function(){var v=$o(a);m.call(v)}}Vo(t,a,e,o)}else a=gh(n,t,e,o,r);return $o(a)}vl=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=tr(t.pendingLanes);n!==0&&(Bi(t,n|1),We(t,we()),!(ae&6)&&(Fn=we()+500,Ft()))}break;case 13:fn(function(){var r=Tt(e,1);if(r!==null){var o=Be();ct(r,e,1,o)}}),ds(e,1)}},_i=function(e){if(e.tag===13){var t=Tt(e,134217728);if(t!==null){var n=Be();ct(t,e,134217728,n)}ds(e,134217728)}},gl=function(e){if(e.tag===13){var t=Qt(e),n=Tt(e,t);if(n!==null){var r=Be();ct(n,e,t,r)}ds(e,t)}},yl=function(){return se},wl=function(e,t){var n=se;try{return se=e,t()}finally{se=n}},Pi=function(e,t,n){switch(t){case"input":if(Ei(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=fo(r);if(!o)throw Error(Q(90));Gs(r),Ei(r,o)}}}break;case"textarea":Qs(e,n);break;case"select":t=n.value,t!=null&&wn(e,!!n.multiple,t,!1)}},rl=is,ol=fn;var yh={usingClientEntryPoint:!1,Events:[wr,In,fo,tl,nl,is]},Nr={findFiberByHostInstance:nn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},wh={bundleType:Nr.bundleType,version:Nr.version,rendererPackageName:Nr.rendererPackageName,rendererConfig:Nr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ct.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ll(e),e===null?null:e.stateNode},findFiberByHostInstance:Nr.findFiberByHostInstance||vh,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yo.isDisabled&&Yo.supportsFiber)try{$r=Yo.inject(wh),ht=Yo}catch(e){}}$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yh,$e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ps(t))throw Error(Q(200));return mh(e,t,null,n)},$e.createRoot=function(e,t){if(!ps(e))throw Error(Q(299));var n=!1,r="",o=Lc;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=fs(e,1,!1,null,null,n,!1,r,o),e[xt]=t.current,vr(e.nodeType===8?e.parentNode:e),new hs(t)},$e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=ll(t),e=e===null?null:e.stateNode,e},$e.flushSync=function(e){return fn(e)},$e.hydrate=function(e,t,n){if(!Qo(t))throw Error(Q(200));return Jo(null,e,t,!0,n)},$e.hydrateRoot=function(e,t,n){if(!ps(e))throw Error(Q(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",a=Lc;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=Nc(t,null,e,1,n!=null?n:null,o,!1,i,a),e[xt]=t.current,vr(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Ko(t)},$e.render=function(e,t,n){if(!Qo(t))throw Error(Q(200));return Jo(null,e,t,!1,n)},$e.unmountComponentAtNode=function(e){if(!Qo(e))throw Error(Q(40));return e._reactRootContainer?(fn(function(){Jo(null,null,e,!1,function(){e._reactRootContainer=null,e[xt]=null})}),!0):!1},$e.unstable_batchedUpdates=is,$e.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Qo(n))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return Jo(e,t,n,!1,r)},$e.version="18.3.1-next-f1338f8080-20240426";function Uc(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Uc)}catch(e){console.error(e)}}Uc(),ks.exports=$e;var Sh=ks.exports,Bc,_c=Sh;Bc=_c.createRoot,_c.hydrateRoot;var zc={exports:{}},Xo={};/**
32
+ `+i.stack}return{value:e,source:t,stack:o,digest:null}}function za(e,t,n){return{value:e,source:null,stack:n!=null?n:null,digest:t!=null?t:null}}function Ha(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Xd=typeof WeakMap=="function"?WeakMap:Map;function Ku(e,t,n){n=bt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Bo||(Bo=!0,ns=r),Ha(e,t)},n}function Qu(e,t,n){n=bt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Ha(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ha(e,t),typeof r!="function"&&($t===null?$t=new Set([this]):$t.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Ju(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Xd;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=fh.bind(null,e,t,n),t.then(e,e))}function Yu(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Xu(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=bt(-1,1),t.tag=2,Wt(n,t,1))),n.lanes|=1),e)}var Zd=Ct.ReactCurrentOwner,Fe=!1;function Ue(e,t,n,r){t.child=e===null?gu(t,null,n,r):Ln(t,e.child,n,r)}function Zu(e,t,n,r,o){n=n.render;var i=t.ref;return Un(t,o),r=ka(e,t,n,r,i,o),n=Na(),e!==null&&!Fe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,At(e,t,o)):(de&&n&&ma(t),t.flags|=1,Ue(e,t,r,o),t.child)}function qu(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!us(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,ec(e,t,i,r,o)):(e=Wo(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:hr,n(a,r)&&e.ref===t.ref)return At(e,t,o)}return t.flags|=1,e=Yt(i,r),e.ref=t.ref,e.return=t,t.child=e}function ec(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(hr(i,r)&&e.ref===t.ref)if(Fe=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Fe=!0);else return t.lanes=e.lanes,At(e,t,o)}return Fa(e,t,n,r,o)}function tc(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ue(Hn,Xe),Xe|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ue(Hn,Xe),Xe|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ue(Hn,Xe),Xe|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ue(Hn,Xe),Xe|=r;return Ue(e,t,o,n),t.child}function nc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Fa(e,t,n,r,o){var i=He(n)?rn:Pe.current;return i=Pn(t,i),Un(t,o),n=ka(e,t,n,r,i,o),r=Na(),e!==null&&!Fe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,At(e,t,o)):(de&&r&&ma(t),t.flags|=1,Ue(e,t,n,o),t.child)}function rc(e,t,n,r,o){if(He(n)){var i=!0;mo(t)}else i=!1;if(Un(t,o),t.stateNode===null)No(e,t),Vu(t,n,r),_a(t,n,r,o),r=!0;else if(e===null){var a=t.stateNode,m=t.memoizedProps;a.props=m;var v=a.context,S=n.contextType;typeof S=="object"&&S!==null?S=et(S):(S=He(n)?rn:Pe.current,S=Pn(t,S));var T=n.getDerivedStateFromProps,R=typeof T=="function"||typeof a.getSnapshotBeforeUpdate=="function";R||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(m!==r||v!==S)&&$u(t,a,r,S),Gt=!1;var C=t.memoizedState;a.state=C,Oo(t,r,a,o),v=t.memoizedState,m!==r||C!==v||ze.current||Gt?(typeof T=="function"&&(Ba(t,n,T,r),v=t.memoizedState),(m=Gt||Wu(t,n,m,r,C,v,S))?(R||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=v),a.props=r,a.state=v,a.context=S,r=m):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,wu(e,t),m=t.memoizedProps,S=t.type===t.elementType?m:st(t.type,m),a.props=S,R=t.pendingProps,C=a.context,v=n.contextType,typeof v=="object"&&v!==null?v=et(v):(v=He(n)?rn:Pe.current,v=Pn(t,v));var O=n.getDerivedStateFromProps;(T=typeof O=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(m!==R||C!==v)&&$u(t,a,r,v),Gt=!1,C=t.memoizedState,a.state=C,Oo(t,r,a,o);var f=t.memoizedState;m!==R||C!==f||ze.current||Gt?(typeof O=="function"&&(Ba(t,n,O,r),f=t.memoizedState),(S=Gt||Wu(t,n,S,r,C,f,v)||!1)?(T||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,f,v),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,f,v)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||m===e.memoizedProps&&C===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&C===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),a.props=r,a.state=f,a.context=v,r=S):(typeof a.componentDidUpdate!="function"||m===e.memoizedProps&&C===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&C===e.memoizedState||(t.flags|=1024),r=!1)}return Ga(e,t,n,r,i,o)}function Ga(e,t,n,r,o,i){nc(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return o&&lu(t,n,!1),At(e,t,i);r=t.stateNode,Zd.current=t;var m=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Ln(t,e.child,null,i),t.child=Ln(t,null,m,i)):Ue(e,t,m,i),t.memoizedState=r.state,o&&lu(t,n,!0),t.child}function oc(e){var t=e.stateNode;t.pendingContext?au(e,t.pendingContext,t.pendingContext!==t.context):t.context&&au(e,t.context,!1),Ta(e,t.containerInfo)}function ic(e,t,n,r,o){return Dn(),wa(o),t.flags|=256,Ue(e,t,n,r),t.child}var Wa={dehydrated:null,treeContext:null,retryLane:0};function Va(e){return{baseLanes:e,cachePool:null,transitions:null}}function ac(e,t,n){var r=t.pendingProps,o=me.current,i=!1,a=(t.flags&128)!==0,m;if((m=a)||(m=e!==null&&e.memoizedState===null?!1:(o&2)!==0),m?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),ue(me,o&1),e===null)return ya(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=Vo(a,r,0,null),e=pn(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Va(n),t.memoizedState=Wa,e):$a(t,a));if(o=e.memoizedState,o!==null&&(m=o.dehydrated,m!==null))return qd(e,t,a,r,m,o,n);if(i){i=r.fallback,a=t.mode,o=e.child,m=o.sibling;var v={mode:"hidden",children:r.children};return!(a&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=v,t.deletions=null):(r=Yt(o,v),r.subtreeFlags=o.subtreeFlags&14680064),m!==null?i=Yt(m,i):(i=pn(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?Va(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=Wa,r}return i=e.child,e=i.sibling,r=Yt(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function $a(e,t){return t=Vo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ko(e,t,n,r){return r!==null&&wa(r),Ln(t,e.child,null,n),e=$a(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qd(e,t,n,r,o,i,a){if(n)return t.flags&256?(t.flags&=-257,r=za(Error(Q(422))),ko(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=Vo({mode:"visible",children:r.children},o,0,null),i=pn(i,o,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Ln(t,e.child,null,a),t.child.memoizedState=Va(a),t.memoizedState=Wa,i);if(!(t.mode&1))return ko(e,t,a,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var m=r.dgst;return r=m,i=Error(Q(419)),r=za(i,r,void 0),ko(e,t,a,r)}if(m=(a&e.childLanes)!==0,Fe||m){if(r=Te,r!==null){switch(a&-a){case 4:o=2;break;case 16:o=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|a)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Tt(e,o),ct(r,e,o,-1))}return ls(),r=za(Error(Q(421))),ko(e,t,a,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=dh.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Ye=_t(o.nextSibling),Je=t,de=!0,at=null,e!==null&&(Ze[qe++]=Ot,Ze[qe++]=Rt,Ze[qe++]=on,Ot=e.id,Rt=e.overflow,on=t),t=$a(t,r.children),t.flags|=4096,t)}function sc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ea(e.return,t,n)}function Ka(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function lc(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Ue(e,t,r.children,n),r=me.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sc(e,n,t);else if(e.tag===19)sc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ue(me,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Ro(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Ka(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Ro(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Ka(t,!0,n,null,i);break;case"together":Ka(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function No(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function At(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),cn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,n=Yt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function eh(e,t,n){switch(t.tag){case 3:oc(t),Dn();break;case 5:xu(t);break;case 1:He(t.type)&&mo(t);break;case 4:Ta(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;ue(Co,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ue(me,me.current&1),t.flags|=128,null):n&t.child.childLanes?ac(e,t,n):(ue(me,me.current&1),e=At(e,t,n),e!==null?e.sibling:null);ue(me,me.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return lc(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),ue(me,me.current),r)break;return null;case 22:case 23:return t.lanes=0,tc(e,t,n)}return At(e,t,n)}var uc,Qa,cc,fc;uc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Qa=function(){},cc=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,ln(mt.current);var i=null;switch(n){case"input":o=Ei(e,o),r=Ei(e,r),i=[];break;case"select":o=pe({},o,{value:void 0}),r=pe({},r,{value:void 0}),i=[];break;case"textarea":o=Ti(e,o),r=Ti(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=fo)}Ai(n,r);var a;n=null;for(S in o)if(!r.hasOwnProperty(S)&&o.hasOwnProperty(S)&&o[S]!=null)if(S==="style"){var m=o[S];for(a in m)m.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else S!=="dangerouslySetInnerHTML"&&S!=="children"&&S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&($n.hasOwnProperty(S)?i||(i=[]):(i=i||[]).push(S,null));for(S in r){var v=r[S];if(m=o!=null?o[S]:void 0,r.hasOwnProperty(S)&&v!==m&&(v!=null||m!=null))if(S==="style")if(m){for(a in m)!m.hasOwnProperty(a)||v&&v.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in v)v.hasOwnProperty(a)&&m[a]!==v[a]&&(n||(n={}),n[a]=v[a])}else n||(i||(i=[]),i.push(S,n)),n=v;else S==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,m=m?m.__html:void 0,v!=null&&m!==v&&(i=i||[]).push(S,v)):S==="children"?typeof v!="string"&&typeof v!="number"||(i=i||[]).push(S,""+v):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&($n.hasOwnProperty(S)?(v!=null&&S==="onScroll"&&ce("scroll",e),i||m===v||(i=[])):(i=i||[]).push(S,v))}n&&(i=i||[]).push("style",n);var S=i;(t.updateQueue=S)&&(t.flags|=4)}},fc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ar(e,t){if(!de)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ne(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function th(e,t,n){var r=t.pendingProps;switch(va(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ne(t),null;case 1:return He(t.type)&&po(),Ne(t),null;case 3:return r=t.stateNode,Bn(),fe(ze),fe(Pe),Ia(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(wo(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,at!==null&&(is(at),at=null))),Qa(e,t),Ne(t),null;case 5:ba(t);var o=ln(Er.current);if(n=t.type,e!==null&&t.stateNode!=null)cc(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Q(166));return Ne(t),null}if(e=ln(mt.current),wo(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[pt]=t,r[yr]=i,e=(t.mode&1)!==0,n){case"dialog":ce("cancel",r),ce("close",r);break;case"iframe":case"object":case"embed":ce("load",r);break;case"video":case"audio":for(o=0;o<mr.length;o++)ce(mr[o],r);break;case"source":ce("error",r);break;case"img":case"image":case"link":ce("error",r),ce("load",r);break;case"details":ce("toggle",r);break;case"input":Vs(r,i),ce("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ce("invalid",r);break;case"textarea":Qs(r,i),ce("invalid",r)}Ai(n,i),o=null;for(var a in i)if(i.hasOwnProperty(a)){var m=i[a];a==="children"?typeof m=="string"?r.textContent!==m&&(i.suppressHydrationWarning!==!0&&co(r.textContent,m,e),o=["children",m]):typeof m=="number"&&r.textContent!==""+m&&(i.suppressHydrationWarning!==!0&&co(r.textContent,m,e),o=["children",""+m]):$n.hasOwnProperty(a)&&m!=null&&a==="onScroll"&&ce("scroll",r)}switch(n){case"input":Hr(r),Ks(r,i,!0);break;case"textarea":Hr(r),Ys(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=fo)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Xs(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[pt]=t,e[yr]=r,uc(e,t,!1,!1),t.stateNode=e;e:{switch(a=Ii(n,r),n){case"dialog":ce("cancel",e),ce("close",e),o=r;break;case"iframe":case"object":case"embed":ce("load",e),o=r;break;case"video":case"audio":for(o=0;o<mr.length;o++)ce(mr[o],e);o=r;break;case"source":ce("error",e),o=r;break;case"img":case"image":case"link":ce("error",e),ce("load",e),o=r;break;case"details":ce("toggle",e),o=r;break;case"input":Vs(e,r),o=Ei(e,r),ce("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=pe({},r,{value:void 0}),ce("invalid",e);break;case"textarea":Qs(e,r),o=Ti(e,r),ce("invalid",e);break;default:o=r}Ai(n,o),m=o;for(i in m)if(m.hasOwnProperty(i)){var v=m[i];i==="style"?el(e,v):i==="dangerouslySetInnerHTML"?(v=v?v.__html:void 0,v!=null&&Zs(e,v)):i==="children"?typeof v=="string"?(n!=="textarea"||v!=="")&&Yn(e,v):typeof v=="number"&&Yn(e,""+v):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&($n.hasOwnProperty(i)?v!=null&&i==="onScroll"&&ce("scroll",e):v!=null&&di(e,i,v,a))}switch(n){case"input":Hr(e),Ks(e,r,!1);break;case"textarea":Hr(e),Ys(e);break;case"option":r.value!=null&&e.setAttribute("value",""+kt(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?wn(e,!!r.multiple,i,!1):r.defaultValue!=null&&wn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=fo)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ne(t),null;case 6:if(e&&t.stateNode!=null)fc(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Q(166));if(n=ln(Er.current),ln(mt.current),wo(t)){if(r=t.stateNode,n=t.memoizedProps,r[pt]=t,(i=r.nodeValue!==n)&&(e=Je,e!==null))switch(e.tag){case 3:co(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&co(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[pt]=t,t.stateNode=r}return Ne(t),null;case 13:if(fe(me),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(de&&Ye!==null&&t.mode&1&&!(t.flags&128))pu(),Dn(),t.flags|=98560,i=!1;else if(i=wo(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Q(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Q(317));i[pt]=t}else Dn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ne(t),i=!1}else at!==null&&(is(at),at=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||me.current&1?xe===0&&(xe=3):ls())),t.updateQueue!==null&&(t.flags|=4),Ne(t),null);case 4:return Bn(),Qa(e,t),e===null&&vr(t.stateNode.containerInfo),Ne(t),null;case 10:return xa(t.type._context),Ne(t),null;case 17:return He(t.type)&&po(),Ne(t),null;case 19:if(fe(me),i=t.memoizedState,i===null)return Ne(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)Ar(i,!1);else{if(xe!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ro(e),a!==null){for(t.flags|=128,Ar(i,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ue(me,me.current&1|2),t.child}e=e.sibling}i.tail!==null&&we()>Fn&&(t.flags|=128,r=!0,Ar(i,!1),t.lanes=4194304)}else{if(!r)if(e=Ro(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ar(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!de)return Ne(t),null}else 2*we()-i.renderingStartTime>Fn&&n!==1073741824&&(t.flags|=128,r=!0,Ar(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=we(),t.sibling=null,n=me.current,ue(me,r?n&1|2:n&1),t):(Ne(t),null);case 22:case 23:return ss(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Xe&1073741824&&(Ne(t),t.subtreeFlags&6&&(t.flags|=8192)):Ne(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function nh(e,t){switch(va(t),t.tag){case 1:return He(t.type)&&po(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bn(),fe(ze),fe(Pe),Ia(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ba(t),null;case 13:if(fe(me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Dn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fe(me),null;case 4:return Bn(),null;case 10:return xa(t.type._context),null;case 22:case 23:return ss(),null;case 24:return null;default:return null}}var Do=!1,De=!1,rh=typeof WeakSet=="function"?WeakSet:Set,q=null;function zn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ge(e,t,r)}else n.current=null}function Ja(e,t,n){try{n()}catch(r){ge(e,t,r)}}var dc=!1;function oh(e,t){if(sa=qr,e=Wl(),qi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch(w){n=null;break e}var a=0,m=-1,v=-1,S=0,T=0,R=e,C=null;t:for(;;){for(var O;R!==n||o!==0&&R.nodeType!==3||(m=a+o),R!==i||r!==0&&R.nodeType!==3||(v=a+r),R.nodeType===3&&(a+=R.nodeValue.length),(O=R.firstChild)!==null;)C=R,R=O;for(;;){if(R===e)break t;if(C===n&&++S===o&&(m=a),C===i&&++T===r&&(v=a),(O=R.nextSibling)!==null)break;R=C,C=R.parentNode}R=O}n=m===-1||v===-1?null:{start:m,end:v}}else n=null}n=n||{start:0,end:0}}else n=null;for(la={focusedElem:e,selectionRange:n},qr=!1,q=t;q!==null;)if(t=q,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;try{var f=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(f!==null){var E=f.memoizedProps,P=f.memoizedState,y=t.stateNode,d=y.getSnapshotBeforeUpdate(t.elementType===t.type?E:st(t.type,E),P);y.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(w){ge(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return f=dc,dc=!1,f}function Ir(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Ja(t,n,i)}o=o.next}while(o!==r)}}function Lo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ya(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function hc(e){var t=e.alternate;t!==null&&(e.alternate=null,hc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[pt],delete t[yr],delete t[da],delete t[zd],delete t[Hd])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function pc(e){return e.tag===5||e.tag===3||e.tag===4}function mc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||pc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xa(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=fo));else if(r!==4&&(e=e.child,e!==null))for(Xa(e,t,n),e=e.sibling;e!==null;)Xa(e,t,n),e=e.sibling}function Za(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Za(e,t,n),e=e.sibling;e!==null;)Za(e,t,n),e=e.sibling}var Ae=null,lt=!1;function Vt(e,t,n){for(n=n.child;n!==null;)vc(e,t,n),n=n.sibling}function vc(e,t,n){if(ht&&typeof ht.onCommitFiberUnmount=="function")try{ht.onCommitFiberUnmount(Kr,n)}catch(m){}switch(n.tag){case 5:De||zn(n,t);case 6:var r=Ae,o=lt;Ae=null,Vt(e,t,n),Ae=r,lt=o,Ae!==null&&(lt?(e=Ae,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ae.removeChild(n.stateNode));break;case 18:Ae!==null&&(lt?(e=Ae,n=n.stateNode,e.nodeType===8?fa(e.parentNode,n):e.nodeType===1&&fa(e,n),sr(e)):fa(Ae,n.stateNode));break;case 4:r=Ae,o=lt,Ae=n.stateNode.containerInfo,lt=!0,Vt(e,t,n),Ae=r,lt=o;break;case 0:case 11:case 14:case 15:if(!De&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Ja(n,t,a),o=o.next}while(o!==r)}Vt(e,t,n);break;case 1:if(!De&&(zn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(m){ge(n,t,m)}Vt(e,t,n);break;case 21:Vt(e,t,n);break;case 22:n.mode&1?(De=(r=De)||n.memoizedState!==null,Vt(e,t,n),De=r):Vt(e,t,n);break;default:Vt(e,t,n)}}function gc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new rh),t.forEach(function(r){var o=hh.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function ut(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,a=t,m=a;e:for(;m!==null;){switch(m.tag){case 5:Ae=m.stateNode,lt=!1;break e;case 3:Ae=m.stateNode.containerInfo,lt=!0;break e;case 4:Ae=m.stateNode.containerInfo,lt=!0;break e}m=m.return}if(Ae===null)throw Error(Q(160));vc(i,a,o),Ae=null,lt=!1;var v=o.alternate;v!==null&&(v.return=null),o.return=null}catch(S){ge(o,t,S)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)yc(t,e),t=t.sibling}function yc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ut(t,e),gt(e),r&4){try{Ir(3,e,e.return),Lo(3,e)}catch(E){ge(e,e.return,E)}try{Ir(5,e,e.return)}catch(E){ge(e,e.return,E)}}break;case 1:ut(t,e),gt(e),r&512&&n!==null&&zn(n,n.return);break;case 5:if(ut(t,e),gt(e),r&512&&n!==null&&zn(n,n.return),e.flags&32){var o=e.stateNode;try{Yn(o,"")}catch(E){ge(e,e.return,E)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,m=e.type,v=e.updateQueue;if(e.updateQueue=null,v!==null)try{m==="input"&&i.type==="radio"&&i.name!=null&&$s(o,i),Ii(m,a);var S=Ii(m,i);for(a=0;a<v.length;a+=2){var T=v[a],R=v[a+1];T==="style"?el(o,R):T==="dangerouslySetInnerHTML"?Zs(o,R):T==="children"?Yn(o,R):di(o,T,R,S)}switch(m){case"input":Oi(o,i);break;case"textarea":Js(o,i);break;case"select":var C=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var O=i.value;O!=null?wn(o,!!i.multiple,O,!1):C!==!!i.multiple&&(i.defaultValue!=null?wn(o,!!i.multiple,i.defaultValue,!0):wn(o,!!i.multiple,i.multiple?[]:"",!1))}o[yr]=i}catch(E){ge(e,e.return,E)}}break;case 6:if(ut(t,e),gt(e),r&4){if(e.stateNode===null)throw Error(Q(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(E){ge(e,e.return,E)}}break;case 3:if(ut(t,e),gt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{sr(t.containerInfo)}catch(E){ge(e,e.return,E)}break;case 4:ut(t,e),gt(e);break;case 13:ut(t,e),gt(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(ts=we())),r&4&&gc(e);break;case 22:if(T=n!==null&&n.memoizedState!==null,e.mode&1?(De=(S=De)||T,ut(t,e),De=S):ut(t,e),gt(e),r&8192){if(S=e.memoizedState!==null,(e.stateNode.isHidden=S)&&!T&&e.mode&1)for(q=e,T=e.child;T!==null;){for(R=q=T;q!==null;){switch(C=q,O=C.child,C.tag){case 0:case 11:case 14:case 15:Ir(4,C,C.return);break;case 1:zn(C,C.return);var f=C.stateNode;if(typeof f.componentWillUnmount=="function"){r=C,n=C.return;try{t=r,f.props=t.memoizedProps,f.state=t.memoizedState,f.componentWillUnmount()}catch(E){ge(r,n,E)}}break;case 5:zn(C,C.return);break;case 22:if(C.memoizedState!==null){Cc(R);continue}}O!==null?(O.return=C,q=O):Cc(R)}T=T.sibling}e:for(T=null,R=e;;){if(R.tag===5){if(T===null){T=R;try{o=R.stateNode,S?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(m=R.stateNode,v=R.memoizedProps.style,a=v!=null&&v.hasOwnProperty("display")?v.display:null,m.style.display=qs("display",a))}catch(E){ge(e,e.return,E)}}}else if(R.tag===6){if(T===null)try{R.stateNode.nodeValue=S?"":R.memoizedProps}catch(E){ge(e,e.return,E)}}else if((R.tag!==22&&R.tag!==23||R.memoizedState===null||R===e)&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===e)break e;for(;R.sibling===null;){if(R.return===null||R.return===e)break e;T===R&&(T=null),R=R.return}T===R&&(T=null),R.sibling.return=R.return,R=R.sibling}}break;case 19:ut(t,e),gt(e),r&4&&gc(e);break;case 21:break;default:ut(t,e),gt(e)}}function gt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(pc(n)){var r=n;break e}n=n.return}throw Error(Q(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Yn(o,""),r.flags&=-33);var i=mc(e);Za(e,i,o);break;case 3:case 4:var a=r.stateNode.containerInfo,m=mc(e);Xa(e,m,a);break;default:throw Error(Q(161))}}catch(v){ge(e,e.return,v)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ih(e,t,n){q=e,wc(e)}function wc(e,t,n){for(var r=(e.mode&1)!==0;q!==null;){var o=q,i=o.child;if(o.tag===22&&r){var a=o.memoizedState!==null||Do;if(!a){var m=o.alternate,v=m!==null&&m.memoizedState!==null||De;m=Do;var S=De;if(Do=a,(De=v)&&!S)for(q=o;q!==null;)a=q,v=a.child,a.tag===22&&a.memoizedState!==null?xc(o):v!==null?(v.return=a,q=v):xc(o);for(;i!==null;)q=i,wc(i),i=i.sibling;q=o,Do=m,De=S}Sc(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,q=i):Sc(e)}}function Sc(e){for(;q!==null;){var t=q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:De||Lo(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!De)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:st(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Cu(t,i,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Cu(t,a,n)}break;case 5:var m=t.stateNode;if(n===null&&t.flags&4){n=m;var v=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":v.autoFocus&&n.focus();break;case"img":v.src&&(n.src=v.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var S=t.alternate;if(S!==null){var T=S.memoizedState;if(T!==null){var R=T.dehydrated;R!==null&&sr(R)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}De||t.flags&512&&Ya(t)}catch(C){ge(t,t.return,C)}}if(t===e){q=null;break}if(n=t.sibling,n!==null){n.return=t.return,q=n;break}q=t.return}}function Cc(e){for(;q!==null;){var t=q;if(t===e){q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,q=n;break}q=t.return}}function xc(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Lo(4,t)}catch(v){ge(t,n,v)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(v){ge(t,o,v)}}var i=t.return;try{Ya(t)}catch(v){ge(t,i,v)}break;case 5:var a=t.return;try{Ya(t)}catch(v){ge(t,a,v)}}}catch(v){ge(t,t.return,v)}if(t===e){q=null;break}var m=t.sibling;if(m!==null){m.return=t.return,q=m;break}q=t.return}}var ah=Math.ceil,jo=Ct.ReactCurrentDispatcher,qa=Ct.ReactCurrentOwner,nt=Ct.ReactCurrentBatchConfig,ae=0,Te=null,Se=null,Ie=0,Xe=0,Hn=zt(0),xe=0,Mr=null,cn=0,Uo=0,es=0,Pr=null,Ge=null,ts=0,Fn=1/0,It=null,Bo=!1,ns=null,$t=null,_o=!1,Kt=null,zo=0,kr=0,rs=null,Ho=-1,Fo=0;function Be(){return ae&6?we():Ho!==-1?Ho:Ho=we()}function Qt(e){return e.mode&1?ae&2&&Ie!==0?Ie&-Ie:Gd.transition!==null?(Fo===0&&(Fo=ml()),Fo):(e=se,e!==0||(e=window.event,e=e===void 0?16:Ol(e.type)),e):1}function ct(e,t,n,r){if(50<kr)throw kr=0,rs=null,Error(Q(185));nr(e,n,r),(!(ae&2)||e!==Te)&&(e===Te&&(!(ae&2)&&(Uo|=n),xe===4&&Jt(e,Ie)),We(e,r),n===1&&ae===0&&!(t.mode&1)&&(Fn=we()+500,vo&&Ft()))}function We(e,t){var n=e.callbackNode;Gf(e,t);var r=Yr(e,e===Te?Ie:0);if(r===0)n!==null&&dl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&dl(n),t===1)e.tag===0?Fd(Oc.bind(null,e)):uu(Oc.bind(null,e)),Bd(function(){!(ae&6)&&Ft()}),n=null;else{switch(vl(r)){case 1:n=ji;break;case 4:n=hl;break;case 16:n=$r;break;case 536870912:n=pl;break;default:n=$r}n=kc(n,Ec.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Ec(e,t){if(Ho=-1,Fo=0,ae&6)throw Error(Q(327));var n=e.callbackNode;if(Gn()&&e.callbackNode!==n)return null;var r=Yr(e,e===Te?Ie:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Go(e,r);else{t=r;var o=ae;ae|=2;var i=Tc();(Te!==e||Ie!==t)&&(It=null,Fn=we()+500,dn(e,t));do try{uh();break}catch(m){Rc(e,m)}while(!0);Ca(),jo.current=i,ae=o,Se!==null?t=0:(Te=null,Ie=0,t=xe)}if(t!==0){if(t===2&&(o=Ui(e),o!==0&&(r=o,t=os(e,o))),t===1)throw n=Mr,dn(e,0),Jt(e,r),We(e,we()),n;if(t===6)Jt(e,r);else{if(o=e.current.alternate,!(r&30)&&!sh(o)&&(t=Go(e,r),t===2&&(i=Ui(e),i!==0&&(r=i,t=os(e,i))),t===1))throw n=Mr,dn(e,0),Jt(e,r),We(e,we()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(Q(345));case 2:hn(e,Ge,It);break;case 3:if(Jt(e,r),(r&130023424)===r&&(t=ts+500-we(),10<t)){if(Yr(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Be(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=ca(hn.bind(null,e,Ge,It),t);break}hn(e,Ge,It);break;case 4:if(Jt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var a=31-ot(r);i=1<<a,a=t[a],a>o&&(o=a),r&=~i}if(r=o,r=we()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ah(r/1960))-r,10<r){e.timeoutHandle=ca(hn.bind(null,e,Ge,It),r);break}hn(e,Ge,It);break;case 5:hn(e,Ge,It);break;default:throw Error(Q(329))}}}return We(e,we()),e.callbackNode===n?Ec.bind(null,e):null}function os(e,t){var n=Pr;return e.current.memoizedState.isDehydrated&&(dn(e,t).flags|=256),e=Go(e,t),e!==2&&(t=Ge,Ge=n,t!==null&&is(t)),e}function is(e){Ge===null?Ge=e:Ge.push.apply(Ge,e)}function sh(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!it(i(),o))return!1}catch(a){return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Jt(e,t){for(t&=~es,t&=~Uo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ot(t),r=1<<n;e[n]=-1,t&=~r}}function Oc(e){if(ae&6)throw Error(Q(327));Gn();var t=Yr(e,0);if(!(t&1))return We(e,we()),null;var n=Go(e,t);if(e.tag!==0&&n===2){var r=Ui(e);r!==0&&(t=r,n=os(e,r))}if(n===1)throw n=Mr,dn(e,0),Jt(e,t),We(e,we()),n;if(n===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,hn(e,Ge,It),We(e,we()),null}function as(e,t){var n=ae;ae|=1;try{return e(t)}finally{ae=n,ae===0&&(Fn=we()+500,vo&&Ft())}}function fn(e){Kt!==null&&Kt.tag===0&&!(ae&6)&&Gn();var t=ae;ae|=1;var n=nt.transition,r=se;try{if(nt.transition=null,se=1,e)return e()}finally{se=r,nt.transition=n,ae=t,!(ae&6)&&Ft()}}function ss(){Xe=Hn.current,fe(Hn)}function dn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Ud(n)),Se!==null)for(n=Se.return;n!==null;){var r=n;switch(va(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&po();break;case 3:Bn(),fe(ze),fe(Pe),Ia();break;case 5:ba(r);break;case 4:Bn();break;case 13:fe(me);break;case 19:fe(me);break;case 10:xa(r.type._context);break;case 22:case 23:ss()}n=n.return}if(Te=e,Se=e=Yt(e.current,null),Ie=Xe=t,xe=0,Mr=null,es=Uo=cn=0,Ge=Pr=null,sn!==null){for(t=0;t<sn.length;t++)if(n=sn[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var a=i.next;i.next=o,r.next=a}n.pending=r}sn=null}return e}function Rc(e,t){do{var n=Se;try{if(Ca(),To.current=Mo,bo){for(var r=ve.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}bo=!1}if(un=0,Re=Ce=ve=null,Or=!1,Rr=0,qa.current=null,n===null||n.return===null){xe=1,Mr=t,Se=null;break}e:{var i=e,a=n.return,m=n,v=t;if(t=Ie,m.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){var S=v,T=m,R=T.tag;if(!(T.mode&1)&&(R===0||R===11||R===15)){var C=T.alternate;C?(T.updateQueue=C.updateQueue,T.memoizedState=C.memoizedState,T.lanes=C.lanes):(T.updateQueue=null,T.memoizedState=null)}var O=Yu(a);if(O!==null){O.flags&=-257,Xu(O,a,m,i,t),O.mode&1&&Ju(i,S,t),t=O,v=S;var f=t.updateQueue;if(f===null){var E=new Set;E.add(v),t.updateQueue=E}else f.add(v);break e}else{if(!(t&1)){Ju(i,S,t),ls();break e}v=Error(Q(426))}}else if(de&&m.mode&1){var P=Yu(a);if(P!==null){!(P.flags&65536)&&(P.flags|=256),Xu(P,a,m,i,t),wa(_n(v,m));break e}}i=v=_n(v,m),xe!==4&&(xe=2),Pr===null?Pr=[i]:Pr.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=Ku(i,v,t);Su(i,y);break e;case 1:m=v;var d=i.type,h=i.stateNode;if(!(i.flags&128)&&(typeof d.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&($t===null||!$t.has(h)))){i.flags|=65536,t&=-t,i.lanes|=t;var w=Qu(i,m,t);Su(i,w);break e}}i=i.return}while(i!==null)}Ac(n)}catch(c){t=c,Se===n&&n!==null&&(Se=n=n.return);continue}break}while(!0)}function Tc(){var e=jo.current;return jo.current=Mo,e===null?Mo:e}function ls(){(xe===0||xe===3||xe===2)&&(xe=4),Te===null||!(cn&268435455)&&!(Uo&268435455)||Jt(Te,Ie)}function Go(e,t){var n=ae;ae|=2;var r=Tc();(Te!==e||Ie!==t)&&(It=null,dn(e,t));do try{lh();break}catch(o){Rc(e,o)}while(!0);if(Ca(),ae=n,jo.current=r,Se!==null)throw Error(Q(261));return Te=null,Ie=0,xe}function lh(){for(;Se!==null;)bc(Se)}function uh(){for(;Se!==null&&!Df();)bc(Se)}function bc(e){var t=Pc(e.alternate,e,Xe);e.memoizedProps=e.pendingProps,t===null?Ac(e):Se=t,qa.current=null}function Ac(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=nh(n,t),n!==null){n.flags&=32767,Se=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{xe=6,Se=null;return}}else if(n=th(n,t,Xe),n!==null){Se=n;return}if(t=t.sibling,t!==null){Se=t;return}Se=t=e}while(t!==null);xe===0&&(xe=5)}function hn(e,t,n){var r=se,o=nt.transition;try{nt.transition=null,se=1,ch(e,t,n,r)}finally{nt.transition=o,se=r}return null}function ch(e,t,n,r){do Gn();while(Kt!==null);if(ae&6)throw Error(Q(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Q(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Wf(e,i),e===Te&&(Se=Te=null,Ie=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||_o||(_o=!0,kc($r,function(){return Gn(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=nt.transition,nt.transition=null;var a=se;se=1;var m=ae;ae|=4,qa.current=null,oh(e,n),yc(n,e),Md(la),qr=!!sa,la=sa=null,e.current=n,ih(n),Lf(),ae=m,se=a,nt.transition=i}else e.current=n;if(_o&&(_o=!1,Kt=e,zo=o),i=e.pendingLanes,i===0&&($t=null),Bf(n.stateNode),We(e,we()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(Bo)throw Bo=!1,e=ns,ns=null,e;return zo&1&&e.tag!==0&&Gn(),i=e.pendingLanes,i&1?e===rs?kr++:(kr=0,rs=e):kr=0,Ft(),null}function Gn(){if(Kt!==null){var e=vl(zo),t=nt.transition,n=se;try{if(nt.transition=null,se=16>e?16:e,Kt===null)var r=!1;else{if(e=Kt,Kt=null,zo=0,ae&6)throw Error(Q(331));var o=ae;for(ae|=4,q=e.current;q!==null;){var i=q,a=i.child;if(q.flags&16){var m=i.deletions;if(m!==null){for(var v=0;v<m.length;v++){var S=m[v];for(q=S;q!==null;){var T=q;switch(T.tag){case 0:case 11:case 15:Ir(8,T,i)}var R=T.child;if(R!==null)R.return=T,q=R;else for(;q!==null;){T=q;var C=T.sibling,O=T.return;if(hc(T),T===S){q=null;break}if(C!==null){C.return=O,q=C;break}q=O}}}var f=i.alternate;if(f!==null){var E=f.child;if(E!==null){f.child=null;do{var P=E.sibling;E.sibling=null,E=P}while(E!==null)}}q=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,q=a;else e:for(;q!==null;){if(i=q,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Ir(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,q=y;break e}q=i.return}}var d=e.current;for(q=d;q!==null;){a=q;var h=a.child;if(a.subtreeFlags&2064&&h!==null)h.return=a,q=h;else e:for(a=d;q!==null;){if(m=q,m.flags&2048)try{switch(m.tag){case 0:case 11:case 15:Lo(9,m)}}catch(c){ge(m,m.return,c)}if(m===a){q=null;break e}var w=m.sibling;if(w!==null){w.return=m.return,q=w;break e}q=m.return}}if(ae=o,Ft(),ht&&typeof ht.onPostCommitFiberRoot=="function")try{ht.onPostCommitFiberRoot(Kr,e)}catch(c){}r=!0}return r}finally{se=n,nt.transition=t}}return!1}function Ic(e,t,n){t=_n(n,t),t=Ku(e,t,1),e=Wt(e,t,1),t=Be(),e!==null&&(nr(e,1,t),We(e,t))}function ge(e,t,n){if(e.tag===3)Ic(e,e,n);else for(;t!==null;){if(t.tag===3){Ic(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&($t===null||!$t.has(r))){e=_n(n,e),e=Qu(t,e,1),t=Wt(t,e,1),e=Be(),t!==null&&(nr(t,1,e),We(t,e));break}}t=t.return}}function fh(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Be(),e.pingedLanes|=e.suspendedLanes&n,Te===e&&(Ie&n)===n&&(xe===4||xe===3&&(Ie&130023424)===Ie&&500>we()-ts?dn(e,0):es|=n),We(e,t)}function Mc(e,t){t===0&&(e.mode&1?(t=Jr,Jr<<=1,!(Jr&130023424)&&(Jr=4194304)):t=1);var n=Be();e=Tt(e,t),e!==null&&(nr(e,t,n),We(e,n))}function dh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Mc(e,n)}function hh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Q(314))}r!==null&&r.delete(t),Mc(e,n)}var Pc;Pc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ze.current)Fe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Fe=!1,eh(e,t,n);Fe=!!(e.flags&131072)}else Fe=!1,de&&t.flags&1048576&&cu(t,yo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;No(e,t),e=t.pendingProps;var o=Pn(t,Pe.current);Un(t,n),o=ka(null,t,r,e,o,n);var i=Na();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,He(r)?(i=!0,mo(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Ra(t),o.updater=Po,t.stateNode=o,o._reactInternals=t,_a(t,r,e,n),t=Ga(null,t,r,!0,i,n)):(t.tag=0,de&&i&&ma(t),Ue(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(No(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=mh(r),e=st(r,e),o){case 0:t=Fa(null,t,r,e,n);break e;case 1:t=rc(null,t,r,e,n);break e;case 11:t=Zu(null,t,r,e,n);break e;case 14:t=qu(null,t,r,st(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),Fa(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),rc(e,t,r,o,n);case 3:e:{if(oc(t),e===null)throw Error(Q(387));r=t.pendingProps,i=t.memoizedState,o=i.element,wu(e,t),Oo(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=_n(Error(Q(423)),t),t=ic(e,t,r,n,o);break e}else if(r!==o){o=_n(Error(Q(424)),t),t=ic(e,t,r,n,o);break e}else for(Ye=_t(t.stateNode.containerInfo.firstChild),Je=t,de=!0,at=null,n=gu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Dn(),r===o){t=At(e,t,n);break e}Ue(e,t,r,n)}t=t.child}return t;case 5:return xu(t),e===null&&ya(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,a=o.children,ua(r,o)?a=null:i!==null&&ua(r,i)&&(t.flags|=32),nc(e,t),Ue(e,t,a,n),t.child;case 6:return e===null&&ya(t),null;case 13:return ac(e,t,n);case 4:return Ta(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ln(t,null,r,n):Ue(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),Zu(e,t,r,o,n);case 7:return Ue(e,t,t.pendingProps,n),t.child;case 8:return Ue(e,t,t.pendingProps.children,n),t.child;case 12:return Ue(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,a=o.value,ue(Co,r._currentValue),r._currentValue=a,i!==null)if(it(i.value,a)){if(i.children===o.children&&!ze.current){t=At(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var m=i.dependencies;if(m!==null){a=i.child;for(var v=m.firstContext;v!==null;){if(v.context===r){if(i.tag===1){v=bt(-1,n&-n),v.tag=2;var S=i.updateQueue;if(S!==null){S=S.shared;var T=S.pending;T===null?v.next=v:(v.next=T.next,T.next=v),S.pending=v}}i.lanes|=n,v=i.alternate,v!==null&&(v.lanes|=n),Ea(i.return,n,t),m.lanes|=n;break}v=v.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Q(341));a.lanes|=n,m=a.alternate,m!==null&&(m.lanes|=n),Ea(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Ue(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Un(t,n),o=et(o),r=r(o),t.flags|=1,Ue(e,t,r,n),t.child;case 14:return r=t.type,o=st(r,t.pendingProps),o=st(r.type,o),qu(e,t,r,o,n);case 15:return ec(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),No(e,t),t.tag=1,He(r)?(e=!0,mo(t)):e=!1,Un(t,n),Vu(t,r,o),_a(t,r,o,n),Ga(null,t,r,!0,e,n);case 19:return lc(e,t,n);case 22:return tc(e,t,n)}throw Error(Q(156,t.tag))};function kc(e,t){return fl(e,t)}function ph(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rt(e,t,n,r){return new ph(e,t,n,r)}function us(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mh(e){if(typeof e=="function")return us(e)?1:0;if(e!=null){if(e=e.$$typeof,e===mi)return 11;if(e===yi)return 14}return 2}function Yt(e,t){var n=e.alternate;return n===null?(n=rt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Wo(e,t,n,r,o,i){var a=2;if(r=e,typeof e=="function")us(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case yn:return pn(n.children,o,i,t);case hi:a=8,o|=8;break;case pi:return e=rt(12,n,t,o|2),e.elementType=pi,e.lanes=i,e;case vi:return e=rt(13,n,t,o),e.elementType=vi,e.lanes=i,e;case gi:return e=rt(19,n,t,o),e.elementType=gi,e.lanes=i,e;case Hs:return Vo(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _s:a=10;break e;case zs:a=9;break e;case mi:a=11;break e;case yi:a=14;break e;case Pt:a=16,r=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=rt(a,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function pn(e,t,n,r){return e=rt(7,e,r,t),e.lanes=n,e}function Vo(e,t,n,r){return e=rt(22,e,r,t),e.elementType=Hs,e.lanes=n,e.stateNode={isHidden:!1},e}function cs(e,t,n){return e=rt(6,e,null,t),e.lanes=n,e}function fs(e,t,n){return t=rt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function vh(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bi(0),this.expirationTimes=Bi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bi(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function ds(e,t,n,r,o,i,a,m,v){return e=new vh(e,t,n,m,v),t===1?(t=1,i===!0&&(t|=8)):t=0,i=rt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ra(i),e}function gh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:gn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Nc(e){if(!e)return Ht;e=e._reactInternals;e:{if(tn(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(He(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var n=e.type;if(He(n))return su(e,n,t)}return t}function Dc(e,t,n,r,o,i,a,m,v){return e=ds(n,r,!0,e,o,i,a,m,v),e.context=Nc(null),n=e.current,r=Be(),o=Qt(n),i=bt(r,o),i.callback=t!=null?t:null,Wt(n,i,o),e.current.lanes=o,nr(e,o,r),We(e,r),e}function $o(e,t,n,r){var o=t.current,i=Be(),a=Qt(o);return n=Nc(n),t.context===null?t.context=n:t.pendingContext=n,t=bt(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Wt(o,t,a),e!==null&&(ct(e,o,a,i),Eo(e,o,a)),a}function Ko(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Lc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hs(e,t){Lc(e,t),(e=e.alternate)&&Lc(e,t)}function yh(){return null}var jc=typeof reportError=="function"?reportError:function(e){console.error(e)};function ps(e){this._internalRoot=e}Qo.prototype.render=ps.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));$o(e,t,null,null)},Qo.prototype.unmount=ps.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fn(function(){$o(null,e,null,null)}),t[xt]=null}};function Qo(e){this._internalRoot=e}Qo.prototype.unstable_scheduleHydration=function(e){if(e){var t=wl();e={blockedOn:null,target:e,priority:t};for(var n=0;n<jt.length&&t!==0&&t<jt[n].priority;n++);jt.splice(n,0,e),n===0&&xl(e)}};function ms(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Jo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Uc(){}function wh(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var S=Ko(a);i.call(S)}}var a=Dc(t,r,e,0,null,!1,!1,"",Uc);return e._reactRootContainer=a,e[xt]=a.current,vr(e.nodeType===8?e.parentNode:e),fn(),a}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var m=r;r=function(){var S=Ko(v);m.call(S)}}var v=ds(e,0,!1,null,null,!1,!1,"",Uc);return e._reactRootContainer=v,e[xt]=v.current,vr(e.nodeType===8?e.parentNode:e),fn(function(){$o(t,v,n,r)}),v}function Yo(e,t,n,r,o){var i=n._reactRootContainer;if(i){var a=i;if(typeof o=="function"){var m=o;o=function(){var v=Ko(a);m.call(v)}}$o(t,a,e,o)}else a=wh(n,t,e,o,r);return Ko(a)}gl=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=tr(t.pendingLanes);n!==0&&(_i(t,n|1),We(t,we()),!(ae&6)&&(Fn=we()+500,Ft()))}break;case 13:fn(function(){var r=Tt(e,1);if(r!==null){var o=Be();ct(r,e,1,o)}}),hs(e,1)}},zi=function(e){if(e.tag===13){var t=Tt(e,134217728);if(t!==null){var n=Be();ct(t,e,134217728,n)}hs(e,134217728)}},yl=function(e){if(e.tag===13){var t=Qt(e),n=Tt(e,t);if(n!==null){var r=Be();ct(n,e,t,r)}hs(e,t)}},wl=function(){return se},Sl=function(e,t){var n=se;try{return se=e,t()}finally{se=n}},ki=function(e,t,n){switch(t){case"input":if(Oi(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=ho(r);if(!o)throw Error(Q(90));Ws(r),Oi(r,o)}}}break;case"textarea":Js(e,n);break;case"select":t=n.value,t!=null&&wn(e,!!n.multiple,t,!1)}},ol=as,il=fn;var Sh={usingClientEntryPoint:!1,Events:[wr,In,ho,nl,rl,as]},Nr={findFiberByHostInstance:nn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ch={bundleType:Nr.bundleType,version:Nr.version,rendererPackageName:Nr.rendererPackageName,rendererConfig:Nr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ct.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ul(e),e===null?null:e.stateNode},findFiberByHostInstance:Nr.findFiberByHostInstance||yh,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Xo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xo.isDisabled&&Xo.supportsFiber)try{Kr=Xo.inject(Ch),ht=Xo}catch(e){}}$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Sh,$e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ms(t))throw Error(Q(200));return gh(e,t,null,n)},$e.createRoot=function(e,t){if(!ms(e))throw Error(Q(299));var n=!1,r="",o=jc;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ds(e,1,!1,null,null,n,!1,r,o),e[xt]=t.current,vr(e.nodeType===8?e.parentNode:e),new ps(t)},$e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=ul(t),e=e===null?null:e.stateNode,e},$e.flushSync=function(e){return fn(e)},$e.hydrate=function(e,t,n){if(!Jo(t))throw Error(Q(200));return Yo(null,e,t,!0,n)},$e.hydrateRoot=function(e,t,n){if(!ms(e))throw Error(Q(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",a=jc;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=Dc(t,null,e,1,n!=null?n:null,o,!1,i,a),e[xt]=t.current,vr(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Qo(t)},$e.render=function(e,t,n){if(!Jo(t))throw Error(Q(200));return Yo(null,e,t,!1,n)},$e.unmountComponentAtNode=function(e){if(!Jo(e))throw Error(Q(40));return e._reactRootContainer?(fn(function(){Yo(null,null,e,!1,function(){e._reactRootContainer=null,e[xt]=null})}),!0):!1},$e.unstable_batchedUpdates=as,$e.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Jo(n))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return Yo(e,t,n,!1,r)},$e.version="18.3.1-next-f1338f8080-20240426";function Bc(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Bc)}catch(e){console.error(e)}}Bc(),Ns.exports=$e;var xh=Ns.exports,_c,zc=xh;_c=zc.createRoot,zc.hydrateRoot;var Hc={exports:{}},Zo={};/**
33
33
  * @license React
34
34
  * react-jsx-runtime.production.min.js
35
35
  *
@@ -37,7 +37,7 @@ Error generating stack: `+i.message+`
37
37
  *
38
38
  * This source code is licensed under the MIT license found in the
39
39
  * LICENSE file in the root directory of this source tree.
40
- */var Ch=oe,xh=Symbol.for("react.element"),Eh=Symbol.for("react.fragment"),Oh=Object.prototype.hasOwnProperty,Rh=Ch.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Th={key:!0,ref:!0,__self:!0,__source:!0};function Hc(e,t,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Oh.call(t,r)&&!Th.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:xh,type:e,key:i,ref:a,props:o,_owner:Rh.current}}Xo.Fragment=Eh,Xo.jsx=Hc,Xo.jsxs=Hc,zc.exports=Xo;var J=zc.exports;const bh=({isOpen:e,onClick:t,primaryColor:n="#007bff",position:r="bottom-right",marginBottom:o=16,marginSide:i=16,hasNewMessages:a=!1,isMobile:m=!1})=>{const v=()=>{const T={backgroundColor:n,zIndex:2147483647,bottom:`${o}px`};return r==="bottom-left"?Zt(yt({},T),{left:`${i}px`}):Zt(yt({},T),{right:`${i}px`})},S=()=>{const T="nbc-fixed nbc-w-16 nbc-h-16 nbc-rounded-full nbc-text-white nbc-shadow-lg nbc-transition-all nbc-duration-300 nbc-flex nbc-items-center nbc-justify-center nbc-border-0 nbc-cursor-pointer hover:nbc-scale-105";let R="";return m?R=e?"nbc-hidden":"nbc-flex":R="nbc-flex",`${T} ${R} ${e?"nbc-rotate-180":""}`};return J.jsxs("button",{onClick:t,className:S(),style:v(),"aria-label":e?"Close chat":"Open chat",children:[a&&!e&&J.jsxs(J.Fragment,{children:[J.jsx("div",{className:"nbc-absolute nbc-top-0 nbc-right-0 nbc-w-3 nbc-h-3 nbc-bg-green-400 nbc-rounded-full nbc-animate-ping nbc-opacity-75"}),J.jsx("div",{className:"nbc-absolute nbc-top-0 nbc-right-0 nbc-w-4 nbc-h-4 nbc-bg-green-500 nbc-rounded-full nbc-border-2 nbc-border-white nbc-flex nbc-items-center nbc-justify-center nbc-shadow-md nbc-animate-bounce",children:J.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-white nbc-rounded-full"})})]}),e?J.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):J.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z M8 12h.01 M12 12h.01 M16 12h.01"})})]})},Ah=({title:e,onClose:t,primaryColor:n="#f59e0b",avatar:r,closeButtonIcon:o="default",closeButtonText:i="×",closeButtonCustomIcon:a})=>{const m=()=>{switch(o){case"text":return J.jsx("span",{className:"nbc-text-sm nbc-font-bold nbc-leading-none",children:i});case"custom":return a?a.startsWith("<svg")?J.jsx("div",{className:"nbc-w-5 nbc-h-5 nbc-flex nbc-items-center nbc-justify-center",dangerouslySetInnerHTML:{__html:a}}):J.jsx("img",{src:a,alt:"Close",className:"nbc-w-5 nbc-h-5"}):J.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});default:return J.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}};return J.jsxs("div",{className:"nbc-p-2 nbc-text-white nbc-flex nbc-justify-between nbc-items-center nbc-font-medium",style:{backgroundColor:n},children:[J.jsxs("div",{className:"nbc-flex nbc-items-center nbc-space-x-3 nbc-text-black",children:[r?J.jsx("img",{src:r,alt:"Avatar",className:"nbc-w-10 nbc-h-10 nbc-rounded-full nbc-object-cover"}):J.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[J.jsx("path",{d:"M12 6V2H8"}),J.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),J.jsx("path",{d:"M2 12h2"}),J.jsx("path",{d:"M9 11v2"}),J.jsx("path",{d:"M15 11v2"}),J.jsx("path",{d:"M20 12h2"})]}),J.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]}),J.jsx("button",{onClick:t,className:"nbc-bg-transparent nbc-border-0 nbc-text-white nbc-cursor-pointer nbc-p-1 nbc-rounded-full nbc-flex nbc-items-center nbc-justify-center hover:nbc-bg-black hover:nbc-bg-opacity-20 nbc-transition-colors nbc-duration-200 nbc-w-8 nbc-h-8","aria-label":"Close chat",children:m()})]})};function Ih(e){if(!e)return"";const t=new Date(e),n=t.getDate().toString().padStart(2,"0"),r=(t.getMonth()+1).toString().padStart(2,"0"),o=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");return`${n}/${r}/${o} ${i}:${a}`}const Fc=e=>{var o,i;const t=new Date(e),n=new Date,r=new Date(n);return r.setDate(r.getDate()-1),t.toDateString()===n.toDateString()?(i=(o=Ih(e.toString()))==null?void 0:o.split(" ")[1])!=null?i:"":t.toDateString()===r.toDateString()?"Yesterday":t.getFullYear()===n.getFullYear()?t.toLocaleDateString("en-US",{month:"short",day:"numeric"}):t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},Mh=({message:e,avatar:t})=>e.sender==="user"?J.jsx("div",{className:"nbc-flex nbc-justify-end nbc-mb-4",children:J.jsxs("div",{className:"nbc-max-w-xs nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-bg-gray-100 nbc-text-gray-900 nbc-rounded-br-md",children:[J.jsx("div",{className:"nbc-whitespace-pre-wrap nbc-break-words",children:e.text}),J.jsx("div",{className:"nbc-text-xs nbc-mt-1 nbc-opacity-70 nbc-text-right",children:Fc(e.timestamp)})]})}):J.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:J.jsxs("div",{className:"nbc-flex nbc-items-start nbc-space-x-3",children:[J.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[t&&J.jsx("img",{src:t,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}),J.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",children:Fc(e.timestamp)})]}),J.jsx("div",{className:"nbc-max-w-xs nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-bg-white nbc-text-gray-800 nbc-rounded-bl-md",children:J.jsx("div",{className:"nbc-whitespace-pre-wrap nbc-break-words",children:e.text})})]})}),Ph=({avatar:e})=>J.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:J.jsxs("div",{className:"nbc-flex nbc-items-start nbc-space-x-3",children:[J.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[e&&J.jsx("img",{src:e,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}),J.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",children:" "})]}),J.jsx("div",{className:"nbc-bg-white nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-rounded-bl-md nbc-shadow-sm",children:J.jsxs("div",{className:"nbc-flex nbc-space-x-1",children:[J.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"0ms"}}),J.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"150ms"}}),J.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"300ms"}})]})})]})}),kh=({messages:e,isTyping:t,avatar:n})=>{const r=oe.useRef(null),o=()=>{var i;(i=r.current)==null||i.scrollIntoView({behavior:"smooth"})};return oe.useEffect(()=>{o()},[e,t]),J.jsxs("div",{className:"nbc-flex-1 nbc-overflow-y-auto nbc-px-2 nbc-pt-4",style:{scrollbarWidth:"thin",scrollbarColor:"#d1d5db #f9fafb"},children:[J.jsx("style",{children:`
40
+ */var Eh=oe,Oh=Symbol.for("react.element"),Rh=Symbol.for("react.fragment"),Th=Object.prototype.hasOwnProperty,bh=Eh.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ah={key:!0,ref:!0,__self:!0,__source:!0};function Fc(e,t,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Th.call(t,r)&&!Ah.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:Oh,type:e,key:i,ref:a,props:o,_owner:bh.current}}Zo.Fragment=Rh,Zo.jsx=Fc,Zo.jsxs=Fc,Hc.exports=Zo;var J=Hc.exports;const Ih=({isOpen:e,onClick:t,primaryColor:n="#007bff",position:r="bottom-right",marginBottom:o=16,marginSide:i=16,hasNewMessages:a=!1,isMobile:m=!1})=>{const v=()=>{const T={backgroundColor:n,zIndex:2147483647,bottom:`${o}px`};return r==="bottom-left"?Zt(yt({},T),{left:`${i}px`}):Zt(yt({},T),{right:`${i}px`})},S=()=>{const T="nbc-fixed nbc-w-16 nbc-h-16 nbc-rounded-full nbc-text-white nbc-shadow-lg nbc-transition-all nbc-duration-300 nbc-flex nbc-items-center nbc-justify-center nbc-border-0 nbc-cursor-pointer hover:nbc-scale-105";let R="";return m?R=e?"nbc-hidden":"nbc-flex":R="nbc-flex",`${T} ${R} ${e?"nbc-rotate-180":""}`};return J.jsxs("button",{onClick:t,className:S(),style:v(),"aria-label":e?"Close chat":"Open chat",children:[a&&!e&&J.jsxs(J.Fragment,{children:[J.jsx("div",{className:"nbc-absolute nbc-top-0 nbc-right-0 nbc-w-3 nbc-h-3 nbc-bg-green-400 nbc-rounded-full nbc-animate-ping nbc-opacity-75"}),J.jsx("div",{className:"nbc-absolute nbc-top-0 nbc-right-0 nbc-w-4 nbc-h-4 nbc-bg-green-500 nbc-rounded-full nbc-border-2 nbc-border-white nbc-flex nbc-items-center nbc-justify-center nbc-shadow-md nbc-animate-bounce",children:J.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-white nbc-rounded-full"})})]}),e?J.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):J.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z M8 12h.01 M12 12h.01 M16 12h.01"})})]})},Mh=({title:e,onClose:t,primaryColor:n="#f59e0b",avatar:r,closeButtonIcon:o="default",closeButtonText:i="×",closeButtonCustomIcon:a})=>{const m=()=>{switch(o){case"text":return J.jsx("span",{className:"nbc-text-sm nbc-font-bold nbc-leading-none",children:i});case"custom":return a?a.startsWith("<svg")?J.jsx("div",{className:"nbc-w-5 nbc-h-5 nbc-flex nbc-items-center nbc-justify-center",dangerouslySetInnerHTML:{__html:a}}):J.jsx("img",{src:a,alt:"Close",className:"nbc-w-5 nbc-h-5"}):J.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});default:return J.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}};return J.jsxs("div",{className:"nbc-p-2 nbc-text-white nbc-flex nbc-justify-between nbc-items-center nbc-font-medium",style:{backgroundColor:n},children:[J.jsxs("div",{className:"nbc-flex nbc-items-center nbc-space-x-3 nbc-text-black",children:[r?J.jsx("img",{src:r,alt:"Avatar",className:"nbc-w-10 nbc-h-10 nbc-rounded-full nbc-object-cover"}):J.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[J.jsx("path",{d:"M12 6V2H8"}),J.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),J.jsx("path",{d:"M2 12h2"}),J.jsx("path",{d:"M9 11v2"}),J.jsx("path",{d:"M15 11v2"}),J.jsx("path",{d:"M20 12h2"})]}),J.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]}),J.jsx("button",{onClick:t,className:"nbc-bg-transparent nbc-border-0 nbc-text-white nbc-cursor-pointer nbc-p-1 nbc-rounded-full nbc-flex nbc-items-center nbc-justify-center hover:nbc-bg-black hover:nbc-bg-opacity-20 nbc-transition-colors nbc-duration-200 nbc-w-8 nbc-h-8","aria-label":"Close chat",children:m()})]})},Ph=e=>{if(e instanceof Date)return e;const t=e.endsWith("Z")?e:`${e}Z`;return new Date(t)};function Gc(e){if(!e)return"";const t=Ph(e),n=t.getDate().toString().padStart(2,"0"),r=(t.getMonth()+1).toString().padStart(2,"0"),o=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");return`${n}/${r}/${o} ${i}:${a}`}const kh=({message:e,avatar:t})=>e.sender==="user"?J.jsx("div",{className:"nbc-flex nbc-justify-end nbc-mb-4",children:J.jsxs("div",{className:"nbc-max-w-xs nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-bg-gray-100 nbc-text-gray-900 nbc-rounded-br-md",children:[J.jsx("div",{className:"nbc-whitespace-pre-wrap nbc-break-words",children:e.text}),J.jsx("div",{className:"nbc-text-xs nbc-mt-1 nbc-opacity-70 nbc-text-right",children:Gc(String(e.timestamp)).split(" ")[1].substring(0,5)})]})}):J.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:J.jsxs("div",{className:"nbc-flex nbc-items-start nbc-space-x-3",children:[J.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[t&&J.jsx("img",{src:t,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}),J.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",children:Gc(String(e.timestamp)).split(" ")[1].substring(0,5)})]}),J.jsx("div",{className:"nbc-max-w-xs nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-bg-white nbc-text-gray-800 nbc-rounded-bl-md",children:J.jsx("div",{className:"nbc-whitespace-pre-wrap nbc-break-words",children:e.text})})]})}),Nh=({avatar:e})=>J.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:J.jsxs("div",{className:"nbc-flex nbc-items-start nbc-space-x-3",children:[J.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[e&&J.jsx("img",{src:e,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}),J.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",children:" "})]}),J.jsx("div",{className:"nbc-bg-white nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-rounded-bl-md nbc-shadow-sm",children:J.jsxs("div",{className:"nbc-flex nbc-space-x-1",children:[J.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"0ms"}}),J.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"150ms"}}),J.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"300ms"}})]})})]})}),Dh=({messages:e,isTyping:t,avatar:n})=>{const r=oe.useRef(null),o=()=>{var i;(i=r.current)==null||i.scrollIntoView({behavior:"smooth"})};return oe.useEffect(()=>{o()},[e,t]),J.jsxs("div",{className:"nbc-flex-1 nbc-overflow-y-auto nbc-px-2 nbc-pt-4",style:{scrollbarWidth:"thin",scrollbarColor:"#d1d5db #f9fafb"},children:[J.jsx("style",{children:`
41
41
  .nbc-flex-1::-webkit-scrollbar {
42
42
  width: 6px;
43
43
  }
@@ -59,7 +59,7 @@ Error generating stack: `+i.message+`
59
59
  .nbc-flex-1::-webkit-scrollbar-button:vertical:end:increment {
60
60
  display: none;
61
61
  }
62
- `}),e.map(i=>J.jsx(Mh,{message:i,avatar:n},i.id)),t&&J.jsx(Ph,{avatar:n}),J.jsx("div",{ref:r})]})},Nh=({onSendMessage:e,placeholder:t="Escribe un mensaje...",disabled:n=!1})=>{const[r,o]=oe.useState(""),i=m=>{m.preventDefault(),r.trim()&&!n&&(e(r.trim()),o(""))},a=m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),r.trim()&&!n&&(e(r.trim()),o("")))};return J.jsx("form",{onSubmit:i,className:"nbc-bg-white nbc-border-t nbc-border-gray-100",children:J.jsxs("div",{className:"nbc-relative",children:[J.jsx("input",{type:"text",value:r,onChange:m=>o(m.target.value),onKeyPress:a,placeholder:t,className:"nbc-w-full nbc-px-4 nbc-pr-12 nbc-text-base nbc-outline-none nbc-text-gray-900 nbc-bg-white nbc-transition-all nbc-duration-200",style:{height:"48px"}}),J.jsx("button",{type:"submit",disabled:!r.trim()||n,className:"nbc-absolute nbc-right-2 nbc-top-1/2 nbc-transform nbc--translate-y-1/2 nbc-w-8 nbc-h-8 nbc-text-gray-500 hover:nbc-text-gray-700 nbc-rounded-full nbc-text-sm nbc-font-medium nbc-transition-all nbc-duration-200 disabled:nbc-opacity-50 disabled:nbc-cursor-not-allowed nbc-border-0 nbc-cursor-pointer nbc-flex nbc-items-center nbc-justify-center hover:nbc-bg-gray-100",children:J.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:" 24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-5 nbc-h-5",children:[J.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),J.jsx("path",{d:"M22 2 11 13"})]})})]})})},Dh=({avatar:e})=>{const t=[{type:"bot",lines:3,widths:["w-full","w-3/4","w-1/2"]},{type:"user",lines:1,widths:["w-2/3"]},{type:"bot",lines:2,widths:["w-full","w-5/6"]},{type:"user",lines:2,widths:["w-3/4","w-1/2"]}];return J.jsxs("div",{className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-space-y-4 nbc-p-4",children:[t.map((n,r)=>J.jsx("div",{className:`nbc-flex ${n.type==="user"?"nbc-justify-end":"nbc-justify-start"} nbc-mb-4`,children:n.type==="user"?J.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((o,i)=>J.jsx("div",{className:`nbc-h-4 nbc-bg-gray-100 nbc-rounded nbc-animate-pulse ${o}`},i))}):J.jsxs("div",{className:"nbc-w-full nbc-flex nbc-items-start nbc-space-x-3",children:[J.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[e?J.jsx("img",{src:e,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0 nbc-opacity-50"}):J.jsx("div",{className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-bg-gray-300 nbc-animate-pulse"}),J.jsx("div",{className:"nbc-w-10 nbc-h-3 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse nbc-mt-1"})]}),J.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((o,i)=>J.jsx("div",{className:`nbc-h-4 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse ${o}`},i))})]})},r)),J.jsx("div",{className:"nbc-text-center nbc-text-sm nbc-text-gray-500 nbc-animate-pulse",children:"Cargando conversación..."})]})},Lh=({isOpen:e,onClose:t,config:n,messages:r,onSendMessage:o,isLoading:i=!1,isAiTyping:a=!1,position:m,marginBottom:v,marginSide:S,isMobile:T=!1,apiKeyMissing:R=!1})=>{const[C,O]=oe.useState(!1),[f,E]=oe.useState(!1),P=w=>{o(w)};if(oe.useEffect(()=>{e?(E(!0),setTimeout(()=>O(!0),10)):(O(!1),setTimeout(()=>E(!1),300))},[e]),!f)return null;const y=()=>{const w=m||n.position||"bottom-right",c=v||n.marginBottom||16,u=S||n.marginSide||16,g={width:"400px",height:"580px",zIndex:2147483647,bottom:`${c+64+10}px`};return w==="bottom-left"?Zt(yt({},g),{left:`${u}px`}):Zt(yt({},g),{right:`${u}px`})},d=()=>`nbc-fixed nbc-bg-white nbc-rounded-lg nbc-shadow-2xl nbc-flex nbc-flex-col nbc-overflow-hidden nbc-font-sans nbc-transition-all nbc-duration-300 nbc-ease-out ${T?"nbc-inset-0 nbc-w-full nbc-h-full nbc-rounded-none":"nbc-w-auto nbc-h-auto nbc-rounded-lg nbc-inset-auto"} ${C?"nbc-opacity-100 nbc-scale-100 nbc-translate-y-0":"nbc-opacity-0 nbc-scale-95 nbc-translate-y-2"}`,h=()=>T?{zIndex:2147483647}:y();return J.jsxs("div",{className:d(),style:h(),children:[J.jsx(Ah,{title:n.title||"Chat",onClose:t,primaryColor:n.primaryColor,avatar:n.avatar,closeButtonIcon:n.closeButtonIcon,closeButtonText:n.closeButtonText,closeButtonCustomIcon:n.closeButtonCustomIcon}),R?J.jsx("div",{className:"nbc-flex-1 nbc-flex nbc-items-center nbc-justify-center nbc-min-h-[220px]",children:J.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-gap-2 nbc-text-black nbc-font-medium nbc-text-[15px] nbc-bg-none nbc-shadow-none nbc-p-0 nbc-rounded-none nbc-text-center",children:[J.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",viewBox:"0 0 24 24",stroke:"#ef4444",strokeWidth:"2",style:{marginBottom:4},children:[J.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"none"}),J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4m0 4h.01"})]}),"Falta la API Key"]})}):i?J.jsx(Dh,{avatar:n.avatar}):J.jsx(kh,{messages:r,isTyping:a,avatar:n.avatar}),J.jsxs("div",{className:"nbc-mb-1 nbc-flex nbc-items-end nbc-justify-center nbc-text-xs nbc-text-black",children:[J.jsx("span",{children:"Powered by"})," ",J.jsx("a",{href:"https://notchatbot.com",target:"_blank",rel:"noopener noreferrer",className:"nbc-font-bold nbc-text-black",children:"NotChatbot"})]}),J.jsx(Nh,{onSendMessage:P,placeholder:n.placeholder||"Escribe un mensaje...",disabled:a||R})]})};function Xt(){const t=Date.now().toString(16).padStart(12,"0"),n=new Uint8Array(10);crypto.getRandomValues(n);const r=Array.from(n).map(i=>i.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),"7"+r.slice(0,3),(parseInt(r.slice(3,4),16)&3|8).toString(16)+r.slice(4,7),r.slice(7,19)].join("-")}function Gc(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function ms(e,t,n={}){const{expires:r,maxAge:o,domain:i,path:a="/",secure:m=window.location.protocol==="https:",sameSite:v="lax"}=n;let S=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;r&&(S+=`; expires=${r.toUTCString()}`),o!==void 0&&(S+=`; max-age=${o}`),i&&(S+=`; domain=${i}`),S+=`; path=${a}`,m&&(S+="; secure"),S+=`; samesite=${v}`,document.cookie=S}function Wc(e){const t=encodeURIComponent(e),n=document.cookie.split(";");for(let r of n)if(r=r.trim(),r.startsWith(t+"="))return decodeURIComponent(r.substring(t.length+1));return null}function jh(e,t={}){ms(e,"",Zt(yt({},t),{expires:new Date(0)}))}function Vc(){try{const e="__webchat_test__";ms(e,"test");const t=Wc(e)==="test";return jh(e),t}catch(e){return!1}}const $c="notchatbot",Uh=24;function vs(){if(!Vc())return console.warn("WebChat: Cookies not supported, using session-only data"),{conversationId:Xt(),conversationStarted:!1};const e=Wc($c);if(e)try{const n=JSON.parse(e);if(n&&typeof n=="object"&&typeof n.conversationId=="string"&&typeof n.conversationStarted=="boolean"&&Gc(n.conversationId))return n}catch(n){console.warn("WebChat: Invalid notchatbot cookie format, creating new one")}const t={conversationId:Xt(),conversationStarted:!1};return Kc(t),t}function Kc(e){if(!Vc()){console.warn("WebChat: Cookies not supported, cannot save data");return}if(!e||!Gc(e.conversationId))throw new Error("Invalid cookie data: conversationId must be a valid UUIDv7");if(typeof e.conversationStarted!="boolean")throw new Error("Invalid cookie data: conversationStarted must be a boolean");const t=Uh*60*60;ms($c,JSON.stringify(e),{maxAge:t,secure:window.location.protocol==="https:",sameSite:"lax",path:"/"})}function Bh(e){const t=vs(),n=Zt(yt({},t),{conversationStarted:e});return Kc(n),n}function Qc(){return vs().conversationId}function Jc(){return vs().conversationStarted}const _h=()=>{if(typeof window=="undefined")return!1;const t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=window.innerWidth<=768,r="ontouchstart"in window||navigator.maxTouchPoints>0;return t||n&&r},gs=()=>_h()?"mobile":"desktop",zh=e=>{if(typeof window=="undefined")return()=>{};let t=gs();const n=()=>{const r=gs();r!==t&&(t=r,e(r))};return window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},Zo=e=>{const t=gs(),n=Zt(yt({},e),{position:e.position||"bottom-right",marginBottom:e.marginBottom||16,marginSide:e.marginSide||16}),r=t==="mobile"?e.mobile:e.desktop;return r&&(r.position!==void 0&&(n.position=r.position),r.marginBottom!==void 0&&(n.marginBottom=r.marginBottom),r.marginSide!==void 0&&(n.marginSide=r.marginSide)),n},Hh=e=>{const t=Zo(e);return{position:t.position,marginBottom:t.marginBottom,marginSide:t.marginSide}},Fh=()=>dt(this,null,function*(){try{return(yield(yield fetch("https://api.ipify.org?format=json")).json()).ip||"unknown"}catch(e){return console.warn("WebChat: Could not fetch user IP:",e),`fallback_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}});function Gh(){return typeof window=="undefined"?!1:window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")}function Yc(){return Gh()?{baseUrl:"http://localhost:3001",chatEndpoint:"http://localhost:3001/api/webchat",conversationEndpoint:"http://localhost:3001/api/webchat/conversation"}:{baseUrl:"https://next.notchatbot.com",chatEndpoint:"https://next.notchatbot.com/api/webchat",conversationEndpoint:"https://next.notchatbot.com/api/webchat/conversation"}}function Wh(){return Yc().chatEndpoint}function Xc(){return Yc().conversationEndpoint}const Vh=(e,t)=>dt(this,null,function*(){try{const n=Xc(),r=yield fetch(`${n}?conversationId=${e}&chatbotUid=${t}`);return r.ok?yield r.json():(console.warn("WebChat: Failed to fetch conversation history:",r.status,r.statusText),null)}catch(n){return console.error("WebChat: Error fetching conversation history:",n),null}}),$h=e=>e.map((t,n)=>({id:t.id||(Date.now()+n).toString(),text:t.content||t.text||"",sender:t.role==="user"?"user":"bot",timestamp:t.createdAt?new Date(t.createdAt):new Date})),Kh=(e,t)=>e.map(n=>({id:n.id,content:n.text,role:n.sender==="user"?"user":"assistant",type:"text",createdAt:n.timestamp.toISOString(),conversationId:t}));var Zc={exports:{}};/*!
62
+ `}),e.map(i=>J.jsx(kh,{message:i,avatar:n},i.id)),t&&J.jsx(Nh,{avatar:n}),J.jsx("div",{ref:r})]})},Lh=({onSendMessage:e,placeholder:t="Escribe un mensaje...",disabled:n=!1})=>{const[r,o]=oe.useState(""),i=m=>{m.preventDefault(),r.trim()&&!n&&(e(r.trim()),o(""))},a=m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),r.trim()&&!n&&(e(r.trim()),o("")))};return J.jsx("form",{onSubmit:i,className:"nbc-bg-white nbc-border-t nbc-border-gray-100",children:J.jsxs("div",{className:"nbc-relative",children:[J.jsx("input",{type:"text",value:r,onChange:m=>o(m.target.value),onKeyPress:a,placeholder:t,className:"nbc-w-full nbc-px-4 nbc-pr-12 nbc-text-base nbc-outline-none nbc-text-gray-900 nbc-bg-white nbc-transition-all nbc-duration-200",style:{height:"48px"}}),J.jsx("button",{type:"submit",disabled:!r.trim()||n,className:"nbc-absolute nbc-right-2 nbc-top-1/2 nbc-transform nbc--translate-y-1/2 nbc-w-8 nbc-h-8 nbc-text-gray-500 hover:nbc-text-gray-700 nbc-rounded-full nbc-text-sm nbc-font-medium nbc-transition-all nbc-duration-200 disabled:nbc-opacity-50 disabled:nbc-cursor-not-allowed nbc-border-0 nbc-cursor-pointer nbc-flex nbc-items-center nbc-justify-center hover:nbc-bg-gray-100",children:J.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:" 24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-5 nbc-h-5",children:[J.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),J.jsx("path",{d:"M22 2 11 13"})]})})]})})},jh=({avatar:e})=>{const t=[{type:"bot",lines:3,widths:["w-full","w-3/4","w-1/2"]},{type:"user",lines:1,widths:["w-2/3"]},{type:"bot",lines:2,widths:["w-full","w-5/6"]},{type:"user",lines:2,widths:["w-3/4","w-1/2"]}];return J.jsxs("div",{className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-space-y-4 nbc-p-4",children:[t.map((n,r)=>J.jsx("div",{className:`nbc-flex ${n.type==="user"?"nbc-justify-end":"nbc-justify-start"} nbc-mb-4`,children:n.type==="user"?J.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((o,i)=>J.jsx("div",{className:`nbc-h-4 nbc-bg-gray-100 nbc-rounded nbc-animate-pulse ${o}`},i))}):J.jsxs("div",{className:"nbc-w-full nbc-flex nbc-items-start nbc-space-x-3",children:[J.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[e?J.jsx("img",{src:e,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0 nbc-opacity-50"}):J.jsx("div",{className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-bg-gray-300 nbc-animate-pulse"}),J.jsx("div",{className:"nbc-w-10 nbc-h-3 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse nbc-mt-1"})]}),J.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((o,i)=>J.jsx("div",{className:`nbc-h-4 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse ${o}`},i))})]})},r)),J.jsx("div",{className:"nbc-text-center nbc-text-sm nbc-text-gray-500 nbc-animate-pulse",children:"Cargando conversación..."})]})},Uh=({isOpen:e,onClose:t,config:n,messages:r,onSendMessage:o,isLoading:i=!1,isAiTyping:a=!1,position:m,marginBottom:v,marginSide:S,isMobile:T=!1,apiKeyMissing:R=!1})=>{const[C,O]=oe.useState(!1),[f,E]=oe.useState(!1),P=w=>{o(w)};if(oe.useEffect(()=>{e?(E(!0),setTimeout(()=>O(!0),10)):(O(!1),setTimeout(()=>E(!1),300))},[e]),!f)return null;const y=()=>{const w=m||n.position||"bottom-right",c=v||n.marginBottom||16,u=S||n.marginSide||16,g={width:"400px",height:"580px",zIndex:2147483647,bottom:`${c+64+10}px`};return w==="bottom-left"?Zt(yt({},g),{left:`${u}px`}):Zt(yt({},g),{right:`${u}px`})},d=()=>`nbc-fixed nbc-bg-white nbc-rounded-lg nbc-shadow-2xl nbc-flex nbc-flex-col nbc-overflow-hidden nbc-font-sans nbc-transition-all nbc-duration-300 nbc-ease-out ${T?"nbc-inset-0 nbc-w-full nbc-h-full nbc-rounded-none":"nbc-w-auto nbc-h-auto nbc-rounded-lg nbc-inset-auto"} ${C?"nbc-opacity-100 nbc-scale-100 nbc-translate-y-0":"nbc-opacity-0 nbc-scale-95 nbc-translate-y-2"}`,h=()=>T?{zIndex:2147483647}:y();return J.jsxs("div",{className:d(),style:h(),children:[J.jsx(Mh,{title:n.title||"Chat",onClose:t,primaryColor:n.primaryColor,avatar:n.avatar,closeButtonIcon:n.closeButtonIcon,closeButtonText:n.closeButtonText,closeButtonCustomIcon:n.closeButtonCustomIcon}),R?J.jsx("div",{className:"nbc-flex-1 nbc-flex nbc-items-center nbc-justify-center nbc-min-h-[220px]",children:J.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-gap-2 nbc-text-black nbc-font-medium nbc-text-[15px] nbc-bg-none nbc-shadow-none nbc-p-0 nbc-rounded-none nbc-text-center",children:[J.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",viewBox:"0 0 24 24",stroke:"#ef4444",strokeWidth:"2",style:{marginBottom:4},children:[J.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"none"}),J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4m0 4h.01"})]}),"Falta la API Key"]})}):i?J.jsx(jh,{avatar:n.avatar}):J.jsx(Dh,{messages:r,isTyping:a,avatar:n.avatar}),J.jsxs("div",{className:"nbc-mb-1 nbc-flex nbc-items-end nbc-justify-center nbc-text-xs nbc-text-black",children:[J.jsx("span",{children:"Powered by"})," ",J.jsx("a",{href:"https://notchatbot.com",target:"_blank",rel:"noopener noreferrer",className:"nbc-font-bold nbc-text-black",children:"NotChatbot"})]}),J.jsx(Lh,{onSendMessage:P,placeholder:n.placeholder||"Escribe un mensaje...",disabled:a||R})]})};function Xt(){const t=Date.now().toString(16).padStart(12,"0"),n=new Uint8Array(10);crypto.getRandomValues(n);const r=Array.from(n).map(i=>i.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),"7"+r.slice(0,3),(parseInt(r.slice(3,4),16)&3|8).toString(16)+r.slice(4,7),r.slice(7,19)].join("-")}function Wc(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function vs(e,t,n={}){const{expires:r,maxAge:o,domain:i,path:a="/",secure:m=window.location.protocol==="https:",sameSite:v="lax"}=n;let S=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;r&&(S+=`; expires=${r.toUTCString()}`),o!==void 0&&(S+=`; max-age=${o}`),i&&(S+=`; domain=${i}`),S+=`; path=${a}`,m&&(S+="; secure"),S+=`; samesite=${v}`,document.cookie=S}function Vc(e){const t=encodeURIComponent(e),n=document.cookie.split(";");for(let r of n)if(r=r.trim(),r.startsWith(t+"="))return decodeURIComponent(r.substring(t.length+1));return null}function Bh(e,t={}){vs(e,"",Zt(yt({},t),{expires:new Date(0)}))}function $c(){try{const e="__webchat_test__";vs(e,"test");const t=Vc(e)==="test";return Bh(e),t}catch(e){return!1}}const Kc="notchatbot",_h=24;function gs(){if(!$c())return console.warn("WebChat: Cookies not supported, using session-only data"),{conversationId:Xt(),conversationStarted:!1};const e=Vc(Kc);if(e)try{const n=JSON.parse(e);if(n&&typeof n=="object"&&typeof n.conversationId=="string"&&typeof n.conversationStarted=="boolean"&&Wc(n.conversationId))return n}catch(n){console.warn("WebChat: Invalid notchatbot cookie format, creating new one")}const t={conversationId:Xt(),conversationStarted:!1};return Qc(t),t}function Qc(e){if(!$c()){console.warn("WebChat: Cookies not supported, cannot save data");return}if(!e||!Wc(e.conversationId))throw new Error("Invalid cookie data: conversationId must be a valid UUIDv7");if(typeof e.conversationStarted!="boolean")throw new Error("Invalid cookie data: conversationStarted must be a boolean");const t=_h*60*60;vs(Kc,JSON.stringify(e),{maxAge:t,secure:window.location.protocol==="https:",sameSite:"lax",path:"/"})}function zh(e){const t=gs(),n=Zt(yt({},t),{conversationStarted:e});return Qc(n),n}function Jc(){return gs().conversationId}function Yc(){return gs().conversationStarted}const Hh=()=>{if(typeof window=="undefined")return!1;const t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=window.innerWidth<=768,r="ontouchstart"in window||navigator.maxTouchPoints>0;return t||n&&r},ys=()=>Hh()?"mobile":"desktop",Fh=e=>{if(typeof window=="undefined")return()=>{};let t=ys();const n=()=>{const r=ys();r!==t&&(t=r,e(r))};return window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},qo=e=>{const t=ys(),n=Zt(yt({},e),{position:e.position||"bottom-right",marginBottom:e.marginBottom||16,marginSide:e.marginSide||16}),r=t==="mobile"?e.mobile:e.desktop;return r&&(r.position!==void 0&&(n.position=r.position),r.marginBottom!==void 0&&(n.marginBottom=r.marginBottom),r.marginSide!==void 0&&(n.marginSide=r.marginSide)),n},Gh=e=>{const t=qo(e);return{position:t.position,marginBottom:t.marginBottom,marginSide:t.marginSide}},Wh=()=>dt(this,null,function*(){try{return(yield(yield fetch("https://api.ipify.org?format=json")).json()).ip||"unknown"}catch(e){return console.warn("WebChat: Could not fetch user IP:",e),`fallback_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}});function Vh(){return typeof window=="undefined"?!1:window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")}function Xc(){return Vh()?{baseUrl:"http://localhost:3001",chatEndpoint:"http://localhost:3001/api/webchat",conversationEndpoint:"http://localhost:3001/api/webchat/conversation"}:{baseUrl:"https://next.notchatbot.com",chatEndpoint:"https://next.notchatbot.com/api/webchat",conversationEndpoint:"https://next.notchatbot.com/api/webchat/conversation"}}function $h(){return Xc().chatEndpoint}function Zc(){return Xc().conversationEndpoint}const Kh=(e,t)=>dt(this,null,function*(){try{const n=Zc(),r=yield fetch(`${n}?conversationId=${e}&chatbotUid=${t}`);return r.ok?yield r.json():(console.warn("WebChat: Failed to fetch conversation history:",r.status,r.statusText),null)}catch(n){return console.error("WebChat: Error fetching conversation history:",n),null}}),Qh=e=>e.map((t,n)=>{let r;return t.createdAt?r=t.createdAt.endsWith("Z")?t.createdAt:`${t.createdAt}Z`:r=new Date().toISOString(),{id:t.id||(Date.now()+n).toString(),text:t.content||t.text||"",sender:t.role==="user"?"user":"bot",timestamp:r}}),Jh=(e,t)=>e.map(n=>({id:n.id,content:n.text,role:n.sender==="user"?"user":"assistant",type:"text",createdAt:n.timestamp instanceof Date?n.timestamp.toISOString():n.timestamp,conversationId:t}));var qc={exports:{}};/*!
63
63
  * @license Copyright 2015-2022 Ably Real-time Ltd (ably.com)
64
64
  *
65
65
  * Ably JavaScript Library v1.2.50
@@ -79,16 +79,16 @@ Error generating stack: `+i.message+`
79
79
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
80
80
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
81
81
  PERFORMANCE OF THIS SOFTWARE.
82
- ***************************************************************************** */var i=function(I,M){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,j){A.__proto__=j}||function(A,j){for(var U in j)Object.prototype.hasOwnProperty.call(j,U)&&(A[U]=j[U])},i(I,M)};function a(I,M){if(typeof M!="function"&&M!==null)throw new TypeError("Class extends value "+String(M)+" is not a constructor or null");i(I,M);function A(){this.constructor=I}I.prototype=M===null?Object.create(M):(A.prototype=M.prototype,new A)}var m=function(){return m=Object.assign||function(M){for(var A,j=1,U=arguments.length;j<U;j++){A=arguments[j];for(var z in A)Object.prototype.hasOwnProperty.call(A,z)&&(M[z]=A[z])}return M},m.apply(this,arguments)};function v(I,M){var A={};for(var j in I)Object.prototype.hasOwnProperty.call(I,j)&&M.indexOf(j)<0&&(A[j]=I[j]);if(I!=null&&typeof Object.getOwnPropertySymbols=="function")for(var U=0,j=Object.getOwnPropertySymbols(I);U<j.length;U++)M.indexOf(j[U])<0&&Object.prototype.propertyIsEnumerable.call(I,j[U])&&(A[j[U]]=I[j[U]]);return A}function S(I,M,A,j){var U=arguments.length,z=U<3?M:j===null?j=Object.getOwnPropertyDescriptor(M,A):j,V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(I,M,A,j);else for(var G=I.length-1;G>=0;G--)(V=I[G])&&(z=(U<3?V(z):U>3?V(M,A,z):V(M,A))||z);return U>3&&z&&Object.defineProperty(M,A,z),z}function T(I,M){return function(A,j){M(A,j,I)}}function R(I,M){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(I,M)}function C(I,M,A,j){function U(z){return z instanceof A?z:new A(function(V){V(z)})}return new(A||(A=Promise))(function(z,V){function G(L){try{b(j.next(L))}catch(B){V(B)}}function F(L){try{b(j.throw(L))}catch(B){V(B)}}function b(L){L.done?z(L.value):U(L.value).then(G,F)}b((j=j.apply(I,M||[])).next())})}function O(I,M){var A={label:0,sent:function(){if(z[0]&1)throw z[1];return z[1]},trys:[],ops:[]},j,U,z,V;return V={next:G(0),throw:G(1),return:G(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function G(b){return function(L){return F([b,L])}}function F(b){if(j)throw new TypeError("Generator is already executing.");for(;A;)try{if(j=1,U&&(z=b[0]&2?U.return:b[0]?U.throw||((z=U.return)&&z.call(U),0):U.next)&&!(z=z.call(U,b[1])).done)return z;switch(U=0,z&&(b=[b[0]&2,z.value]),b[0]){case 0:case 1:z=b;break;case 4:return A.label++,{value:b[1],done:!1};case 5:A.label++,U=b[1],b=[0];continue;case 7:b=A.ops.pop(),A.trys.pop();continue;default:if(z=A.trys,!(z=z.length>0&&z[z.length-1])&&(b[0]===6||b[0]===2)){A=0;continue}if(b[0]===3&&(!z||b[1]>z[0]&&b[1]<z[3])){A.label=b[1];break}if(b[0]===6&&A.label<z[1]){A.label=z[1],z=b;break}if(z&&A.label<z[2]){A.label=z[2],A.ops.push(b);break}z[2]&&A.ops.pop(),A.trys.pop();continue}b=M.call(I,A)}catch(L){b=[6,L],U=0}finally{j=z=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}}var f=Object.create?function(I,M,A,j){j===void 0&&(j=A),Object.defineProperty(I,j,{enumerable:!0,get:function(){return M[A]}})}:function(I,M,A,j){j===void 0&&(j=A),I[j]=M[A]};function E(I,M){for(var A in I)A!=="default"&&!Object.prototype.hasOwnProperty.call(M,A)&&f(M,I,A)}function P(I){var M=typeof Symbol=="function"&&Symbol.iterator,A=M&&I[M],j=0;if(A)return A.call(I);if(I&&typeof I.length=="number")return{next:function(){return I&&j>=I.length&&(I=void 0),{value:I&&I[j++],done:!I}}};throw new TypeError(M?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(I,M){var A=typeof Symbol=="function"&&I[Symbol.iterator];if(!A)return I;var j=A.call(I),U,z=[],V;try{for(;(M===void 0||M-- >0)&&!(U=j.next()).done;)z.push(U.value)}catch(G){V={error:G}}finally{try{U&&!U.done&&(A=j.return)&&A.call(j)}finally{if(V)throw V.error}}return z}function d(){for(var I=[],M=0;M<arguments.length;M++)I=I.concat(y(arguments[M]));return I}function h(){for(var I=0,M=0,A=arguments.length;M<A;M++)I+=arguments[M].length;for(var j=Array(I),U=0,M=0;M<A;M++)for(var z=arguments[M],V=0,G=z.length;V<G;V++,U++)j[U]=z[V];return j}function w(I,M,A){if(A||arguments.length===2)for(var j=0,U=M.length,z;j<U;j++)(z||!(j in M))&&(z||(z=Array.prototype.slice.call(M,0,j)),z[j]=M[j]);return I.concat(z||Array.prototype.slice.call(M))}function c(I){return this instanceof c?(this.v=I,this):new c(I)}function u(I,M,A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var j=A.apply(I,M||[]),U,z=[];return U={},V("next"),V("throw"),V("return"),U[Symbol.asyncIterator]=function(){return this},U;function V(_){j[_]&&(U[_]=function(W){return new Promise(function(Y,X){z.push([_,W,Y,X])>1||G(_,W)})})}function G(_,W){try{F(j[_](W))}catch(Y){B(z[0][3],Y)}}function F(_){_.value instanceof c?Promise.resolve(_.value.v).then(b,L):B(z[0][2],_)}function b(_){G("next",_)}function L(_){G("throw",_)}function B(_,W){_(W),z.shift(),z.length&&G(z[0][0],z[0][1])}}function l(I){var M,A;return M={},j("next"),j("throw",function(U){throw U}),j("return"),M[Symbol.iterator]=function(){return this},M;function j(U,z){M[U]=I[U]?function(V){return(A=!A)?{value:c(I[U](V)),done:U==="return"}:z?z(V):V}:z}}function s(I){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var M=I[Symbol.asyncIterator],A;return M?M.call(I):(I=typeof P=="function"?P(I):I[Symbol.iterator](),A={},j("next"),j("throw"),j("return"),A[Symbol.asyncIterator]=function(){return this},A);function j(z){A[z]=I[z]&&function(V){return new Promise(function(G,F){V=I[z](V),U(G,F,V.done,V.value)})}}function U(z,V,G,F){Promise.resolve(F).then(function(b){z({value:b,done:G})},V)}}function g(I,M){return Object.defineProperty?Object.defineProperty(I,"raw",{value:M}):I.raw=M,I}var p=Object.create?function(I,M){Object.defineProperty(I,"default",{enumerable:!0,value:M})}:function(I,M){I.default=M};function x(I){if(I&&I.__esModule)return I;var M={};if(I!=null)for(var A in I)A!=="default"&&Object.prototype.hasOwnProperty.call(I,A)&&f(M,I,A);return p(M,I),M}function D(I){return I&&I.__esModule?I:{default:I}}function N(I,M,A,j){if(A==="a"&&!j)throw new TypeError("Private accessor was defined without a getter");if(typeof M=="function"?I!==M||!j:!M.has(I))throw new TypeError("Cannot read private member from an object whose class did not declare it");return A==="m"?j:A==="a"?j.call(I):j?j.value:M.get(I)}function k(I,M,A,j,U){if(j==="m")throw new TypeError("Private method is not writable");if(j==="a"&&!U)throw new TypeError("Private accessor was defined without a setter");if(typeof M=="function"?I!==M||!U:!M.has(I))throw new TypeError("Cannot write private member to an object whose class did not declare it");return j==="a"?U.call(I,A):U?U.value=A:M.set(I,A),A}},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0}),r.allToUpperCase=r.allToLowerCase=r.encodeBody=r.decodeBody=r.Format=r.promisify=r.trim=r.arrChooseN=r.randomHexString=r.randomString=r.cheapRandStr=r.dataSizeBytes=r.inspectBody=r.inspectError=r.isErrorInfoOrPartialErrorInfo=r.now=r.parseQueryString=r.toQueryString=r.arrPopRandomElement=r.defaultPostHeaders=r.defaultGetHeaders=r.allSame=r.arrEvery=r.arrFilter=r.arrMap=r.safeArrForEach=r.arrForEach=r.forInOwnNonNullProperties=r.valuesArray=r.keysArray=r.arrWithoutValue=r.arrDeleteValue=r.arrIn=r.arrIndexOf=r.arrSubtract=r.arrIntersectOb=r.arrIntersect=r.intersect=r.containsValue=r.inherits=r.prototypicalClone=r.shallowClone=r.isEmptyArg=r.isOnlyPropIn=r.isEmpty=r.isObject=r.ensureArray=r.isArray=r.copy=r.mixin=void 0,r.arrEquals=r.toBase64=r.matchDerivedChannel=r.shallowEquals=r.getGlobalObject=r.getRetryTime=r.getJitterCoefficient=r.getBackoffCoefficient=void 0;var a=o(0),m=a.__importDefault(o(3)),v=a.__importStar(o(8)),S=a.__importDefault(o(4)),T=o(11),R=o(31);function C(H){return Math.floor(Math.random()*H.length)}function O(H){for(var $=[],K=1;K<arguments.length;K++)$[K-1]=arguments[K];for(var ee=0;ee<$.length;ee++){var ie=$[ee];if(!ie)break;var Ve=Object.prototype.hasOwnProperty;for(var Dr in ie)(!Ve||Ve.call(ie,Dr))&&(H[Dr]=ie[Dr])}return H}r.mixin=O;function f(H){return O({},H)}r.copy=f,r.isArray=Array.isArray||function(H){return Object.prototype.toString.call(H)=="[object Array]"};function E(H){return h(H)?[]:(0,r.isArray)(H)?H:[H]}r.ensureArray=E;function P(H){return Object.prototype.toString.call(H)=="[object Object]"}r.isObject=P;function y(H){for(var $ in H)return!1;return!0}r.isEmpty=y;function d(H,$){for(var K in H)if(K!==$)return!1;return!0}r.isOnlyPropIn=d;function h(H){return H==null}r.isEmptyArg=h;function w(H){var $=new Object;for(var K in H)$[K]=H[K];return $}r.shallowClone=w;function c(H,$){var K=function(){function ie(){}return ie}();K.prototype=H;var ee=new K;return $&&O(ee,$),ee}r.prototypicalClone=c;var u=function(H,$){if(m.default.Config.inherits){m.default.Config.inherits(H,$);return}H.super_=$,H.prototype=c($.prototype,{constructor:H})};r.inherits=u;function l(H,$){for(var K in H)if(H[K]==$)return!0;return!1}r.containsValue=l;function s(H,$){return(0,r.isArray)($)?g(H,$):p(H,$)}r.intersect=s;function g(H,$){for(var K=[],ee=0;ee<H.length;ee++){var ie=H[ee];(0,r.arrIndexOf)($,ie)!=-1&&K.push(ie)}return K}r.arrIntersect=g;function p(H,$){for(var K=[],ee=0;ee<H.length;ee++){var ie=H[ee];ie in $&&K.push(ie)}return K}r.arrIntersectOb=p;function x(H,$){for(var K=[],ee=0;ee<H.length;ee++){var ie=H[ee];(0,r.arrIndexOf)($,ie)==-1&&K.push(ie)}return K}r.arrSubtract=x,r.arrIndexOf=Array.prototype.indexOf?function(H,$,K){return H.indexOf($,K)}:function(H,$,K){K=K||0;for(var ee=H.length;K<ee;K++)if(H[K]===$)return K;return-1};function D(H,$){return(0,r.arrIndexOf)(H,$)!==-1}r.arrIn=D;function N(H,$){var K=(0,r.arrIndexOf)(H,$),ee=K!=-1;return ee&&H.splice(K,1),ee}r.arrDeleteValue=N;function k(H,$){var K=H.slice();return N(K,$),K}r.arrWithoutValue=k;function I(H,$){var K=[];for(var ee in H)$&&!Object.prototype.hasOwnProperty.call(H,ee)||K.push(ee);return K}r.keysArray=I;function M(H,$){var K=[];for(var ee in H)$&&!Object.prototype.hasOwnProperty.call(H,ee)||K.push(H[ee]);return K}r.valuesArray=M;function A(H,$){for(var K in H)Object.prototype.hasOwnProperty.call(H,K)&&H[K]&&$(K)}r.forInOwnNonNullProperties=A,r.arrForEach=Array.prototype.forEach?function(H,$){H.forEach($)}:function(H,$){for(var K=H.length,ee=0;ee<K;ee++)$(H[ee],ee,H)};function j(H,$){return(0,r.arrForEach)(H.slice(),$)}r.safeArrForEach=j,r.arrMap=Array.prototype.map?function(H,$){return H.map($)}:function(H,$){for(var K=[],ee=H.length,ie=0;ie<ee;ie++)K.push($(H[ie],ie,H));return K},r.arrFilter=Array.prototype.filter?function(H,$){return H.filter($)}:function(H,$){for(var K=[],ee=H.length,ie=0;ie<ee;ie++)$(H[ie])&&K.push(H[ie]);return K},r.arrEvery=Array.prototype.every?function(H,$){return H.every($)}:function(H,$){for(var K=H.length,ee=0;ee<K;ee++)if(!$(H[ee],ee,H))return!1;return!0};function U(H,$){if(H.length===0)return!0;var K=H[0][$];return(0,r.arrEvery)(H,function(ee){return ee[$]===K})}r.allSame=U;var z={json:"application/json",jsonp:"application/javascript",xml:"application/xml",html:"text/html",msgpack:"application/x-msgpack"};function V(H,$){var K=z[$||he.json];return{accept:K,"X-Ably-Version":v.default.protocolVersion.toString(),"Ably-Agent":(0,v.getAgentString)(H)}}r.defaultGetHeaders=V;function G(H,$){var K,ee=K=z[$||he.json];return{accept:ee,"content-type":K,"X-Ably-Version":v.default.protocolVersion.toString(),"Ably-Agent":(0,v.getAgentString)(H)}}r.defaultPostHeaders=G;function F(H){return H.splice(C(H),1)[0]}r.arrPopRandomElement=F;function b(H){var $=[];if(H)for(var K in H)$.push(encodeURIComponent(K)+"="+encodeURIComponent(H[K]));return $.length?"?"+$.join("&"):""}r.toQueryString=b;function L(H){for(var $,K=/([^?&=]+)=?([^&]*)/g,ee={};$=K.exec(H);)ee[decodeURIComponent($[1])]=decodeURIComponent($[2]);return ee}r.parseQueryString=L,r.now=Date.now||function(){return new Date().getTime()};function B(H){return typeof H=="object"&&H!==null&&(H.constructor.name=="ErrorInfo"||H.constructor.name=="PartialErrorInfo")}r.isErrorInfoOrPartialErrorInfo=B;function _(H){var $,K;return H instanceof Error||(($=H==null?void 0:H.constructor)===null||$===void 0?void 0:$.name)==="ErrorInfo"||((K=H==null?void 0:H.constructor)===null||K===void 0?void 0:K.name)==="PartialErrorInfo"?H.toString():m.default.Config.inspect(H)}r.inspectError=_;function W(H){return m.default.BufferUtils.isBuffer(H)?H.toString():typeof H=="string"?H:m.default.Config.inspect(H)}r.inspectBody=W;function Y(H){if(m.default.BufferUtils.isBuffer(H))return m.default.BufferUtils.byteLength(H);if(typeof H=="string")return m.default.Config.stringByteSize(H);throw new Error("Expected input of Utils.dataSizeBytes to be a buffer or string, but was: "+typeof H)}r.dataSizeBytes=Y;function X(){return String(Math.random()).substr(2)}r.cheapRandStr=X;var te=function(H){if(m.default.Config.getRandomValues&&typeof Uint8Array!="undefined"){var $=new Uint8Array(H);return m.default.Config.getRandomValues($),m.default.BufferUtils.base64Encode($)}for(var K=m.default.BufferUtils.base64CharSet,ee=Math.round(H*4/3),ie="",Ve=0;Ve<ee;Ve++)ie+=K[C(K)];return ie};r.randomString=te;var re=function(H){if(m.default.Config.getRandomValues&&typeof Uint8Array!="undefined"){var $=new Uint8Array(H);return m.default.Config.getRandomValues($),m.default.BufferUtils.hexEncode($)}for(var K=m.default.BufferUtils.hexCharSet,ee=H*2,ie="",Ve=0;Ve<ee;Ve++)ie+=K[C(K)];return ie};r.randomHexString=re;function le(H,$){for(var K=Math.min($,H.length),ee=H.slice(),ie=[],Ve=0;Ve<K;Ve++)ie.push(F(ee));return ie}r.arrChooseN=le,r.trim=String.prototype.trim?function(H){return H.trim()}:function(H){return H.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function Z(H,$,K){return new Promise(function(ee,ie){H[$].apply(H,a.__spreadArray(a.__spreadArray([],K,!1),[function(Ve,Dr){Ve?ie(Ve):ee(Dr)}],!1))})}r.promisify=Z;var he;(function(H){H.msgpack="msgpack",H.json="json"})(he=r.Format||(r.Format={}));function Me(H,$){return $=="msgpack"?m.default.Config.msgpack.decode(H):JSON.parse(String(H))}r.decodeBody=Me;function _e(H,$){return $=="msgpack"?m.default.Config.msgpack.encode(H,!0):JSON.stringify(H)}r.encodeBody=_e;function Ee(H){return H.map(function($){return $&&$.toLowerCase()})}r.allToLowerCase=Ee;function Mt(H){return H.map(function($){return $&&$.toUpperCase()})}r.allToUpperCase=Mt;function qo(H){return Math.min((H+2)/3,2)}r.getBackoffCoefficient=qo;function ft(){return 1-Math.random()*.2}r.getJitterCoefficient=ft;function ei(H,$){return H*qo($)*ft()}r.getRetryTime=ei;function ws(){return i||(typeof window!="undefined"?window:self)}r.getGlobalObject=ws;function Ss(H,$){return Object.keys(H).every(function(K){return H[K]===$[K]})&&Object.keys($).every(function(K){return $[K]===H[K]})}r.shallowEquals=Ss;function sp(H){var $=/^(\[([^?]*)(?:(.*))\])?(.+)$/,K=H.match($);if(!K||!K.length||K.length<5)throw new S.default("regex match failed",400,40010);if(K[2])throw new S.default("cannot use a derived option with a ".concat(K[2]," channel"),400,40010);return{qualifierParam:K[3]||"",channelName:K[4]}}r.matchDerivedChannel=sp;function lp(H){return m.default.Config.createHmac?Buffer.from(H,"ascii").toString("base64"):(0,T.stringify)((0,R.parse)(H))}r.toBase64=lp;function up(H,$){return H.length===$.length&&(0,r.arrEvery)(H,function(K,ee){return K===$[ee]})}r.arrEquals=up}).call(this,o(13))},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),m=a.__importDefault(o(3)),v=i||(typeof window!="undefined"?window:self),S;(function(f){f[f.None=0]="None",f[f.Error=1]="Error",f[f.Major=2]="Major",f[f.Minor=3]="Minor",f[f.Micro=4]="Micro"})(S||(S={}));function T(f,E){return"".concat(f).padStart(E?3:2,"0")}function R(f){return m.default.Config.logTimestamps?function(E){var P=new Date;f(T(P.getHours())+":"+T(P.getMinutes())+":"+T(P.getSeconds())+"."+T(P.getMilliseconds(),1)+" "+E)}:f}var C=function(){var f,E,P,y;return typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"||typeof((E=(f=v==null?void 0:v.console)===null||f===void 0?void 0:f.log)===null||E===void 0?void 0:E.apply)=="function"?(P=function(){for(var d=[],h=0;h<arguments.length;h++)d[h]=arguments[h];console.log.apply(console,d)},y=console.warn?function(){for(var d=[],h=0;h<arguments.length;h++)d[h]=arguments[h];console.warn.apply(console,d)}:P):v!=null&&v.console.log?P=y=function(){Function.prototype.apply.call(console.log,console,arguments)}:P=y=function(){},[P,y].map(R)},O=function(){function f(){f.logLevel=f.LOG_DEFAULT}return f.initLogHandlers=function(){var E=C(),P=E[0],y=E[1];this.logHandler=P,this.logErrorHandler=y},f.renamedClientOption=function(E,P){f.deprecationWarning("The `".concat(E,"` client option has been renamed to `").concat(P,"`. Please update your code to use `").concat(P,"` instead. `").concat(E,"` will be removed in a future version."))},f.renamedMethod=function(E,P,y){f.deprecationWarning("`".concat(E,"`’s `").concat(P,"` method has been renamed to `").concat(y,"`. Please update your code to use `").concat(y,"` instead. `").concat(P,"` will be removed in a future version."))},f.deprecationWarning=function(E){f.shouldLog(S.Error)&&f.logErrorHandler("Ably: Deprecation warning - ".concat(E))},f.logLevel=S.Error,f.LOG_NONE=S.None,f.LOG_ERROR=S.Error,f.LOG_MAJOR=S.Major,f.LOG_MINOR=S.Minor,f.LOG_MICRO=S.Micro,f.LOG_DEFAULT=S.Error,f.LOG_DEBUG=S.Micro,f.logAction=function(E,P,y){f.shouldLog(E)&&(E===S.Error?f.logErrorHandler:f.logHandler)("Ably: "+P+": "+y)},f.deprecated=function(E,P){f.deprecationWarning("".concat(E," is deprecated and will be removed in a future version. ").concat(P))},f.shouldLog=function(E){return E<=f.logLevel},f.setLog=function(E,P){E!==void 0&&(f.logLevel=E),P!==void 0&&(f.logHandler=f.logErrorHandler=P)},f}();r.default=O}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function a(){}return a}();r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.PartialErrorInfo=void 0;var i=o(0),a=i.__importDefault(o(3)),m=i.__importStar(o(1));function v(R){var C="["+R.constructor.name;return R.message&&(C+=": "+R.message),R.statusCode&&(C+="; statusCode="+R.statusCode),R.code&&(C+="; code="+R.code),R.cause&&(C+="; cause="+m.inspectError(R.cause)),R.href&&!(R.message&&R.message.indexOf("help.ably.io")>-1)&&(C+="; see "+R.href+" "),C+="]",C}var S=function(R){i.__extends(C,R);function C(O,f,E,P){var y=R.call(this,O)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(y,C.prototype),y.code=f,y.statusCode=E,y.cause=P,y}return C.prototype.toString=function(){return v(this)},C.fromValues=function(O){var f=O,E=f.message,P=f.code,y=f.statusCode;if(typeof E!="string"||typeof P!="number"||typeof y!="number")throw new Error("ErrorInfo.fromValues(): invalid values: "+a.default.Config.inspect(O));var d=Object.assign(new C(E,P,y),O);return d.code&&!d.href&&(d.href="https://help.ably.io/error/"+d.code),d},C}(Error);r.default=S;var T=function(R){i.__extends(C,R);function C(O,f,E,P){var y=R.call(this,O)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(y,C.prototype),y.code=f,y.statusCode=E,y.cause=P,y}return C.prototype.toString=function(){return v(this)},C}(Error);r.PartialErrorInfo=T},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){if(typeof ArrayBuffer=="function"){var a=i,m=a.lib,v=m.WordArray,S=v.init,T=v.init=function(R){if(R instanceof ArrayBuffer&&(R=new Uint8Array(R)),(R instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&R instanceof Uint8ClampedArray||R instanceof Int16Array||R instanceof Uint16Array||R instanceof Int32Array||R instanceof Uint32Array||R instanceof Float32Array||R instanceof Float64Array)&&(R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength)),R instanceof Uint8Array){for(var C=R.byteLength,O=[],f=0;f<C;f++)O[f>>>2]|=R[f]<<24-f%4*8;S.call(this,O,C)}else S.apply(this,arguments)};T.prototype=v}}(),i.lib.WordArray})},function(n,r,o){(function(i){(function(a,m){n.exports=m()})(this,function(){var a=a||function(m,v){var S;if(typeof window!="undefined"&&window.crypto&&(S=window.crypto),!S&&typeof window!="undefined"&&window.msCrypto&&(S=window.msCrypto),!S&&typeof i!="undefined"&&i.crypto&&(S=i.crypto),!S)try{S=o(44)}catch(u){}var T=function(){if(S){if(typeof S.getRandomValues=="function")try{return S.getRandomValues(new Uint32Array(1))[0]}catch(u){}if(typeof S.randomBytes=="function")try{return S.randomBytes(4).readInt32LE()}catch(u){}}throw new Error("Native crypto module could not be used to get secure random number.")},R=Object.create||function(){function u(){}return function(l){var s;return u.prototype=l,s=new u,u.prototype=null,s}}(),C={},O=C.lib={},f=O.Base=function(){return{extend:function(u){var l=R(this);return u&&l.mixIn(u),(!l.hasOwnProperty("init")||this.init===l.init)&&(l.init=function(){l.$super.init.apply(this,arguments)}),l.init.prototype=l,l.$super=this,l},create:function(){var u=this.extend();return u.init.apply(u,arguments),u},init:function(){},mixIn:function(u){for(var l in u)u.hasOwnProperty(l)&&(this[l]=u[l]);u.hasOwnProperty("toString")&&(this.toString=u.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),E=O.WordArray=f.extend({init:function(u,l){u=this.words=u||[],l!=v?this.sigBytes=l:this.sigBytes=u.length*4},toString:function(u){return(u||y).stringify(this)},concat:function(u){var l=this.words,s=u.words,g=this.sigBytes,p=u.sigBytes;if(this.clamp(),g%4)for(var x=0;x<p;x++){var D=s[x>>>2]>>>24-x%4*8&255;l[g+x>>>2]|=D<<24-(g+x)%4*8}else for(var x=0;x<p;x+=4)l[g+x>>>2]=s[x>>>2];return this.sigBytes+=p,this},clamp:function(){var u=this.words,l=this.sigBytes;u[l>>>2]&=4294967295<<32-l%4*8,u.length=m.ceil(l/4)},clone:function(){var u=f.clone.call(this);return u.words=this.words.slice(0),u},random:function(u){for(var l=[],s=0;s<u;s+=4)l.push(T());return new E.init(l,u)}}),P=C.enc={},y=P.Hex={stringify:function(u){for(var l=u.words,s=u.sigBytes,g=[],p=0;p<s;p++){var x=l[p>>>2]>>>24-p%4*8&255;g.push((x>>>4).toString(16)),g.push((x&15).toString(16))}return g.join("")},parse:function(u){for(var l=u.length,s=[],g=0;g<l;g+=2)s[g>>>3]|=parseInt(u.substr(g,2),16)<<24-g%8*4;return new E.init(s,l/2)}},d=P.Latin1={stringify:function(u){for(var l=u.words,s=u.sigBytes,g=[],p=0;p<s;p++){var x=l[p>>>2]>>>24-p%4*8&255;g.push(String.fromCharCode(x))}return g.join("")},parse:function(u){for(var l=u.length,s=[],g=0;g<l;g++)s[g>>>2]|=(u.charCodeAt(g)&255)<<24-g%4*8;return new E.init(s,l)}},h=P.Utf8={stringify:function(u){try{return decodeURIComponent(escape(d.stringify(u)))}catch(l){throw new Error("Malformed UTF-8 data")}},parse:function(u){return d.parse(unescape(encodeURIComponent(u)))}},w=O.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new E.init,this._nDataBytes=0},_append:function(u){typeof u=="string"&&(u=h.parse(u)),this._data.concat(u),this._nDataBytes+=u.sigBytes},_process:function(u){var l,s=this._data,g=s.words,p=s.sigBytes,x=this.blockSize,D=x*4,N=p/D;u?N=m.ceil(N):N=m.max((N|0)-this._minBufferSize,0);var k=N*x,I=m.min(k*4,p);if(k){for(var M=0;M<k;M+=x)this._doProcessBlock(g,M);l=g.splice(0,k),s.sigBytes-=I}return new E.init(l,I)},clone:function(){var u=f.clone.call(this);return u._data=this._data.clone(),u},_minBufferSize:0});O.Hasher=w.extend({cfg:f.extend(),init:function(u){this.cfg=this.cfg.extend(u),this.reset()},reset:function(){w.reset.call(this),this._doReset()},update:function(u){return this._append(u),this._process(),this},finalize:function(u){u&&this._append(u);var l=this._doFinalize();return l},blockSize:16,_createHelper:function(u){return function(l,s){return new u.init(s).finalize(l)}},_createHmacHelper:function(u){return function(l,s){return new c.HMAC.init(u,s).finalize(l)}}});var c=C.algo={};return C}(Math);return a})}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(2)),v=i.__importDefault(o(3));function S(C,O,f){try{O.apply(C,f)}catch(E){m.default.logAction(m.default.LOG_ERROR,"EventEmitter.emit()","Unexpected listener exception: "+E+"; stack = "+(E&&E.stack))}}function T(C,O,f){for(var E,P,y,d=0;d<C.length;d++)if(E=C[d],f&&(E=E[f]),a.isArray(E)){for(;(P=a.arrIndexOf(E,O))!==-1;)E.splice(P,1);f&&E.length===0&&delete C[d][f]}else if(a.isObject(E))for(y in E)Object.prototype.hasOwnProperty.call(E,y)&&a.isArray(E[y])&&T([E],O,y)}var R=function(){function C(){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null)}return C.prototype.on=function(){for(var O=this,f=[],E=0;E<arguments.length;E++)f[E]=arguments[E];if(f.length===1){var P=f[0];if(typeof P=="function")this.any.push(P);else throw new Error("EventListener.on(): Invalid arguments: "+v.default.Config.inspect(f))}if(f.length===2){var y=f[0],d=f[1];if(typeof d!="function")throw new Error("EventListener.on(): Invalid arguments: "+v.default.Config.inspect(f));if(a.isEmptyArg(y))this.any.push(d);else if(a.isArray(y))y.forEach(function(w){O.on(w,d)});else{if(typeof y!="string")throw new Error("EventListener.on(): Invalid arguments: "+v.default.Config.inspect(f));var h=this.events[y]||(this.events[y]=[]);h.push(d)}}},C.prototype.off=function(){for(var O,f=this,E=[],P=0;P<arguments.length;P++)E[P]=arguments[P];if(E.length==0||a.isEmptyArg(E[0])&&a.isEmptyArg(E[1])){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null);return}var y=E[0],d=E[1],h=null,w=null;if(E.length===1||!d)typeof y=="function"?h=y:w=y;else{if(typeof d!="function")throw new Error("EventEmitter.off(): invalid arguments:"+v.default.Config.inspect(E));O=[y,d],w=O[0],h=O[1]}if(h&&a.isEmptyArg(w)){T([this.any,this.events,this.anyOnce,this.eventsOnce],h);return}if(a.isArray(w)){w.forEach(function(c){f.off(c,h)});return}if(typeof w!="string")throw new Error("EventEmitter.off(): invalid arguments:"+v.default.Config.inspect(E));h?T([this.events,this.eventsOnce],h,w):(delete this.events[w],delete this.eventsOnce[w])},C.prototype.listeners=function(O){if(O){var f=this.events[O]||[];return this.eventsOnce[O]&&Array.prototype.push.apply(f,this.eventsOnce[O]),f.length?f:null}return this.any.length?this.any:null},C.prototype.emit=function(O){for(var f=[],E=1;E<arguments.length;E++)f[E-1]=arguments[E];var P={event:O},y=[];this.anyOnce.length&&(Array.prototype.push.apply(y,this.anyOnce),this.anyOnce=[]),this.any.length&&Array.prototype.push.apply(y,this.any);var d=this.eventsOnce[O];d&&(Array.prototype.push.apply(y,d),delete this.eventsOnce[O]);var h=this.events[O];h&&Array.prototype.push.apply(y,h),a.arrForEach(y,function(w){S(P,w,f)})},C.prototype.once=function(){for(var O=this,f=[],E=0;E<arguments.length;E++)f[E]=arguments[E];var P=f.length;if((P===0||P===1&&typeof f[0]!="function")&&v.default.Config.Promise){var y=f[0];return new v.default.Config.Promise(function(l){O.once(y,l)})}var d=f[0],h=f[1];if(f.length===1&&typeof d=="function")this.anyOnce.push(d);else if(a.isEmptyArg(d)){if(typeof h!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+v.default.Config.inspect(f));this.anyOnce.push(h)}else if(a.isArray(d)){var w=this,c=function(){var l=Array.prototype.slice.call(arguments);if(a.arrForEach(d,function(s){w.off(s,c)}),typeof h!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+v.default.Config.inspect(f));h.apply(this,l)};a.arrForEach(d,function(l){w.on(l,c)})}else{if(typeof d!="string")throw new Error("EventEmitter.once(): Invalid arguments:"+v.default.Config.inspect(f));var u=this.eventsOnce[d]||(this.eventsOnce[d]=[]);if(h){if(typeof h!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+v.default.Config.inspect(f));u.push(h)}}},C.prototype.whenState=function(O,f,E){for(var P=this,y=[],d=3;d<arguments.length;d++)y[d-3]=arguments[d];var h={event:O};if(typeof O!="string"||typeof f!="string")throw"whenState requires a valid event String argument";if(typeof E!="function"&&v.default.Config.Promise)return new v.default.Config.Promise(function(w){C.prototype.whenState.apply(P,[O,f,w].concat(y))});O===f?S(h,E,y):this.once(O,E)},C}();r.default=R},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.getDefaults=r.normaliseOptions=r.objectifyOptions=r.getAgentString=r.getHosts=r.getFallbackHosts=r.environmentFallbackHosts=r.getHttpScheme=r.getPort=r.getHost=void 0;var i=o(0),a=i.__importDefault(o(3)),m=i.__importStar(o(1)),v=i.__importDefault(o(2)),S=i.__importDefault(o(4)),T=o(43),R="ably-js/"+T.version,C={ENVIRONMENT:"",REST_HOST:"rest.ably.io",REALTIME_HOST:"realtime.ably.io",FALLBACK_HOSTS:["A.ably-realtime.com","B.ably-realtime.com","C.ably-realtime.com","D.ably-realtime.com","E.ably-realtime.com"],PORT:80,TLS_PORT:443,TIMEOUTS:{disconnectedRetryTimeout:15e3,suspendedRetryTimeout:3e4,httpRequestTimeout:15e3,channelRetryTimeout:15e3,fallbackRetryTimeout:6e5,connectionStateTtl:12e4,realtimeRequestTimeout:1e4,recvTimeout:9e4,preferenceConnectTimeout:6e3,parallelUpgradeDelay:6e3},httpMaxRetryCount:3,maxMessageSize:65536,version:T.version,protocolVersion:2,agent:R,getHost:O,getPort:f,getHttpScheme:E,environmentFallbackHosts:P,getFallbackHosts:y,getHosts:d,checkHost:h,objectifyOptions:l,normaliseOptions:s};function O(p,x,D){return D?x=x==p.restHost&&p.realtimeHost||x||p.realtimeHost:x=x||p.restHost,x}r.getHost=O;function f(p,x){return x||p.tls?p.tlsPort:p.port}r.getPort=f;function E(p){return p.tls?"https://":"http://"}r.getHttpScheme=E;function P(p){return[p+"-a-fallback.ably-realtime.com",p+"-b-fallback.ably-realtime.com",p+"-c-fallback.ably-realtime.com",p+"-d-fallback.ably-realtime.com",p+"-e-fallback.ably-realtime.com"]}r.environmentFallbackHosts=P;function y(p){var x=p.fallbackHosts,D=typeof p.httpMaxRetryCount!="undefined"?p.httpMaxRetryCount:C.httpMaxRetryCount;return x?m.arrChooseN(x,D):[]}r.getFallbackHosts=y;function d(p){return[p.restHost].concat(y(p))}r.getHosts=d;function h(p){if(typeof p!="string")throw new S.default("host must be a string; was a "+typeof p,4e4,400);if(!p.length)throw new S.default("host must not be zero-length",4e4,400)}function w(p,x,D){return p.realtimeHost?p.realtimeHost:p.restHost?(v.default.logAction(v.default.LOG_MINOR,"Defaults.normaliseOptions",'restHost is set to "'+p.restHost+'" but realtimeHost is not set, so setting realtimeHost to "'+p.restHost+'" too. If this is not what you want, please set realtimeHost explicitly.'),p.restHost):x?C.REALTIME_HOST:D+"-"+C.REALTIME_HOST}function c(p){var x={};for(var D in C.TIMEOUTS)x[D]=p[D]||C.TIMEOUTS[D];return x}function u(p){var x=C.agent;if(p.agents)for(var D in p.agents)x+=" "+D+"/"+p.agents[D];return x}r.getAgentString=u;function l(p){return typeof p=="string"?p.indexOf(":")==-1?{token:p}:{key:p}:p}r.objectifyOptions=l;function s(p){if(p.host&&(v.default.renamedClientOption("host","restHost"),p.restHost=p.host),p.wsHost&&(v.default.renamedClientOption("wsHost","realtimeHost"),p.realtimeHost=p.wsHost),p.queueEvents&&(v.default.renamedClientOption("queueEvents","queueMessages"),p.queueMessages=p.queueEvents),p.headers&&v.default.deprecated("the `headers` client option",""),p.fallbackHostsUseDefault){if(p.fallbackHosts){var x="fallbackHosts and fallbackHostsUseDefault cannot both be set";throw v.default.logAction(v.default.LOG_ERROR,"Defaults.normaliseOptions",x),new S.default(x,4e4,400)}if(p.port||p.tlsPort){var x="fallbackHostsUseDefault cannot be set when port or tlsPort are set";throw v.default.logAction(v.default.LOG_ERROR,"Defaults.normaliseOptions",x),new S.default(x,4e4,400)}p.environment?v.default.deprecated("The `fallbackHostsUseDefault` client option","If you’re using this client option to force the library to make use of fallback hosts even though you’ve set the `environment` client option, then this is no longer necessary: remove your usage of the `fallbackHostsUseDefault` client option and the library will then automatically choose the correct fallback hosts to use for the specified environment."):v.default.deprecated("The `fallbackHostsUseDefault` client option","If you’re using this client option to force the library to make use of fallback hosts even though you’re not using the primary Ably environment, then stop using `fallbackHostsUseDefault`, and update your code to either pass the `environment` client option (in which case the library will automatically choose the correct fallback hosts to use for the specified environment), or to pass the `fallbackHosts` client option to specify a custom list of fallback hosts to use (for example, if you’re using a custom CNAME, in which case Ably will have provided you with an explicit list of fallback hosts)."),p.fallbackHosts=C.FALLBACK_HOSTS}p.recover===!0&&(v.default.deprecated("The ability to use a boolean value for the `recover` client option","If you wish for the connection to always be recovered, replace `{ recover: true }` with a function that always passes `true` to its callback: `{ recover: function(lastConnectionDetails, cb) { cb(true); } }`"),p.recover=function(F,b){b(!0)}),typeof p.recover=="function"&&p.closeOnUnload===!0&&(v.default.logAction(v.default.LOG_ERROR,"Defaults.normaliseOptions","closeOnUnload was true and a session recovery function was set - these are mutually exclusive, so unsetting the latter"),p.recover=void 0),"closeOnUnload"in p||(p.closeOnUnload=!p.recover),p.transports&&m.arrIn(p.transports,"xhr")&&(v.default.deprecationWarning('The "xhr" transport has been renamed to "xhr_streaming". Please update your client options code to use `transports: ["xhr_streaming"]` instead. The ability to use `transports: ["xhr"]` will be removed in a future version.'),m.arrDeleteValue(p.transports,"xhr"),p.transports.push("xhr_streaming")),"queueMessages"in p||(p.queueMessages=!0);var D=p.environment&&String(p.environment).toLowerCase()||C.ENVIRONMENT,N=!D||D==="production";!p.fallbackHosts&&!p.restHost&&!p.realtimeHost&&!p.port&&!p.tlsPort&&(p.fallbackHosts=N?C.FALLBACK_HOSTS:P(D));var k=p.restHost||(N?C.REST_HOST:D+"-"+C.REST_HOST),I=w(p,N,D);m.arrForEach((p.fallbackHosts||[]).concat(k,I),h),p.port=p.port||C.PORT,p.tlsPort=p.tlsPort||C.TLS_PORT,"tls"in p||(p.tls=!0);var M=c(p);if("useBinaryProtocol"in p?p.useBinaryProtocol=a.default.Config.supportsBinary&&p.useBinaryProtocol:p.useBinaryProtocol=a.default.Config.preferBinary,p.clientId){var A=p.headers=p.headers||{};A["X-Ably-ClientId"]=a.default.BufferUtils.base64Encode(a.default.BufferUtils.utf8Encode(p.clientId))}"idempotentRestPublishing"in p||(p.idempotentRestPublishing=!0),p.promises&&!a.default.Config.Promise&&(v.default.logAction(v.default.LOG_ERROR,"Defaults.normaliseOptions","{promises: true} was specified, but no Promise constructor found; disabling promises"),p.promises=!1);var j=null,U=p.connectivityCheckUrl;if(p.connectivityCheckUrl){var z=p.connectivityCheckUrl.split("?"),V=z[0],G=z[1];j=G?m.parseQueryString(G):{},V.indexOf("://")===-1&&(V="https://"+V),U=V}return i.__assign(i.__assign({},p),{useBinaryProtocol:"useBinaryProtocol"in p?a.default.Config.supportsBinary&&p.useBinaryProtocol:a.default.Config.preferBinary,realtimeHost:I,restHost:k,maxMessageSize:p.maxMessageSize||C.maxMessageSize,timeouts:M,connectivityCheckParams:j,connectivityCheckUrl:U})}r.normaliseOptions=s,r.default=C;function g(p){return Object.assign(C,p)}r.getDefaults=g},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(3)),m=i.__importDefault(o(2)),v=i.__importDefault(o(4)),S=i.__importStar(o(1));function T(f){return!f||!f.channelOptions?{channelOptions:f,plugins:{},baseEncodedPreviousPayload:void 0}:f}function R(f){if(f&&f.cipher){if(!a.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var E=a.default.Crypto.getCipher(f.cipher);return{cipher:E.cipherParams,channelCipher:E.cipher}}return f!=null?f:{}}function C(f){var E=0;return f.name&&(E+=f.name.length),f.clientId&&(E+=f.clientId.length),f.extras&&(E+=JSON.stringify(f.extras).length),f.data&&(E+=S.dataSizeBytes(f.data)),E}var O=function(){function f(){}return f.prototype.toJSON=function(){var E=this.encoding,P=this.data;return P&&a.default.BufferUtils.isBuffer(P)&&(arguments.length>0?(E=E?E+"/base64":"base64",P=a.default.BufferUtils.base64Encode(P)):P=a.default.BufferUtils.toBuffer(P)),{name:this.name,id:this.id,clientId:this.clientId,connectionId:this.connectionId,connectionKey:this.connectionKey,extras:this.extras,encoding:E,data:P}},f.prototype.toString=function(){var E="[Message";return this.name&&(E+="; name="+this.name),this.id&&(E+="; id="+this.id),this.timestamp&&(E+="; timestamp="+this.timestamp),this.clientId&&(E+="; clientId="+this.clientId),this.connectionId&&(E+="; connectionId="+this.connectionId),this.encoding&&(E+="; encoding="+this.encoding),this.extras&&(E+="; extras ="+JSON.stringify(this.extras)),this.data&&(typeof this.data=="string"?E+="; data="+this.data:a.default.BufferUtils.isBuffer(this.data)?E+="; data (buffer)="+a.default.BufferUtils.base64Encode(this.data):E+="; data (json)="+JSON.stringify(this.data)),this.extras&&(E+="; extras="+JSON.stringify(this.extras)),E+="]",E},f.encrypt=function(E,P,y){var d=E.data,h=E.encoding,w=P.channelCipher;h=h?h+"/":"",a.default.BufferUtils.isBuffer(d)||(d=a.default.BufferUtils.utf8Encode(String(d)),h=h+"utf-8/"),w.encrypt(d,function(c,u){if(c){y(c);return}E.data=u,E.encoding=h+"cipher+"+w.algorithm,y(null,E)})},f.encode=function(E,P,y){var d=E.data,h=typeof d=="string"||a.default.BufferUtils.isBuffer(d)||d===null||d===void 0;if(!h)if(S.isObject(d)||S.isArray(d))E.data=JSON.stringify(d),E.encoding=E.encoding?E.encoding+"/json":"json";else throw new v.default("Data type is unsupported",40013,400);P!=null&&P.cipher?f.encrypt(E,P,y):y(null,E)},f.encodeArray=function(E,P,y){for(var d=0,h=0;h<E.length;h++)f.encode(E[h],P,function(w){if(w){y(w);return}d++,d==E.length&&y(null,E)})},f.decode=function(E,P){var y=T(P),d=E.data,h=E.encoding;if(h){var w=h.split("/"),c=void 0,u=w.length,l=E.data,s="";try{for(;(c=u)>0;){var g=w[--u].match(/([-\w]+)(\+([\w-]+))?/);if(!g)break;switch(s=g[1],s){case"base64":l=a.default.BufferUtils.base64Decode(String(l)),c==w.length&&(d=l);continue;case"utf-8":l=a.default.BufferUtils.utf8Decode(l);continue;case"json":l=JSON.parse(l);continue;case"cipher":if(y.channelOptions!=null&&y.channelOptions.cipher&&y.channelOptions.channelCipher){var p=g[3],x=y.channelOptions.channelCipher;if(p!=x.algorithm)throw new Error("Unable to decrypt message with given cipher; incompatible cipher params");l=x.decrypt(l);continue}else throw new Error("Unable to decrypt message; not an encrypted channel");case"vcdiff":if(!y.plugins||!y.plugins.vcdiff)throw new v.default("Missing Vcdiff decoder (https://github.com/ably-forks/vcdiff-decoder)",40019,400);if(typeof Uint8Array=="undefined")throw new v.default("Delta decoding not supported on this browser (need ArrayBuffer & Uint8Array)",40020,400);try{var D=y.baseEncodedPreviousPayload;typeof D=="string"&&(D=a.default.BufferUtils.utf8Encode(D)),D=a.default.BufferUtils.toBuffer(D),l=a.default.BufferUtils.toBuffer(l),l=a.default.BufferUtils.typedArrayToBuffer(y.plugins.vcdiff.decode(l,D)),d=l}catch(k){throw new v.default("Vcdiff delta decode failed with "+k,40018,400)}continue;default:throw new Error("Unknown encoding")}}}catch(k){var N=k;throw new v.default("Error processing the "+s+" encoding, decoder returned ‘"+N.message+"’",N.code||40013,400)}finally{E.encoding=c<=0?null:w.slice(0,c).join("/"),E.data=l}}y.baseEncodedPreviousPayload=d},f.fromResponseBody=function(E,P,y){y&&(E=S.decodeBody(E,y));for(var d=0;d<E.length;d++){var h=E[d]=f.fromValues(E[d]);try{f.decode(h,P)}catch(w){m.default.logAction(m.default.LOG_ERROR,"Message.fromResponseBody()",w.toString())}}return E},f.fromValues=function(E){return Object.assign(new f,E)},f.fromValuesArray=function(E){for(var P=E.length,y=new Array(P),d=0;d<P;d++)y[d]=f.fromValues(E[d]);return y},f.fromEncoded=function(E,P){var y=f.fromValues(E),d=R(P!=null?P:null);try{f.decode(y,d)}catch(h){m.default.logAction(m.default.LOG_ERROR,"Message.fromEncoded()",h.toString())}return y},f.fromEncodedArray=function(E,P){return E.map(function(y){return f.fromEncoded(y,P)})},f.getMessagesSize=function(E){for(var P,y=0,d=0;d<E.length;d++)P=E[d],y+=P.size||(P.size=C(P));return y},f.serialize=S.encodeBody,f}();r.default=O},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(4)),v=i.__importDefault(o(9)),S=i.__importDefault(o(16)),T={HEARTBEAT:0,ACK:1,NACK:2,CONNECT:3,CONNECTED:4,DISCONNECT:5,DISCONNECTED:6,CLOSE:7,CLOSED:8,ERROR:9,ATTACH:10,ATTACHED:11,DETACH:12,DETACHED:13,PRESENCE:14,MESSAGE:15,SYNC:16,AUTH:17,ACTIVATE:18},R=[];Object.keys(T).forEach(function(y){R[T[y]]=y});var C={HAS_PRESENCE:1,HAS_BACKLOG:2,RESUMED:4,TRANSIENT:16,ATTACH_RESUME:32,PRESENCE:65536,PUBLISH:1<<17,SUBSCRIBE:1<<18,PRESENCE_SUBSCRIBE:1<<19},O=Object.keys(C);C.MODE_ALL=C.PRESENCE|C.PUBLISH|C.SUBSCRIBE|C.PRESENCE_SUBSCRIBE;function f(y){var d=[];if(y)for(var h=0;h<y.length;h++)d.push(y[h].toString());return"[ "+d.join(", ")+" ]"}var E="id channel channelSerial connectionId count msgSerial timestamp".split(" "),P=function(){function y(){var d=this;this.hasFlag=function(h){return(d.flags&C[h])>0}}return y.prototype.setFlag=function(d){return this.flags=this.flags|C[d]},y.prototype.getMode=function(){return this.flags&&this.flags&C.MODE_ALL},y.prototype.encodeModesToFlags=function(d){var h=this;d.forEach(function(w){return h.setFlag(w)})},y.prototype.decodeModesFromFlags=function(){var d=this,h=[];return y.channelModes.forEach(function(w){d.hasFlag(w)&&h.push(w)}),h.length>0?h:void 0},y.fromValues=function(d){return Object.assign(new y,d)},y.Action=T,y.channelModes=["PRESENCE","PUBLISH","SUBSCRIBE","PRESENCE_SUBSCRIBE"],y.ActionName=R,y.serialize=a.encodeBody,y.deserialize=function(d,h){var w=a.decodeBody(d,h);return y.fromDeserialized(w)},y.fromDeserialized=function(d){var h=d.error;h&&(d.error=m.default.fromValues(h));var w=d.messages;if(w)for(var c=0;c<w.length;c++)w[c]=v.default.fromValues(w[c]);var u=d.presence;if(u)for(var c=0;c<u.length;c++)u[c]=S.default.fromValues(u[c],!0);return Object.assign(new y,d)},y.stringify=function(d){var h="[ProtocolMessage";d.action!==void 0&&(h+="; action="+y.ActionName[d.action]||!1);for(var w,c=0;c<E.length;c++)w=E[c],d[w]!==void 0&&(h+="; "+w+"="+d[w]);if(d.messages&&(h+="; messages="+f(v.default.fromValuesArray(d.messages))),d.presence&&(h+="; presence="+f(S.default.fromValuesArray(d.presence))),d.error&&(h+="; error="+m.default.fromValues(d.error).toString()),d.auth&&d.auth.accessToken&&(h+="; token="+d.auth.accessToken),d.flags&&(h+="; flags="+O.filter(d.hasFlag).join(",")),d.params){var u="";a.forInOwnNonNullProperties(d.params,function(l){u.length>0&&(u+="; "),u+=l+"="+d.params[l]}),u.length>0&&(h+="; params=["+u+"]")}return h+="]",h},y}();r.default=P},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){var a=i,m=a.lib,v=m.WordArray,S=a.enc;S.Base64={stringify:function(R){var C=R.words,O=R.sigBytes,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";R.clamp();for(var E=[],P=0;P<O;P+=3)for(var y=C[P>>>2]>>>24-P%4*8&255,d=C[P+1>>>2]>>>24-(P+1)%4*8&255,h=C[P+2>>>2]>>>24-(P+2)%4*8&255,w=y<<16|d<<8|h,c=0;c<4&&P+c*.75<O;c++)E.push(f.charAt(w>>>6*(3-c)&63));var u=f.charAt(64);if(u)for(;E.length%4;)E.push(u);return E.join("")},parse:function(R){var C=R.length,O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var E=0;E<O.length;E++)f[O.charCodeAt(E)]=E}var P=O.charAt(64);if(P){var y=R.indexOf(P);y!==-1&&(C=y)}return T(R,C,f)}};function T(R,C,O){for(var f=[],E=0,P=0;P<C;P++)if(P%4){var y=O[R.charCodeAt(P-1)]<<P%4*2,d=O[R.charCodeAt(P)]>>>6-P%4*2,h=y|d;f[E>>>2]|=h<<24-E%4*8,E++}return v.create(f,E)}}(),i.enc.Base64})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(10)),v=i.__importDefault(o(26)),S=i.__importDefault(o(2)),T=i.__importDefault(o(8)),R=i.__importDefault(o(21)),C=i.__importDefault(o(18)),O=i.__importDefault(o(4)),f=i.__importDefault(o(22)),E=i.__importDefault(o(3));function P(h){var w=[80015,80017,80030];return h.code?C.default.isTokenErr(h)?!1:a.arrIn(w,h.code)?!0:h.code>=4e4&&h.code<5e4:!1}function y(h){return P(h)?[m.default.fromValues({action:m.default.Action.ERROR,error:h})]:[m.default.fromValues({action:m.default.Action.DISCONNECTED,error:h})]}var d=function(h){i.__extends(w,h);function w(c,u,l){var s=h.call(this,c,u,l,!0)||this;return s.onAuthUpdated=function(g){s.authParams={access_token:g.token}},s.stream="stream"in l?l.stream:!0,s.sendRequest=null,s.recvRequest=null,s.pendingCallback=null,s.pendingItems=null,s}return w.prototype.connect=function(){var c=this;S.default.logAction(S.default.LOG_MINOR,"CometTransport.connect()","starting"),v.default.prototype.connect.call(this);var u=this.params,l=u.options,s=T.default.getHost(l,u.host),g=T.default.getPort(l),p=l.tls?"https://":"http://";this.baseUri=p+s+":"+g+"/comet/";var x=this.baseUri+"connect";S.default.logAction(S.default.LOG_MINOR,"CometTransport.connect()","uri: "+x),this.auth.getAuthParams(function(D,N){if(D){c.disconnect(D);return}if(!c.isDisposed){c.authParams=N;var k=c.params.getConnectParams(N);"stream"in k&&(c.stream=k.stream),S.default.logAction(S.default.LOG_MINOR,"CometTransport.connect()","connectParams:"+a.toQueryString(k));var I=!1,M=c.recvRequest=c.createRequest(x,null,k,null,c.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV);M.on("data",function(A){c.recvRequest&&(I||(I=!0,c.emit("preconnect")),c.onData(A))}),M.on("complete",function(A){if(c.recvRequest||(A=A||new O.default("Request cancelled",80003,400)),c.recvRequest=null,!I&&!A&&(I=!0,c.emit("preconnect")),c.onActivity(),A){A.code?c.onData(y(A)):c.disconnect(A);return}E.default.Config.nextTick(function(){c.recv()})}),M.exec()}})},w.prototype.requestClose=function(){S.default.logAction(S.default.LOG_MINOR,"CometTransport.requestClose()"),this._requestCloseOrDisconnect(!0)},w.prototype.requestDisconnect=function(){S.default.logAction(S.default.LOG_MINOR,"CometTransport.requestDisconnect()"),this._requestCloseOrDisconnect(!1)},w.prototype._requestCloseOrDisconnect=function(c){var u=this,l=c?this.closeUri:this.disconnectUri;if(l){var s=this.createRequest(l,null,this.authParams,null,f.default.REQ_SEND);s.on("complete",function(g){g&&(S.default.logAction(S.default.LOG_ERROR,"CometTransport.request"+(c?"Close()":"Disconnect()"),"request returned err = "+a.inspectError(g)),u.finish("disconnected",g))}),s.exec()}},w.prototype.dispose=function(){var c=this;S.default.logAction(S.default.LOG_MINOR,"CometTransport.dispose()",""),this.isDisposed||(this.isDisposed=!0,this.recvRequest&&(S.default.logAction(S.default.LOG_MINOR,"CometTransport.dispose()","aborting recv request"),this.recvRequest.abort(),this.recvRequest=null),this.finish("disconnected",R.default.disconnected()),E.default.Config.nextTick(function(){c.emit("disposed")}))},w.prototype.onConnect=function(c){var u;if(!this.isDisposed){var l=(u=c.connectionDetails)===null||u===void 0?void 0:u.connectionKey;v.default.prototype.onConnect.call(this,c);var s=this.baseUri+l;S.default.logAction(S.default.LOG_MICRO,"CometTransport.onConnect()","baseUri = "+s),this.sendUri=s+"/send",this.recvUri=s+"/recv",this.closeUri=s+"/close",this.disconnectUri=s+"/disconnect"}},w.prototype.send=function(c){if(this.sendRequest){this.pendingItems=this.pendingItems||[],this.pendingItems.push(c);return}var u=this.pendingItems||[];u.push(c),this.pendingItems=null,this.sendItems(u)},w.prototype.sendAnyPending=function(){var c=this.pendingItems;c&&(this.pendingItems=null,this.sendItems(c))},w.prototype.sendItems=function(c){var u=this,l=this.sendRequest=this.createRequest(this.sendUri,null,this.authParams,this.encodeRequest(c),f.default.REQ_SEND);l.on("complete",function(s,g){if(s&&S.default.logAction(S.default.LOG_ERROR,"CometTransport.sendItems()","on complete: err = "+a.inspectError(s)),u.sendRequest=null,s){s.code?u.onData(y(s)):u.disconnect(s);return}g&&u.onData(g),u.pendingItems&&E.default.Config.nextTick(function(){u.sendRequest||u.sendAnyPending()})}),l.exec()},w.prototype.recv=function(){var c=this;if(!this.recvRequest&&this.isConnected){var u=this.recvRequest=this.createRequest(this.recvUri,null,this.authParams,null,this.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV_POLL);u.on("data",function(l){c.onData(l)}),u.on("complete",function(l){if(c.recvRequest=null,c.onActivity(),l){l.code?c.onData(y(l)):c.disconnect(l);return}E.default.Config.nextTick(function(){c.recv()})}),u.exec()}},w.prototype.onData=function(c){try{var u=this.decodeResponse(c);if(u&&u.length)for(var l=0;l<u.length;l++)this.onProtocolMessage(m.default.fromDeserialized(u[l]))}catch(s){S.default.logAction(S.default.LOG_ERROR,"CometTransport.onData()","Unexpected exception handing channel event: "+s.stack)}},w.prototype.encodeRequest=function(c){return JSON.stringify(c)},w.prototype.decodeResponse=function(c){return typeof c=="string"?JSON.parse(c):c},w}(v.default);r.default=d},function(n,r){var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(i){typeof window=="object"&&(o=window)}n.exports=o},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.isSuccessCode=void 0;var i;(function(m){m[m.Success=200]="Success",m[m.NoContent=204]="NoContent",m[m.BadRequest=400]="BadRequest",m[m.Unauthorized=401]="Unauthorized",m[m.Forbidden=403]="Forbidden",m[m.RequestTimeout=408]="RequestTimeout",m[m.InternalServerError=500]="InternalServerError"})(i||(i={}));function a(m){return m>=i.Success&&m<i.BadRequest}r.isSuccessCode=a,r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(3)),m=i.__importStar(o(1)),v=i.__importDefault(o(2)),S=i.__importDefault(o(18)),T=i.__importDefault(o(19)),R=o(4),C=i.__importDefault(o(14));function O(h,w,c,u,l){h.http.supportsAuthHeaders?h.auth.getAuthHeaders(function(s,g){s?u(s):l(m.mixin(g,w),c)}):h.auth.getAuthParams(function(s,g){s?u(s):l(w,m.mixin(g,c))})}function f(h,w){return function(c,u,l,s,g){if(c&&!u){h(c);return}if(g===C.default.NoContent){h(c,[],l,!0,g);return}if(!s)try{u=m.decodeBody(u,w)}catch(I){m.isErrorInfoOrPartialErrorInfo(I)?h(I):h(new R.PartialErrorInfo(m.inspectError(I),null));return}if(!u){h(new R.PartialErrorInfo("unenvelope(): Response body is missing",null));return}var p=u,x=p.statusCode,D=p.response,N=p.headers;if(x===void 0){h(c,u,l,!0,g);return}if(x<200||x>=300){var k=D&&D.error||c;k||(k=new Error("Error in unenveloping "+u),k.statusCode=x),h(k,D,N,!0,x);return}h(c,D,N,!0,x)}}function E(h){var w=[];if(h)for(var c in h)w.push(c+"="+h[c]);return w.join("&")}function P(h,w){return h+(w?"?":"")+E(w)}function y(h,w,c,u){return function(l,s,g,p,x){l?v.default.logAction(v.default.LOG_MICRO,"Resource."+w+"()","Received Error; "+P(c,u)+"; Error: "+m.inspectError(l)):v.default.logAction(v.default.LOG_MICRO,"Resource."+w+"()","Received; "+P(c,u)+"; Headers: "+E(g)+"; StatusCode: "+x+"; Body: "+(a.default.BufferUtils.isBuffer(s)?s.toString():s)),h&&h(l,s,g,p,x)}}var d=function(){function h(){}return h.get=function(w,c,u,l,s,g){h.do(T.default.Get,w,c,null,u,l,s,g)},h.delete=function(w,c,u,l,s,g){h.do(T.default.Delete,w,c,null,u,l,s,g)},h.post=function(w,c,u,l,s,g,p){h.do(T.default.Post,w,c,u,l,s,g,p)},h.patch=function(w,c,u,l,s,g,p){h.do(T.default.Patch,w,c,u,l,s,g,p)},h.put=function(w,c,u,l,s,g,p){h.do(T.default.Put,w,c,u,l,s,g,p)},h.do=function(w,c,u,l,s,g,p,x){v.default.shouldLog(v.default.LOG_MICRO)&&(x=y(x,w,u,g)),p&&(x=x&&f(x,p),(g=g||{}).envelope=p);function D(N,k){var I;if(v.default.shouldLog(v.default.LOG_MICRO)&&v.default.logAction(v.default.LOG_MICRO,"Resource."+w+"()","Sending; "+P(u,k)),v.default.shouldLog(v.default.LOG_MICRO)){var M=l;if(((I=N["content-type"])===null||I===void 0?void 0:I.indexOf("msgpack"))>0)try{M=a.default.Config.msgpack.decode(l)}catch(A){v.default.logAction(v.default.LOG_MICRO,"Resource."+w+"()","Sending MsgPack Decoding Error: "+m.inspectError(A))}v.default.logAction(v.default.LOG_MICRO,"Resource."+w+"()","Sending; "+P(u,k)+"; Body: "+M)}c.http.do(w,c,u,N,l,k,function(A,j,U,z,V){if(A&&S.default.isTokenErr(A)){c.auth.authorize(null,null,function(G){if(G){x(G);return}O(c,N,k,x,D)});return}x(A,j,U,z,V)})}O(c,s,g,x,D)},h}();r.default=d},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(2)),m=i.__importDefault(o(3)),v=i.__importDefault(o(9)),S=i.__importStar(o(1));function T(C){return R.Actions.indexOf(C)}var R=function(){function C(){}return C.prototype.isSynthesized=function(){return!this.id||!this.connectionId?!0:this.id.substring(this.connectionId.length,0)!==this.connectionId},C.prototype.parseId=function(){if(!this.id)throw new Error("parseId(): Presence message does not contain an id");var O=this.id.split(":");return{connectionId:O[0],msgSerial:parseInt(O[1],10),index:parseInt(O[2],10)}},C.prototype.toJSON=function(){var O=this.data,f=this.encoding;return O&&m.default.BufferUtils.isBuffer(O)&&(arguments.length>0?(f=f?f+"/base64":"base64",O=m.default.BufferUtils.base64Encode(O)):O=m.default.BufferUtils.toBuffer(O)),{id:this.id,clientId:this.clientId,action:T(this.action),data:O,encoding:f,extras:this.extras}},C.prototype.toString=function(){var O="[PresenceMessage";return O+="; action="+this.action,this.id&&(O+="; id="+this.id),this.timestamp&&(O+="; timestamp="+this.timestamp),this.clientId&&(O+="; clientId="+this.clientId),this.connectionId&&(O+="; connectionId="+this.connectionId),this.encoding&&(O+="; encoding="+this.encoding),this.data&&(typeof this.data=="string"?O+="; data="+this.data:m.default.BufferUtils.isBuffer(this.data)?O+="; data (buffer)="+m.default.BufferUtils.base64Encode(this.data):O+="; data (json)="+JSON.stringify(this.data)),this.extras&&(O+="; extras="+JSON.stringify(this.extras)),O+="]",O},C.fromResponseBody=function(O,f,E){var P=[];E&&(O=S.decodeBody(O,E));for(var y=0;y<O.length;y++){var d=P[y]=C.fromValues(O[y],!0);try{C.decode(d,f)}catch(h){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromResponseBody()",h.toString())}}return P},C.fromValues=function(O,f){return f&&(O.action=C.Actions[O.action]),Object.assign(new C,O)},C.fromValuesArray=function(O){for(var f=O.length,E=new Array(f),P=0;P<f;P++)E[P]=C.fromValues(O[P]);return E},C.fromEncoded=function(O,f){var E=C.fromValues(O,!0);try{C.decode(E,f!=null?f:{})}catch(P){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromEncoded()",P.toString())}return E},C.fromEncodedArray=function(O,f){return O.map(function(E){return C.fromEncoded(E,f)})},C.fromData=function(O){return O instanceof C?O:C.fromValues({data:O})},C.Actions=["absent","present","enter","leave","update"],C.encode=v.default.encode,C.decode=v.default.decode,C.getMessagesSize=v.default.getMessagesSize,C}();r.default=R},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),m=a.__importStar(o(1)),v=a.__importDefault(o(7)),S=a.__importStar(o(4)),T=a.__importDefault(o(2)),R=a.__importDefault(o(8)),C=a.__importDefault(o(22)),O=a.__importDefault(o(3));function f(p,x){return m.arrIn(m.allToLowerCase(m.keysArray(x)),"x-ably-errorcode")}function E(p,x){if(f(p,x))return p.error&&S.default.fromValues(p.error)}var P=function(){},y=0,d={},h=typeof i!="undefined"&&i.XDomainRequest;function w(){var p=navigator.userAgent.toString().match(/MSIE\s([\d.]+)/);return p&&Number(p[1])}function c(){var p;return h&&(p=w())&&p===10}function u(p,x){return p.getResponseHeader&&p.getResponseHeader(x)}function l(p){return p.getResponseHeader&&(p.getResponseHeader("transfer-encoding")||!p.getResponseHeader("content-length"))}function s(p){for(var x=m.trim(p.getAllResponseHeaders()).split(`\r
83
- `),D={},N=0;N<x.length;N++){var k=x[N].split(":").map(m.trim);D[k[0].toLowerCase()]=k[1]}return D}var g=function(p){a.__extends(x,p);function x(D,N,k,I,M,A,j){var U=p.call(this)||this;return k=k||{},k.rnd=m.cheapRandStr(),c()&&!k.envelope&&(k.envelope="json"),U.uri=D+m.toQueryString(k),U.headers=N||{},U.body=I,U.method=j?j.toUpperCase():m.isEmptyArg(I)?"GET":"POST",U.requestMode=M,U.timeouts=A,U.timedOut=!1,U.requestComplete=!1,U.id=String(++y),d[U.id]=U,U}return x.createRequest=function(D,N,k,I,M,A,j){var U=A||R.default.TIMEOUTS;return new x(D,N,m.copy(k),I,M,U,j)},x.prototype.complete=function(D,N,k,I,M){this.requestComplete||(this.requestComplete=!0,!D&&N&&this.emit("data",N),this.emit("complete",D,N,k,I,M),this.dispose())},x.prototype.abort=function(){this.dispose()},x.prototype.exec=function(){var D=this,N=this.headers,k=this.requestMode==C.default.REQ_SEND?this.timeouts.httpRequestTimeout:this.timeouts.recvTimeout,I=this.timer=setTimeout(function(){D.timedOut=!0,A.abort()},k),M=this.method,A=this.xhr=new XMLHttpRequest,j=N.accept,U=this.body,z="text";if(j?j.indexOf("application/x-msgpack")===0&&(z="arraybuffer"):N.accept="application/json",U){var V=N["content-type"]||(N["content-type"]="application/json");V.indexOf("application/json")>-1&&typeof U!="string"&&(U=JSON.stringify(U))}A.open(M,this.uri,!0),A.responseType=z,"authorization"in N&&(A.withCredentials=!0);for(var G in N)A.setRequestHeader(G,N[G]);var F=function(Z,he,Me,_e){var Ee,Mt=he+" (event type: "+Z.type+")";!((Ee=D==null?void 0:D.xhr)===null||Ee===void 0)&&Ee.statusText&&(Mt+=", current statusText is "+D.xhr.statusText),T.default.logAction(T.default.LOG_ERROR,"Request.on"+Z.type+"()",Mt),D.complete(new S.PartialErrorInfo(Mt,Me,_e))};A.onerror=function(Z){F(Z,"XHR error occurred",null,400)},A.onabort=function(Z){D.timedOut?F(Z,"Request aborted due to request timeout expiring",null,408):F(Z,"Request cancelled",null,400)},A.ontimeout=function(Z){F(Z,"Request timed out",null,408)};var b,L,B,_=0,W=!1,Y=function(){if(clearTimeout(I),B=L<400,L==204){D.complete(null,null,null,null,L);return}b=D.requestMode==C.default.REQ_RECV_STREAM&&B&&l(A)},X=function(){var Z;try{var he=u(A,"content-type"),Me=he?he.indexOf("application/json")>=0:A.responseType=="text";if(Me){var _e=A.responseType==="arraybuffer"?O.default.BufferUtils.utf8Decode(A.response):String(A.responseText);_e.length?Z=JSON.parse(_e):Z=_e,W=!0}else Z=A.response;Z.response!==void 0?(L=Z.statusCode,B=L<400,N=Z.headers,Z=Z.response):N=s(A)}catch(Mt){D.complete(new S.PartialErrorInfo("Malformed response body from server: "+Mt.message,null,400));return}if(B||m.isArray(Z)){D.complete(null,Z,N,W,L);return}var Ee=E(Z,N);Ee||(Ee=new S.PartialErrorInfo("Error response received from server: "+L+" body was: "+O.default.Config.inspect(Z),null,L)),D.complete(Ee,Z,N,W,L)};function te(){for(var Z=A.responseText,he=Z.length-1,Me,_e;_<he&&(Me=Z.indexOf(`
84
- `,_))>-1;)_e=Z.slice(_,Me),_=Me+1,re(_e)}var re=function(Z){try{Z=JSON.parse(Z)}catch(he){D.complete(new S.PartialErrorInfo("Malformed response body from server: "+he.message,null,400));return}D.emit("data",Z)},le=function(){te(),D.streamComplete=!0,O.default.Config.nextTick(function(){D.complete()})};A.onreadystatechange=function(){var Z=A.readyState;Z<3||A.status!==0&&(L===void 0&&(L=A.status,L===1223&&(L=204),Y()),Z==3&&b?te():Z==4&&(b?le():X()))},A.send(U)},x.prototype.dispose=function(){var D=this.xhr;if(D){D.onreadystatechange=D.onerror=D.onabort=D.ontimeout=P,this.xhr=null;var N=this.timer;N&&(clearTimeout(N),this.timer=null),this.requestComplete||D.abort()}delete d[this.id]},x}(v.default);r.default=g}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(2)),m=i.__importStar(o(1)),v=i.__importDefault(o(24)),S=i.__importDefault(o(4)),T=i.__importDefault(o(45)),R=o(11),C=i.__importDefault(o(19)),O=i.__importDefault(o(14)),f=i.__importDefault(o(3)),E=i.__importDefault(o(15)),P=Math.pow(2,17);function y(){}function d(){return("000000"+Math.floor(Math.random()*1e16)).slice(-16)}function h(k){return!!k.connection}function w(k){return m.isErrorInfoOrPartialErrorInfo(k)?(k.code||(k.statusCode===403?k.code=40300:(k.code=40170,k.statusCode=401)),k):new S.default(m.inspectError(k),k.code||40170,k.statusCode||401)}var c=function(k,I){if(f.default.Config.createHmac){var M=f.default.Config.createHmac("SHA256",I);return M.update(k),M.digest("base64")}return(0,R.stringify)((0,T.default)(k,I))};function u(k){if(!k)return"";typeof k=="string"&&(k=JSON.parse(k));var I=Object.create(null),M=m.keysArray(k,!0);if(!M)return"";M.sort();for(var A=0;A<M.length;A++)I[M[A]]=k[M[A]].sort();return JSON.stringify(I)}function l(k){if(k.authCallback)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with authCallback");else if(k.authUrl)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with authUrl");else if(k.key)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with client-side signing");else if(k.tokenDetails)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with supplied token only");else{var I="authOptions must include valid authentication parameters";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",I),new Error(I)}}function s(k){return"useTokenAuth"in k&&!k.useTokenAuth}function g(k){return k.useTokenAuth||!s(k)&&(k.authCallback||k.authUrl||k.token||k.tokenDetails)}function p(k){return!k.key&&!k.authCallback&&!k.authUrl}var x=0;function D(){return x++}var N=function(){function k(I,M){if(this.authOptions={},this.client=I,this.tokenParams=M.defaultTokenParams||{},this.currentTokenRequestId=null,this.waitingForTokenRequest=null,g(M)){if(M.key&&!c){var A="client-side token request signing not supported";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",A),new Error(A)}p(M)&&a.default.logAction(a.default.LOG_ERROR,"Auth()","Warning: library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help"),this._saveTokenOptions(M.defaultTokenParams,M),l(this.authOptions)}else{if(!M.key){var A="No authentication options provided; need one of: key, authUrl, or authCallback (or for testing only, token or tokenDetails)";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",A),new S.default(A,40160,401)}a.default.logAction(a.default.LOG_MINOR,"Auth()","anonymous, using basic auth"),this._saveBasicOptions(M)}}return k.prototype.authorize=function(I,M,A){var j=this,U;if(typeof I=="function"&&!A?(A=I,U=I=null):typeof M=="function"&&!A?(A=M,U=null):U=M,!A&&this.client.options.promises)return m.promisify(this,"authorize",arguments);if(U&&U.key&&this.authOptions.key!==U.key)throw new S.default("Unable to update auth options with incompatible key",40102,401);U&&"force"in U&&(a.default.deprecated("The `force` auth option","If you’re using this option to force `authorize()` to fetch a new token even if the current token has not expired, this is no longer necessary, as `authorize()` now always fetches a new token. Update your code to no longer pass the `force` auth option. Note that, in general, passing an auth options argument to `authorize()` will overwrite the library’s stored auth options, which may not be what you want. The library currently contains a special case behavior where passing an auth options object which only contains `{ force: true }` will _not_ overwrite the stored options. This special case behavior will be removed alongside support for the `force` option, so if you’re currently passing `authorize()` an auth options object which only contains `{ force: true }`, you should stop passing it an auth options object entirely."),m.isOnlyPropIn(U,"force")&&(U=null)),this._forceNewToken(I,U,function(z,V){if(z){j.client.connection&&z.statusCode===O.default.Forbidden&&j.client.connection.connectionManager.actOnErrorFromAuthorize(z),A==null||A(z);return}h(j.client)?j.client.connection.connectionManager.onAuthUpdated(V,A||y):A==null||A(null,V)})},k.prototype.authorise=function(I,M,A){a.default.renamedMethod("Auth","authorise","authorize"),this.authorize(I,M,A)},k.prototype._forceNewToken=function(I,M,A){var j=this;this.tokenDetails=null,this._saveTokenOptions(I,M),l(this.authOptions),this._ensureValidAuthCredentials(!0,function(U,z){delete j.tokenParams.timestamp,delete j.authOptions.queryTime,A(U,z)})},k.prototype.requestToken=function(I,M,A){var j=this;if(typeof I=="function"&&!A?(A=I,M=I=null):typeof M=="function"&&!A&&(A=M,M=null),!A&&this.client.options.promises)return m.promisify(this,"requestToken",arguments);M=M||this.authOptions,I=I||m.copy(this.tokenParams);var U=A||y,z,V=this.client;if(M.authCallback)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with authCallback"),z=M.authCallback;else if(M.authUrl)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with authUrl"),z=function(_,W){var Y=m.mixin({accept:"application/json, text/plain"},M.authHeaders),X=M.authMethod&&M.authMethod.toLowerCase()==="post",te,re=M.authUrl.indexOf("?");re>-1&&(te=m.parseQueryString(M.authUrl.slice(re)),M.authUrl=M.authUrl.slice(0,re),X||(M.authParams=m.mixin(te,M.authParams)));var le=m.mixin({},M.authParams||{},_),Z=function(_e,Ee,Mt,qo){var ft;if(_e?a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Received Error: "+m.inspectError(_e)):(ft=Mt["content-type"],a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Received; content-type: "+ft+"; body: "+m.inspectBody(Ee))),_e||qo)return W(_e,Ee);if(f.default.BufferUtils.isBuffer(Ee)&&(Ee=Ee.toString()),!ft){W(new S.default("authUrl response is missing a content-type header",40170,401));return}var ei=ft.indexOf("application/json")>-1,ws=ft.indexOf("text/plain")>-1||ft.indexOf("application/jwt")>-1;if(!ei&&!ws){W(new S.default("authUrl responded with unacceptable content-type "+ft+", should be either text/plain, application/jwt or application/json",40170,401));return}if(ei){if(Ee.length>P){W(new S.default("authUrl response exceeded max permitted length",40170,401));return}try{Ee=JSON.parse(Ee)}catch(Ss){W(new S.default("Unexpected error processing authURL response; err = "+Ss.message,40170,401));return}}W(null,Ee,ft)};if(a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Requesting token from "+M.authUrl+"; Params: "+JSON.stringify(le)+"; method: "+(X?"POST":"GET")),X){var he=Y||{};he["content-type"]="application/x-www-form-urlencoded";var Me=m.toQueryString(le).slice(1);j.client.http.doUri(C.default.Post,V,M.authUrl,he,Me,te,Z)}else j.client.http.doUri(C.default.Get,V,M.authUrl,Y||{},null,le,Z)};else if(M.key)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with client-side signing"),z=function(_,W){j.createTokenRequest(_,M,W)};else{var G="Need a new token, but authOptions does not include any way to request one (no authUrl, authCallback, or key)";a.default.logAction(a.default.LOG_ERROR,"Auth()","library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help"),U(new S.default(G,40171,403));return}"capability"in I&&(I.capability=u(I.capability));var F=function(_,W){var Y=_.keyName,X="/keys/"+Y+"/requestToken",te=function(le){return V.baseUri(le)+X},re=m.defaultPostHeaders(j.client.options);M.requestHeaders&&m.mixin(re,M.requestHeaders),a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().requestToken","Sending POST to "+X+"; Token params: "+JSON.stringify(_)),j.client.http.do(C.default.Post,V,te,re,JSON.stringify(_),null,W)},b=!1,L=this.client.options.timeouts.realtimeRequestTimeout,B=setTimeout(function(){b=!0;var _="Token request callback timed out after "+L/1e3+" seconds";a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",_),U(new S.default(_,40170,401))},L);z(I,function(_,W,Y){if(!b){if(clearTimeout(B),_){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request signing call returned error; err = "+m.inspectError(_)),U(w(_));return}if(typeof W=="string"){W.length===0?U(new S.default("Token string is empty",40170,401)):W.length>P?U(new S.default("Token string exceeded max permitted length (was "+W.length+" bytes)",40170,401)):W==="undefined"||W==="null"?U(new S.default("Token string was literal null/undefined",40170,401)):W[0]==="{"&&!(Y&&Y.indexOf("application/jwt")>-1)?U(new S.default("Token was double-encoded; make sure you're not JSON-encoding an already encoded token request or details",40170,401)):U(null,{token:W});return}if(typeof W!="object"){var X="Expected token request callback to call back with a token string or token request/details object, but got a "+typeof W;a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",X),U(new S.default(X,40170,401));return}var te=JSON.stringify(W).length;if(te>P&&!M.suppressMaxLengthCheck){U(new S.default("Token request/details object exceeded max permitted stringified size (was "+te+" bytes)",40170,401));return}if("issued"in W){U(null,W);return}if(!("keyName"in W)){var X="Expected token request callback to call back with a token string, token request object, or token details object";a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",X),U(new S.default(X,40170,401));return}F(W,function(re,le,Z,he){if(re){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request API call returned error; err = "+m.inspectError(re)),U(w(re));return}he||(le=JSON.parse(le)),a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","token received"),U(null,le)})}})},k.prototype.createTokenRequest=function(I,M,A){var j=this;if(typeof I=="function"&&!A?(A=I,M=I=null):typeof M=="function"&&!A&&(A=M,M=null),!A&&this.client.options.promises)return m.promisify(this,"createTokenRequest",arguments);M=M||this.authOptions,I=I||m.copy(this.tokenParams);var U=M.key;if(!U){A(new S.default("No key specified",40101,403));return}var z=U.split(":"),V=z[0],G=z[1];if(!G){A(new S.default("Invalid key specified",40101,403));return}if(I.clientId===""){A(new S.default("clientId can’t be an empty string",40012,400));return}"capability"in I&&(I.capability=u(I.capability));var F=m.mixin({keyName:V},I),b=I.clientId||"",L=I.ttl||"",B=I.capability||"";(function(_){if(F.timestamp){_();return}j.getTimestamp(M&&M.queryTime,function(W,Y){if(W){A(W);return}F.timestamp=Y,_()})})(function(){var _=F.nonce||(F.nonce=d()),W=F.timestamp,Y=F.keyName+`
82
+ ***************************************************************************** */var i=function(I,M){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,j){A.__proto__=j}||function(A,j){for(var U in j)Object.prototype.hasOwnProperty.call(j,U)&&(A[U]=j[U])},i(I,M)};function a(I,M){if(typeof M!="function"&&M!==null)throw new TypeError("Class extends value "+String(M)+" is not a constructor or null");i(I,M);function A(){this.constructor=I}I.prototype=M===null?Object.create(M):(A.prototype=M.prototype,new A)}var m=function(){return m=Object.assign||function(M){for(var A,j=1,U=arguments.length;j<U;j++){A=arguments[j];for(var z in A)Object.prototype.hasOwnProperty.call(A,z)&&(M[z]=A[z])}return M},m.apply(this,arguments)};function v(I,M){var A={};for(var j in I)Object.prototype.hasOwnProperty.call(I,j)&&M.indexOf(j)<0&&(A[j]=I[j]);if(I!=null&&typeof Object.getOwnPropertySymbols=="function")for(var U=0,j=Object.getOwnPropertySymbols(I);U<j.length;U++)M.indexOf(j[U])<0&&Object.prototype.propertyIsEnumerable.call(I,j[U])&&(A[j[U]]=I[j[U]]);return A}function S(I,M,A,j){var U=arguments.length,z=U<3?M:j===null?j=Object.getOwnPropertyDescriptor(M,A):j,W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(I,M,A,j);else for(var G=I.length-1;G>=0;G--)(W=I[G])&&(z=(U<3?W(z):U>3?W(M,A,z):W(M,A))||z);return U>3&&z&&Object.defineProperty(M,A,z),z}function T(I,M){return function(A,j){M(A,j,I)}}function R(I,M){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(I,M)}function C(I,M,A,j){function U(z){return z instanceof A?z:new A(function(W){W(z)})}return new(A||(A=Promise))(function(z,W){function G(L){try{b(j.next(L))}catch(B){W(B)}}function F(L){try{b(j.throw(L))}catch(B){W(B)}}function b(L){L.done?z(L.value):U(L.value).then(G,F)}b((j=j.apply(I,M||[])).next())})}function O(I,M){var A={label:0,sent:function(){if(z[0]&1)throw z[1];return z[1]},trys:[],ops:[]},j,U,z,W;return W={next:G(0),throw:G(1),return:G(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function G(b){return function(L){return F([b,L])}}function F(b){if(j)throw new TypeError("Generator is already executing.");for(;A;)try{if(j=1,U&&(z=b[0]&2?U.return:b[0]?U.throw||((z=U.return)&&z.call(U),0):U.next)&&!(z=z.call(U,b[1])).done)return z;switch(U=0,z&&(b=[b[0]&2,z.value]),b[0]){case 0:case 1:z=b;break;case 4:return A.label++,{value:b[1],done:!1};case 5:A.label++,U=b[1],b=[0];continue;case 7:b=A.ops.pop(),A.trys.pop();continue;default:if(z=A.trys,!(z=z.length>0&&z[z.length-1])&&(b[0]===6||b[0]===2)){A=0;continue}if(b[0]===3&&(!z||b[1]>z[0]&&b[1]<z[3])){A.label=b[1];break}if(b[0]===6&&A.label<z[1]){A.label=z[1],z=b;break}if(z&&A.label<z[2]){A.label=z[2],A.ops.push(b);break}z[2]&&A.ops.pop(),A.trys.pop();continue}b=M.call(I,A)}catch(L){b=[6,L],U=0}finally{j=z=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}}var f=Object.create?function(I,M,A,j){j===void 0&&(j=A),Object.defineProperty(I,j,{enumerable:!0,get:function(){return M[A]}})}:function(I,M,A,j){j===void 0&&(j=A),I[j]=M[A]};function E(I,M){for(var A in I)A!=="default"&&!Object.prototype.hasOwnProperty.call(M,A)&&f(M,I,A)}function P(I){var M=typeof Symbol=="function"&&Symbol.iterator,A=M&&I[M],j=0;if(A)return A.call(I);if(I&&typeof I.length=="number")return{next:function(){return I&&j>=I.length&&(I=void 0),{value:I&&I[j++],done:!I}}};throw new TypeError(M?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(I,M){var A=typeof Symbol=="function"&&I[Symbol.iterator];if(!A)return I;var j=A.call(I),U,z=[],W;try{for(;(M===void 0||M-- >0)&&!(U=j.next()).done;)z.push(U.value)}catch(G){W={error:G}}finally{try{U&&!U.done&&(A=j.return)&&A.call(j)}finally{if(W)throw W.error}}return z}function d(){for(var I=[],M=0;M<arguments.length;M++)I=I.concat(y(arguments[M]));return I}function h(){for(var I=0,M=0,A=arguments.length;M<A;M++)I+=arguments[M].length;for(var j=Array(I),U=0,M=0;M<A;M++)for(var z=arguments[M],W=0,G=z.length;W<G;W++,U++)j[U]=z[W];return j}function w(I,M,A){if(A||arguments.length===2)for(var j=0,U=M.length,z;j<U;j++)(z||!(j in M))&&(z||(z=Array.prototype.slice.call(M,0,j)),z[j]=M[j]);return I.concat(z||Array.prototype.slice.call(M))}function c(I){return this instanceof c?(this.v=I,this):new c(I)}function u(I,M,A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var j=A.apply(I,M||[]),U,z=[];return U={},W("next"),W("throw"),W("return"),U[Symbol.asyncIterator]=function(){return this},U;function W(_){j[_]&&(U[_]=function(V){return new Promise(function(Y,X){z.push([_,V,Y,X])>1||G(_,V)})})}function G(_,V){try{F(j[_](V))}catch(Y){B(z[0][3],Y)}}function F(_){_.value instanceof c?Promise.resolve(_.value.v).then(b,L):B(z[0][2],_)}function b(_){G("next",_)}function L(_){G("throw",_)}function B(_,V){_(V),z.shift(),z.length&&G(z[0][0],z[0][1])}}function l(I){var M,A;return M={},j("next"),j("throw",function(U){throw U}),j("return"),M[Symbol.iterator]=function(){return this},M;function j(U,z){M[U]=I[U]?function(W){return(A=!A)?{value:c(I[U](W)),done:U==="return"}:z?z(W):W}:z}}function s(I){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var M=I[Symbol.asyncIterator],A;return M?M.call(I):(I=typeof P=="function"?P(I):I[Symbol.iterator](),A={},j("next"),j("throw"),j("return"),A[Symbol.asyncIterator]=function(){return this},A);function j(z){A[z]=I[z]&&function(W){return new Promise(function(G,F){W=I[z](W),U(G,F,W.done,W.value)})}}function U(z,W,G,F){Promise.resolve(F).then(function(b){z({value:b,done:G})},W)}}function g(I,M){return Object.defineProperty?Object.defineProperty(I,"raw",{value:M}):I.raw=M,I}var p=Object.create?function(I,M){Object.defineProperty(I,"default",{enumerable:!0,value:M})}:function(I,M){I.default=M};function x(I){if(I&&I.__esModule)return I;var M={};if(I!=null)for(var A in I)A!=="default"&&Object.prototype.hasOwnProperty.call(I,A)&&f(M,I,A);return p(M,I),M}function D(I){return I&&I.__esModule?I:{default:I}}function N(I,M,A,j){if(A==="a"&&!j)throw new TypeError("Private accessor was defined without a getter");if(typeof M=="function"?I!==M||!j:!M.has(I))throw new TypeError("Cannot read private member from an object whose class did not declare it");return A==="m"?j:A==="a"?j.call(I):j?j.value:M.get(I)}function k(I,M,A,j,U){if(j==="m")throw new TypeError("Private method is not writable");if(j==="a"&&!U)throw new TypeError("Private accessor was defined without a setter");if(typeof M=="function"?I!==M||!U:!M.has(I))throw new TypeError("Cannot write private member to an object whose class did not declare it");return j==="a"?U.call(I,A):U?U.value=A:M.set(I,A),A}},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0}),r.allToUpperCase=r.allToLowerCase=r.encodeBody=r.decodeBody=r.Format=r.promisify=r.trim=r.arrChooseN=r.randomHexString=r.randomString=r.cheapRandStr=r.dataSizeBytes=r.inspectBody=r.inspectError=r.isErrorInfoOrPartialErrorInfo=r.now=r.parseQueryString=r.toQueryString=r.arrPopRandomElement=r.defaultPostHeaders=r.defaultGetHeaders=r.allSame=r.arrEvery=r.arrFilter=r.arrMap=r.safeArrForEach=r.arrForEach=r.forInOwnNonNullProperties=r.valuesArray=r.keysArray=r.arrWithoutValue=r.arrDeleteValue=r.arrIn=r.arrIndexOf=r.arrSubtract=r.arrIntersectOb=r.arrIntersect=r.intersect=r.containsValue=r.inherits=r.prototypicalClone=r.shallowClone=r.isEmptyArg=r.isOnlyPropIn=r.isEmpty=r.isObject=r.ensureArray=r.isArray=r.copy=r.mixin=void 0,r.arrEquals=r.toBase64=r.matchDerivedChannel=r.shallowEquals=r.getGlobalObject=r.getRetryTime=r.getJitterCoefficient=r.getBackoffCoefficient=void 0;var a=o(0),m=a.__importDefault(o(3)),v=a.__importStar(o(8)),S=a.__importDefault(o(4)),T=o(11),R=o(31);function C(H){return Math.floor(Math.random()*H.length)}function O(H){for(var $=[],K=1;K<arguments.length;K++)$[K-1]=arguments[K];for(var ee=0;ee<$.length;ee++){var ie=$[ee];if(!ie)break;var Ve=Object.prototype.hasOwnProperty;for(var Lr in ie)(!Ve||Ve.call(ie,Lr))&&(H[Lr]=ie[Lr])}return H}r.mixin=O;function f(H){return O({},H)}r.copy=f,r.isArray=Array.isArray||function(H){return Object.prototype.toString.call(H)=="[object Array]"};function E(H){return h(H)?[]:(0,r.isArray)(H)?H:[H]}r.ensureArray=E;function P(H){return Object.prototype.toString.call(H)=="[object Object]"}r.isObject=P;function y(H){for(var $ in H)return!1;return!0}r.isEmpty=y;function d(H,$){for(var K in H)if(K!==$)return!1;return!0}r.isOnlyPropIn=d;function h(H){return H==null}r.isEmptyArg=h;function w(H){var $=new Object;for(var K in H)$[K]=H[K];return $}r.shallowClone=w;function c(H,$){var K=function(){function ie(){}return ie}();K.prototype=H;var ee=new K;return $&&O(ee,$),ee}r.prototypicalClone=c;var u=function(H,$){if(m.default.Config.inherits){m.default.Config.inherits(H,$);return}H.super_=$,H.prototype=c($.prototype,{constructor:H})};r.inherits=u;function l(H,$){for(var K in H)if(H[K]==$)return!0;return!1}r.containsValue=l;function s(H,$){return(0,r.isArray)($)?g(H,$):p(H,$)}r.intersect=s;function g(H,$){for(var K=[],ee=0;ee<H.length;ee++){var ie=H[ee];(0,r.arrIndexOf)($,ie)!=-1&&K.push(ie)}return K}r.arrIntersect=g;function p(H,$){for(var K=[],ee=0;ee<H.length;ee++){var ie=H[ee];ie in $&&K.push(ie)}return K}r.arrIntersectOb=p;function x(H,$){for(var K=[],ee=0;ee<H.length;ee++){var ie=H[ee];(0,r.arrIndexOf)($,ie)==-1&&K.push(ie)}return K}r.arrSubtract=x,r.arrIndexOf=Array.prototype.indexOf?function(H,$,K){return H.indexOf($,K)}:function(H,$,K){K=K||0;for(var ee=H.length;K<ee;K++)if(H[K]===$)return K;return-1};function D(H,$){return(0,r.arrIndexOf)(H,$)!==-1}r.arrIn=D;function N(H,$){var K=(0,r.arrIndexOf)(H,$),ee=K!=-1;return ee&&H.splice(K,1),ee}r.arrDeleteValue=N;function k(H,$){var K=H.slice();return N(K,$),K}r.arrWithoutValue=k;function I(H,$){var K=[];for(var ee in H)$&&!Object.prototype.hasOwnProperty.call(H,ee)||K.push(ee);return K}r.keysArray=I;function M(H,$){var K=[];for(var ee in H)$&&!Object.prototype.hasOwnProperty.call(H,ee)||K.push(H[ee]);return K}r.valuesArray=M;function A(H,$){for(var K in H)Object.prototype.hasOwnProperty.call(H,K)&&H[K]&&$(K)}r.forInOwnNonNullProperties=A,r.arrForEach=Array.prototype.forEach?function(H,$){H.forEach($)}:function(H,$){for(var K=H.length,ee=0;ee<K;ee++)$(H[ee],ee,H)};function j(H,$){return(0,r.arrForEach)(H.slice(),$)}r.safeArrForEach=j,r.arrMap=Array.prototype.map?function(H,$){return H.map($)}:function(H,$){for(var K=[],ee=H.length,ie=0;ie<ee;ie++)K.push($(H[ie],ie,H));return K},r.arrFilter=Array.prototype.filter?function(H,$){return H.filter($)}:function(H,$){for(var K=[],ee=H.length,ie=0;ie<ee;ie++)$(H[ie])&&K.push(H[ie]);return K},r.arrEvery=Array.prototype.every?function(H,$){return H.every($)}:function(H,$){for(var K=H.length,ee=0;ee<K;ee++)if(!$(H[ee],ee,H))return!1;return!0};function U(H,$){if(H.length===0)return!0;var K=H[0][$];return(0,r.arrEvery)(H,function(ee){return ee[$]===K})}r.allSame=U;var z={json:"application/json",jsonp:"application/javascript",xml:"application/xml",html:"text/html",msgpack:"application/x-msgpack"};function W(H,$){var K=z[$||he.json];return{accept:K,"X-Ably-Version":v.default.protocolVersion.toString(),"Ably-Agent":(0,v.getAgentString)(H)}}r.defaultGetHeaders=W;function G(H,$){var K,ee=K=z[$||he.json];return{accept:ee,"content-type":K,"X-Ably-Version":v.default.protocolVersion.toString(),"Ably-Agent":(0,v.getAgentString)(H)}}r.defaultPostHeaders=G;function F(H){return H.splice(C(H),1)[0]}r.arrPopRandomElement=F;function b(H){var $=[];if(H)for(var K in H)$.push(encodeURIComponent(K)+"="+encodeURIComponent(H[K]));return $.length?"?"+$.join("&"):""}r.toQueryString=b;function L(H){for(var $,K=/([^?&=]+)=?([^&]*)/g,ee={};$=K.exec(H);)ee[decodeURIComponent($[1])]=decodeURIComponent($[2]);return ee}r.parseQueryString=L,r.now=Date.now||function(){return new Date().getTime()};function B(H){return typeof H=="object"&&H!==null&&(H.constructor.name=="ErrorInfo"||H.constructor.name=="PartialErrorInfo")}r.isErrorInfoOrPartialErrorInfo=B;function _(H){var $,K;return H instanceof Error||(($=H==null?void 0:H.constructor)===null||$===void 0?void 0:$.name)==="ErrorInfo"||((K=H==null?void 0:H.constructor)===null||K===void 0?void 0:K.name)==="PartialErrorInfo"?H.toString():m.default.Config.inspect(H)}r.inspectError=_;function V(H){return m.default.BufferUtils.isBuffer(H)?H.toString():typeof H=="string"?H:m.default.Config.inspect(H)}r.inspectBody=V;function Y(H){if(m.default.BufferUtils.isBuffer(H))return m.default.BufferUtils.byteLength(H);if(typeof H=="string")return m.default.Config.stringByteSize(H);throw new Error("Expected input of Utils.dataSizeBytes to be a buffer or string, but was: "+typeof H)}r.dataSizeBytes=Y;function X(){return String(Math.random()).substr(2)}r.cheapRandStr=X;var te=function(H){if(m.default.Config.getRandomValues&&typeof Uint8Array!="undefined"){var $=new Uint8Array(H);return m.default.Config.getRandomValues($),m.default.BufferUtils.base64Encode($)}for(var K=m.default.BufferUtils.base64CharSet,ee=Math.round(H*4/3),ie="",Ve=0;Ve<ee;Ve++)ie+=K[C(K)];return ie};r.randomString=te;var re=function(H){if(m.default.Config.getRandomValues&&typeof Uint8Array!="undefined"){var $=new Uint8Array(H);return m.default.Config.getRandomValues($),m.default.BufferUtils.hexEncode($)}for(var K=m.default.BufferUtils.hexCharSet,ee=H*2,ie="",Ve=0;Ve<ee;Ve++)ie+=K[C(K)];return ie};r.randomHexString=re;function le(H,$){for(var K=Math.min($,H.length),ee=H.slice(),ie=[],Ve=0;Ve<K;Ve++)ie.push(F(ee));return ie}r.arrChooseN=le,r.trim=String.prototype.trim?function(H){return H.trim()}:function(H){return H.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function Z(H,$,K){return new Promise(function(ee,ie){H[$].apply(H,a.__spreadArray(a.__spreadArray([],K,!1),[function(Ve,Lr){Ve?ie(Ve):ee(Lr)}],!1))})}r.promisify=Z;var he;(function(H){H.msgpack="msgpack",H.json="json"})(he=r.Format||(r.Format={}));function Me(H,$){return $=="msgpack"?m.default.Config.msgpack.decode(H):JSON.parse(String(H))}r.decodeBody=Me;function _e(H,$){return $=="msgpack"?m.default.Config.msgpack.encode(H,!0):JSON.stringify(H)}r.encodeBody=_e;function Ee(H){return H.map(function($){return $&&$.toLowerCase()})}r.allToLowerCase=Ee;function Mt(H){return H.map(function($){return $&&$.toUpperCase()})}r.allToUpperCase=Mt;function ei(H){return Math.min((H+2)/3,2)}r.getBackoffCoefficient=ei;function ft(){return 1-Math.random()*.2}r.getJitterCoefficient=ft;function ti(H,$){return H*ei($)*ft()}r.getRetryTime=ti;function Ss(){return i||(typeof window!="undefined"?window:self)}r.getGlobalObject=Ss;function Cs(H,$){return Object.keys(H).every(function(K){return H[K]===$[K]})&&Object.keys($).every(function(K){return $[K]===H[K]})}r.shallowEquals=Cs;function lp(H){var $=/^(\[([^?]*)(?:(.*))\])?(.+)$/,K=H.match($);if(!K||!K.length||K.length<5)throw new S.default("regex match failed",400,40010);if(K[2])throw new S.default("cannot use a derived option with a ".concat(K[2]," channel"),400,40010);return{qualifierParam:K[3]||"",channelName:K[4]}}r.matchDerivedChannel=lp;function up(H){return m.default.Config.createHmac?Buffer.from(H,"ascii").toString("base64"):(0,T.stringify)((0,R.parse)(H))}r.toBase64=up;function cp(H,$){return H.length===$.length&&(0,r.arrEvery)(H,function(K,ee){return K===$[ee]})}r.arrEquals=cp}).call(this,o(13))},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),m=a.__importDefault(o(3)),v=i||(typeof window!="undefined"?window:self),S;(function(f){f[f.None=0]="None",f[f.Error=1]="Error",f[f.Major=2]="Major",f[f.Minor=3]="Minor",f[f.Micro=4]="Micro"})(S||(S={}));function T(f,E){return"".concat(f).padStart(E?3:2,"0")}function R(f){return m.default.Config.logTimestamps?function(E){var P=new Date;f(T(P.getHours())+":"+T(P.getMinutes())+":"+T(P.getSeconds())+"."+T(P.getMilliseconds(),1)+" "+E)}:f}var C=function(){var f,E,P,y;return typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"||typeof((E=(f=v==null?void 0:v.console)===null||f===void 0?void 0:f.log)===null||E===void 0?void 0:E.apply)=="function"?(P=function(){for(var d=[],h=0;h<arguments.length;h++)d[h]=arguments[h];console.log.apply(console,d)},y=console.warn?function(){for(var d=[],h=0;h<arguments.length;h++)d[h]=arguments[h];console.warn.apply(console,d)}:P):v!=null&&v.console.log?P=y=function(){Function.prototype.apply.call(console.log,console,arguments)}:P=y=function(){},[P,y].map(R)},O=function(){function f(){f.logLevel=f.LOG_DEFAULT}return f.initLogHandlers=function(){var E=C(),P=E[0],y=E[1];this.logHandler=P,this.logErrorHandler=y},f.renamedClientOption=function(E,P){f.deprecationWarning("The `".concat(E,"` client option has been renamed to `").concat(P,"`. Please update your code to use `").concat(P,"` instead. `").concat(E,"` will be removed in a future version."))},f.renamedMethod=function(E,P,y){f.deprecationWarning("`".concat(E,"`’s `").concat(P,"` method has been renamed to `").concat(y,"`. Please update your code to use `").concat(y,"` instead. `").concat(P,"` will be removed in a future version."))},f.deprecationWarning=function(E){f.shouldLog(S.Error)&&f.logErrorHandler("Ably: Deprecation warning - ".concat(E))},f.logLevel=S.Error,f.LOG_NONE=S.None,f.LOG_ERROR=S.Error,f.LOG_MAJOR=S.Major,f.LOG_MINOR=S.Minor,f.LOG_MICRO=S.Micro,f.LOG_DEFAULT=S.Error,f.LOG_DEBUG=S.Micro,f.logAction=function(E,P,y){f.shouldLog(E)&&(E===S.Error?f.logErrorHandler:f.logHandler)("Ably: "+P+": "+y)},f.deprecated=function(E,P){f.deprecationWarning("".concat(E," is deprecated and will be removed in a future version. ").concat(P))},f.shouldLog=function(E){return E<=f.logLevel},f.setLog=function(E,P){E!==void 0&&(f.logLevel=E),P!==void 0&&(f.logHandler=f.logErrorHandler=P)},f}();r.default=O}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function a(){}return a}();r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.PartialErrorInfo=void 0;var i=o(0),a=i.__importDefault(o(3)),m=i.__importStar(o(1));function v(R){var C="["+R.constructor.name;return R.message&&(C+=": "+R.message),R.statusCode&&(C+="; statusCode="+R.statusCode),R.code&&(C+="; code="+R.code),R.cause&&(C+="; cause="+m.inspectError(R.cause)),R.href&&!(R.message&&R.message.indexOf("help.ably.io")>-1)&&(C+="; see "+R.href+" "),C+="]",C}var S=function(R){i.__extends(C,R);function C(O,f,E,P){var y=R.call(this,O)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(y,C.prototype),y.code=f,y.statusCode=E,y.cause=P,y}return C.prototype.toString=function(){return v(this)},C.fromValues=function(O){var f=O,E=f.message,P=f.code,y=f.statusCode;if(typeof E!="string"||typeof P!="number"||typeof y!="number")throw new Error("ErrorInfo.fromValues(): invalid values: "+a.default.Config.inspect(O));var d=Object.assign(new C(E,P,y),O);return d.code&&!d.href&&(d.href="https://help.ably.io/error/"+d.code),d},C}(Error);r.default=S;var T=function(R){i.__extends(C,R);function C(O,f,E,P){var y=R.call(this,O)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(y,C.prototype),y.code=f,y.statusCode=E,y.cause=P,y}return C.prototype.toString=function(){return v(this)},C}(Error);r.PartialErrorInfo=T},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){if(typeof ArrayBuffer=="function"){var a=i,m=a.lib,v=m.WordArray,S=v.init,T=v.init=function(R){if(R instanceof ArrayBuffer&&(R=new Uint8Array(R)),(R instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&R instanceof Uint8ClampedArray||R instanceof Int16Array||R instanceof Uint16Array||R instanceof Int32Array||R instanceof Uint32Array||R instanceof Float32Array||R instanceof Float64Array)&&(R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength)),R instanceof Uint8Array){for(var C=R.byteLength,O=[],f=0;f<C;f++)O[f>>>2]|=R[f]<<24-f%4*8;S.call(this,O,C)}else S.apply(this,arguments)};T.prototype=v}}(),i.lib.WordArray})},function(n,r,o){(function(i){(function(a,m){n.exports=m()})(this,function(){var a=a||function(m,v){var S;if(typeof window!="undefined"&&window.crypto&&(S=window.crypto),!S&&typeof window!="undefined"&&window.msCrypto&&(S=window.msCrypto),!S&&typeof i!="undefined"&&i.crypto&&(S=i.crypto),!S)try{S=o(44)}catch(u){}var T=function(){if(S){if(typeof S.getRandomValues=="function")try{return S.getRandomValues(new Uint32Array(1))[0]}catch(u){}if(typeof S.randomBytes=="function")try{return S.randomBytes(4).readInt32LE()}catch(u){}}throw new Error("Native crypto module could not be used to get secure random number.")},R=Object.create||function(){function u(){}return function(l){var s;return u.prototype=l,s=new u,u.prototype=null,s}}(),C={},O=C.lib={},f=O.Base=function(){return{extend:function(u){var l=R(this);return u&&l.mixIn(u),(!l.hasOwnProperty("init")||this.init===l.init)&&(l.init=function(){l.$super.init.apply(this,arguments)}),l.init.prototype=l,l.$super=this,l},create:function(){var u=this.extend();return u.init.apply(u,arguments),u},init:function(){},mixIn:function(u){for(var l in u)u.hasOwnProperty(l)&&(this[l]=u[l]);u.hasOwnProperty("toString")&&(this.toString=u.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),E=O.WordArray=f.extend({init:function(u,l){u=this.words=u||[],l!=v?this.sigBytes=l:this.sigBytes=u.length*4},toString:function(u){return(u||y).stringify(this)},concat:function(u){var l=this.words,s=u.words,g=this.sigBytes,p=u.sigBytes;if(this.clamp(),g%4)for(var x=0;x<p;x++){var D=s[x>>>2]>>>24-x%4*8&255;l[g+x>>>2]|=D<<24-(g+x)%4*8}else for(var x=0;x<p;x+=4)l[g+x>>>2]=s[x>>>2];return this.sigBytes+=p,this},clamp:function(){var u=this.words,l=this.sigBytes;u[l>>>2]&=4294967295<<32-l%4*8,u.length=m.ceil(l/4)},clone:function(){var u=f.clone.call(this);return u.words=this.words.slice(0),u},random:function(u){for(var l=[],s=0;s<u;s+=4)l.push(T());return new E.init(l,u)}}),P=C.enc={},y=P.Hex={stringify:function(u){for(var l=u.words,s=u.sigBytes,g=[],p=0;p<s;p++){var x=l[p>>>2]>>>24-p%4*8&255;g.push((x>>>4).toString(16)),g.push((x&15).toString(16))}return g.join("")},parse:function(u){for(var l=u.length,s=[],g=0;g<l;g+=2)s[g>>>3]|=parseInt(u.substr(g,2),16)<<24-g%8*4;return new E.init(s,l/2)}},d=P.Latin1={stringify:function(u){for(var l=u.words,s=u.sigBytes,g=[],p=0;p<s;p++){var x=l[p>>>2]>>>24-p%4*8&255;g.push(String.fromCharCode(x))}return g.join("")},parse:function(u){for(var l=u.length,s=[],g=0;g<l;g++)s[g>>>2]|=(u.charCodeAt(g)&255)<<24-g%4*8;return new E.init(s,l)}},h=P.Utf8={stringify:function(u){try{return decodeURIComponent(escape(d.stringify(u)))}catch(l){throw new Error("Malformed UTF-8 data")}},parse:function(u){return d.parse(unescape(encodeURIComponent(u)))}},w=O.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new E.init,this._nDataBytes=0},_append:function(u){typeof u=="string"&&(u=h.parse(u)),this._data.concat(u),this._nDataBytes+=u.sigBytes},_process:function(u){var l,s=this._data,g=s.words,p=s.sigBytes,x=this.blockSize,D=x*4,N=p/D;u?N=m.ceil(N):N=m.max((N|0)-this._minBufferSize,0);var k=N*x,I=m.min(k*4,p);if(k){for(var M=0;M<k;M+=x)this._doProcessBlock(g,M);l=g.splice(0,k),s.sigBytes-=I}return new E.init(l,I)},clone:function(){var u=f.clone.call(this);return u._data=this._data.clone(),u},_minBufferSize:0});O.Hasher=w.extend({cfg:f.extend(),init:function(u){this.cfg=this.cfg.extend(u),this.reset()},reset:function(){w.reset.call(this),this._doReset()},update:function(u){return this._append(u),this._process(),this},finalize:function(u){u&&this._append(u);var l=this._doFinalize();return l},blockSize:16,_createHelper:function(u){return function(l,s){return new u.init(s).finalize(l)}},_createHmacHelper:function(u){return function(l,s){return new c.HMAC.init(u,s).finalize(l)}}});var c=C.algo={};return C}(Math);return a})}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(2)),v=i.__importDefault(o(3));function S(C,O,f){try{O.apply(C,f)}catch(E){m.default.logAction(m.default.LOG_ERROR,"EventEmitter.emit()","Unexpected listener exception: "+E+"; stack = "+(E&&E.stack))}}function T(C,O,f){for(var E,P,y,d=0;d<C.length;d++)if(E=C[d],f&&(E=E[f]),a.isArray(E)){for(;(P=a.arrIndexOf(E,O))!==-1;)E.splice(P,1);f&&E.length===0&&delete C[d][f]}else if(a.isObject(E))for(y in E)Object.prototype.hasOwnProperty.call(E,y)&&a.isArray(E[y])&&T([E],O,y)}var R=function(){function C(){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null)}return C.prototype.on=function(){for(var O=this,f=[],E=0;E<arguments.length;E++)f[E]=arguments[E];if(f.length===1){var P=f[0];if(typeof P=="function")this.any.push(P);else throw new Error("EventListener.on(): Invalid arguments: "+v.default.Config.inspect(f))}if(f.length===2){var y=f[0],d=f[1];if(typeof d!="function")throw new Error("EventListener.on(): Invalid arguments: "+v.default.Config.inspect(f));if(a.isEmptyArg(y))this.any.push(d);else if(a.isArray(y))y.forEach(function(w){O.on(w,d)});else{if(typeof y!="string")throw new Error("EventListener.on(): Invalid arguments: "+v.default.Config.inspect(f));var h=this.events[y]||(this.events[y]=[]);h.push(d)}}},C.prototype.off=function(){for(var O,f=this,E=[],P=0;P<arguments.length;P++)E[P]=arguments[P];if(E.length==0||a.isEmptyArg(E[0])&&a.isEmptyArg(E[1])){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null);return}var y=E[0],d=E[1],h=null,w=null;if(E.length===1||!d)typeof y=="function"?h=y:w=y;else{if(typeof d!="function")throw new Error("EventEmitter.off(): invalid arguments:"+v.default.Config.inspect(E));O=[y,d],w=O[0],h=O[1]}if(h&&a.isEmptyArg(w)){T([this.any,this.events,this.anyOnce,this.eventsOnce],h);return}if(a.isArray(w)){w.forEach(function(c){f.off(c,h)});return}if(typeof w!="string")throw new Error("EventEmitter.off(): invalid arguments:"+v.default.Config.inspect(E));h?T([this.events,this.eventsOnce],h,w):(delete this.events[w],delete this.eventsOnce[w])},C.prototype.listeners=function(O){if(O){var f=this.events[O]||[];return this.eventsOnce[O]&&Array.prototype.push.apply(f,this.eventsOnce[O]),f.length?f:null}return this.any.length?this.any:null},C.prototype.emit=function(O){for(var f=[],E=1;E<arguments.length;E++)f[E-1]=arguments[E];var P={event:O},y=[];this.anyOnce.length&&(Array.prototype.push.apply(y,this.anyOnce),this.anyOnce=[]),this.any.length&&Array.prototype.push.apply(y,this.any);var d=this.eventsOnce[O];d&&(Array.prototype.push.apply(y,d),delete this.eventsOnce[O]);var h=this.events[O];h&&Array.prototype.push.apply(y,h),a.arrForEach(y,function(w){S(P,w,f)})},C.prototype.once=function(){for(var O=this,f=[],E=0;E<arguments.length;E++)f[E]=arguments[E];var P=f.length;if((P===0||P===1&&typeof f[0]!="function")&&v.default.Config.Promise){var y=f[0];return new v.default.Config.Promise(function(l){O.once(y,l)})}var d=f[0],h=f[1];if(f.length===1&&typeof d=="function")this.anyOnce.push(d);else if(a.isEmptyArg(d)){if(typeof h!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+v.default.Config.inspect(f));this.anyOnce.push(h)}else if(a.isArray(d)){var w=this,c=function(){var l=Array.prototype.slice.call(arguments);if(a.arrForEach(d,function(s){w.off(s,c)}),typeof h!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+v.default.Config.inspect(f));h.apply(this,l)};a.arrForEach(d,function(l){w.on(l,c)})}else{if(typeof d!="string")throw new Error("EventEmitter.once(): Invalid arguments:"+v.default.Config.inspect(f));var u=this.eventsOnce[d]||(this.eventsOnce[d]=[]);if(h){if(typeof h!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+v.default.Config.inspect(f));u.push(h)}}},C.prototype.whenState=function(O,f,E){for(var P=this,y=[],d=3;d<arguments.length;d++)y[d-3]=arguments[d];var h={event:O};if(typeof O!="string"||typeof f!="string")throw"whenState requires a valid event String argument";if(typeof E!="function"&&v.default.Config.Promise)return new v.default.Config.Promise(function(w){C.prototype.whenState.apply(P,[O,f,w].concat(y))});O===f?S(h,E,y):this.once(O,E)},C}();r.default=R},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.getDefaults=r.normaliseOptions=r.objectifyOptions=r.getAgentString=r.getHosts=r.getFallbackHosts=r.environmentFallbackHosts=r.getHttpScheme=r.getPort=r.getHost=void 0;var i=o(0),a=i.__importDefault(o(3)),m=i.__importStar(o(1)),v=i.__importDefault(o(2)),S=i.__importDefault(o(4)),T=o(43),R="ably-js/"+T.version,C={ENVIRONMENT:"",REST_HOST:"rest.ably.io",REALTIME_HOST:"realtime.ably.io",FALLBACK_HOSTS:["A.ably-realtime.com","B.ably-realtime.com","C.ably-realtime.com","D.ably-realtime.com","E.ably-realtime.com"],PORT:80,TLS_PORT:443,TIMEOUTS:{disconnectedRetryTimeout:15e3,suspendedRetryTimeout:3e4,httpRequestTimeout:15e3,channelRetryTimeout:15e3,fallbackRetryTimeout:6e5,connectionStateTtl:12e4,realtimeRequestTimeout:1e4,recvTimeout:9e4,preferenceConnectTimeout:6e3,parallelUpgradeDelay:6e3},httpMaxRetryCount:3,maxMessageSize:65536,version:T.version,protocolVersion:2,agent:R,getHost:O,getPort:f,getHttpScheme:E,environmentFallbackHosts:P,getFallbackHosts:y,getHosts:d,checkHost:h,objectifyOptions:l,normaliseOptions:s};function O(p,x,D){return D?x=x==p.restHost&&p.realtimeHost||x||p.realtimeHost:x=x||p.restHost,x}r.getHost=O;function f(p,x){return x||p.tls?p.tlsPort:p.port}r.getPort=f;function E(p){return p.tls?"https://":"http://"}r.getHttpScheme=E;function P(p){return[p+"-a-fallback.ably-realtime.com",p+"-b-fallback.ably-realtime.com",p+"-c-fallback.ably-realtime.com",p+"-d-fallback.ably-realtime.com",p+"-e-fallback.ably-realtime.com"]}r.environmentFallbackHosts=P;function y(p){var x=p.fallbackHosts,D=typeof p.httpMaxRetryCount!="undefined"?p.httpMaxRetryCount:C.httpMaxRetryCount;return x?m.arrChooseN(x,D):[]}r.getFallbackHosts=y;function d(p){return[p.restHost].concat(y(p))}r.getHosts=d;function h(p){if(typeof p!="string")throw new S.default("host must be a string; was a "+typeof p,4e4,400);if(!p.length)throw new S.default("host must not be zero-length",4e4,400)}function w(p,x,D){return p.realtimeHost?p.realtimeHost:p.restHost?(v.default.logAction(v.default.LOG_MINOR,"Defaults.normaliseOptions",'restHost is set to "'+p.restHost+'" but realtimeHost is not set, so setting realtimeHost to "'+p.restHost+'" too. If this is not what you want, please set realtimeHost explicitly.'),p.restHost):x?C.REALTIME_HOST:D+"-"+C.REALTIME_HOST}function c(p){var x={};for(var D in C.TIMEOUTS)x[D]=p[D]||C.TIMEOUTS[D];return x}function u(p){var x=C.agent;if(p.agents)for(var D in p.agents)x+=" "+D+"/"+p.agents[D];return x}r.getAgentString=u;function l(p){return typeof p=="string"?p.indexOf(":")==-1?{token:p}:{key:p}:p}r.objectifyOptions=l;function s(p){if(p.host&&(v.default.renamedClientOption("host","restHost"),p.restHost=p.host),p.wsHost&&(v.default.renamedClientOption("wsHost","realtimeHost"),p.realtimeHost=p.wsHost),p.queueEvents&&(v.default.renamedClientOption("queueEvents","queueMessages"),p.queueMessages=p.queueEvents),p.headers&&v.default.deprecated("the `headers` client option",""),p.fallbackHostsUseDefault){if(p.fallbackHosts){var x="fallbackHosts and fallbackHostsUseDefault cannot both be set";throw v.default.logAction(v.default.LOG_ERROR,"Defaults.normaliseOptions",x),new S.default(x,4e4,400)}if(p.port||p.tlsPort){var x="fallbackHostsUseDefault cannot be set when port or tlsPort are set";throw v.default.logAction(v.default.LOG_ERROR,"Defaults.normaliseOptions",x),new S.default(x,4e4,400)}p.environment?v.default.deprecated("The `fallbackHostsUseDefault` client option","If you’re using this client option to force the library to make use of fallback hosts even though you’ve set the `environment` client option, then this is no longer necessary: remove your usage of the `fallbackHostsUseDefault` client option and the library will then automatically choose the correct fallback hosts to use for the specified environment."):v.default.deprecated("The `fallbackHostsUseDefault` client option","If you’re using this client option to force the library to make use of fallback hosts even though you’re not using the primary Ably environment, then stop using `fallbackHostsUseDefault`, and update your code to either pass the `environment` client option (in which case the library will automatically choose the correct fallback hosts to use for the specified environment), or to pass the `fallbackHosts` client option to specify a custom list of fallback hosts to use (for example, if you’re using a custom CNAME, in which case Ably will have provided you with an explicit list of fallback hosts)."),p.fallbackHosts=C.FALLBACK_HOSTS}p.recover===!0&&(v.default.deprecated("The ability to use a boolean value for the `recover` client option","If you wish for the connection to always be recovered, replace `{ recover: true }` with a function that always passes `true` to its callback: `{ recover: function(lastConnectionDetails, cb) { cb(true); } }`"),p.recover=function(F,b){b(!0)}),typeof p.recover=="function"&&p.closeOnUnload===!0&&(v.default.logAction(v.default.LOG_ERROR,"Defaults.normaliseOptions","closeOnUnload was true and a session recovery function was set - these are mutually exclusive, so unsetting the latter"),p.recover=void 0),"closeOnUnload"in p||(p.closeOnUnload=!p.recover),p.transports&&m.arrIn(p.transports,"xhr")&&(v.default.deprecationWarning('The "xhr" transport has been renamed to "xhr_streaming". Please update your client options code to use `transports: ["xhr_streaming"]` instead. The ability to use `transports: ["xhr"]` will be removed in a future version.'),m.arrDeleteValue(p.transports,"xhr"),p.transports.push("xhr_streaming")),"queueMessages"in p||(p.queueMessages=!0);var D=p.environment&&String(p.environment).toLowerCase()||C.ENVIRONMENT,N=!D||D==="production";!p.fallbackHosts&&!p.restHost&&!p.realtimeHost&&!p.port&&!p.tlsPort&&(p.fallbackHosts=N?C.FALLBACK_HOSTS:P(D));var k=p.restHost||(N?C.REST_HOST:D+"-"+C.REST_HOST),I=w(p,N,D);m.arrForEach((p.fallbackHosts||[]).concat(k,I),h),p.port=p.port||C.PORT,p.tlsPort=p.tlsPort||C.TLS_PORT,"tls"in p||(p.tls=!0);var M=c(p);if("useBinaryProtocol"in p?p.useBinaryProtocol=a.default.Config.supportsBinary&&p.useBinaryProtocol:p.useBinaryProtocol=a.default.Config.preferBinary,p.clientId){var A=p.headers=p.headers||{};A["X-Ably-ClientId"]=a.default.BufferUtils.base64Encode(a.default.BufferUtils.utf8Encode(p.clientId))}"idempotentRestPublishing"in p||(p.idempotentRestPublishing=!0),p.promises&&!a.default.Config.Promise&&(v.default.logAction(v.default.LOG_ERROR,"Defaults.normaliseOptions","{promises: true} was specified, but no Promise constructor found; disabling promises"),p.promises=!1);var j=null,U=p.connectivityCheckUrl;if(p.connectivityCheckUrl){var z=p.connectivityCheckUrl.split("?"),W=z[0],G=z[1];j=G?m.parseQueryString(G):{},W.indexOf("://")===-1&&(W="https://"+W),U=W}return i.__assign(i.__assign({},p),{useBinaryProtocol:"useBinaryProtocol"in p?a.default.Config.supportsBinary&&p.useBinaryProtocol:a.default.Config.preferBinary,realtimeHost:I,restHost:k,maxMessageSize:p.maxMessageSize||C.maxMessageSize,timeouts:M,connectivityCheckParams:j,connectivityCheckUrl:U})}r.normaliseOptions=s,r.default=C;function g(p){return Object.assign(C,p)}r.getDefaults=g},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(3)),m=i.__importDefault(o(2)),v=i.__importDefault(o(4)),S=i.__importStar(o(1));function T(f){return!f||!f.channelOptions?{channelOptions:f,plugins:{},baseEncodedPreviousPayload:void 0}:f}function R(f){if(f&&f.cipher){if(!a.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var E=a.default.Crypto.getCipher(f.cipher);return{cipher:E.cipherParams,channelCipher:E.cipher}}return f!=null?f:{}}function C(f){var E=0;return f.name&&(E+=f.name.length),f.clientId&&(E+=f.clientId.length),f.extras&&(E+=JSON.stringify(f.extras).length),f.data&&(E+=S.dataSizeBytes(f.data)),E}var O=function(){function f(){}return f.prototype.toJSON=function(){var E=this.encoding,P=this.data;return P&&a.default.BufferUtils.isBuffer(P)&&(arguments.length>0?(E=E?E+"/base64":"base64",P=a.default.BufferUtils.base64Encode(P)):P=a.default.BufferUtils.toBuffer(P)),{name:this.name,id:this.id,clientId:this.clientId,connectionId:this.connectionId,connectionKey:this.connectionKey,extras:this.extras,encoding:E,data:P}},f.prototype.toString=function(){var E="[Message";return this.name&&(E+="; name="+this.name),this.id&&(E+="; id="+this.id),this.timestamp&&(E+="; timestamp="+this.timestamp),this.clientId&&(E+="; clientId="+this.clientId),this.connectionId&&(E+="; connectionId="+this.connectionId),this.encoding&&(E+="; encoding="+this.encoding),this.extras&&(E+="; extras ="+JSON.stringify(this.extras)),this.data&&(typeof this.data=="string"?E+="; data="+this.data:a.default.BufferUtils.isBuffer(this.data)?E+="; data (buffer)="+a.default.BufferUtils.base64Encode(this.data):E+="; data (json)="+JSON.stringify(this.data)),this.extras&&(E+="; extras="+JSON.stringify(this.extras)),E+="]",E},f.encrypt=function(E,P,y){var d=E.data,h=E.encoding,w=P.channelCipher;h=h?h+"/":"",a.default.BufferUtils.isBuffer(d)||(d=a.default.BufferUtils.utf8Encode(String(d)),h=h+"utf-8/"),w.encrypt(d,function(c,u){if(c){y(c);return}E.data=u,E.encoding=h+"cipher+"+w.algorithm,y(null,E)})},f.encode=function(E,P,y){var d=E.data,h=typeof d=="string"||a.default.BufferUtils.isBuffer(d)||d===null||d===void 0;if(!h)if(S.isObject(d)||S.isArray(d))E.data=JSON.stringify(d),E.encoding=E.encoding?E.encoding+"/json":"json";else throw new v.default("Data type is unsupported",40013,400);P!=null&&P.cipher?f.encrypt(E,P,y):y(null,E)},f.encodeArray=function(E,P,y){for(var d=0,h=0;h<E.length;h++)f.encode(E[h],P,function(w){if(w){y(w);return}d++,d==E.length&&y(null,E)})},f.decode=function(E,P){var y=T(P),d=E.data,h=E.encoding;if(h){var w=h.split("/"),c=void 0,u=w.length,l=E.data,s="";try{for(;(c=u)>0;){var g=w[--u].match(/([-\w]+)(\+([\w-]+))?/);if(!g)break;switch(s=g[1],s){case"base64":l=a.default.BufferUtils.base64Decode(String(l)),c==w.length&&(d=l);continue;case"utf-8":l=a.default.BufferUtils.utf8Decode(l);continue;case"json":l=JSON.parse(l);continue;case"cipher":if(y.channelOptions!=null&&y.channelOptions.cipher&&y.channelOptions.channelCipher){var p=g[3],x=y.channelOptions.channelCipher;if(p!=x.algorithm)throw new Error("Unable to decrypt message with given cipher; incompatible cipher params");l=x.decrypt(l);continue}else throw new Error("Unable to decrypt message; not an encrypted channel");case"vcdiff":if(!y.plugins||!y.plugins.vcdiff)throw new v.default("Missing Vcdiff decoder (https://github.com/ably-forks/vcdiff-decoder)",40019,400);if(typeof Uint8Array=="undefined")throw new v.default("Delta decoding not supported on this browser (need ArrayBuffer & Uint8Array)",40020,400);try{var D=y.baseEncodedPreviousPayload;typeof D=="string"&&(D=a.default.BufferUtils.utf8Encode(D)),D=a.default.BufferUtils.toBuffer(D),l=a.default.BufferUtils.toBuffer(l),l=a.default.BufferUtils.typedArrayToBuffer(y.plugins.vcdiff.decode(l,D)),d=l}catch(k){throw new v.default("Vcdiff delta decode failed with "+k,40018,400)}continue;default:throw new Error("Unknown encoding")}}}catch(k){var N=k;throw new v.default("Error processing the "+s+" encoding, decoder returned ‘"+N.message+"’",N.code||40013,400)}finally{E.encoding=c<=0?null:w.slice(0,c).join("/"),E.data=l}}y.baseEncodedPreviousPayload=d},f.fromResponseBody=function(E,P,y){y&&(E=S.decodeBody(E,y));for(var d=0;d<E.length;d++){var h=E[d]=f.fromValues(E[d]);try{f.decode(h,P)}catch(w){m.default.logAction(m.default.LOG_ERROR,"Message.fromResponseBody()",w.toString())}}return E},f.fromValues=function(E){return Object.assign(new f,E)},f.fromValuesArray=function(E){for(var P=E.length,y=new Array(P),d=0;d<P;d++)y[d]=f.fromValues(E[d]);return y},f.fromEncoded=function(E,P){var y=f.fromValues(E),d=R(P!=null?P:null);try{f.decode(y,d)}catch(h){m.default.logAction(m.default.LOG_ERROR,"Message.fromEncoded()",h.toString())}return y},f.fromEncodedArray=function(E,P){return E.map(function(y){return f.fromEncoded(y,P)})},f.getMessagesSize=function(E){for(var P,y=0,d=0;d<E.length;d++)P=E[d],y+=P.size||(P.size=C(P));return y},f.serialize=S.encodeBody,f}();r.default=O},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(4)),v=i.__importDefault(o(9)),S=i.__importDefault(o(16)),T={HEARTBEAT:0,ACK:1,NACK:2,CONNECT:3,CONNECTED:4,DISCONNECT:5,DISCONNECTED:6,CLOSE:7,CLOSED:8,ERROR:9,ATTACH:10,ATTACHED:11,DETACH:12,DETACHED:13,PRESENCE:14,MESSAGE:15,SYNC:16,AUTH:17,ACTIVATE:18},R=[];Object.keys(T).forEach(function(y){R[T[y]]=y});var C={HAS_PRESENCE:1,HAS_BACKLOG:2,RESUMED:4,TRANSIENT:16,ATTACH_RESUME:32,PRESENCE:65536,PUBLISH:1<<17,SUBSCRIBE:1<<18,PRESENCE_SUBSCRIBE:1<<19},O=Object.keys(C);C.MODE_ALL=C.PRESENCE|C.PUBLISH|C.SUBSCRIBE|C.PRESENCE_SUBSCRIBE;function f(y){var d=[];if(y)for(var h=0;h<y.length;h++)d.push(y[h].toString());return"[ "+d.join(", ")+" ]"}var E="id channel channelSerial connectionId count msgSerial timestamp".split(" "),P=function(){function y(){var d=this;this.hasFlag=function(h){return(d.flags&C[h])>0}}return y.prototype.setFlag=function(d){return this.flags=this.flags|C[d]},y.prototype.getMode=function(){return this.flags&&this.flags&C.MODE_ALL},y.prototype.encodeModesToFlags=function(d){var h=this;d.forEach(function(w){return h.setFlag(w)})},y.prototype.decodeModesFromFlags=function(){var d=this,h=[];return y.channelModes.forEach(function(w){d.hasFlag(w)&&h.push(w)}),h.length>0?h:void 0},y.fromValues=function(d){return Object.assign(new y,d)},y.Action=T,y.channelModes=["PRESENCE","PUBLISH","SUBSCRIBE","PRESENCE_SUBSCRIBE"],y.ActionName=R,y.serialize=a.encodeBody,y.deserialize=function(d,h){var w=a.decodeBody(d,h);return y.fromDeserialized(w)},y.fromDeserialized=function(d){var h=d.error;h&&(d.error=m.default.fromValues(h));var w=d.messages;if(w)for(var c=0;c<w.length;c++)w[c]=v.default.fromValues(w[c]);var u=d.presence;if(u)for(var c=0;c<u.length;c++)u[c]=S.default.fromValues(u[c],!0);return Object.assign(new y,d)},y.stringify=function(d){var h="[ProtocolMessage";d.action!==void 0&&(h+="; action="+y.ActionName[d.action]||!1);for(var w,c=0;c<E.length;c++)w=E[c],d[w]!==void 0&&(h+="; "+w+"="+d[w]);if(d.messages&&(h+="; messages="+f(v.default.fromValuesArray(d.messages))),d.presence&&(h+="; presence="+f(S.default.fromValuesArray(d.presence))),d.error&&(h+="; error="+m.default.fromValues(d.error).toString()),d.auth&&d.auth.accessToken&&(h+="; token="+d.auth.accessToken),d.flags&&(h+="; flags="+O.filter(d.hasFlag).join(",")),d.params){var u="";a.forInOwnNonNullProperties(d.params,function(l){u.length>0&&(u+="; "),u+=l+"="+d.params[l]}),u.length>0&&(h+="; params=["+u+"]")}return h+="]",h},y}();r.default=P},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){var a=i,m=a.lib,v=m.WordArray,S=a.enc;S.Base64={stringify:function(R){var C=R.words,O=R.sigBytes,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";R.clamp();for(var E=[],P=0;P<O;P+=3)for(var y=C[P>>>2]>>>24-P%4*8&255,d=C[P+1>>>2]>>>24-(P+1)%4*8&255,h=C[P+2>>>2]>>>24-(P+2)%4*8&255,w=y<<16|d<<8|h,c=0;c<4&&P+c*.75<O;c++)E.push(f.charAt(w>>>6*(3-c)&63));var u=f.charAt(64);if(u)for(;E.length%4;)E.push(u);return E.join("")},parse:function(R){var C=R.length,O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var E=0;E<O.length;E++)f[O.charCodeAt(E)]=E}var P=O.charAt(64);if(P){var y=R.indexOf(P);y!==-1&&(C=y)}return T(R,C,f)}};function T(R,C,O){for(var f=[],E=0,P=0;P<C;P++)if(P%4){var y=O[R.charCodeAt(P-1)]<<P%4*2,d=O[R.charCodeAt(P)]>>>6-P%4*2,h=y|d;f[E>>>2]|=h<<24-E%4*8,E++}return v.create(f,E)}}(),i.enc.Base64})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(10)),v=i.__importDefault(o(26)),S=i.__importDefault(o(2)),T=i.__importDefault(o(8)),R=i.__importDefault(o(21)),C=i.__importDefault(o(18)),O=i.__importDefault(o(4)),f=i.__importDefault(o(22)),E=i.__importDefault(o(3));function P(h){var w=[80015,80017,80030];return h.code?C.default.isTokenErr(h)?!1:a.arrIn(w,h.code)?!0:h.code>=4e4&&h.code<5e4:!1}function y(h){return P(h)?[m.default.fromValues({action:m.default.Action.ERROR,error:h})]:[m.default.fromValues({action:m.default.Action.DISCONNECTED,error:h})]}var d=function(h){i.__extends(w,h);function w(c,u,l){var s=h.call(this,c,u,l,!0)||this;return s.onAuthUpdated=function(g){s.authParams={access_token:g.token}},s.stream="stream"in l?l.stream:!0,s.sendRequest=null,s.recvRequest=null,s.pendingCallback=null,s.pendingItems=null,s}return w.prototype.connect=function(){var c=this;S.default.logAction(S.default.LOG_MINOR,"CometTransport.connect()","starting"),v.default.prototype.connect.call(this);var u=this.params,l=u.options,s=T.default.getHost(l,u.host),g=T.default.getPort(l),p=l.tls?"https://":"http://";this.baseUri=p+s+":"+g+"/comet/";var x=this.baseUri+"connect";S.default.logAction(S.default.LOG_MINOR,"CometTransport.connect()","uri: "+x),this.auth.getAuthParams(function(D,N){if(D){c.disconnect(D);return}if(!c.isDisposed){c.authParams=N;var k=c.params.getConnectParams(N);"stream"in k&&(c.stream=k.stream),S.default.logAction(S.default.LOG_MINOR,"CometTransport.connect()","connectParams:"+a.toQueryString(k));var I=!1,M=c.recvRequest=c.createRequest(x,null,k,null,c.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV);M.on("data",function(A){c.recvRequest&&(I||(I=!0,c.emit("preconnect")),c.onData(A))}),M.on("complete",function(A){if(c.recvRequest||(A=A||new O.default("Request cancelled",80003,400)),c.recvRequest=null,!I&&!A&&(I=!0,c.emit("preconnect")),c.onActivity(),A){A.code?c.onData(y(A)):c.disconnect(A);return}E.default.Config.nextTick(function(){c.recv()})}),M.exec()}})},w.prototype.requestClose=function(){S.default.logAction(S.default.LOG_MINOR,"CometTransport.requestClose()"),this._requestCloseOrDisconnect(!0)},w.prototype.requestDisconnect=function(){S.default.logAction(S.default.LOG_MINOR,"CometTransport.requestDisconnect()"),this._requestCloseOrDisconnect(!1)},w.prototype._requestCloseOrDisconnect=function(c){var u=this,l=c?this.closeUri:this.disconnectUri;if(l){var s=this.createRequest(l,null,this.authParams,null,f.default.REQ_SEND);s.on("complete",function(g){g&&(S.default.logAction(S.default.LOG_ERROR,"CometTransport.request"+(c?"Close()":"Disconnect()"),"request returned err = "+a.inspectError(g)),u.finish("disconnected",g))}),s.exec()}},w.prototype.dispose=function(){var c=this;S.default.logAction(S.default.LOG_MINOR,"CometTransport.dispose()",""),this.isDisposed||(this.isDisposed=!0,this.recvRequest&&(S.default.logAction(S.default.LOG_MINOR,"CometTransport.dispose()","aborting recv request"),this.recvRequest.abort(),this.recvRequest=null),this.finish("disconnected",R.default.disconnected()),E.default.Config.nextTick(function(){c.emit("disposed")}))},w.prototype.onConnect=function(c){var u;if(!this.isDisposed){var l=(u=c.connectionDetails)===null||u===void 0?void 0:u.connectionKey;v.default.prototype.onConnect.call(this,c);var s=this.baseUri+l;S.default.logAction(S.default.LOG_MICRO,"CometTransport.onConnect()","baseUri = "+s),this.sendUri=s+"/send",this.recvUri=s+"/recv",this.closeUri=s+"/close",this.disconnectUri=s+"/disconnect"}},w.prototype.send=function(c){if(this.sendRequest){this.pendingItems=this.pendingItems||[],this.pendingItems.push(c);return}var u=this.pendingItems||[];u.push(c),this.pendingItems=null,this.sendItems(u)},w.prototype.sendAnyPending=function(){var c=this.pendingItems;c&&(this.pendingItems=null,this.sendItems(c))},w.prototype.sendItems=function(c){var u=this,l=this.sendRequest=this.createRequest(this.sendUri,null,this.authParams,this.encodeRequest(c),f.default.REQ_SEND);l.on("complete",function(s,g){if(s&&S.default.logAction(S.default.LOG_ERROR,"CometTransport.sendItems()","on complete: err = "+a.inspectError(s)),u.sendRequest=null,s){s.code?u.onData(y(s)):u.disconnect(s);return}g&&u.onData(g),u.pendingItems&&E.default.Config.nextTick(function(){u.sendRequest||u.sendAnyPending()})}),l.exec()},w.prototype.recv=function(){var c=this;if(!this.recvRequest&&this.isConnected){var u=this.recvRequest=this.createRequest(this.recvUri,null,this.authParams,null,this.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV_POLL);u.on("data",function(l){c.onData(l)}),u.on("complete",function(l){if(c.recvRequest=null,c.onActivity(),l){l.code?c.onData(y(l)):c.disconnect(l);return}E.default.Config.nextTick(function(){c.recv()})}),u.exec()}},w.prototype.onData=function(c){try{var u=this.decodeResponse(c);if(u&&u.length)for(var l=0;l<u.length;l++)this.onProtocolMessage(m.default.fromDeserialized(u[l]))}catch(s){S.default.logAction(S.default.LOG_ERROR,"CometTransport.onData()","Unexpected exception handing channel event: "+s.stack)}},w.prototype.encodeRequest=function(c){return JSON.stringify(c)},w.prototype.decodeResponse=function(c){return typeof c=="string"?JSON.parse(c):c},w}(v.default);r.default=d},function(n,r){var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(i){typeof window=="object"&&(o=window)}n.exports=o},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.isSuccessCode=void 0;var i;(function(m){m[m.Success=200]="Success",m[m.NoContent=204]="NoContent",m[m.BadRequest=400]="BadRequest",m[m.Unauthorized=401]="Unauthorized",m[m.Forbidden=403]="Forbidden",m[m.RequestTimeout=408]="RequestTimeout",m[m.InternalServerError=500]="InternalServerError"})(i||(i={}));function a(m){return m>=i.Success&&m<i.BadRequest}r.isSuccessCode=a,r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(3)),m=i.__importStar(o(1)),v=i.__importDefault(o(2)),S=i.__importDefault(o(18)),T=i.__importDefault(o(19)),R=o(4),C=i.__importDefault(o(14));function O(h,w,c,u,l){h.http.supportsAuthHeaders?h.auth.getAuthHeaders(function(s,g){s?u(s):l(m.mixin(g,w),c)}):h.auth.getAuthParams(function(s,g){s?u(s):l(w,m.mixin(g,c))})}function f(h,w){return function(c,u,l,s,g){if(c&&!u){h(c);return}if(g===C.default.NoContent){h(c,[],l,!0,g);return}if(!s)try{u=m.decodeBody(u,w)}catch(I){m.isErrorInfoOrPartialErrorInfo(I)?h(I):h(new R.PartialErrorInfo(m.inspectError(I),null));return}if(!u){h(new R.PartialErrorInfo("unenvelope(): Response body is missing",null));return}var p=u,x=p.statusCode,D=p.response,N=p.headers;if(x===void 0){h(c,u,l,!0,g);return}if(x<200||x>=300){var k=D&&D.error||c;k||(k=new Error("Error in unenveloping "+u),k.statusCode=x),h(k,D,N,!0,x);return}h(c,D,N,!0,x)}}function E(h){var w=[];if(h)for(var c in h)w.push(c+"="+h[c]);return w.join("&")}function P(h,w){return h+(w?"?":"")+E(w)}function y(h,w,c,u){return function(l,s,g,p,x){l?v.default.logAction(v.default.LOG_MICRO,"Resource."+w+"()","Received Error; "+P(c,u)+"; Error: "+m.inspectError(l)):v.default.logAction(v.default.LOG_MICRO,"Resource."+w+"()","Received; "+P(c,u)+"; Headers: "+E(g)+"; StatusCode: "+x+"; Body: "+(a.default.BufferUtils.isBuffer(s)?s.toString():s)),h&&h(l,s,g,p,x)}}var d=function(){function h(){}return h.get=function(w,c,u,l,s,g){h.do(T.default.Get,w,c,null,u,l,s,g)},h.delete=function(w,c,u,l,s,g){h.do(T.default.Delete,w,c,null,u,l,s,g)},h.post=function(w,c,u,l,s,g,p){h.do(T.default.Post,w,c,u,l,s,g,p)},h.patch=function(w,c,u,l,s,g,p){h.do(T.default.Patch,w,c,u,l,s,g,p)},h.put=function(w,c,u,l,s,g,p){h.do(T.default.Put,w,c,u,l,s,g,p)},h.do=function(w,c,u,l,s,g,p,x){v.default.shouldLog(v.default.LOG_MICRO)&&(x=y(x,w,u,g)),p&&(x=x&&f(x,p),(g=g||{}).envelope=p);function D(N,k){var I;if(v.default.shouldLog(v.default.LOG_MICRO)&&v.default.logAction(v.default.LOG_MICRO,"Resource."+w+"()","Sending; "+P(u,k)),v.default.shouldLog(v.default.LOG_MICRO)){var M=l;if(((I=N["content-type"])===null||I===void 0?void 0:I.indexOf("msgpack"))>0)try{M=a.default.Config.msgpack.decode(l)}catch(A){v.default.logAction(v.default.LOG_MICRO,"Resource."+w+"()","Sending MsgPack Decoding Error: "+m.inspectError(A))}v.default.logAction(v.default.LOG_MICRO,"Resource."+w+"()","Sending; "+P(u,k)+"; Body: "+M)}c.http.do(w,c,u,N,l,k,function(A,j,U,z,W){if(A&&S.default.isTokenErr(A)){c.auth.authorize(null,null,function(G){if(G){x(G);return}O(c,N,k,x,D)});return}x(A,j,U,z,W)})}O(c,s,g,x,D)},h}();r.default=d},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(2)),m=i.__importDefault(o(3)),v=i.__importDefault(o(9)),S=i.__importStar(o(1));function T(C){return R.Actions.indexOf(C)}var R=function(){function C(){}return C.prototype.isSynthesized=function(){return!this.id||!this.connectionId?!0:this.id.substring(this.connectionId.length,0)!==this.connectionId},C.prototype.parseId=function(){if(!this.id)throw new Error("parseId(): Presence message does not contain an id");var O=this.id.split(":");return{connectionId:O[0],msgSerial:parseInt(O[1],10),index:parseInt(O[2],10)}},C.prototype.toJSON=function(){var O=this.data,f=this.encoding;return O&&m.default.BufferUtils.isBuffer(O)&&(arguments.length>0?(f=f?f+"/base64":"base64",O=m.default.BufferUtils.base64Encode(O)):O=m.default.BufferUtils.toBuffer(O)),{id:this.id,clientId:this.clientId,action:T(this.action),data:O,encoding:f,extras:this.extras}},C.prototype.toString=function(){var O="[PresenceMessage";return O+="; action="+this.action,this.id&&(O+="; id="+this.id),this.timestamp&&(O+="; timestamp="+this.timestamp),this.clientId&&(O+="; clientId="+this.clientId),this.connectionId&&(O+="; connectionId="+this.connectionId),this.encoding&&(O+="; encoding="+this.encoding),this.data&&(typeof this.data=="string"?O+="; data="+this.data:m.default.BufferUtils.isBuffer(this.data)?O+="; data (buffer)="+m.default.BufferUtils.base64Encode(this.data):O+="; data (json)="+JSON.stringify(this.data)),this.extras&&(O+="; extras="+JSON.stringify(this.extras)),O+="]",O},C.fromResponseBody=function(O,f,E){var P=[];E&&(O=S.decodeBody(O,E));for(var y=0;y<O.length;y++){var d=P[y]=C.fromValues(O[y],!0);try{C.decode(d,f)}catch(h){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromResponseBody()",h.toString())}}return P},C.fromValues=function(O,f){return f&&(O.action=C.Actions[O.action]),Object.assign(new C,O)},C.fromValuesArray=function(O){for(var f=O.length,E=new Array(f),P=0;P<f;P++)E[P]=C.fromValues(O[P]);return E},C.fromEncoded=function(O,f){var E=C.fromValues(O,!0);try{C.decode(E,f!=null?f:{})}catch(P){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromEncoded()",P.toString())}return E},C.fromEncodedArray=function(O,f){return O.map(function(E){return C.fromEncoded(E,f)})},C.fromData=function(O){return O instanceof C?O:C.fromValues({data:O})},C.Actions=["absent","present","enter","leave","update"],C.encode=v.default.encode,C.decode=v.default.decode,C.getMessagesSize=v.default.getMessagesSize,C}();r.default=R},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),m=a.__importStar(o(1)),v=a.__importDefault(o(7)),S=a.__importStar(o(4)),T=a.__importDefault(o(2)),R=a.__importDefault(o(8)),C=a.__importDefault(o(22)),O=a.__importDefault(o(3));function f(p,x){return m.arrIn(m.allToLowerCase(m.keysArray(x)),"x-ably-errorcode")}function E(p,x){if(f(p,x))return p.error&&S.default.fromValues(p.error)}var P=function(){},y=0,d={},h=typeof i!="undefined"&&i.XDomainRequest;function w(){var p=navigator.userAgent.toString().match(/MSIE\s([\d.]+)/);return p&&Number(p[1])}function c(){var p;return h&&(p=w())&&p===10}function u(p,x){return p.getResponseHeader&&p.getResponseHeader(x)}function l(p){return p.getResponseHeader&&(p.getResponseHeader("transfer-encoding")||!p.getResponseHeader("content-length"))}function s(p){for(var x=m.trim(p.getAllResponseHeaders()).split(`\r
83
+ `),D={},N=0;N<x.length;N++){var k=x[N].split(":").map(m.trim);D[k[0].toLowerCase()]=k[1]}return D}var g=function(p){a.__extends(x,p);function x(D,N,k,I,M,A,j){var U=p.call(this)||this;return k=k||{},k.rnd=m.cheapRandStr(),c()&&!k.envelope&&(k.envelope="json"),U.uri=D+m.toQueryString(k),U.headers=N||{},U.body=I,U.method=j?j.toUpperCase():m.isEmptyArg(I)?"GET":"POST",U.requestMode=M,U.timeouts=A,U.timedOut=!1,U.requestComplete=!1,U.id=String(++y),d[U.id]=U,U}return x.createRequest=function(D,N,k,I,M,A,j){var U=A||R.default.TIMEOUTS;return new x(D,N,m.copy(k),I,M,U,j)},x.prototype.complete=function(D,N,k,I,M){this.requestComplete||(this.requestComplete=!0,!D&&N&&this.emit("data",N),this.emit("complete",D,N,k,I,M),this.dispose())},x.prototype.abort=function(){this.dispose()},x.prototype.exec=function(){var D=this,N=this.headers,k=this.requestMode==C.default.REQ_SEND?this.timeouts.httpRequestTimeout:this.timeouts.recvTimeout,I=this.timer=setTimeout(function(){D.timedOut=!0,A.abort()},k),M=this.method,A=this.xhr=new XMLHttpRequest,j=N.accept,U=this.body,z="text";if(j?j.indexOf("application/x-msgpack")===0&&(z="arraybuffer"):N.accept="application/json",U){var W=N["content-type"]||(N["content-type"]="application/json");W.indexOf("application/json")>-1&&typeof U!="string"&&(U=JSON.stringify(U))}A.open(M,this.uri,!0),A.responseType=z,"authorization"in N&&(A.withCredentials=!0);for(var G in N)A.setRequestHeader(G,N[G]);var F=function(Z,he,Me,_e){var Ee,Mt=he+" (event type: "+Z.type+")";!((Ee=D==null?void 0:D.xhr)===null||Ee===void 0)&&Ee.statusText&&(Mt+=", current statusText is "+D.xhr.statusText),T.default.logAction(T.default.LOG_ERROR,"Request.on"+Z.type+"()",Mt),D.complete(new S.PartialErrorInfo(Mt,Me,_e))};A.onerror=function(Z){F(Z,"XHR error occurred",null,400)},A.onabort=function(Z){D.timedOut?F(Z,"Request aborted due to request timeout expiring",null,408):F(Z,"Request cancelled",null,400)},A.ontimeout=function(Z){F(Z,"Request timed out",null,408)};var b,L,B,_=0,V=!1,Y=function(){if(clearTimeout(I),B=L<400,L==204){D.complete(null,null,null,null,L);return}b=D.requestMode==C.default.REQ_RECV_STREAM&&B&&l(A)},X=function(){var Z;try{var he=u(A,"content-type"),Me=he?he.indexOf("application/json")>=0:A.responseType=="text";if(Me){var _e=A.responseType==="arraybuffer"?O.default.BufferUtils.utf8Decode(A.response):String(A.responseText);_e.length?Z=JSON.parse(_e):Z=_e,V=!0}else Z=A.response;Z.response!==void 0?(L=Z.statusCode,B=L<400,N=Z.headers,Z=Z.response):N=s(A)}catch(Mt){D.complete(new S.PartialErrorInfo("Malformed response body from server: "+Mt.message,null,400));return}if(B||m.isArray(Z)){D.complete(null,Z,N,V,L);return}var Ee=E(Z,N);Ee||(Ee=new S.PartialErrorInfo("Error response received from server: "+L+" body was: "+O.default.Config.inspect(Z),null,L)),D.complete(Ee,Z,N,V,L)};function te(){for(var Z=A.responseText,he=Z.length-1,Me,_e;_<he&&(Me=Z.indexOf(`
84
+ `,_))>-1;)_e=Z.slice(_,Me),_=Me+1,re(_e)}var re=function(Z){try{Z=JSON.parse(Z)}catch(he){D.complete(new S.PartialErrorInfo("Malformed response body from server: "+he.message,null,400));return}D.emit("data",Z)},le=function(){te(),D.streamComplete=!0,O.default.Config.nextTick(function(){D.complete()})};A.onreadystatechange=function(){var Z=A.readyState;Z<3||A.status!==0&&(L===void 0&&(L=A.status,L===1223&&(L=204),Y()),Z==3&&b?te():Z==4&&(b?le():X()))},A.send(U)},x.prototype.dispose=function(){var D=this.xhr;if(D){D.onreadystatechange=D.onerror=D.onabort=D.ontimeout=P,this.xhr=null;var N=this.timer;N&&(clearTimeout(N),this.timer=null),this.requestComplete||D.abort()}delete d[this.id]},x}(v.default);r.default=g}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(2)),m=i.__importStar(o(1)),v=i.__importDefault(o(24)),S=i.__importDefault(o(4)),T=i.__importDefault(o(45)),R=o(11),C=i.__importDefault(o(19)),O=i.__importDefault(o(14)),f=i.__importDefault(o(3)),E=i.__importDefault(o(15)),P=Math.pow(2,17);function y(){}function d(){return("000000"+Math.floor(Math.random()*1e16)).slice(-16)}function h(k){return!!k.connection}function w(k){return m.isErrorInfoOrPartialErrorInfo(k)?(k.code||(k.statusCode===403?k.code=40300:(k.code=40170,k.statusCode=401)),k):new S.default(m.inspectError(k),k.code||40170,k.statusCode||401)}var c=function(k,I){if(f.default.Config.createHmac){var M=f.default.Config.createHmac("SHA256",I);return M.update(k),M.digest("base64")}return(0,R.stringify)((0,T.default)(k,I))};function u(k){if(!k)return"";typeof k=="string"&&(k=JSON.parse(k));var I=Object.create(null),M=m.keysArray(k,!0);if(!M)return"";M.sort();for(var A=0;A<M.length;A++)I[M[A]]=k[M[A]].sort();return JSON.stringify(I)}function l(k){if(k.authCallback)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with authCallback");else if(k.authUrl)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with authUrl");else if(k.key)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with client-side signing");else if(k.tokenDetails)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with supplied token only");else{var I="authOptions must include valid authentication parameters";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",I),new Error(I)}}function s(k){return"useTokenAuth"in k&&!k.useTokenAuth}function g(k){return k.useTokenAuth||!s(k)&&(k.authCallback||k.authUrl||k.token||k.tokenDetails)}function p(k){return!k.key&&!k.authCallback&&!k.authUrl}var x=0;function D(){return x++}var N=function(){function k(I,M){if(this.authOptions={},this.client=I,this.tokenParams=M.defaultTokenParams||{},this.currentTokenRequestId=null,this.waitingForTokenRequest=null,g(M)){if(M.key&&!c){var A="client-side token request signing not supported";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",A),new Error(A)}p(M)&&a.default.logAction(a.default.LOG_ERROR,"Auth()","Warning: library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help"),this._saveTokenOptions(M.defaultTokenParams,M),l(this.authOptions)}else{if(!M.key){var A="No authentication options provided; need one of: key, authUrl, or authCallback (or for testing only, token or tokenDetails)";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",A),new S.default(A,40160,401)}a.default.logAction(a.default.LOG_MINOR,"Auth()","anonymous, using basic auth"),this._saveBasicOptions(M)}}return k.prototype.authorize=function(I,M,A){var j=this,U;if(typeof I=="function"&&!A?(A=I,U=I=null):typeof M=="function"&&!A?(A=M,U=null):U=M,!A&&this.client.options.promises)return m.promisify(this,"authorize",arguments);if(U&&U.key&&this.authOptions.key!==U.key)throw new S.default("Unable to update auth options with incompatible key",40102,401);U&&"force"in U&&(a.default.deprecated("The `force` auth option","If you’re using this option to force `authorize()` to fetch a new token even if the current token has not expired, this is no longer necessary, as `authorize()` now always fetches a new token. Update your code to no longer pass the `force` auth option. Note that, in general, passing an auth options argument to `authorize()` will overwrite the library’s stored auth options, which may not be what you want. The library currently contains a special case behavior where passing an auth options object which only contains `{ force: true }` will _not_ overwrite the stored options. This special case behavior will be removed alongside support for the `force` option, so if you’re currently passing `authorize()` an auth options object which only contains `{ force: true }`, you should stop passing it an auth options object entirely."),m.isOnlyPropIn(U,"force")&&(U=null)),this._forceNewToken(I,U,function(z,W){if(z){j.client.connection&&z.statusCode===O.default.Forbidden&&j.client.connection.connectionManager.actOnErrorFromAuthorize(z),A==null||A(z);return}h(j.client)?j.client.connection.connectionManager.onAuthUpdated(W,A||y):A==null||A(null,W)})},k.prototype.authorise=function(I,M,A){a.default.renamedMethod("Auth","authorise","authorize"),this.authorize(I,M,A)},k.prototype._forceNewToken=function(I,M,A){var j=this;this.tokenDetails=null,this._saveTokenOptions(I,M),l(this.authOptions),this._ensureValidAuthCredentials(!0,function(U,z){delete j.tokenParams.timestamp,delete j.authOptions.queryTime,A(U,z)})},k.prototype.requestToken=function(I,M,A){var j=this;if(typeof I=="function"&&!A?(A=I,M=I=null):typeof M=="function"&&!A&&(A=M,M=null),!A&&this.client.options.promises)return m.promisify(this,"requestToken",arguments);M=M||this.authOptions,I=I||m.copy(this.tokenParams);var U=A||y,z,W=this.client;if(M.authCallback)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with authCallback"),z=M.authCallback;else if(M.authUrl)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with authUrl"),z=function(_,V){var Y=m.mixin({accept:"application/json, text/plain"},M.authHeaders),X=M.authMethod&&M.authMethod.toLowerCase()==="post",te,re=M.authUrl.indexOf("?");re>-1&&(te=m.parseQueryString(M.authUrl.slice(re)),M.authUrl=M.authUrl.slice(0,re),X||(M.authParams=m.mixin(te,M.authParams)));var le=m.mixin({},M.authParams||{},_),Z=function(_e,Ee,Mt,ei){var ft;if(_e?a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Received Error: "+m.inspectError(_e)):(ft=Mt["content-type"],a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Received; content-type: "+ft+"; body: "+m.inspectBody(Ee))),_e||ei)return V(_e,Ee);if(f.default.BufferUtils.isBuffer(Ee)&&(Ee=Ee.toString()),!ft){V(new S.default("authUrl response is missing a content-type header",40170,401));return}var ti=ft.indexOf("application/json")>-1,Ss=ft.indexOf("text/plain")>-1||ft.indexOf("application/jwt")>-1;if(!ti&&!Ss){V(new S.default("authUrl responded with unacceptable content-type "+ft+", should be either text/plain, application/jwt or application/json",40170,401));return}if(ti){if(Ee.length>P){V(new S.default("authUrl response exceeded max permitted length",40170,401));return}try{Ee=JSON.parse(Ee)}catch(Cs){V(new S.default("Unexpected error processing authURL response; err = "+Cs.message,40170,401));return}}V(null,Ee,ft)};if(a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Requesting token from "+M.authUrl+"; Params: "+JSON.stringify(le)+"; method: "+(X?"POST":"GET")),X){var he=Y||{};he["content-type"]="application/x-www-form-urlencoded";var Me=m.toQueryString(le).slice(1);j.client.http.doUri(C.default.Post,W,M.authUrl,he,Me,te,Z)}else j.client.http.doUri(C.default.Get,W,M.authUrl,Y||{},null,le,Z)};else if(M.key)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with client-side signing"),z=function(_,V){j.createTokenRequest(_,M,V)};else{var G="Need a new token, but authOptions does not include any way to request one (no authUrl, authCallback, or key)";a.default.logAction(a.default.LOG_ERROR,"Auth()","library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help"),U(new S.default(G,40171,403));return}"capability"in I&&(I.capability=u(I.capability));var F=function(_,V){var Y=_.keyName,X="/keys/"+Y+"/requestToken",te=function(le){return W.baseUri(le)+X},re=m.defaultPostHeaders(j.client.options);M.requestHeaders&&m.mixin(re,M.requestHeaders),a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().requestToken","Sending POST to "+X+"; Token params: "+JSON.stringify(_)),j.client.http.do(C.default.Post,W,te,re,JSON.stringify(_),null,V)},b=!1,L=this.client.options.timeouts.realtimeRequestTimeout,B=setTimeout(function(){b=!0;var _="Token request callback timed out after "+L/1e3+" seconds";a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",_),U(new S.default(_,40170,401))},L);z(I,function(_,V,Y){if(!b){if(clearTimeout(B),_){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request signing call returned error; err = "+m.inspectError(_)),U(w(_));return}if(typeof V=="string"){V.length===0?U(new S.default("Token string is empty",40170,401)):V.length>P?U(new S.default("Token string exceeded max permitted length (was "+V.length+" bytes)",40170,401)):V==="undefined"||V==="null"?U(new S.default("Token string was literal null/undefined",40170,401)):V[0]==="{"&&!(Y&&Y.indexOf("application/jwt")>-1)?U(new S.default("Token was double-encoded; make sure you're not JSON-encoding an already encoded token request or details",40170,401)):U(null,{token:V});return}if(typeof V!="object"){var X="Expected token request callback to call back with a token string or token request/details object, but got a "+typeof V;a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",X),U(new S.default(X,40170,401));return}var te=JSON.stringify(V).length;if(te>P&&!M.suppressMaxLengthCheck){U(new S.default("Token request/details object exceeded max permitted stringified size (was "+te+" bytes)",40170,401));return}if("issued"in V){U(null,V);return}if(!("keyName"in V)){var X="Expected token request callback to call back with a token string, token request object, or token details object";a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",X),U(new S.default(X,40170,401));return}F(V,function(re,le,Z,he){if(re){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request API call returned error; err = "+m.inspectError(re)),U(w(re));return}he||(le=JSON.parse(le)),a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","token received"),U(null,le)})}})},k.prototype.createTokenRequest=function(I,M,A){var j=this;if(typeof I=="function"&&!A?(A=I,M=I=null):typeof M=="function"&&!A&&(A=M,M=null),!A&&this.client.options.promises)return m.promisify(this,"createTokenRequest",arguments);M=M||this.authOptions,I=I||m.copy(this.tokenParams);var U=M.key;if(!U){A(new S.default("No key specified",40101,403));return}var z=U.split(":"),W=z[0],G=z[1];if(!G){A(new S.default("Invalid key specified",40101,403));return}if(I.clientId===""){A(new S.default("clientId can’t be an empty string",40012,400));return}"capability"in I&&(I.capability=u(I.capability));var F=m.mixin({keyName:W},I),b=I.clientId||"",L=I.ttl||"",B=I.capability||"";(function(_){if(F.timestamp){_();return}j.getTimestamp(M&&M.queryTime,function(V,Y){if(V){A(V);return}F.timestamp=Y,_()})})(function(){var _=F.nonce||(F.nonce=d()),V=F.timestamp,Y=F.keyName+`
85
85
  `+L+`
86
86
  `+B+`
87
87
  `+b+`
88
- `+W+`
88
+ `+V+`
89
89
  `+_+`
90
- `;F.mac=F.mac||c(Y,G),a.default.logAction(a.default.LOG_MINOR,"Auth.getTokenRequest()","generated signed request"),A(null,F)})},k.prototype.getAuthParams=function(I){this.method=="basic"?I(null,{key:this.key}):this._ensureValidAuthCredentials(!1,function(M,A){if(M){I(M);return}if(!A)throw new Error("Auth.getAuthParams(): _ensureValidAuthCredentials returned no error or tokenDetails");I(null,{access_token:A.token})})},k.prototype.getAuthHeaders=function(I){this.method=="basic"?I(null,{authorization:"Basic "+this.basicKey}):this._ensureValidAuthCredentials(!1,function(M,A){if(M){I(M);return}if(!A)throw new Error("Auth.getAuthParams(): _ensureValidAuthCredentials returned no error or tokenDetails");I(null,{authorization:"Bearer "+m.toBase64(A.token)})})},k.prototype.getTimestamp=function(I,M){!this.isTimeOffsetSet()&&(I||this.authOptions.queryTime)?this.client.time(M):M(null,this.getTimestampUsingOffset())},k.prototype.getTimestampUsingOffset=function(){return m.now()+(this.client.serverTimeOffset||0)},k.prototype.isTimeOffsetSet=function(){return this.client.serverTimeOffset!==null},k.prototype._saveBasicOptions=function(I){this.method="basic",this.key=I.key,this.basicKey=m.toBase64(I.key),this.authOptions=I||{},"clientId"in I&&this._userSetClientId(I.clientId)},k.prototype._saveTokenOptions=function(I,M){this.method="token",I&&(this.tokenParams=I),M&&(M.token&&(M.tokenDetails=typeof M.token=="string"?{token:M.token}:M.token),M.tokenDetails&&(this.tokenDetails=M.tokenDetails),"clientId"in M&&this._userSetClientId(M.clientId),this.authOptions=M)},k.prototype._ensureValidAuthCredentials=function(I,M){var A=this,j=this.tokenDetails;if(j){if(this._tokenClientIdMismatch(j.clientId)){M(new S.default("Mismatch between clientId in token ("+j.clientId+") and current clientId ("+this.clientId+")",40102,403));return}if(!this.isTimeOffsetSet()||!j.expires||j.expires>=this.getTimestampUsingOffset()){a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","using cached token; expires = "+j.expires),M(null,j);return}a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","deleting expired token"),this.tokenDetails=null}if((this.waitingForTokenRequest||(this.waitingForTokenRequest=v.default.create())).push(M),!(this.currentTokenRequestId!==null&&!I)){var U=this.currentTokenRequestId=D();this.requestToken(this.tokenParams,this.authOptions,function(z,V){if(A.currentTokenRequestId>U){a.default.logAction(a.default.LOG_MINOR,"Auth._ensureValidAuthCredentials()","Discarding token request response; overtaken by newer one");return}A.currentTokenRequestId=null;var G=A.waitingForTokenRequest||y;if(A.waitingForTokenRequest=null,z){G(z);return}G(null,A.tokenDetails=V)})}},k.prototype._userSetClientId=function(I){if(typeof I=="string"||I===null){if(I==="*")throw new S.default('Can’t use "*" as a clientId as that string is reserved. (To change the default token request behaviour to use a wildcard clientId, instantiate the library with {defaultTokenParams: {clientId: "*"}}), or if calling authorize(), pass it in as a tokenParam: authorize({clientId: "*"}, authOptions)',40012,400);var M=this._uncheckedSetClientId(I);if(M)throw M}else throw new S.default("clientId must be either a string or null",40012,400)},k.prototype._uncheckedSetClientId=function(I){if(this._tokenClientIdMismatch(I)){var M="Unexpected clientId mismatch: client has "+this.clientId+", requested "+I,A=new S.default(M,40102,401);return a.default.logAction(a.default.LOG_ERROR,"Auth._uncheckedSetClientId()",M),A}else return this.clientId=this.tokenParams.clientId=I,null},k.prototype._tokenClientIdMismatch=function(I){return!!(this.clientId&&this.clientId!=="*"&&I&&I!=="*"&&this.clientId!==I)},k.isTokenErr=function(I){return I.code&&I.code>=40140&&I.code<40150},k.prototype.revokeTokens=function(I,M,A){if(g(this.client.options))throw new S.default("Cannot revoke tokens when using token auth",40162,401);var j=this.client.options.keyName,U;if(typeof M=="function"?(A=M,U={}):U=M!=null?M:{},A===void 0){if(this.client.options.promises)return m.promisify(this,"revokeTokens",[I,U]);A=y}var z=A,V=i.__assign({targets:I.map(function(L){return"".concat(L.type,":").concat(L.value)})},U),G=this.client.options.useBinaryProtocol?m.Format.msgpack:m.Format.json,F=m.defaultPostHeaders(this.client.options,G);this.client.options.headers&&m.mixin(F,this.client.options.headers);var b=m.encodeBody(V,G);E.default.post(this.client,"/keys/".concat(j,"/revokeTokens"),b,F,{newBatchResponse:"true"},null,function(L,B,_,W){if(L){z(L);return}var Y=W?B:m.decodeBody(B,G);z(null,Y)})},k}();r.default=N},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i;(function(a){a.Get="get",a.Delete="delete",a.Post="post",a.Put="put",a.Patch="patch"})(i||(i={})),r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.HttpPaginatedResponse=r.PaginatedResult=void 0;var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(2)),v=i.__importDefault(o(15)),S=i.__importDefault(o(14));function T(P){var y=P.match(/^\.\/(\w+)\?(.*)$/);return y&&y[2]&&a.parseQueryString(y[2])}function R(P){typeof P=="string"&&(P=P.split(","));for(var y={},d=0;d<P.length;d++){var h=P[d].match(/^\s*<(.+)>;\s*rel="(\w+)"$/);if(h){var w=T(h[1]);w&&(y[h[2]]=w)}}return y}function C(P,y,d){return!(d&&(y||typeof P.code=="number"))}var O=function(){function P(y,d,h,w,c,u){this.rest=y,this.path=d,this.headers=h,this.envelope=w!=null?w:null,this.bodyHandler=c,this.useHttpPaginatedResponse=u||!1}return P.prototype.get=function(y,d){var h=this;v.default.get(this.rest,this.path,this.headers,y,this.envelope,function(w,c,u,l,s){h.handlePage(w,c,u,l,s,d)})},P.prototype.delete=function(y,d){var h=this;v.default.delete(this.rest,this.path,this.headers,y,this.envelope,function(w,c,u,l,s){h.handlePage(w,c,u,l,s,d)})},P.prototype.post=function(y,d,h){var w=this;v.default.post(this.rest,this.path,d,this.headers,y,this.envelope,function(c,u,l,s,g){h&&w.handlePage(c,u,l,s,g,h)})},P.prototype.put=function(y,d,h){var w=this;v.default.put(this.rest,this.path,d,this.headers,y,this.envelope,function(c,u,l,s,g){h&&w.handlePage(c,u,l,s,g,h)})},P.prototype.patch=function(y,d,h){var w=this;v.default.patch(this.rest,this.path,d,this.headers,y,this.envelope,function(c,u,l,s,g){h&&w.handlePage(c,u,l,s,g,h)})},P.prototype.handlePage=function(y,d,h,w,c,u){if(y&&C(y,d,this.useHttpPaginatedResponse)){m.default.logAction(m.default.LOG_ERROR,"PaginatedResource.handlePage()","Unexpected error getting resource: err = "+a.inspectError(y)),u==null||u(y);return}var l,s,g;try{l=c==S.default.NoContent?[]:this.bodyHandler(d,h||{},w)}catch(p){u==null||u(y||p);return}h&&(s=h.Link||h.link)&&(g=R(s)),this.useHttpPaginatedResponse?u(null,new E(this,l,h||{},c,g,y)):u(null,new f(this,l,g))},P}(),f=function(){function P(y,d,h){var w=this;this.resource=y,this.items=d;var c=this;h&&("first"in h&&(this.first=function(u){if(!u&&c.resource.rest.options.promises)return a.promisify(c,"first",[]);c.get(h.first,u)}),"current"in h&&(this.current=function(u){if(!u&&c.resource.rest.options.promises)return a.promisify(c,"current",[]);c.get(h.current,u)}),this.next=function(u){if(!u&&c.resource.rest.options.promises)return a.promisify(c,"next",[]);"next"in h?c.get(h.next,u):u(null,null)},this.hasNext=function(){return"next"in h},this.isLast=function(){var u;return!(!((u=w.hasNext)===null||u===void 0)&&u.call(w))})}return P.prototype.get=function(y,d){var h=this.resource;v.default.get(h.rest,h.path,h.headers,y,h.envelope,function(w,c,u,l,s){h.handlePage(w,c,u,l,s,d)})},P}();r.PaginatedResult=f;var E=function(P){i.__extends(y,P);function y(d,h,w,c,u,l){var s=P.call(this,d,h,u)||this;return s.statusCode=c,s.success=c<300&&c>=200,s.headers=w,s.errorCode=l&&l.code,s.errorMessage=l&&l.message,s}return y.prototype.toJSON=function(){return{items:this.items,statusCode:this.statusCode,success:this.success,headers:this.headers,errorCode:this.errorCode,errorMessage:this.errorMessage}},y}(f);r.HttpPaginatedResponse=E,r.default=O},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.isRetriable=void 0;var i=o(0),a=i.__importDefault(o(4)),m={DISCONNECTED:80003,SUSPENDED:80002,FAILED:8e4,CLOSING:80017,CLOSED:80017,UNKNOWN_CONNECTION_ERR:50002,UNKNOWN_CHANNEL_ERR:50001},v={disconnected:function(){return a.default.fromValues({statusCode:400,code:m.DISCONNECTED,message:"Connection to server temporarily unavailable"})},suspended:function(){return a.default.fromValues({statusCode:400,code:m.SUSPENDED,message:"Connection to server unavailable"})},failed:function(){return a.default.fromValues({statusCode:400,code:m.FAILED,message:"Connection failed or disconnected by server"})},closing:function(){return a.default.fromValues({statusCode:400,code:m.CLOSING,message:"Connection closing"})},closed:function(){return a.default.fromValues({statusCode:400,code:m.CLOSED,message:"Connection closed"})},unknownConnectionErr:function(){return a.default.fromValues({statusCode:500,code:m.UNKNOWN_CONNECTION_ERR,message:"Internal connection error"})},unknownChannelErr:function(){return a.default.fromValues({statusCode:500,code:m.UNKNOWN_CONNECTION_ERR,message:"Internal channel error"})}};function S(T){return!T.statusCode||!T.code||T.statusCode>=500?!0:Object.values(m).includes(T.code)}r.isRetriable=S,r.default=v},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i;(function(a){a[a.REQ_SEND=0]="REQ_SEND",a[a.REQ_RECV=1]="REQ_RECV",a[a.REQ_RECV_POLL=2]="REQ_RECV_POLL",a[a.REQ_RECV_STREAM=3]="REQ_RECV_STREAM"})(i||(i={})),r.default=i},function(n,r,o){(function(i,a){n.exports=a(o(6),o(5),o(58),o(11),o(40),o(32),o(25),o(27),o(28),o(59),o(60))})(this,function(i){return i})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(2)),m=function(){function v(S){this.members=S||[]}return v.prototype.call=function(){for(var S=[],T=0;T<arguments.length;T++)S[T]=arguments[T];for(var R=0,C=this.members;R<C.length;R++){var O=C[R];if(O)try{O.apply(void 0,S)}catch(f){a.default.logAction(a.default.LOG_ERROR,"Multicaster multiple callback handler","Unexpected exception: "+f+"; stack = "+f.stack)}}},v.prototype.push=function(){for(var S,T=[],R=0;R<arguments.length;R++)T[R]=arguments[R];(S=this.members).push.apply(S,T)},v.create=function(S){var T=new v(S);return Object.assign(function(){for(var R=[],C=0;C<arguments.length;C++)R[C]=arguments[C];return T.call.apply(T,R)},{push:function(R){return T.push(R)}})},v}();r.default=m},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){(function(){var a=i,m=a.lib,v=m.Base,S=a.enc,T=S.Utf8,R=a.algo;R.HMAC=v.extend({init:function(C,O){C=this._hasher=new C.init,typeof O=="string"&&(O=T.parse(O));var f=C.blockSize,E=f*4;O.sigBytes>E&&(O=C.finalize(O)),O.clamp();for(var P=this._oKey=O.clone(),y=this._iKey=O.clone(),d=P.words,h=y.words,w=0;w<f;w++)d[w]^=1549556828,h[w]^=909522486;P.sigBytes=y.sigBytes=E,this.reset()},reset:function(){var C=this._hasher;C.reset(),C.update(this._iKey)},update:function(C){return this._hasher.update(C),this},finalize:function(C){var O=this._hasher,f=O.finalize(C);O.reset();var E=O.finalize(this._oKey.clone().concat(f));return E}})})()})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(10)),m=i.__importStar(o(1)),v=i.__importDefault(o(7)),S=i.__importDefault(o(2)),T=i.__importDefault(o(21)),R=i.__importDefault(o(4)),C=i.__importDefault(o(3)),O=a.default.Action,f=a.default.fromValues({action:O.CLOSE}),E=a.default.fromValues({action:O.DISCONNECT}),P=function(y){i.__extends(d,y);function d(h,w,c,u){var l=y.call(this)||this;return u&&(c.format=void 0,c.heartbeats=!0),l.connectionManager=h,h.registerProposedTransport(l),l.auth=w,l.params=c,l.timeouts=c.options.timeouts,l.format=c.format,l.isConnected=!1,l.isFinished=!1,l.isDisposed=!1,l.maxIdleInterval=null,l.idleTimer=null,l.lastActivity=null,l}return d.prototype.connect=function(){},d.prototype.close=function(){this.isConnected&&this.requestClose(),this.finish("closed",T.default.closed())},d.prototype.disconnect=function(h){this.isConnected&&this.requestDisconnect(),this.finish("disconnected",h||T.default.disconnected())},d.prototype.fail=function(h){this.isConnected&&this.requestDisconnect(),this.finish("failed",h||T.default.failed())},d.prototype.finish=function(h,w){var c;this.isFinished||(this.isFinished=!0,this.isConnected=!1,this.maxIdleInterval=null,clearTimeout((c=this.idleTimer)!==null&&c!==void 0?c:void 0),this.idleTimer=null,this.emit(h,w),this.dispose())},d.prototype.onProtocolMessage=function(h){switch(S.default.shouldLog(S.default.LOG_MICRO)&&S.default.logAction(S.default.LOG_MICRO,"Transport.onProtocolMessage()","received on "+this.shortName+": "+a.default.stringify(h)+"; connectionId = "+this.connectionManager.connectionId),this.onActivity(),h.action){case O.HEARTBEAT:S.default.logAction(S.default.LOG_MICRO,"Transport.onProtocolMessage()",this.shortName+" heartbeat; connectionId = "+this.connectionManager.connectionId),this.emit("heartbeat",h.id);break;case O.CONNECTED:this.onConnect(h),this.emit("connected",h.error,h.connectionId,h.connectionDetails,h);break;case O.CLOSED:this.onClose(h);break;case O.DISCONNECTED:this.onDisconnect(h);break;case O.ACK:this.emit("ack",h.msgSerial,h.count);break;case O.NACK:this.emit("nack",h.msgSerial,h.count,h.error);break;case O.SYNC:this.connectionManager.onChannelMessage(h,this);break;case O.ACTIVATE:break;case O.AUTH:this.auth.authorize(function(w){w&&S.default.logAction(S.default.LOG_ERROR,"Transport.onProtocolMessage()","Ably requested re-authentication, but unable to obtain a new token: "+m.inspectError(w))});break;case O.ERROR:if(S.default.logAction(S.default.LOG_MINOR,"Transport.onProtocolMessage()","received error action; connectionId = "+this.connectionManager.connectionId+"; err = "+C.default.Config.inspect(h.error)+(h.channel?", channel: "+h.channel:"")),h.channel===void 0){this.onFatalError(h);break}this.connectionManager.onChannelMessage(h,this);break;default:this.connectionManager.onChannelMessage(h,this)}},d.prototype.onConnect=function(h){if(this.isConnected=!0,!h.connectionDetails)throw new Error("Transport.onConnect(): Connect message recieved without connectionDetails");var w=h.connectionDetails.maxIdleInterval;w&&(this.maxIdleInterval=w+this.timeouts.realtimeRequestTimeout,this.onActivity())},d.prototype.onDisconnect=function(h){var w=h&&h.error;S.default.logAction(S.default.LOG_MINOR,"Transport.onDisconnect()","err = "+m.inspectError(w)),this.finish("disconnected",w)},d.prototype.onFatalError=function(h){var w=h&&h.error;S.default.logAction(S.default.LOG_MINOR,"Transport.onFatalError()","err = "+m.inspectError(w)),this.finish("failed",w)},d.prototype.onClose=function(h){var w=h&&h.error;S.default.logAction(S.default.LOG_MINOR,"Transport.onClose()","err = "+m.inspectError(w)),this.finish("closed",w)},d.prototype.requestClose=function(){S.default.logAction(S.default.LOG_MINOR,"Transport.requestClose()",""),this.send(f)},d.prototype.requestDisconnect=function(){S.default.logAction(S.default.LOG_MINOR,"Transport.requestDisconnect()",""),this.send(E)},d.prototype.ping=function(h){var w={action:a.default.Action.HEARTBEAT};h&&(w.id=h),this.send(a.default.fromValues(w))},d.prototype.dispose=function(){S.default.logAction(S.default.LOG_MINOR,"Transport.dispose()",""),this.isDisposed=!0,this.off()},d.prototype.onActivity=function(){this.maxIdleInterval&&(this.lastActivity=this.connectionManager.lastActivity=m.now(),this.setIdleTimer(this.maxIdleInterval+100))},d.prototype.setIdleTimer=function(h){var w=this;this.idleTimer||(this.idleTimer=setTimeout(function(){w.onIdleTimerExpire()},h))},d.prototype.onIdleTimerExpire=function(){if(!this.lastActivity||!this.maxIdleInterval)throw new Error("Transport.onIdleTimerExpire(): lastActivity/maxIdleInterval not set");this.idleTimer=null;var h=m.now()-this.lastActivity,w=this.maxIdleInterval-h;if(w<=0){var c="No activity seen from realtime in "+h+"ms; assuming connection has dropped";S.default.logAction(S.default.LOG_ERROR,"Transport.onIdleTimerExpire()",c),this.disconnect(new R.default(c,80003,408))}else this.setIdleTimer(w+100)},d.tryConnect=function(h,w,c,u,l){var s=new h(w,c,u),g,p=function(D){clearTimeout(g),l({event:this.event,error:D})},x=w.options.timeouts.realtimeRequestTimeout;g=setTimeout(function(){s.off(["preconnect","disconnected","failed"]),s.dispose(),p.call({event:"disconnected"},new R.default("Timeout waiting for transport to indicate itself viable",5e4,500))},x),s.on(["failed","disconnected"],p),s.on("preconnect",function(){S.default.logAction(S.default.LOG_MINOR,"Transport.tryConnect()","viable transport "+s),clearTimeout(g),s.off(["failed","disconnected"],p),l(null,s)}),s.connect()},d}(v.default);r.default=P},function(n,r,o){(function(i,a){n.exports=a(o(6),o(40),o(25))})(this,function(i){return function(){var a=i,m=a.lib,v=m.Base,S=m.WordArray,T=a.algo,R=T.MD5,C=T.EvpKDF=v.extend({cfg:v.extend({keySize:128/32,hasher:R,iterations:1}),init:function(O){this.cfg=this.cfg.extend(O)},compute:function(O,f){for(var E,P=this.cfg,y=P.hasher.create(),d=S.create(),h=d.words,w=P.keySize,c=P.iterations;h.length<w;){E&&y.update(E),E=y.update(O).finalize(f),y.reset();for(var u=1;u<c;u++)E=y.finalize(E),y.reset();d.concat(E)}return d.sigBytes=w*4,d}});a.EvpKDF=function(O,f,E){return C.create(E).compute(O,f)}}(),i.EvpKDF})},function(n,r,o){(function(i,a){n.exports=a(o(6),o(27))})(this,function(i){i.lib.Cipher||function(a){var m=i,v=m.lib,S=v.Base,T=v.WordArray,R=v.BufferedBlockAlgorithm,C=m.enc;C.Utf8;var O=C.Base64,f=m.algo,E=f.EvpKDF,P=v.Cipher=R.extend({cfg:S.extend(),createEncryptor:function(N,k){return this.create(this._ENC_XFORM_MODE,N,k)},createDecryptor:function(N,k){return this.create(this._DEC_XFORM_MODE,N,k)},init:function(N,k,I){this.cfg=this.cfg.extend(I),this._xformMode=N,this._key=k,this.reset()},reset:function(){R.reset.call(this),this._doReset()},process:function(N){return this._append(N),this._process()},finalize:function(N){N&&this._append(N);var k=this._doFinalize();return k},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(k){return typeof k=="string"?D:g}return function(k){return{encrypt:function(I,M,A){return N(M).encrypt(k,I,M,A)},decrypt:function(I,M,A){return N(M).decrypt(k,I,M,A)}}}}()});v.StreamCipher=P.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1});var y=m.mode={},d=v.BlockCipherMode=S.extend({createEncryptor:function(N,k){return this.Encryptor.create(N,k)},createDecryptor:function(N,k){return this.Decryptor.create(N,k)},init:function(N,k){this._cipher=N,this._iv=k}}),h=y.CBC=function(){var N=d.extend();N.Encryptor=N.extend({processBlock:function(I,M){var A=this._cipher,j=A.blockSize;k.call(this,I,M,j),A.encryptBlock(I,M),this._prevBlock=I.slice(M,M+j)}}),N.Decryptor=N.extend({processBlock:function(I,M){var A=this._cipher,j=A.blockSize,U=I.slice(M,M+j);A.decryptBlock(I,M),k.call(this,I,M,j),this._prevBlock=U}});function k(I,M,A){var j,U=this._iv;U?(j=U,this._iv=a):j=this._prevBlock;for(var z=0;z<A;z++)I[M+z]^=j[z]}return N}(),w=m.pad={},c=w.Pkcs7={pad:function(N,k){for(var I=k*4,M=I-N.sigBytes%I,A=M<<24|M<<16|M<<8|M,j=[],U=0;U<M;U+=4)j.push(A);var z=T.create(j,M);N.concat(z)},unpad:function(N){var k=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=k}};v.BlockCipher=P.extend({cfg:P.cfg.extend({mode:h,padding:c}),reset:function(){var N;P.reset.call(this);var k=this.cfg,I=k.iv,M=k.mode;this._xformMode==this._ENC_XFORM_MODE?N=M.createEncryptor:(N=M.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==N?this._mode.init(this,I&&I.words):(this._mode=N.call(M,this,I&&I.words),this._mode.__creator=N)},_doProcessBlock:function(N,k){this._mode.processBlock(N,k)},_doFinalize:function(){var N,k=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(k.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),k.unpad(N)),N},blockSize:128/32});var u=v.CipherParams=S.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),l=m.format={},s=l.OpenSSL={stringify:function(N){var k,I=N.ciphertext,M=N.salt;return M?k=T.create([1398893684,1701076831]).concat(M).concat(I):k=I,k.toString(O)},parse:function(N){var k,I=O.parse(N),M=I.words;return M[0]==1398893684&&M[1]==1701076831&&(k=T.create(M.slice(2,4)),M.splice(0,4),I.sigBytes-=16),u.create({ciphertext:I,salt:k})}},g=v.SerializableCipher=S.extend({cfg:S.extend({format:s}),encrypt:function(N,k,I,M){M=this.cfg.extend(M);var A=N.createEncryptor(I,M),j=A.finalize(k),U=A.cfg;return u.create({ciphertext:j,key:I,iv:U.iv,algorithm:N,mode:U.mode,padding:U.padding,blockSize:N.blockSize,formatter:M.format})},decrypt:function(N,k,I,M){M=this.cfg.extend(M),k=this._parse(k,M.format);var A=N.createDecryptor(I,M).finalize(k.ciphertext);return A},_parse:function(N,k){return typeof N=="string"?k.parse(N,this):N}}),p=m.kdf={},x=p.OpenSSL={execute:function(N,k,I,M){M||(M=T.random(64/8));var A=E.create({keySize:k+I}).compute(N,M),j=T.create(A.words.slice(k),I*4);return A.sigBytes=k*4,u.create({key:A,iv:j,salt:M})}},D=v.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:x}),encrypt:function(N,k,I,M){M=this.cfg.extend(M);var A=M.kdf.execute(I,N.keySize,N.ivSize);M.iv=A.iv;var j=g.encrypt.call(this,N,k,A.key,M);return j.mixIn(A),j},decrypt:function(N,k,I,M){M=this.cfg.extend(M),k=this._parse(k,M.format);var A=M.kdf.execute(I,N.keySize,N.ivSize,k.salt);M.iv=A.iv;var j=g.decrypt.call(this,N,k,A.key,M);return j}})}()})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.Request=r.createRequest=void 0;var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(12)),v=i.__importDefault(o(3)),S=i.__importDefault(o(7)),T=o(4),R=i.__importDefault(o(8)),C=i.__importDefault(o(2)),O=i.__importDefault(o(22)),f=a.getGlobalObject(),E=function(){},P=f._ablyjs_jsonp={};P._=function(l){return P["_"+l]||E};var y=1,d="jsonp";function h(l,s,g,p,x,D,N){return D=D||R.default.TIMEOUTS,new c(void 0,l,s,a.copy(g),p,x,D,N)}r.createRequest=h;var w=function(l){i.__extends(s,l);function s(g,p,x){var D=l.call(this,g,p,x)||this;return D.shortName=d,x.stream=!1,D}return s.isAvailable=function(){return v.default.Config.jsonpSupported&&v.default.Config.allowComet},s.prototype.toString=function(){return"JSONPTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},s.prototype.createRequest=function(g,p,x,D,N,k,I){return k=(this===null||this===void 0?void 0:this.timeouts)||k||R.default.TIMEOUTS,h(g,p,x,D,N,k,I)},s}(m.default),c=function(l){i.__extends(s,l);function s(g,p,x,D,N,k,I,M){var A=l.call(this)||this;return g===void 0&&(g=y++),A.id=g,A.uri=p,A.params=D||{},A.params.rnd=a.cheapRandStr(),x&&(x["X-Ably-Version"]&&(A.params.v=x["X-Ably-Version"]),x["X-Ably-Lib"]&&(A.params.lib=x["X-Ably-Lib"])),A.body=N,A.method=M,A.requestMode=k,A.timeouts=I,A.requestComplete=!1,A}return s.prototype.exec=function(){var g=this,p=this.id,x=this.body,D=this.method,N=this.uri,k=this.params;k.callback="_ablyjs_jsonp._("+p+")",k.envelope="jsonp",x&&(k.body=x),D&&D!=="get"&&(k.method=D);var I=this.script=document.createElement("script"),M=N+a.toQueryString(k);I.src=M,I.src.split("/").slice(-1)[0]!==M.split("/").slice(-1)[0]&&C.default.logAction(C.default.LOG_ERROR,"JSONP Request.exec()","Warning: the browser appears to have truncated the script URI. This will likely result in the request failing due to an unparseable body param"),I.async=!0,I.type="text/javascript",I.charset="UTF-8",I.onerror=function(U){g.complete(new T.PartialErrorInfo("JSONP script error (event: "+v.default.Config.inspect(U)+")",null,400))},P["_"+p]=function(U){if(U.statusCode){var z=U.response;if(U.statusCode==204)g.complete(null,null,null,U.statusCode);else if(!z)g.complete(new T.PartialErrorInfo("Invalid server response: no envelope detected",null,500));else if(U.statusCode<400||a.isArray(z))g.complete(null,z,U.headers,U.statusCode);else{var V=z.error||new T.PartialErrorInfo("Error response received from server",null,U.statusCode);g.complete(V)}}else g.complete(null,U)};var A=this.requestMode==O.default.REQ_SEND?this.timeouts.httpRequestTimeout:this.timeouts.recvTimeout;this.timer=setTimeout(this.abort.bind(this),A);var j=document.getElementsByTagName("head")[0];j.insertBefore(I,j.firstChild)},s.prototype.complete=function(g,p,x,D){if(x=x||{},!this.requestComplete){this.requestComplete=!0;var N=void 0;p&&(N=typeof p=="string"?"text/plain":"application/json",x["content-type"]=N,this.emit("data",p)),this.emit("complete",g,p,x,!0,D),this.dispose()}},s.prototype.abort=function(){this.dispose()},s.prototype.dispose=function(){var g=this.timer;g&&(clearTimeout(g),this.timer=null);var p=this.script;p.parentNode&&p.parentNode.removeChild(p),delete P[this.id],this.emit("disposed")},s}(S.default);r.Request=c;function u(l){return f.JSONPTransport=w,w.isAvailable()&&(l.supportedTransports[d]=w),w}r.default=u},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(2)),v=i.__importDefault(o(8)),S=i.__importDefault(o(18)),T=i.__importDefault(o(46)),R=i.__importDefault(o(20)),C=i.__importDefault(o(33)),O=i.__importDefault(o(4)),f=i.__importDefault(o(49)),E=i.__importDefault(o(19)),P=i.__importDefault(o(3)),y=i.__importDefault(o(9)),d=i.__importDefault(o(16)),h=i.__importDefault(o(15)),w=function(){},c=function(){function l(s){if(!s){var g="no options provided";throw m.default.logAction(m.default.LOG_ERROR,"Rest()",g),new Error(g)}var p=v.default.objectifyOptions(s);p.log?(m.default.setLog(p.log.level,p.log.handler),m.default.deprecated("The `log` client option","Equivalent functionality is provided by the `logLevel` and `logHandler` client options. Update your client options code of the form `{ log: { level: logLevel, handler: logHandler } }` to instead be `{ logLevel, logHandler }`.")):m.default.setLog(p.logLevel,p.logHandler),m.default.logAction(m.default.LOG_MICRO,"Rest()","initialized with clientOptions "+P.default.Config.inspect(s));var x=this.options=v.default.normaliseOptions(p);if(x.key){var D=x.key.match(/^([^:\s]+):([^:.\s]+)$/);if(!D){var g="invalid key parameter";throw m.default.logAction(m.default.LOG_ERROR,"Rest()",g),new O.default(g,40400,404)}x.keyName=D[1],x.keySecret=D[2]}if("clientId"in x)if(typeof x.clientId=="string"||x.clientId===null){if(x.clientId==="*")throw new O.default('Can’t use "*" as a clientId as that string is reserved. (To change the default token request behaviour to use a wildcard clientId, use {defaultTokenParams: {clientId: "*"}})',40012,400)}else throw new O.default("clientId must be either a string or null",40012,400);m.default.logAction(m.default.LOG_MINOR,"Rest()","started; version = "+v.default.version),this.baseUri=this.authority=function(N){return v.default.getHttpScheme(x)+N+":"+v.default.getPort(x,!1)},this._currentFallback=null,this.serverTimeOffset=null,this.http=new P.default.Http(x),this.auth=new S.default(this,x),this.channels=new u(this),this.push=new T.default(this)}return l.prototype.stats=function(s,g){if(g===void 0)if(typeof s=="function")g=s,s=null;else{if(this.options.promises)return a.promisify(this,"stats",[s]);g=w}var p=a.defaultGetHeaders(this.options),x=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,D=this.http.supportsLinkHeaders?void 0:x;this.options.headers&&a.mixin(p,this.options.headers),new R.default(this,"/stats",p,D,function(N,k,I){for(var M=I?N:JSON.parse(N),A=0;A<M.length;A++)M[A]=f.default.fromValues(M[A]);return M}).get(s,g)},l.prototype.time=function(s,g){var p=this;if(g===void 0){if(typeof s=="function")g=s,s=null;else if(this.options.promises)return a.promisify(this,"time",[s])}var x=g||w,D=a.defaultGetHeaders(this.options);this.options.headers&&a.mixin(D,this.options.headers);var N=function(k){return p.authority(k)+"/time"};this.http.do(E.default.Get,this,N,D,null,s,function(k,I,M,A){if(k){x(k);return}A||(I=JSON.parse(I));var j=I[0];if(!j){x(new O.default("Internal error (unexpected result type from GET /time)",5e4,500));return}p.serverTimeOffset=j-a.now(),x(null,j)})},l.prototype.request=function(s,g,p,x,D,N){var k=this.options.useBinaryProtocol,I=k?P.default.Config.msgpack.encode:JSON.stringify,M=k?P.default.Config.msgpack.decode:JSON.parse,A=k?a.Format.msgpack:a.Format.json,j=this.http.supportsLinkHeaders?void 0:A;p=p||{};var U=s.toLowerCase(),z=U=="get"?a.defaultGetHeaders(this.options,A):a.defaultPostHeaders(this.options,A);if(N===void 0){if(this.options.promises)return a.promisify(this,"request",[s,g,p,x,D]);N=w}typeof x!="string"&&(x=I(x)),this.options.headers&&a.mixin(z,this.options.headers),D&&a.mixin(z,D);var V=new R.default(this,g,z,j,function(G,F,b){return a.ensureArray(b?G:M(G))},!0);if(!a.arrIn(P.default.Http.methods,U))throw new O.default("Unsupported method "+U,40500,405);a.arrIn(P.default.Http.methodsWithBody,U)?V[U](p,x,N):V[U](p,N)},l.prototype.batchPublish=function(s,g){if(g===void 0){if(this.options.promises)return a.promisify(this,"batchPublish",[s]);g=w}var p=g,x,D;a.isArray(s)?(x=s,D=!1):(x=[s],D=!0);var N=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,k=a.defaultPostHeaders(this.options,N);this.options.headers&&a.mixin(k,this.options.headers);var I=a.encodeBody(x,N);h.default.post(this,"/messages",I,k,{newBatchResponse:"true"},null,function(M,A,j,U){if(M){p(M);return}var z=U?A:a.decodeBody(A,N);D?p(null,z[0]):p(null,z)})},l.prototype.batchPresence=function(s,g){if(g===void 0){if(this.options.promises)return a.promisify(this,"batchPresence",[s]);g=w}var p=g,x=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,D=a.defaultPostHeaders(this.options,x);this.options.headers&&a.mixin(D,this.options.headers);var N=s.join(",");h.default.get(this,"/presence",D,{newBatchResponse:"true",channels:N},null,function(k,I,M,A){if(k){p(k);return}var j=A?I:a.decodeBody(I,x);p(null,j)})},l.prototype.setLog=function(s){m.default.setLog(s.level,s.handler)},l.Promise=function(s){return s=v.default.objectifyOptions(s),s.promises=!0,new l(s)},l.Callbacks=l,l.Platform=P.default,l.Message=y.default,l.PresenceMessage=d.default,l}(),u=function(){function l(s){this.rest=s,this.all=Object.create(null)}return l.prototype.get=function(s,g){s=String(s);var p=this.all[s];return p?g&&p.setOptions(g):this.all[s]=p=new C.default(this.rest,s,g),p},l.prototype.release=function(s){delete this.all[String(s)]},l}();r.default=c},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return i.enc.Utf8})},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(a){var m=i,v=m.lib,S=v.WordArray,T=v.Hasher,R=m.algo,C=[],O=[];(function(){function P(w){for(var c=a.sqrt(w),u=2;u<=c;u++)if(!(w%u))return!1;return!0}function y(w){return(w-(w|0))*4294967296|0}for(var d=2,h=0;h<64;)P(d)&&(h<8&&(C[h]=y(a.pow(d,1/2))),O[h]=y(a.pow(d,1/3)),h++),d++})();var f=[],E=R.SHA256=T.extend({_doReset:function(){this._hash=new S.init(C.slice(0))},_doProcessBlock:function(P,y){for(var d=this._hash.words,h=d[0],w=d[1],c=d[2],u=d[3],l=d[4],s=d[5],g=d[6],p=d[7],x=0;x<64;x++){if(x<16)f[x]=P[y+x]|0;else{var D=f[x-15],N=(D<<25|D>>>7)^(D<<14|D>>>18)^D>>>3,k=f[x-2],I=(k<<15|k>>>17)^(k<<13|k>>>19)^k>>>10;f[x]=N+f[x-7]+I+f[x-16]}var M=l&s^~l&g,A=h&w^h&c^w&c,j=(h<<30|h>>>2)^(h<<19|h>>>13)^(h<<10|h>>>22),U=(l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25),z=p+U+M+O[x]+f[x],V=j+A;p=g,g=s,s=l,l=u+z|0,u=c,c=w,w=h,h=z+V|0}d[0]=d[0]+h|0,d[1]=d[1]+w|0,d[2]=d[2]+c|0,d[3]=d[3]+u|0,d[4]=d[4]+l|0,d[5]=d[5]+s|0,d[6]=d[6]+g|0,d[7]=d[7]+p|0},_doFinalize:function(){var P=this._data,y=P.words,d=this._nDataBytes*8,h=P.sigBytes*8;return y[h>>>5]|=128<<24-h%32,y[(h+64>>>9<<4)+14]=a.floor(d/4294967296),y[(h+64>>>9<<4)+15]=d,P.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var P=T.clone.call(this);return P._hash=this._hash.clone(),P}});m.SHA256=T._createHelper(E),m.HmacSHA256=T._createHmacHelper(E)}(Math),i.SHA256})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(7)),v=i.__importDefault(o(2)),S=i.__importDefault(o(34)),T=i.__importDefault(o(9)),R=i.__importDefault(o(4)),C=i.__importDefault(o(20)),O=i.__importDefault(o(15)),f=i.__importDefault(o(3));function E(){}var P=9;function y(w){return a.arrEvery(w,function(c){return!c.id})}function d(w){var c=w||{};if(c.cipher){if(!f.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var u=f.default.Crypto.getCipher(c.cipher);c.cipher=u.cipherParams,c.channelCipher=u.cipher}else"cipher"in c&&(c.cipher=void 0,c.channelCipher=null);return c}var h=function(w){i.__extends(c,w);function c(u,l,s){var g=w.call(this)||this;return v.default.logAction(v.default.LOG_MINOR,"Channel()","started; name = "+l),g.rest=u,g.name=l,g.basePath="/channels/"+encodeURIComponent(l),g.presence=new S.default(g),g.channelOptions=d(s),g}return c.prototype.setOptions=function(u){this.channelOptions=d(u)},c.prototype.history=function(u,l){if(v.default.logAction(v.default.LOG_MICRO,"Channel.history()","channel = "+this.name),l===void 0)if(typeof u=="function")l=u,u=null;else{if(this.rest.options.promises)return a.promisify(this,"history",arguments);l=E}this._history(u,l)},c.prototype._history=function(u,l){var s=this.rest,g=s.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,p=this.rest.http.supportsLinkHeaders?void 0:g,x=a.defaultGetHeaders(s.options,g);s.options.headers&&a.mixin(x,s.options.headers);var D=this.channelOptions;new C.default(s,this.basePath+"/messages",x,p,function(N,k,I){return T.default.fromResponseBody(N,D,I?void 0:g)}).get(u,l)},c.prototype.publish=function(){var u=this,l=arguments.length,s=arguments[0],g=arguments[1],p=arguments[l-1],x,D;if(typeof p!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);p=E}if(typeof s=="string"||s===null)x=[T.default.fromValues({name:s,data:g})],D=arguments[2];else if(a.isObject(s))x=[T.default.fromValues(s)],D=arguments[1];else if(a.isArray(s))x=T.default.fromValuesArray(s),D=arguments[1];else throw new R.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);(typeof D!="object"||!D)&&(D={});var N=this.rest,k=N.options,I=k.useBinaryProtocol?a.Format.msgpack:a.Format.json,M=N.options.idempotentRestPublishing,A=a.defaultPostHeaders(N.options,I);if(k.headers&&a.mixin(A,k.headers),M&&y(x)){var j=a.randomString(P);a.arrForEach(x,function(U,z){U.id=j+":"+z.toString()})}T.default.encodeArray(x,this.channelOptions,function(U){if(U){p(U);return}var z=T.default.getMessagesSize(x),V=k.maxMessageSize;if(z>V){p(new R.default("Maximum size of messages that can be published at once exceeded ( was "+z+" bytes; limit is "+V+" bytes)",40009,400));return}u._publish(T.default.serialize(x,I),A,D,p)})},c.prototype._publish=function(u,l,s,g){O.default.post(this.rest,this.basePath+"/messages",u,l,s,null,g)},c.prototype.status=function(u){if(typeof u!="function"&&this.rest.options.promises)return a.promisify(this,"status",[]);var l=this.rest.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,s=a.defaultPostHeaders(this.rest.options,l);O.default.get(this.rest,this.basePath,s,{},l,u||E)},c}(m.default);r.default=h},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(7)),v=i.__importDefault(o(2)),S=i.__importDefault(o(20)),T=i.__importDefault(o(16));function R(){}var C=function(O){i.__extends(f,O);function f(E){var P=O.call(this)||this;return P.channel=E,P.basePath=E.basePath+"/presence",P}return f.prototype.get=function(E,P){if(v.default.logAction(v.default.LOG_MICRO,"Presence.get()","channel = "+this.channel.name),P===void 0)if(typeof E=="function")P=E,E=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"get",arguments);P=R}var y=this.channel.rest,d=y.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,h=this.channel.rest.http.supportsLinkHeaders?void 0:d,w=a.defaultGetHeaders(y.options,d);y.options.headers&&a.mixin(w,y.options.headers);var c=this.channel.channelOptions;new S.default(y,this.basePath,w,h,function(u,l,s){return T.default.fromResponseBody(u,c,s?void 0:d)}).get(E,P)},f.prototype.history=function(E,P){return v.default.logAction(v.default.LOG_MICRO,"Presence.history()","channel = "+this.channel.name),this._history(E,P)},f.prototype._history=function(E,P){if(P===void 0)if(typeof E=="function")P=E,E=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"_history",[E]);P=R}var y=this.channel.rest,d=y.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,h=this.channel.rest.http.supportsLinkHeaders?void 0:d,w=a.defaultGetHeaders(y.options,d);y.options.headers&&a.mixin(w,y.options.headers);var c=this.channel.channelOptions;new S.default(y,this.basePath+"/history",w,h,function(u,l,s){return T.default.fromResponseBody(u,c,s?void 0:d)}).get(E,P)},f}(m.default);r.default=C},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0}),r.TransportParams=void 0;var a=o(0),m=a.__importDefault(o(10)),v=a.__importStar(o(1)),S=a.__importStar(o(52)),T=a.__importStar(o(8)),R=a.__importDefault(o(3)),C=a.__importDefault(o(7)),O=a.__importDefault(o(36)),f=a.__importDefault(o(2)),E=a.__importDefault(o(37)),P=a.__importStar(o(21)),y=a.__importStar(o(4)),d=a.__importDefault(o(18)),h=a.__importDefault(o(9)),w=a.__importDefault(o(24)),c=a.__importDefault(o(53)),u=a.__importDefault(o(26)),l=a.__importDefault(o(14)),s=function(){var G;return typeof R.default.WebStorage!="undefined"&&((G=R.default.WebStorage)===null||G===void 0?void 0:G.localSupported)},g=function(){var G;return typeof R.default.WebStorage!="undefined"&&((G=R.default.WebStorage)===null||G===void 0?void 0:G.sessionSupported)},p=m.default.Action,x=function(){},D="ably-transport-preference",N="ably-connection-recovery";function k(){var G,F;return g()&&((F=(G=R.default.WebStorage)===null||G===void 0?void 0:G.getSession)===null||F===void 0?void 0:F.call(G,N))}function I(G){var F,b;return g()&&((b=(F=R.default.WebStorage)===null||F===void 0?void 0:F.setSession)===null||b===void 0?void 0:b.call(F,N,G))}function M(){var G,F;return g()&&((F=(G=R.default.WebStorage)===null||G===void 0?void 0:G.removeSession)===null||F===void 0?void 0:F.call(G,N))}function A(G,F){return v.arrIndexOf(R.default.Defaults.transportPreferenceOrder,G.shortName)>v.arrIndexOf(R.default.Defaults.transportPreferenceOrder,F.shortName)}function j(G,F,b){var L;if(G.channel!==F.channel||(L=G.action)!==p.PRESENCE&&L!==p.MESSAGE||L!==F.action)return!1;var B=L===p.PRESENCE?"presence":"messages",_=G[B].concat(F[B]),W=h.default.getMessagesSize(_);return W>b||!v.allSame(_,"clientId")||!v.arrEvery(_,function(Y){return!Y.id})?!1:(G[B]=_,!0)}function U(G){try{return JSON.parse(G)}catch(F){return null}}var z=function(){function G(F,b,L,B){this.options=F,this.host=b,this.mode=L,this.connectionKey=B,this.format=F.useBinaryProtocol?v.Format.msgpack:v.Format.json}return G.prototype.getConnectParams=function(F){var b=F?v.copy(F):{},L=this.options;switch(this.mode){case"upgrade":b.upgrade=this.connectionKey;break;case"resume":b.resume=this.connectionKey;break;case"recover":{var B=U(L.recover);B&&(b.recover=B.connectionKey);break}}return L.clientId!==void 0&&(b.clientId=L.clientId),L.echoMessages===!1&&(b.echo="false"),this.format!==void 0&&(b.format=this.format),this.stream!==void 0&&(b.stream=this.stream),this.heartbeats!==void 0&&(b.heartbeats=this.heartbeats),b.v=T.default.protocolVersion,b.agent=(0,T.getAgentString)(this.options),L.transportParams!==void 0&&v.mixin(b,L.transportParams),b},G.prototype.toString=function(){var F="[mode="+this.mode;return this.host&&(F+=",host="+this.host),this.connectionKey&&(F+=",connectionKey="+this.connectionKey),this.format&&(F+=",format="+this.format),F+="]",F},G}();r.TransportParams=z;var V=function(G){a.__extends(F,G);function F(b,L){var B=G.call(this)||this;B.disconnectedRetryCount=0,F.initTransports(),B.realtime=b,B.options=L;var _=L.timeouts,W=_.preferenceConnectTimeout+_.realtimeRequestTimeout;if(B.states={initialized:{state:"initialized",terminal:!1,queueEvents:!0,sendEvents:!1,failState:"disconnected"},connecting:{state:"connecting",terminal:!1,queueEvents:!0,sendEvents:!1,retryDelay:W,failState:"disconnected"},connected:{state:"connected",terminal:!1,queueEvents:!1,sendEvents:!0,failState:"disconnected"},synchronizing:{state:"connected",terminal:!1,queueEvents:!0,sendEvents:!1,forceQueueEvents:!0,failState:"disconnected"},disconnected:{state:"disconnected",terminal:!1,queueEvents:!0,sendEvents:!1,retryDelay:_.disconnectedRetryTimeout,failState:"disconnected"},suspended:{state:"suspended",terminal:!1,queueEvents:!1,sendEvents:!1,retryDelay:_.suspendedRetryTimeout,failState:"suspended"},closing:{state:"closing",terminal:!1,queueEvents:!1,sendEvents:!1,retryDelay:_.realtimeRequestTimeout,failState:"closed"},closed:{state:"closed",terminal:!0,queueEvents:!1,sendEvents:!1,failState:"closed"},failed:{state:"failed",terminal:!0,queueEvents:!1,sendEvents:!1,failState:"failed"}},B.state=B.states.initialized,B.errorReason=null,B.queuedMessages=new O.default,B.msgSerial=0,B.connectionDetails=void 0,B.connectionId=void 0,B.connectionKey=void 0,B.connectionStateTtl=_.connectionStateTtl,B.maxIdleInterval=null,B.transports=v.intersect(L.transports||T.default.defaultTransports,F.supportedTransports),B.baseTransport=v.intersect(T.default.baseTransportOrder,B.transports)[0],B.upgradeTransports=v.intersect(B.transports,T.default.upgradeTransports),B.transportPreference=null,B.httpHosts=T.default.getHosts(L),B.activeProtocol=null,B.proposedTransports=[],B.pendingTransports=[],B.host=null,B.lastAutoReconnectAttempt=null,B.lastActivity=null,B.forceFallbackHost=!1,B.connectCounter=0,f.default.logAction(f.default.LOG_MINOR,"Realtime.ConnectionManager()","started"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","requested transports = ["+(L.transports||T.default.defaultTransports)+"]"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","available transports = ["+B.transports+"]"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","http hosts = ["+B.httpHosts+"]"),!B.transports.length){var Y="no requested transports available";throw f.default.logAction(f.default.LOG_ERROR,"realtime.ConnectionManager()",Y),new Error(Y)}var X=R.default.Config.addEventListener;return X&&(g()&&typeof L.recover=="function"&&X("beforeunload",B.persistConnection.bind(B)),L.closeOnUnload===!0&&X("beforeunload",function(){f.default.logAction(f.default.LOG_MAJOR,"Realtime.ConnectionManager()","beforeunload event has triggered the connection to close as closeOnUnload is true"),B.requestState({state:"closing"})}),X("online",function(){B.state==B.states.disconnected||B.state==B.states.suspended?(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager caught browser ‘online’ event","reattempting connection"),B.requestState({state:"connecting"})):B.state==B.states.connecting&&(B.pendingTransports.forEach(function(te){te.off()}),B.disconnectAllTransports(),B.startConnect())}),X("offline",function(){B.state==B.states.connected&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager caught browser ‘offline’ event","disconnecting active transport"),B.disconnectAllTransports())})),B}return F.initTransports=function(){(0,c.default)(F),v.arrForEach(R.default.Transports,function(b){b(F)})},F.prototype.createTransportParams=function(b,L){return new z(this.options,b,L,this.connectionKey)},F.prototype.getTransportParams=function(b){var L=this,B=function(_){if(L.connectionKey){_("resume");return}if(typeof L.options.recover=="string"){_("recover");return}var W=L.options.recover,Y=k();if(Y&&typeof W=="function"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Calling clientOptions-provided recover function with last session data"),W(Y,function(X){X?(L.options.recover=Y.recoveryKey,_("recover")):_("clean")});return}_("clean")};B(function(_){var W=L.createTransportParams(null,_);if(_==="recover"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport recovery mode = recover; recoveryKey = "+L.options.recover);var Y=U(L.options.recover);Y&&(L.msgSerial=Y.msgSerial)}else f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport params = "+W.toString());b(W)})},F.prototype.tryATransport=function(b,L,B){var _=this;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","trying "+L),u.default.tryConnect(F.supportedTransports[L],this,this.realtime.auth,b,function(W,Y){var X=_.state;if(X==_.states.closing||X==_.states.closed||X==_.states.failed){Y&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","connection "+X.state+" while we were attempting the transport; closing "+Y),Y.close()),B(!0);return}if(W){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","transport "+L+" "+W.event+", err: "+W.error.toString()),d.default.isTokenErr(W.error)&&!(_.errorReason&&d.default.isTokenErr(_.errorReason))?(_.errorReason=W.error,_.realtime.auth._forceNewToken(null,null,function(te){if(te){_.actOnErrorFromAuthorize(te);return}_.tryATransport(b,L,B)})):W.event==="failed"?(_.notifyState({state:"failed",error:W.error}),B(!0)):W.event==="disconnected"&&((0,P.isRetriable)(W.error)?B(!1):(_.notifyState({state:_.states.connecting.failState,error:W.error}),B(!0)));return}f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","viable transport "+L+"; setting pending"),_.setTransportPending(Y,b),B(null,Y)})},F.prototype.setTransportPending=function(b,L){var B=this,_=L.mode;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setTransportPending()","transport = "+b+"; mode = "+_),v.arrDeleteValue(this.proposedTransports,b),this.pendingTransports.push(b);var W=R.default.Defaults.transportPreferenceOrder[R.default.Defaults.transportPreferenceOrder.length-1];b.once("connected",function(X,te,re){_=="upgrade"&&B.activeProtocol?b.shortName!==W&&v.arrIn(B.getUpgradePossibilities(),W)&&B.activeProtocol?setTimeout(function(){B.scheduleTransportActivation(X,b,te,re)},B.options.timeouts.parallelUpgradeDelay):B.scheduleTransportActivation(X,b,te,re):(B.activateTransport(X,b,te,re),R.default.Config.nextTick(function(){B.connectImpl(L)})),_==="recover"&&B.options.recover&&(B.options.recover=null,B.unpersistConnection())});var Y=this;b.on(["disconnected","closed","failed"],function(X){Y.deactivateTransport(b,this.event,X)}),this.emit("transport.pending",b)},F.prototype.scheduleTransportActivation=function(b,L,B,_){var W=this,Y=this.activeProtocol&&this.activeProtocol.getTransport(),X=function(){L.disconnect(),v.arrDeleteValue(W.pendingTransports,L)};if(this.state!==this.states.connected&&this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Current connection state ("+this.state.state+(this.state===this.states.synchronizing?", but with an upgrade already in progress":"")+") is not valid to upgrade in; abandoning upgrade to "+L.shortName),X();return}if(Y&&!A(L,Y)){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+L.shortName+" is no better than current active transport "+Y.shortName+" - abandoning upgrade"),X();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Scheduling transport upgrade; transport = "+L);var te=null;if(!L.isConnected){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+L.shortName+"is no longer connected; abandoning upgrade"),X();return}if(this.state===this.states.connected)f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Currently connected, so temporarily pausing events until the upgrade is complete"),this.state=this.states.synchronizing,te=this.activeProtocol;else if(this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Current connection state ("+this.state.state+(this.state===this.states.synchronizing?", but with an upgrade already in progress":"")+") is not valid to upgrade in; abandoning upgrade to "+L.shortName),X();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Syncing transport; transport = "+L);var re=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Activating transport; transport = "+L),L.send(m.default.fromValues({action:p.ACTIVATE})),W.activateTransport(b,L,B,_),W.state===W.states.synchronizing?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, sending queued messages on upgraded transport; transport = "+L),W.state=W.states.connected):f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, but state is now "+W.state.state+", so leaving unchanged"),W.state.sendEvents&&W.sendQueuedMessages()};te?te.onceIdle(re):re()},F.prototype.activateTransport=function(b,L,B,_){var W=this;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","transport = "+L),b&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","error = "+b),B&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.activateTransport()","connectionId = "+B),_&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.activateTransport()","connectionDetails = "+JSON.stringify(_)),this.persistTransportPreference(L);var Y=this.state,X=this.states.connected.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","current state = "+Y.state),Y.state==this.states.closing.state||Y.state==this.states.closed.state||Y.state==this.states.failed.state)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Disconnecting transport and abandoning"),L.disconnect(),!1;if(v.arrDeleteValue(this.pendingTransports,L),!L.isConnected)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Declining to activate transport "+L+" since it appears to no longer be connected"),!1;var te=this.activeProtocol;this.activeProtocol=new S.default(L),this.host=L.params.host;var re=_.connectionKey;if(re&&this.connectionKey!=re&&this.setConnection(B,_,!!b),this.onConnectionDetailsUpdate(_,L),R.default.Config.nextTick(function(){L.on("connected",function(Z,he,Me){W.onConnectionDetailsUpdate(Me,L),W.emit("update",new E.default(X,X,null,Z))})}),Y.state===this.states.connected.state?b&&(this.errorReason=this.realtime.connection.errorReason=b,this.emit("update",new E.default(X,X,null,b))):(this.notifyState({state:"connected",error:b}),this.errorReason=this.realtime.connection.errorReason=b||null),this.emit("transport.active",L),te)if(te.messageQueue.count()>0&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Previous active protocol (for transport "+te.transport.shortName+", new one is "+L.shortName+") finishing with "+te.messageQueue.count()+" messages still pending"),te.transport===L){var le="Assumption violated: activating a transport that was also the transport for the previous active protocol; transport = "+L.shortName+"; stack = "+new Error().stack;f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()",le)}else te.finish();return v.safeArrForEach(this.pendingTransports,function(Z){if(Z===L){var he="Assumption violated: activating a transport that is still marked as a pending transport; transport = "+L.shortName+"; stack = "+new Error().stack;f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()",he),v.arrDeleteValue(W.pendingTransports,L)}else Z.disconnect()}),v.safeArrForEach(this.proposedTransports,function(Z){Z===L?(f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Assumption violated: activating a transport that is still marked as a proposed transport; transport = "+L.shortName+"; stack = "+new Error().stack),v.arrDeleteValue(W.proposedTransports,L)):Z.dispose()}),!0},F.prototype.deactivateTransport=function(b,L,B){var _=this.activeProtocol,W=_&&_.getTransport()===b,Y=v.arrDeleteValue(this.pendingTransports,b),X=v.arrDeleteValue(this.proposedTransports,b),te=this.noTransportsScheduledForActivation();if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.deactivateTransport()","transport = "+b),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.deactivateTransport()","state = "+L+(W?"; was active":Y?"; was pending":X?"; was proposed":"")+(te?"":"; another transport is scheduled for activation")),B&&B.message&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","reason = "+B.message),W&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","Getting, clearing, and requeuing "+this.activeProtocol.messageQueue.count()+" pending messages"),this.queuePendingMessages(_.getPendingMessages()),R.default.Config.nextTick(function(){_.clearPendingMessages()}),this.activeProtocol=this.host=null),this.emit("transport.inactive",b),W&&te||W&&L==="failed"||L==="closed"||_===null&&Y&&this.pendingTransports.length===0){if(L==="disconnected"&&B&&B.statusCode>500&&this.httpHosts.length>1){this.unpersistTransportPreference(),this.forceFallbackHost=!0,this.notifyState({state:L,error:B,retryImmediately:!0});return}var re=L==="failed"&&d.default.isTokenErr(B)?"disconnected":L;this.notifyState({state:re,error:B});return}W&&L==="disconnected"&&this.state!==this.states.synchronizing&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","wasActive but another transport is connected and scheduled for activation, so going into the connecting state until it activates"),this.startSuspendTimer(),this.startTransitionTimer(this.states.connecting),this.notifyState({state:"connecting",error:B}))},F.prototype.noTransportsScheduledForActivation=function(){return v.isEmpty(this.pendingTransports)||this.pendingTransports.every(function(b){return!b.isConnected})},F.prototype.setConnection=function(b,L,B){var _=this.connectionId,W=_&&_!==b,Y=!_&&B;(W||Y)&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setConnection()","Resetting msgSerial"),this.msgSerial=0,this.queuedMessages.resetSendAttempted()),this.connectionId!==b&&f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setConnection()","New connectionId; reattaching any attached channels"),this.realtime.connection.id=this.connectionId=b,this.realtime.connection.key=this.connectionKey=L.connectionKey},F.prototype.clearConnection=function(){this.realtime.connection.id=this.connectionId=void 0,this.realtime.connection.key=this.connectionKey=void 0,this.msgSerial=0,this.unpersistConnection()},F.prototype.createRecoveryKey=function(){return this.connectionKey?JSON.stringify({connectionKey:this.connectionKey,msgSerial:this.msgSerial,channelSerials:this.realtime.channels.channelSerials()}):null},F.prototype.checkConnectionStateFreshness=function(){if(!(!this.lastActivity||!this.connectionId)){var b=v.now()-this.lastActivity;b>this.connectionStateTtl+this.maxIdleInterval&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.checkConnectionStateFreshness()","Last known activity from realtime was "+b+"ms ago; discarding connection state"),this.clearConnection(),this.states.connecting.failState="suspended")}},F.prototype.persistConnection=function(){if(g()){var b=this.createRecoveryKey();b&&I({recoveryKey:b,disconnectedAt:v.now(),location:i.location,clientId:this.realtime.auth.clientId})}},F.prototype.unpersistConnection=function(){M()},F.prototype.getError=function(){return this.errorReason||this.getStateError()},F.prototype.getStateError=function(){var b,L;return(L=(b=P.default)[this.state.state])===null||L===void 0?void 0:L.call(b)},F.prototype.activeState=function(){return this.state.queueEvents||this.state.sendEvents},F.prototype.enactStateChange=function(b){var L=b.current==="failed"?f.default.LOG_ERROR:f.default.LOG_MAJOR;f.default.logAction(L,"Connection state",b.current+(b.reason?"; reason: "+b.reason:"")),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.enactStateChange","setting new state: "+b.current+"; reason = "+(b.reason&&b.reason.message));var B=this.state=this.states[b.current];b.reason&&(this.errorReason=b.reason,this.realtime.connection.errorReason=b.reason),(B.terminal||B.state==="suspended")&&this.clearConnection(),this.emit("connectionstate",b)},F.prototype.startTransitionTimer=function(b){var L=this;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startTransitionTimer()","transitionState: "+b.state),this.transitionTimer&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startTransitionTimer()","clearing already-running timer"),clearTimeout(this.transitionTimer)),this.transitionTimer=setTimeout(function(){L.transitionTimer&&(L.transitionTimer=null,f.default.logAction(f.default.LOG_MINOR,"ConnectionManager "+b.state+" timer expired","requesting new state: "+b.failState),L.notifyState({state:b.failState}))},b.retryDelay)},F.prototype.cancelTransitionTimer=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.cancelTransitionTimer()",""),this.transitionTimer&&(clearTimeout(this.transitionTimer),this.transitionTimer=null)},F.prototype.startSuspendTimer=function(){var b=this;this.suspendTimer||(this.suspendTimer=setTimeout(function(){b.suspendTimer&&(b.suspendTimer=null,f.default.logAction(f.default.LOG_MINOR,"ConnectionManager suspend timer expired","requesting new state: suspended"),b.states.connecting.failState="suspended",b.notifyState({state:"suspended"}))},this.connectionStateTtl))},F.prototype.checkSuspendTimer=function(b){b!=="disconnected"&&b!=="suspended"&&b!=="connecting"&&this.cancelSuspendTimer()},F.prototype.cancelSuspendTimer=function(){this.states.connecting.failState="disconnected",this.suspendTimer&&(clearTimeout(this.suspendTimer),this.suspendTimer=null)},F.prototype.startRetryTimer=function(b){var L=this;this.retryTimer=setTimeout(function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager retry timer expired","retrying"),L.retryTimer=null,L.requestState({state:"connecting"})},b)},F.prototype.cancelRetryTimer=function(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)},F.prototype.notifyState=function(b){var L=this,B,_,W=b.state,Y=W==="disconnected"&&(this.state===this.states.connected||this.state===this.states.synchronizing||b.retryImmediately||this.state===this.states.connecting&&b.error&&d.default.isTokenErr(b.error)&&!(this.errorReason&&d.default.isTokenErr(this.errorReason)));if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.notifyState()","new state: "+W+(Y?"; will retry connection immediately":"")),W!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(b.state),(W==="suspended"||W==="connected")&&(this.disconnectedRetryCount=0),!this.state.terminal)){var X=this.states[b.state],te=X.retryDelay;X.state==="disconnected"&&(this.disconnectedRetryCount++,te=v.getRetryTime(X.retryDelay,this.disconnectedRetryCount));var re=new E.default(this.state.state,X.state,te,b.error||((_=(B=P.default)[X.state])===null||_===void 0?void 0:_.call(B)));if(Y){var le=function(){L.state===L.states.disconnected&&(L.lastAutoReconnectAttempt=v.now(),L.requestState({state:"connecting"}))},Z=this.lastAutoReconnectAttempt&&v.now()-this.lastAutoReconnectAttempt+1;Z&&Z<1e3?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.notifyState()","Last reconnect attempt was only "+Z+"ms ago, waiting another "+(1e3-Z)+"ms before trying again"),setTimeout(le,1e3-Z)):R.default.Config.nextTick(le)}else(W==="disconnected"||W==="suspended")&&this.startRetryTimer(te);(W==="disconnected"&&!Y||W==="suspended"||X.terminal)&&R.default.Config.nextTick(function(){L.disconnectAllTransports()}),W=="connected"&&!this.activeProtocol&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.notifyState()","Broken invariant: attempted to go into connected state, but there is no active protocol"),this.enactStateChange(re),this.state.sendEvents?this.sendQueuedMessages():this.state.queueEvents||(this.realtime.channels.propogateConnectionInterruption(W,re.reason),this.failQueuedMessages(re.reason))}},F.prototype.requestState=function(b){var L=this,B,_,W=b.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.requestState()","requested state: "+W+"; current state: "+this.state.state),W!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(W),!(W=="connecting"&&this.state.state=="connected")&&!(W=="closing"&&this.state.state=="closed"))){var Y=this.states[W],X=new E.default(this.state.state,Y.state,null,b.error||((_=(B=P.default)[Y.state])===null||_===void 0?void 0:_.call(B)));this.enactStateChange(X),W=="connecting"&&R.default.Config.nextTick(function(){L.startConnect()}),W=="closing"&&this.closeImpl()}},F.prototype.startConnect=function(){var b=this;if(this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startConnect()","Must be in connecting state to connect, but was "+this.state.state);return}var L=this.realtime.auth,B=++this.connectCounter,_=function(){b.checkConnectionStateFreshness(),b.getTransportParams(function(Y){if(Y.mode==="recover"&&Y.options.recover){var X=U(Y.options.recover);X&&b.realtime.channels.recoverChannels(X.channelSerials)}B===b.connectCounter&&b.connectImpl(Y,B)})};if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startConnect()","starting connection"),this.startSuspendTimer(),this.startTransitionTimer(this.states.connecting),L.method==="basic")_();else{var W=function(Y){B===b.connectCounter&&(Y?b.actOnErrorFromAuthorize(Y):_())};this.errorReason&&d.default.isTokenErr(this.errorReason)?L._forceNewToken(null,null,W):L._ensureValidAuthCredentials(!1,W)}},F.prototype.connectImpl=function(b,L){var B=this.state.state;B!==this.states.connecting.state&&B!==this.states.connected.state?f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectImpl()","Must be in connecting state to connect (or connected to upgrade), but was "+B):this.pendingTransports.length?f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectImpl()","Transports "+this.pendingTransports[0].toString()+" currently pending; taking no action"):B==this.states.connected.state?this.upgradeIfNeeded(b):this.transports.length>1&&this.getTransportPreference()?this.connectPreference(b,L):this.connectBase(b,L)},F.prototype.connectPreference=function(b,L){var B=this,_=this.getTransportPreference(),W=!1;v.arrIn(this.transports,_)||(this.unpersistTransportPreference(),this.connectImpl(b,L)),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectPreference()","Trying to connect with stored transport preference "+_);var Y=setTimeout(function(){W=!0,B.state.state!==B.states.connected.state&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectPreference()","Shortcircuit connection attempt with "+_+" failed; clearing preference and trying from scratch"),B.disconnectAllTransports(),B.unpersistTransportPreference()),B.connectImpl(b,L)},this.options.timeouts.preferenceConnectTimeout);b.host=this.httpHosts[0],this.tryATransport(b,_,function(X,te){clearTimeout(Y),W&&te?(te.off(),te.disconnect(),v.arrDeleteValue(B.pendingTransports,te)):!te&&!X&&(B.unpersistTransportPreference(),B.connectImpl(b,L))})},F.prototype.connectBase=function(b,L){var B=this,_=function(re){B.notifyState({state:B.states.connecting.failState,error:re})},W=this.httpHosts.slice(),Y=function(re,le){L===B.connectCounter&&!le&&!re&&te()};f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectBase()","Trying to connect with base transport "+this.baseTransport);var X=W.shift();if(!X){_(new y.default("Unable to connect (no available host)",80003,404));return}b.host=X;var te=function(){if(!W.length){_(new y.default("Unable to connect (and no more fallback hosts to try)",80003,404));return}if(!B.realtime.http.checkConnectivity){_(new y.PartialErrorInfo("Internal error: Http.checkConnectivity not set",null,500));return}B.realtime.http.checkConnectivity(function(re,le){if(L===B.connectCounter){if(re){_(re);return}if(!le){_(new y.default("Unable to connect (network unreachable)",80003,404));return}b.host=v.arrPopRandomElement(W),B.tryATransport(b,B.baseTransport,Y)}})};if(this.forceFallbackHost&&W.length){this.forceFallbackHost=!1,te();return}this.tryATransport(b,this.baseTransport,Y)},F.prototype.getUpgradePossibilities=function(){var b=this.activeProtocol.getTransport().shortName,L=v.arrIndexOf(this.upgradeTransports,b);return this.upgradeTransports.slice(L+1)},F.prototype.upgradeIfNeeded=function(b){var L=this,B=this.getUpgradePossibilities();f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.upgradeIfNeeded()","upgrade possibilities: "+R.default.Config.inspect(B)),B.length&&v.arrForEach(B,function(_){var W=L.createTransportParams(b.host,"upgrade");L.tryATransport(W,_,x)})},F.prototype.closeImpl=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.closeImpl()","closing connection"),this.cancelSuspendTimer(),this.startTransitionTimer(this.states.closing),v.safeArrForEach(this.pendingTransports,function(b){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Closing pending transport: "+b),b&&b.close()}),v.safeArrForEach(this.proposedTransports,function(b){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Disposing of proposed transport: "+b),b&&b.dispose()}),this.activeProtocol&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Closing active transport: "+this.activeProtocol.getTransport()),this.activeProtocol.getTransport().close()),this.notifyState({state:"closed"})},F.prototype.onAuthUpdated=function(b,L){var B=this,_;switch(this.state.state){case"connected":{if(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Sending AUTH message on active transport"),(this.pendingTransports.length||this.proposedTransports.length)&&this.state!==this.states.synchronizing){this.disconnectAllTransports(!0);var W=this.activeProtocol.getTransport().params;R.default.Config.nextTick(function(){B.state.state==="connected"&&B.upgradeIfNeeded(W)})}var Y=(_=this.activeProtocol)===null||_===void 0?void 0:_.getTransport();Y&&Y.onAuthUpdated&&Y.onAuthUpdated(b);var X=m.default.fromValues({action:p.AUTH,auth:{accessToken:b.token}});this.send(X);var te=function(){B.off(re),L(null,b)},re=function(Z){Z.current==="failed"&&(B.off(te),B.off(re),L(Z.reason||B.getStateError()))};this.once("connectiondetails",te),this.on("connectionstate",re);break}case"connecting":f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Aborting current connection attempts in order to start again with the new auth details"),this.disconnectAllTransports();default:{f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Connection state is "+this.state.state+"; waiting until either connected or failed");var le=function(Z){switch(Z.current){case"connected":B.off(le),L(null,b);break;case"failed":case"closed":case"suspended":B.off(le),L(Z.reason||B.getStateError());break}};this.on("connectionstate",le),this.state.state==="connecting"?this.startConnect():this.requestState({state:"connecting"})}}},F.prototype.disconnectAllTransports=function(b){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.disconnectAllTransports()","Disconnecting all transports"+(b?" except the active transport":"")),this.connectCounter++,v.safeArrForEach(this.pendingTransports,function(L){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting pending transport: "+L),L&&L.disconnect()}),this.pendingTransports=[],v.safeArrForEach(this.proposedTransports,function(L){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disposing of proposed transport: "+L),L&&L.dispose()}),this.proposedTransports=[],this.activeProtocol&&!b&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting active transport: "+this.activeProtocol.getTransport()),this.activeProtocol.getTransport().disconnect())},F.prototype.send=function(b,L,B){B=B||x;var _=this.state;if(_.sendEvents){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","sending event"),this.sendImpl(new S.PendingMessage(b,B));return}var W=L&&_.queueEvents||_.forceQueueEvents;if(!W){var Y="rejecting event, queueEvent was "+L+", state was "+_.state;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()",Y),B(this.errorReason||new y.default(Y,9e4,400));return}f.default.shouldLog(f.default.LOG_MICRO)&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","queueing msg; "+m.default.stringify(b)),this.queue(b,B)},F.prototype.sendImpl=function(b){var L=b.message;b.ackRequired&&!b.sendAttempted&&(L.msgSerial=this.msgSerial++);try{this.activeProtocol.send(b)}catch(B){f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.sendImpl()","Unexpected exception in transport.send(): "+B.stack)}},F.prototype.queue=function(b,L){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.queue()","queueing event");var B=this.queuedMessages.last(),_=this.options.maxMessageSize;B&&!B.sendAttempted&&j(B.message,b,_)?(B.merged||(B.callback=w.default.create([B.callback]),B.merged=!0),B.callback.push(L)):this.queuedMessages.push(new S.PendingMessage(b,L))},F.prototype.sendQueuedMessages=function(){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.sendQueuedMessages()","sending "+this.queuedMessages.count()+" queued messages");for(var b;b=this.queuedMessages.shift();)this.sendImpl(b)},F.prototype.queuePendingMessages=function(b){b&&b.length&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.queuePendingMessages()","queueing "+b.length+" pending messages"),this.queuedMessages.prepend(b))},F.prototype.failQueuedMessages=function(b){var L=this.queuedMessages.count();L>0&&(f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.failQueuedMessages()","failing "+L+" queued messages, err = "+v.inspectError(b)),this.queuedMessages.completeAllMessages(b))},F.prototype.onChannelMessage=function(b,L){var B=this.activeProtocol&&L===this.activeProtocol.getTransport(),_=v.arrIn(this.pendingTransports,L)&&this.state==this.states.synchronizing;B||_?this.realtime.channels.onChannelMessage(b):v.arrIndexOf([p.ACK,p.NACK,p.ERROR],b.action)>-1?this.realtime.channels.onChannelMessage(b):f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onChannelMessage()","received message "+JSON.stringify(b)+"on defunct transport; discarding")},F.prototype.ping=function(b,L){var B=this;if(b){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.ping()","transport = "+b);var _=function(){b.off("heartbeat",X),L(new y.default("Timeout waiting for heartbeat response",5e4,500))},W=v.now(),Y=v.cheapRandStr(),X=function(he){if(he===Y){b.off("heartbeat",X),clearTimeout(te);var Me=v.now()-W;L(null,Me)}},te=setTimeout(_,this.options.timeouts.realtimeRequestTimeout);b.on("heartbeat",X),b.ping(Y);return}if(this.state.state!=="connected"){L(new y.default("Unable to ping service; not connected",4e4,400));return}var re=!1,le=function(he,Me){B.off("transport.active",Z),re||(re=!0,L(he,Me))},Z=function(){re||(re=!0,R.default.Config.nextTick(function(){B.ping(null,L)}))};this.on("transport.active",Z),this.ping(this.activeProtocol.getTransport(),le)},F.prototype.abort=function(b){this.activeProtocol.getTransport().fail(b)},F.prototype.registerProposedTransport=function(b){this.proposedTransports.push(b)},F.prototype.getTransportPreference=function(){var b,L;return this.transportPreference||s()&&((L=(b=R.default.WebStorage)===null||b===void 0?void 0:b.get)===null||L===void 0?void 0:L.call(b,D))},F.prototype.persistTransportPreference=function(b){var L,B;v.arrIn(T.default.upgradeTransports,b.shortName)&&(this.transportPreference=b.shortName,s()&&((B=(L=R.default.WebStorage)===null||L===void 0?void 0:L.set)===null||B===void 0||B.call(L,D,b.shortName)))},F.prototype.unpersistTransportPreference=function(){var b,L;this.transportPreference=null,s()&&((L=(b=R.default.WebStorage)===null||b===void 0?void 0:b.remove)===null||L===void 0||L.call(b,D))},F.prototype.actOnErrorFromAuthorize=function(b){if(b.code===40171)this.notifyState({state:"failed",error:b});else if(b.code===40102)this.notifyState({state:"failed",error:b});else if(b.statusCode===l.default.Forbidden){var L="Client configured authentication provider returned 403; failing the connection";f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.actOnErrorFromAuthorize()",L),this.notifyState({state:"failed",error:new y.default(L,80019,403,b)})}else{var L="Client configured authentication provider request failed";f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.actOnErrorFromAuthorize",L),this.notifyState({state:this.state.failState,error:new y.default(L,80019,401,b)})}},F.prototype.onConnectionDetailsUpdate=function(b,L){if(b){this.connectionDetails=b,b.maxMessageSize&&(this.options.maxMessageSize=b.maxMessageSize);var B=b.clientId;if(B){var _=this.realtime.auth._uncheckedSetClientId(B);if(_){f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.onConnectionDetailsUpdate()",_.message),L.fail(_);return}}var W=b.connectionStateTtl;W&&(this.connectionStateTtl=W),this.maxIdleInterval=b.maxIdleInterval,this.emit("connectiondetails",b)}},F.supportedTransports={},F}(C.default);r.default=V}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(7)),m=i.__importDefault(o(2)),v=function(S){i.__extends(T,S);function T(){var R=S.call(this)||this;return R.messages=[],R}return T.prototype.count=function(){return this.messages.length},T.prototype.push=function(R){this.messages.push(R)},T.prototype.shift=function(){return this.messages.shift()},T.prototype.last=function(){return this.messages[this.messages.length-1]},T.prototype.copyAll=function(){return this.messages.slice()},T.prototype.append=function(R){this.messages.push.apply(this.messages,R)},T.prototype.prepend=function(R){this.messages.unshift.apply(this.messages,R)},T.prototype.completeMessages=function(R,C,O){m.default.logAction(m.default.LOG_MICRO,"MessageQueue.completeMessages()","serial = "+R+"; count = "+C),O=O||null;var f=this.messages;if(f.length===0)throw new Error("MessageQueue.completeMessages(): completeMessages called on any empty MessageQueue");var E=f[0];if(E){var P=E.message.msgSerial,y=R+C;if(y>P)for(var d=f.splice(0,y-P),h=0,w=d;h<w.length;h++){var c=w[h];c.callback(O)}f.length==0&&this.emit("idle")}},T.prototype.completeAllMessages=function(R){this.completeMessages(0,Number.MAX_SAFE_INTEGER||Number.MAX_VALUE,R)},T.prototype.resetSendAttempted=function(){for(var R=0,C=this.messages;R<C.length;R++){var O=C[R];O.sendAttempted=!1}},T.prototype.clear=function(){m.default.logAction(m.default.LOG_MICRO,"MessageQueue.clear()","clearing "+this.messages.length+" messages"),this.messages=[],this.emit("idle")},T}(a.default);r.default=v},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function a(m,v,S,T){this.previous=m,this.current=v,S&&(this.retryIn=S),T&&(this.reason=T)}return a}();r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(10)),m=i.__importDefault(o(7)),v=i.__importStar(o(1)),S=i.__importDefault(o(33)),T=i.__importDefault(o(2)),R=i.__importDefault(o(54)),C=i.__importDefault(o(9)),O=i.__importDefault(o(39)),f=i.__importStar(o(4)),E=i.__importDefault(o(16)),P=i.__importDefault(o(21)),y=a.default.Action,d=function(){};function h(u){if(u&&"params"in u&&!v.isObject(u.params))return new f.default("options.params must be an object",4e4,400);if(u&&"modes"in u){if(!v.isArray(u.modes))return new f.default("options.modes must be an array",4e4,400);for(var l=0;l<u.modes.length;l++){var s=u.modes[l];if(!s||typeof s!="string"||!v.arrIn(a.default.channelModes,String.prototype.toUpperCase.call(s)))return new f.default("Invalid channel mode: "+s,4e4,400)}}}var w=function(u){i.__extends(l,u);function l(s,g,p){var x=u.call(this,s,g,p)||this;return x.retryCount=0,x.history=function(D,N){if(T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.history()","channel = "+this.name),N===void 0)if(typeof D=="function")N=D,D=null;else{if(this.rest.options.promises)return v.promisify(this,"history",arguments);N=d}if(D&&D.untilAttach){if(this.state!=="attached"){N(new f.default("option untilAttach requires the channel to be attached",4e4,400));return}if(!this.properties.attachSerial){N(new f.default("untilAttach was specified and channel is attached, but attachSerial is not defined",4e4,400));return}delete D.untilAttach,D.from_serial=this.properties.attachSerial}S.default.prototype._history.call(this,D,N)},x.whenState=function(D,N){return m.default.prototype.whenState.call(x,D,x.state,N)},T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel()","started; name = "+g),x.realtime=s,x.presence=new R.default(x),x.connectionManager=s.connection.connectionManager,x.state="initialized",x.subscriptions=new m.default,x.syncChannelSerial=void 0,x.properties={attachSerial:void 0,channelSerial:void 0},x.setOptions(p),x.errorReason=null,x._requestedFlags=null,x._mode=null,x._attachResume=!1,x._decodingContext={channelOptions:x.channelOptions,plugins:s.options.plugins||{},baseEncodedPreviousPayload:void 0},x._lastPayload={messageId:null,protocolMessageChannelSerial:null,decodeFailureRecoveryInProgress:null},x._allChannelChanges=new m.default,x}return l.prototype.invalidStateError=function(){return new f.default("Channel operation failed as channel state is "+this.state,90001,400,this.errorReason||void 0)},l.processListenerArgs=function(s){return s=Array.prototype.slice.call(s),typeof s[0]=="function"&&s.unshift(null),s[s.length-1]==null&&s.pop(),s},l.prototype.setOptions=function(s,g){var p=this.channelOptions;if(!g&&this.rest.options.promises)return v.promisify(this,"setOptions",arguments);var x=g||function(N){N&&T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel.setOptions()","Set options failed: "+N.toString())},D=h(s);if(D){x(D);return}S.default.prototype.setOptions.call(this,s),this._decodingContext&&(this._decodingContext.channelOptions=this.channelOptions),this._shouldReattachToSetOptions(s,p)?(this.attachImpl(),this._allChannelChanges.once(["attached","update","detached","failed"],function(N){switch(this.event){case"update":case"attached":x==null||x(null);return;default:x==null||x(N.reason);return}})):x()},l.prototype._shouldReattachToSetOptions=function(s,g){if(!(this.state==="attached"||this.state==="attaching"))return!1;if(s!=null&&s.params){var p=c(s.params),x=c(g.params);if(Object.keys(p).length!==Object.keys(x).length||!v.shallowEquals(x,p))return!0}return!!(s!=null&&s.modes&&(!g.modes||!v.arrEquals(s.modes,g.modes)))},l.prototype.publish=function(){for(var s=this,g=[],p=0;p<arguments.length;p++)g[p]=arguments[p];var x=g[0],D=g.length,N=g[D-1];if(typeof N!="function"){if(this.realtime.options.promises)return v.promisify(this,"publish",arguments);N=d,++D}if(!this.connectionManager.activeState()){N(this.connectionManager.getError());return}if(D==2)if(v.isObject(x))x=[C.default.fromValues(x)];else if(v.isArray(x))x=C.default.fromValuesArray(x);else throw new f.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);else x=[C.default.fromValues({name:g[0],data:g[1]})];var k=this.realtime.options.maxMessageSize;C.default.encodeArray(x,this.channelOptions,function(I){if(I){N(I);return}var M=C.default.getMessagesSize(x);if(M>k){N(new f.default("Maximum size of messages that can be published at once exceeded ( was "+M+" bytes; limit is "+k+" bytes)",40009,400));return}s.__publish(x,N)})},l.prototype.__publish=function(s,g){T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.publish()","message count = "+s.length);var p=this.state;switch(p){case"failed":case"suspended":g(f.default.fromValues(this.invalidStateError()));break;default:{T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.publish()","sending message; channel state is "+p);var x=new a.default;x.action=y.MESSAGE,x.channel=this.name,x.messages=s,this.sendMessage(x,g);break}}},l.prototype.onEvent=function(s){T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.onEvent()","received message");for(var g=this.subscriptions,p=0;p<s.length;p++){var x=s[p];g.emit(x.name,x)}},l.prototype.attach=function(s,g){var p;if(typeof s=="function"?(g=s,p=null):p=s,!g){if(this.realtime.options.promises)return v.promisify(this,"attach",arguments);g=function(x){x&&T.default.logAction(T.default.LOG_MAJOR,"RealtimeChannel.attach()","Channel attach failed: "+x.toString())}}if(p)T.default.deprecated("The ability to pass an array of channel mode flags as the first argument of `RealtimeChannel.attach()`","To set channel mode flags, populate the `modes` property of the channel options object that you pass to `Channels.get()` or `RealtimeChannel.setOptions()`."),this._requestedFlags=p;else if(this.state==="attached"){g(null,null);return}this._attach(!1,null,g)},l.prototype._attach=function(s,g,p){p||(p=function(D){D&&T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel._attach()","Channel attach failed: "+D.toString())});var x=this.connectionManager;if(!x.activeState()){p(x.getError());return}(this.state!=="attaching"||s)&&this.requestState("attaching",g),this.once(function(D){switch(this.event){case"attached":p==null||p(null,D);break;case"detached":case"suspended":case"failed":p==null||p(D.reason||x.getError()||new f.default("Unable to attach; reason unknown; state = "+this.event,9e4,500));break;case"detaching":p==null||p(new f.default("Attach request superseded by a subsequent detach request",9e4,409));break}})},l.prototype.attachImpl=function(){T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.attachImpl()","sending ATTACH message");var s=a.default.fromValues({action:y.ATTACH,channel:this.name,params:this.channelOptions.params,channelSerial:this.properties.channelSerial});this._requestedFlags?s.encodeModesToFlags(this._requestedFlags):this.channelOptions.modes&&s.encodeModesToFlags(v.allToUpperCase(this.channelOptions.modes)),this._attachResume&&s.setFlag("ATTACH_RESUME"),this._lastPayload.decodeFailureRecoveryInProgress&&(s.channelSerial=this._lastPayload.protocolMessageChannelSerial),this.sendMessage(s,d)},l.prototype.detach=function(s){if(!s){if(this.realtime.options.promises)return v.promisify(this,"detach",arguments);s=d}var g=this.connectionManager;if(!g.activeState()){s(g.getError());return}switch(this.state){case"suspended":this.notifyState("detached"),s();break;case"detached":s();break;case"failed":s(new f.default("Unable to detach; channel state = failed",90001,400));break;default:this.requestState("detaching");case"detaching":this.once(function(p){switch(this.event){case"detached":s();break;case"attached":case"suspended":case"failed":s(p.reason||g.getError()||new f.default("Unable to detach; reason unknown; state = "+this.event,9e4,500));break;case"attaching":s(new f.default("Detach request superseded by a subsequent attach request",9e4,409));break}})}},l.prototype.detachImpl=function(s){T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.detach()","sending DETACH message");var g=a.default.fromValues({action:y.DETACH,channel:this.name});this.sendMessage(g,s||d)},l.prototype.subscribe=function(){for(var s=[],g=0;g<arguments.length;g++)s[g]=arguments[g];var p=l.processListenerArgs(s),x=p[0],D=p[1],N=p[2];if(!N&&this.realtime.options.promises)return v.promisify(this,"subscribe",[x,D]);if(this.state==="failed"){N==null||N(f.default.fromValues(this.invalidStateError()));return}return x&&typeof x=="object"&&!Array.isArray(x)?this._subscribeFilter(x,D):this.subscriptions.on(x,D),this.attach(N||d)},l.prototype._subscribeFilter=function(s,g){var p=function(x){var D,N,k,I,M,A,j={name:x.name,refTimeserial:(N=(D=x.extras)===null||D===void 0?void 0:D.ref)===null||N===void 0?void 0:N.timeserial,refType:(I=(k=x.extras)===null||k===void 0?void 0:k.ref)===null||I===void 0?void 0:I.type,isRef:!!(!((A=(M=x.extras)===null||M===void 0?void 0:M.ref)===null||A===void 0)&&A.timeserial),clientId:x.clientId};Object.entries(s).find(function(U){var z=U[0],V=U[1];return V!==void 0?j[z]!==V:!1})||g(x)};this._addFilteredSubscription(s,g,p),this.subscriptions.on(p)},l.prototype._addFilteredSubscription=function(s,g,p){var x;if(this.filteredSubscriptions||(this.filteredSubscriptions=new Map),this.filteredSubscriptions.has(g)){var D=this.filteredSubscriptions.get(g);D.set(s,((x=D==null?void 0:D.get(s))===null||x===void 0?void 0:x.concat(p))||[p])}else this.filteredSubscriptions.set(g,new Map([[s,[p]]]))},l.prototype._getAndDeleteFilteredSubscriptions=function(s,g){var p=this;if(!this.filteredSubscriptions)return[];if(!g&&s)return Array.from(this.filteredSubscriptions.entries()).map(function(k){var I,M=k[0],A=k[1],j=A.get(s);return A.delete(s),A.size===0&&((I=p.filteredSubscriptions)===null||I===void 0||I.delete(M)),j}).reduce(function(k,I){var M;return I?(M=k).concat.apply(M,I):k},[]);if(!g||!this.filteredSubscriptions.has(g))return[];var x=this.filteredSubscriptions.get(g);if(!s){var D=Array.from(x.values()).reduce(function(k,I){return k.concat.apply(k,I)},[]);return this.filteredSubscriptions.delete(g),D}var N=x.get(s);return x.delete(s),N||[]},l.prototype.unsubscribe=function(){for(var s=this,g,p=[],x=0;x<arguments.length;x++)p[x]=arguments[x];var D=l.processListenerArgs(p),N=D[0],k=D[1];if(typeof N=="object"&&!k||!((g=this.filteredSubscriptions)===null||g===void 0)&&g.has(k)){this._getAndDeleteFilteredSubscriptions(N,k).forEach(function(I){return s.subscriptions.off(I)});return}this.subscriptions.off(N,k)},l.prototype.sync=function(){switch(this.state){case"initialized":case"detaching":case"detached":throw new f.PartialErrorInfo("Unable to sync to channel; not attached",4e4)}var s=this.connectionManager;if(!s.activeState())throw s.getError();var g=a.default.fromValues({action:y.SYNC,channel:this.name});this.syncChannelSerial&&(g.channelSerial=this.syncChannelSerial),s.send(g)},l.prototype.sendMessage=function(s,g){this.connectionManager.send(s,this.realtime.options.queueMessages,g)},l.prototype.sendPresence=function(s,g){var p=a.default.fromValues({action:y.PRESENCE,channel:this.name,presence:v.isArray(s)?E.default.fromValuesArray(s):[E.default.fromValues(s)]});this.sendMessage(p,g)},l.prototype.onMessage=function(s){(s.action===y.ATTACHED||s.action===y.MESSAGE||s.action===y.PRESENCE)&&this.setChannelSerial(s.channelSerial);var g,p=!1;switch(s.action){case y.ATTACHED:{this.properties.attachSerial=s.channelSerial,this._mode=s.getMode(),this.params=s.params||{};var x=s.decodeModesFromFlags();this.modes=x&&v.allToLowerCase(x)||void 0;var D=s.hasFlag("RESUMED"),N=s.hasFlag("HAS_PRESENCE"),k=s.hasFlag("HAS_BACKLOG");if(this.state==="attached"){D||this.presence.onAttached(N);var I=new O.default(this.state,this.state,D,k,s.error);this._allChannelChanges.emit("update",I),(!D||this.channelOptions.updateOnAttached)&&this.emit("update",I)}else this.state==="detaching"?this.checkPendingState():this.notifyState("attached",s.error,D,N,k);break}case y.DETACHED:{var M=s.error?f.default.fromValues(s.error):new f.default("Channel detached",90001,404);this.state==="detaching"?this.notifyState("detached",M):this.state==="attaching"?this.notifyState("suspended",M):this.requestState("attaching",M);break}case y.SYNC:if(p=!0,g=this.syncChannelSerial=s.channelSerial,!s.presence)break;case y.PRESENCE:{for(var A=s.presence,j=s.id,U=s.connectionId,z=s.timestamp,V=this.channelOptions,G=void 0,F=0;F<A.length;F++)try{G=A[F],E.default.decode(G,V),G.connectionId||(G.connectionId=U),G.timestamp||(G.timestamp=z),G.id||(G.id=j+":"+F)}catch(Y){T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel.onMessage()",Y.toString())}this.presence.setPresence(A,p,g);break}case y.MESSAGE:{if(this.state!=="attached"){T.default.logAction(T.default.LOG_MAJOR,"RealtimeChannel.onMessage()",'Message "'+s.id+'" skipped as this channel "'+this.name+'" state is not "attached" (state is "'+this.state+'").');return}var b=s.messages,L=b[0],B=b[b.length-1],j=s.id,U=s.connectionId,z=s.timestamp;if(L.extras&&L.extras.delta&&L.extras.delta.from!==this._lastPayload.messageId){var _='Delta message decode failure - previous message not available for message "'+s.id+'" on this channel "'+this.name+'".';T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel.onMessage()",_),this._startDecodeFailureRecovery(new f.default(_,40018,400));break}for(var F=0;F<b.length;F++){var _=b[F];try{C.default.decode(_,this._decodingContext)}catch(Z){switch(T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel.onMessage()",Z.toString()),Z.code){case 40018:this._startDecodeFailureRecovery(Z);return;case 40019:case 40021:this.notifyState("failed",Z);return}}_.connectionId||(_.connectionId=U),_.timestamp||(_.timestamp=z),_.id||(_.id=j+":"+F)}this._lastPayload.messageId=B.id,this._lastPayload.protocolMessageChannelSerial=s.channelSerial,this.onEvent(b);break}case y.ERROR:{var W=s.error;W&&W.code==80016?this.checkPendingState():this.notifyState("failed",f.default.fromValues(W));break}default:T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel.onMessage()","Fatal protocol error: unrecognised action ("+s.action+")"),this.connectionManager.abort(P.default.unknownChannelErr())}},l.prototype._startDecodeFailureRecovery=function(s){var g=this;this._lastPayload.decodeFailureRecoveryInProgress||(T.default.logAction(T.default.LOG_MAJOR,"RealtimeChannel.onMessage()","Starting decode failure recovery process."),this._lastPayload.decodeFailureRecoveryInProgress=!0,this._attach(!0,s,function(){g._lastPayload.decodeFailureRecoveryInProgress=!1}))},l.prototype.onAttached=function(){T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel.onAttached","activating channel; name = "+this.name)},l.prototype.notifyState=function(s,g,p,x,D){if(T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.notifyState","name = "+this.name+", current state = "+this.state+", notifying state "+s),this.clearStateTimer(),v.arrIn(["detached","suspended","failed"],s)&&(this.properties.channelSerial=null),s!==this.state){this.presence.actOnChannelState(s,x,g),s==="suspended"&&this.connectionManager.state.sendEvents?this.startRetryTimer():this.cancelRetryTimer(),g&&(this.errorReason=g);var N=new O.default(this.state,s,p,D,g),k=s==="failed"?T.default.LOG_ERROR:T.default.LOG_MAJOR;T.default.logAction(k,'Channel state for channel "'+this.name+'"',s+(g?"; reason: "+g:"")),s!=="attaching"&&s!=="suspended"&&(this.retryCount=0),s==="attached"&&this.onAttached(),s==="attached"?this._attachResume=!0:(s==="detaching"||s==="failed")&&(this._attachResume=!1),this.state=s,this._allChannelChanges.emit(s,N),this.emit(s,N)}},l.prototype.requestState=function(s,g){T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel.requestState","name = "+this.name+", state = "+s),this.notifyState(s,g),this.checkPendingState()},l.prototype.checkPendingState=function(){var s=this.connectionManager.state;if(!(s.sendEvents||s.forceQueueEvents)){T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel.checkPendingState","sendEvents is false; state is "+this.connectionManager.state.state);return}switch(T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel.checkPendingState","name = "+this.name+", state = "+this.state),this.state){case"attaching":this.startStateTimerIfNotRunning(),this.attachImpl();break;case"detaching":this.startStateTimerIfNotRunning(),this.detachImpl();break;case"attached":this.sync();break}},l.prototype.timeoutPendingState=function(){switch(this.state){case"attaching":{var s=new f.default("Channel attach timed out",90007,408);this.notifyState("suspended",s);break}case"detaching":{var s=new f.default("Channel detach timed out",90007,408);this.notifyState("attached",s);break}default:this.checkPendingState();break}},l.prototype.startStateTimerIfNotRunning=function(){var s=this;this.stateTimer||(this.stateTimer=setTimeout(function(){T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel.startStateTimerIfNotRunning","timer expired"),s.stateTimer=null,s.timeoutPendingState()},this.realtime.options.timeouts.realtimeRequestTimeout))},l.prototype.clearStateTimer=function(){var s=this.stateTimer;s&&(clearTimeout(s),this.stateTimer=null)},l.prototype.startRetryTimer=function(){var s=this;if(!this.retryTimer){this.retryCount++;var g=v.getRetryTime(this.realtime.options.timeouts.channelRetryTimeout,this.retryCount);this.retryTimer=setTimeout(function(){s.state==="suspended"&&s.connectionManager.state.sendEvents&&(s.retryTimer=null,T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel retry timer expired","attempting a new attach"),s.requestState("attaching"))},g)}},l.prototype.cancelRetryTimer=function(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)},l.prototype.getReleaseErr=function(){var s=this.state;return s==="initialized"||s==="detached"||s==="failed"?null:new f.default("Can only release a channel in a state where there is no possibility of further updates from the server being received (initialized, detached, or failed); was "+s,90001,400)},l.prototype.setChannelSerial=function(s){T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.setChannelSerial()","Updating channel serial; serial = "+s+"; previous = "+this.properties.channelSerial),s&&(this.properties.channelSerial=s)},l}(S.default);function c(u){var l=u||{};l.agent;var s=i.__rest(l,["agent"]);return s}r.default=w},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function a(m,v,S,T,R){this.previous=m,this.current=v,v==="attached"&&(this.resumed=S,this.hasBacklog=T),R&&(this.reason=R)}return a}();r.default=i},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){var a=i,m=a.lib,v=m.WordArray,S=m.Hasher,T=a.algo,R=[],C=T.SHA1=S.extend({_doReset:function(){this._hash=new v.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(O,f){for(var E=this._hash.words,P=E[0],y=E[1],d=E[2],h=E[3],w=E[4],c=0;c<80;c++){if(c<16)R[c]=O[f+c]|0;else{var u=R[c-3]^R[c-8]^R[c-14]^R[c-16];R[c]=u<<1|u>>>31}var l=(P<<5|P>>>27)+w+R[c];c<20?l+=(y&d|~y&h)+1518500249:c<40?l+=(y^d^h)+1859775393:c<60?l+=(y&d|y&h|d&h)-1894007588:l+=(y^d^h)-899497514,w=h,h=d,d=y<<30|y>>>2,y=P,P=l}E[0]=E[0]+P|0,E[1]=E[1]+y|0,E[2]=E[2]+d|0,E[3]=E[3]+h|0,E[4]=E[4]+w|0},_doFinalize:function(){var O=this._data,f=O.words,E=this._nDataBytes*8,P=O.sigBytes*8;return f[P>>>5]|=128<<24-P%32,f[(P+64>>>9<<4)+14]=Math.floor(E/4294967296),f[(P+64>>>9<<4)+15]=E,O.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var O=S.clone.call(this);return O._hash=this._hash.clone(),O}});a.SHA1=S._createHelper(C),a.HmacSHA1=S._createHmacHelper(C)}(),i.SHA1})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});function i(c){if(c===void 0)return"undefined";var u,l;if(c instanceof ArrayBuffer?(l="ArrayBuffer",u=new DataView(c)):c instanceof DataView&&(l="DataView",u=c),!u)return JSON.stringify(c);for(var s=[],g=0;g<c.byteLength;g++){if(g>20){s.push("...");break}var p=u.getUint8(g).toString(16);p.length===1&&(p="0"+p),s.push(p)}return"<"+l+" "+s.join(" ")+">"}function a(c,u,l){for(var s=0,g=l.length;s<g;s++){var p=l.charCodeAt(s);if(p<128){c.setUint8(u++,p>>>0&127|0);continue}if(p<2048){c.setUint8(u++,p>>>6&31|192),c.setUint8(u++,p>>>0&63|128);continue}if(p<65536){c.setUint8(u++,p>>>12&15|224),c.setUint8(u++,p>>>6&63|128),c.setUint8(u++,p>>>0&63|128);continue}if(p<1114112){c.setUint8(u++,p>>>18&7|240),c.setUint8(u++,p>>>12&63|128),c.setUint8(u++,p>>>6&63|128),c.setUint8(u++,p>>>0&63|128);continue}throw new Error("bad codepoint "+p)}}function m(c,u,l){for(var s="",g=u,p=u+l;g<p;g++){var x=c.getUint8(g);if(!(x&128)){s+=String.fromCharCode(x);continue}if((x&224)===192){s+=String.fromCharCode((x&15)<<6|c.getUint8(++g)&63);continue}if((x&240)===224){s+=String.fromCharCode((x&15)<<12|(c.getUint8(++g)&63)<<6|(c.getUint8(++g)&63)<<0);continue}if((x&248)===240){s+=String.fromCharCode((x&7)<<18|(c.getUint8(++g)&63)<<12|(c.getUint8(++g)&63)<<6|(c.getUint8(++g)&63)<<0);continue}throw new Error("Invalid byte "+x.toString(16))}return s}function v(c){for(var u=0,l=0,s=c.length;l<s;l++){var g=c.charCodeAt(l);if(g<128){u+=1;continue}if(g<2048){u+=2;continue}if(g<65536){u+=3;continue}if(g<1114112){u+=4;continue}throw new Error("bad codepoint "+g)}return u}function S(c,u){var l=w(c,u);if(l!==0){var s=new ArrayBuffer(l),g=new DataView(s);return h(c,g,0,u),s}}var T=65536*65536,R=1/T;function C(c,u){return u=u||0,c.getInt32(u)*T+c.getUint32(u+4)}function O(c,u){return u=u||0,c.getUint32(u)*T+c.getUint32(u+4)}function f(c,u,l){l<9223372036854776e3?(c.setInt32(u,Math.floor(l*R)),c.setInt32(u+4,l&-1)):(c.setUint32(u,2147483647),c.setUint32(u+4,2147483647))}function E(c,u,l){l<18446744073709552e3?(c.setUint32(u,Math.floor(l*R)),c.setInt32(u+4,l&-1)):(c.setUint32(u,4294967295),c.setUint32(u+4,4294967295))}var P=function(){function c(u,l){var s=this;this.map=function(g){for(var p={},x=0;x<g;x++){var D=s.parse();p[D]=s.parse()}return p},this.bin=function(g){var p=new ArrayBuffer(g);return new Uint8Array(p).set(new Uint8Array(s.view.buffer,s.offset,g),0),s.offset+=g,p},this.buf=this.bin,this.str=function(g){var p=m(s.view,s.offset,g);return s.offset+=g,p},this.array=function(g){for(var p=new Array(g),x=0;x<g;x++)p[x]=s.parse();return p},this.ext=function(g){return s.offset+=g,{type:s.view.getInt8(s.offset),data:s.buf(g)}},this.parse=function(){var g=s.view.getUint8(s.offset),p,x;if(!(g&128))return s.offset++,g;if((g&240)===128)return x=g&15,s.offset++,s.map(x);if((g&240)===144)return x=g&15,s.offset++,s.array(x);if((g&224)===160)return x=g&31,s.offset++,s.str(x);if((g&224)===224)return p=s.view.getInt8(s.offset),s.offset++,p;switch(g){case 192:return s.offset++,null;case 193:s.offset++;return;case 194:return s.offset++,!1;case 195:return s.offset++,!0;case 196:return x=s.view.getUint8(s.offset+1),s.offset+=2,s.bin(x);case 197:return x=s.view.getUint16(s.offset+1),s.offset+=3,s.bin(x);case 198:return x=s.view.getUint32(s.offset+1),s.offset+=5,s.bin(x);case 199:return x=s.view.getUint8(s.offset+1),s.offset+=2,s.ext(x);case 200:return x=s.view.getUint16(s.offset+1),s.offset+=3,s.ext(x);case 201:return x=s.view.getUint32(s.offset+1),s.offset+=5,s.ext(x);case 202:return p=s.view.getFloat32(s.offset+1),s.offset+=5,p;case 203:return p=s.view.getFloat64(s.offset+1),s.offset+=9,p;case 204:return p=s.view.getUint8(s.offset+1),s.offset+=2,p;case 205:return p=s.view.getUint16(s.offset+1),s.offset+=3,p;case 206:return p=s.view.getUint32(s.offset+1),s.offset+=5,p;case 207:return p=O(s.view,s.offset+1),s.offset+=9,p;case 208:return p=s.view.getInt8(s.offset+1),s.offset+=2,p;case 209:return p=s.view.getInt16(s.offset+1),s.offset+=3,p;case 210:return p=s.view.getInt32(s.offset+1),s.offset+=5,p;case 211:return p=C(s.view,s.offset+1),s.offset+=9,p;case 212:return x=1,s.offset++,s.ext(x);case 213:return x=2,s.offset++,s.ext(x);case 214:return x=4,s.offset++,s.ext(x);case 215:return x=8,s.offset++,s.ext(x);case 216:return x=16,s.offset++,s.ext(x);case 217:return x=s.view.getUint8(s.offset+1),s.offset+=2,s.str(x);case 218:return x=s.view.getUint16(s.offset+1),s.offset+=3,s.str(x);case 219:return x=s.view.getUint32(s.offset+1),s.offset+=5,s.str(x);case 220:return x=s.view.getUint16(s.offset+1),s.offset+=3,s.array(x);case 221:return x=s.view.getUint32(s.offset+1),s.offset+=5,s.array(x);case 222:return x=s.view.getUint16(s.offset+1),s.offset+=3,s.map(x);case 223:return x=s.view.getUint32(s.offset+1),s.offset+=5,s.map(x)}throw new Error("Unknown type 0x"+g.toString(16))},this.offset=l||0,this.view=u}return c}();function y(c){var u=new DataView(c),l=new P(u),s=l.parse();if(l.offset!==c.byteLength)throw new Error(c.byteLength-l.offset+" trailing bytes");return s}function d(c,u){return Object.keys(c).filter(function(l){var s=c[l],g=typeof s;return(!u||s!=null)&&(g!=="function"||!!s.toJSON)})}function h(c,u,l,s){var g=typeof c;if(typeof c=="string"){var p=v(c);if(p<32)return u.setUint8(l,p|160),a(u,l+1,c),1+p;if(p<256)return u.setUint8(l,217),u.setUint8(l+1,p),a(u,l+2,c),2+p;if(p<65536)return u.setUint8(l,218),u.setUint16(l+1,p),a(u,l+3,c),3+p;if(p<4294967296)return u.setUint8(l,219),u.setUint32(l+1,p),a(u,l+5,c),5+p}if(ArrayBuffer.isView&&ArrayBuffer.isView(c)&&(c=c.buffer),c instanceof ArrayBuffer){var x=c.byteLength;if(x<256)return u.setUint8(l,196),u.setUint8(l+1,x),new Uint8Array(u.buffer).set(new Uint8Array(c),l+2),2+x;if(x<65536)return u.setUint8(l,197),u.setUint16(l+1,x),new Uint8Array(u.buffer).set(new Uint8Array(c),l+3),3+x;if(x<4294967296)return u.setUint8(l,198),u.setUint32(l+1,x),new Uint8Array(u.buffer).set(new Uint8Array(c),l+5),5+x}if(typeof c=="number"){if(Math.floor(c)!==c)return u.setUint8(l,203),u.setFloat64(l+1,c),9;if(c>=0){if(c<128)return u.setUint8(l,c),1;if(c<256)return u.setUint8(l,204),u.setUint8(l+1,c),2;if(c<65536)return u.setUint8(l,205),u.setUint16(l+1,c),3;if(c<4294967296)return u.setUint8(l,206),u.setUint32(l+1,c),5;if(c<18446744073709552e3)return u.setUint8(l,207),E(u,l+1,c),9;throw new Error("Number too big 0x"+c.toString(16))}if(c>=-32)return u.setInt8(l,c),1;if(c>=-128)return u.setUint8(l,208),u.setInt8(l+1,c),2;if(c>=-32768)return u.setUint8(l,209),u.setInt16(l+1,c),3;if(c>=-2147483648)return u.setUint8(l,210),u.setInt32(l+1,c),5;if(c>=-9223372036854776e3)return u.setUint8(l,211),f(u,l+1,c),9;throw new Error("Number too small -0x"+(-c).toString(16).substr(1))}if(g==="undefined")return s?0:(u.setUint8(l,212),u.setUint8(l+1,0),u.setUint8(l+2,0),3);if(c===null)return s?0:(u.setUint8(l,192),1);if(g==="boolean")return u.setUint8(l,c?195:194),1;if(typeof c.toJSON=="function")return h(c.toJSON(),u,l,s);if(g==="object"){var D,N=0,k=void 0,I=Array.isArray(c);if(I?D=c.length:(k=d(c,s),D=k.length),D<16?(u.setUint8(l,D|(I?144:128)),N=1):D<65536?(u.setUint8(l,I?220:222),u.setUint16(l+1,D),N=3):D<4294967296&&(u.setUint8(l,I?221:223),u.setUint32(l+1,D),N=5),I)for(var M=0;M<D;M++)N+=h(c[M],u,l+N,s);else if(k)for(var M=0;M<D;M++){var A=k[M];N+=h(A,u,l+N),N+=h(c[A],u,l+N,s)}return N}if(g==="function")return 0;throw new Error("Unknown type "+g)}function w(c,u){var l=typeof c;if(l==="string"){var s=v(c);if(s<32)return 1+s;if(s<256)return 2+s;if(s<65536)return 3+s;if(s<4294967296)return 5+s}if(ArrayBuffer.isView&&ArrayBuffer.isView(c)&&(c=c.buffer),c instanceof ArrayBuffer){var g=c.byteLength;if(g<256)return 2+g;if(g<65536)return 3+g;if(g<4294967296)return 5+g}if(typeof c=="number"){if(Math.floor(c)!==c)return 9;if(c>=0){if(c<128)return 1;if(c<256)return 2;if(c<65536)return 3;if(c<4294967296)return 5;if(c<18446744073709552e3)return 9;throw new Error("Number too big 0x"+c.toString(16))}if(c>=-32)return 1;if(c>=-128)return 2;if(c>=-32768)return 3;if(c>=-2147483648)return 5;if(c>=-9223372036854776e3)return 9;throw new Error("Number too small -0x"+c.toString(16).substr(1))}if(l==="boolean")return 1;if(c===null)return u?0:1;if(c===void 0)return u?0:3;if(typeof c.toJSON=="function")return w(c.toJSON(),u);if(l==="object"){var p,x=0;if(Array.isArray(c)){p=c.length;for(var D=0;D<p;D++)x+=w(c[D],u)}else{var N=d(c,u);p=N.length;for(var D=0;D<p;D++){var k=N[D];x+=w(k)+w(c[k],u)}}if(p<16)return 1+x;if(p<65536)return 3+x;if(p<4294967296)return 5+x;throw new Error("Array or object too long 0x"+p.toString(16))}if(l==="function")return 0;throw new Error("Unknown type "+l)}r.default={encode:S,decode:y,inspect:i,utf8Write:a,utf8Read:m,utf8ByteCount:v}},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(30)),m=i.__importDefault(o(50)),v=i.__importDefault(o(3)),S=i.__importDefault(o(4)),T=i.__importDefault(o(55)),R=i.__importDefault(o(57)),C=i.__importDefault(o(62)),O=i.__importDefault(o(64)),f=i.__importDefault(o(68)),E=i.__importDefault(o(2)),P=o(8),y=i.__importDefault(o(65)),d=i.__importDefault(o(66)),h=i.__importDefault(o(41)),w=(0,R.default)(O.default,T.default);v.default.Crypto=w,v.default.BufferUtils=T.default,v.default.Http=C.default,v.default.Config=O.default,v.default.Transports=f.default,v.default.WebStorage=y.default,a.default.Crypto=w,m.default.Crypto=w,E.default.initLogHandlers(),v.default.Defaults=(0,P.getDefaults)(d.default),v.default.Config.agent&&(v.default.Defaults.agent+=" "+v.default.Config.agent),v.default.Config.noUpgrade&&(v.default.Defaults.upgradeTransports=[]),r.default={ErrorInfo:S.default,Rest:a.default,Realtime:m.default,msgpack:h.default}},function(n){n.exports=JSON.parse('{"name":"ably","description":"Realtime client library for Ably, the realtime messaging service","version":"1.2.50","license":"Apache-2.0","bugs":{"url":"https://github.com/ably/ably-js/issues","email":"support@ably.com"},"main":"./build/ably-node.js","typings":"./ably.d.ts","react-native":{"./build/ably-node.js":"./build/ably-reactnative.js"},"browser":{"./build/ably-node.js":"./build/ably-commonjs.js"},"files":["build/**","ably.d.ts","callbacks.d.ts","callbacks.js","promises.d.ts","promises.js","resources/**","src/**","react/**"],"dependencies":{"@ably/msgpack-js":"^0.4.0","got":"^11.8.5","ws":"^8.14.2"},"peerDependencies":{"react":">=16.8.0","react-dom":">=16.8.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}},"devDependencies":{"@ably/vcdiff-decoder":"1.0.4","@arethetypeswrong/cli":"^0.13.1","@babel/preset-env":"^7.23.6","@testing-library/react":"^13.3.0","@types/crypto-js":"^4.0.1","@types/jmespath":"^0.15.2","@types/node":"^15.0.0","@types/request":"^2.48.7","@types/ws":"^8.2.0","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","@vitejs/plugin-react":"^1.3.2","async":"ably-forks/async#requirejs","aws-sdk":"^2.1413.0","babel-loader":"^8.3.0","chai":"^4.2.0","copy-webpack-plugin":"^6.4.1","cors":"^2.8.5","crypto-js":"ably-forks/crypto-js#crypto-lite","eslint":"^7.13.0","eslint-plugin-import":"^2.28.0","eslint-plugin-jsdoc":"^40.0.0","eslint-plugin-react":"^7.32.2","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-security":"^1.4.0","express":"^4.17.1","glob":"~4.4","google-closure-compiler":"^20180610.0.1","grunt":"^1.6.1","grunt-bump":"^0.3.1","grunt-cli":"~1.2.0","grunt-closure-tools":"^1.0.0","grunt-contrib-concat":"~0.5","grunt-shell":"~1.1","grunt-webpack":"^4.0.2","hexy":"~0.2","jmespath":"^0.16.0","jsdom":"^20.0.0","kexec":"ably-forks/node-kexec#update-for-node-12","minimist":"^1.2.5","mocha":"^8.1.3","mocha-junit-reporter":"^2.2.1","null-loader":"^4.0.1","playwright":"^1.39.0","prettier":"^2.5.1","react":">=18.1.0","react-dom":">=18.1.0","requirejs":"~2.1","shelljs":"~0.8","source-map-explorer":"^2.5.2","ts-loader":"^8.2.0","tsconfig-paths-webpack-plugin":"^4.0.1","tslib":"^2.3.1","typedoc":"^0.23.8","typescript":"^4.6.4","vite":"^4.4.9","vitest":"^0.18.0","webpack":"^4.44.2","webpack-cli":"^4.2.0","webpack-node-externals":"^3.0.0"},"engines":{"node":">=5.10.x"},"repository":"ably/ably-js","jspm":{"registry":"npm","directories":{"lib":"build"},"main":"ably"},"scripts":{"start:react":"npx vite serve","grunt":"grunt","test":"grunt test","test:node":"grunt test:node","test:node:skip-build":"grunt mocha","test:webserver":"grunt test:webserver","test:playwright":"node test/support/runPlaywrightTests.js","test:react":"vitest run","concat":"grunt concat","build":"grunt build:all && npm run build:react","build:node":"grunt build:node","build:browser":"grunt build:browser","build:react":"npm run build:react:mjs && npm run build:react:cjs && cp src/platform/react-hooks/res/package.react.json react/package.json","build:react:mjs":"tsc --project src/platform/react-hooks/tsconfig.mjs.json && cp src/platform/react-hooks/res/package.mjs.json react/mjs/package.json","build:react:cjs":"tsc --project src/platform/react-hooks/tsconfig.cjs.json && cp src/platform/react-hooks/res/package.cjs.json react/cjs/package.json","requirejs":"grunt requirejs","lint":"eslint .","lint:fix":"eslint --fix .","check-closure-compiler":"grunt check-closure-compiler","prepare":"npm run build","format":"prettier --write --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/cdn_deploy.js docs/chrome-mv3.md","format:check":"prettier --check --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/cdn_deploy.js","sourcemap":"source-map-explorer build/ably.min.js","sourcemap:noencryption":"source-map-explorer build/ably.noencryption.min.js","docs":"typedoc --entryPoints ably.d.ts --out docs/generated/default --readme docs/landing-pages/default.md && typedoc --entryPoints promises.d.ts --out docs/generated/promises --name \\"ably (Promise-based)\\" --readme docs/landing-pages/promises.md && cp docs/landing-pages/choose-library.html docs/generated/index.html"}}')},function(n,r){},function(n,r,o){(function(i,a){n.exports=a(o(6),o(32),o(25))})(this,function(i){return i.HmacSHA256})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(47)),v=i.__importDefault(o(15)),S=i.__importDefault(o(20)),T=i.__importDefault(o(4)),R=i.__importDefault(o(48)),C=function(){},O=function(){function y(d){this.rest=d,this.admin=new f(d)}return y}(),f=function(){function y(d){this.rest=d,this.deviceRegistrations=new E(d),this.channelSubscriptions=new P(d)}return y.prototype.publish=function(d,h,w){var c=this.rest,u=c.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,l=a.defaultPostHeaders(c.options,u),s={},g=a.mixin({recipient:d},h);if(typeof w!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);w=C}c.options.headers&&a.mixin(l,c.options.headers),c.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var p=a.encodeBody(g,u);v.default.post(c,"/push/publish",p,l,s,null,function(x){return w(x)})},y}(),E=function(){function y(d){this.rest=d}return y.prototype.save=function(d,h){var w=this.rest,c=m.default.fromValues(d),u=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,l=a.defaultPostHeaders(w.options,u),s={};if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);h=C}w.options.headers&&a.mixin(l,w.options.headers),w.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var g=a.encodeBody(c,u);v.default.put(w,"/push/deviceRegistrations/"+encodeURIComponent(d.id),g,l,s,null,function(p,x,D,N){h(p,p?void 0:m.default.fromResponseBody(x,N?void 0:u))})},y.prototype.get=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultGetHeaders(w.options,c),l=d.id||d;if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"get",arguments);h=C}if(typeof l!="string"||!l.length){h(new T.default("First argument to DeviceRegistrations#get must be a deviceId string or DeviceDetails",4e4,400));return}w.options.headers&&a.mixin(u,w.options.headers),v.default.get(w,"/push/deviceRegistrations/"+encodeURIComponent(l),u,{},null,function(s,g,p,x){h(s,s?void 0:m.default.fromResponseBody(g,x?void 0:c))})},y.prototype.list=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=this.rest.http.supportsLinkHeaders?void 0:c,l=a.defaultGetHeaders(w.options,c);if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);h=C}w.options.headers&&a.mixin(l,w.options.headers),new S.default(w,"/push/deviceRegistrations",l,u,function(s,g,p){return m.default.fromResponseBody(s,p?void 0:c)}).get(d,h)},y.prototype.remove=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultGetHeaders(w.options,c),l={},s=d.id||d;if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"remove",arguments);h=C}if(typeof s!="string"||!s.length){h(new T.default("First argument to DeviceRegistrations#remove must be a deviceId string or DeviceDetails",4e4,400));return}w.options.headers&&a.mixin(u,w.options.headers),w.options.pushFullWait&&a.mixin(l,{fullWait:"true"}),v.default.delete(w,"/push/deviceRegistrations/"+encodeURIComponent(s),u,l,null,function(g){return h(g)})},y.prototype.removeWhere=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultGetHeaders(w.options,c);if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);h=C}w.options.headers&&a.mixin(u,w.options.headers),w.options.pushFullWait&&a.mixin(d,{fullWait:"true"}),v.default.delete(w,"/push/deviceRegistrations",u,d,null,function(l){return h(l)})},y}(),P=function(){function y(d){this.remove=y.prototype.removeWhere,this.rest=d}return y.prototype.save=function(d,h){var w=this.rest,c=R.default.fromValues(d),u=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,l=a.defaultPostHeaders(w.options,u),s={};if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);h=C}w.options.headers&&a.mixin(l,w.options.headers),w.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var g=a.encodeBody(c,u);v.default.post(w,"/push/channelSubscriptions",g,l,s,null,function(p,x,D,N){h(p,!p&&R.default.fromResponseBody(x,N?void 0:u))})},y.prototype.list=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=this.rest.http.supportsLinkHeaders?void 0:c,l=a.defaultGetHeaders(w.options,c);if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);h=C}w.options.headers&&a.mixin(l,w.options.headers),new S.default(w,"/push/channelSubscriptions",l,u,function(s,g,p){return R.default.fromResponseBody(s,p?void 0:c)}).get(d,h)},y.prototype.removeWhere=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultGetHeaders(w.options,c);if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);h=C}w.options.headers&&a.mixin(u,w.options.headers),w.options.pushFullWait&&a.mixin(d,{fullWait:"true"}),v.default.delete(w,"/push/channelSubscriptions",u,d,null,function(l){return h(l)})},y.prototype.listChannels=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=this.rest.http.supportsLinkHeaders?void 0:c,l=a.defaultGetHeaders(w.options,c);if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"listChannels",arguments);h=C}w.options.headers&&a.mixin(l,w.options.headers),w.options.pushFullWait&&a.mixin(d,{fullWait:"true"}),new S.default(w,"/push/channels",l,u,function(s,g,p){for(var x=!p&&c?a.decodeBody(s,c):s,D=0;D<x.length;D++)x[D]=String(x[D]);return x}).get(d,h)},y}();r.default=O},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(4)),v;(function(R){R.Phone="phone",R.Tablet="tablet",R.Desktop="desktop",R.TV="tv",R.Watch="watch",R.Car="car",R.Embedded="embedded",R.Other="other"})(v||(v={}));var S;(function(R){R.Android="android",R.IOS="ios",R.Browser="browser"})(S||(S={}));var T=function(){function R(){}return R.prototype.toJSON=function(){var C,O,f;return{id:this.id,deviceSecret:this.deviceSecret,platform:this.platform,formFactor:this.formFactor,clientId:this.clientId,metadata:this.metadata,deviceIdentityToken:this.deviceIdentityToken,push:{recipient:(C=this.push)===null||C===void 0?void 0:C.recipient,state:(O=this.push)===null||O===void 0?void 0:O.state,error:(f=this.push)===null||f===void 0?void 0:f.error}}},R.prototype.toString=function(){var C,O,f,E,P="[DeviceDetails";return this.id&&(P+="; id="+this.id),this.platform&&(P+="; platform="+this.platform),this.formFactor&&(P+="; formFactor="+this.formFactor),this.clientId&&(P+="; clientId="+this.clientId),this.metadata&&(P+="; metadata="+this.metadata),this.deviceIdentityToken&&(P+="; deviceIdentityToken="+JSON.stringify(this.deviceIdentityToken)),!((C=this.push)===null||C===void 0)&&C.recipient&&(P+="; push.recipient="+JSON.stringify(this.push.recipient)),!((O=this.push)===null||O===void 0)&&O.state&&(P+="; push.state="+this.push.state),!((f=this.push)===null||f===void 0)&&f.error&&(P+="; push.error="+JSON.stringify(this.push.error)),!((E=this.push)===null||E===void 0)&&E.metadata&&(P+="; push.metadata="+this.push.metadata),P+="]",P},R.fromResponseBody=function(C,O){return O&&(C=a.decodeBody(C,O)),a.isArray(C)?R.fromValuesArray(C):R.fromValues(C)},R.fromValues=function(C){return C.error=C.error&&m.default.fromValues(C.error),Object.assign(new R,C)},R.fromValuesArray=function(C){for(var O=C.length,f=new Array(O),E=0;E<O;E++)f[E]=R.fromValues(C[E]);return f},R.toRequestBody=a.encodeBody,R}();r.default=T},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=function(){function v(){}return v.prototype.toJSON=function(){return{channel:this.channel,deviceId:this.deviceId,clientId:this.clientId}},v.prototype.toString=function(){var S="[PushChannelSubscription";return this.channel&&(S+="; channel="+this.channel),this.deviceId&&(S+="; deviceId="+this.deviceId),this.clientId&&(S+="; clientId="+this.clientId),S+="]",S},v.fromResponseBody=function(S,T){return T&&(S=a.decodeBody(S,T)),a.isArray(S)?v.fromValuesArray(S):v.fromValues(S)},v.fromValues=function(S){return Object.assign(new v,S)},v.fromValuesArray=function(S){for(var T=S.length,R=new Array(T),C=0;C<T;C++)R[C]=v.fromValues(S[C]);return R},v.toRequestBody=a.encodeBody,v}();r.default=m},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=function(){function w(c){this.count=c&&c.count||0,this.data=c&&c.data||0,this.uncompressedData=c&&c.uncompressedData||0,this.failed=c&&c.failed||0,this.refused=c&&c.refused||0}return w}(),v=function(w){i.__extends(c,w);function c(u){var l=w.call(this,u)||this;return u&&u.category&&(l.category={},a.forInOwnNonNullProperties(u.category,function(s){l.category[s]=new m(u.category[s])})),l}return c}(m),S=function(){function w(c){this.peak=c&&c.peak||0,this.min=c&&c.min||0,this.mean=c&&c.mean||0,this.opened=c&&c.opened||0,this.refused=c&&c.refused||0}return w}(),T=function(){function w(c){this.succeeded=c&&c.succeeded||0,this.failed=c&&c.failed||0,this.refused=c&&c.refused||0}return w}(),R=function(){function w(c){this.plain=new S(c&&c.plain),this.tls=new S(c&&c.tls),this.all=new S(c&&c.all)}return w}(),C=function(){function w(c){this.messages=new v(c&&c.messages),this.presence=new v(c&&c.presence),this.all=new v(c&&c.all)}return w}(),O=function(){function w(c){this.realtime=new C(c&&c.realtime),this.rest=new C(c&&c.rest),this.webhook=new C(c&&c.webhook),this.sharedQueue=new C(c&&c.sharedQueue),this.externalQueue=new C(c&&c.externalQueue),this.httpEvent=new C(c&&c.httpEvent),this.push=new C(c&&c.push),this.all=new C(c&&c.all)}return w}(),f=function(){function w(c){this.all=new C(c&&c.all),this.inbound=new O(c&&c.inbound),this.outbound=new O(c&&c.outbound)}return w}(),E=function(){function w(c){this.all=new C(c&&c.all),this.producerPaid=new f(c&&c.producerPaid),this.consumerPaid=new f(c&&c.consumerPaid)}return w}(),P=function(){function w(c){this.messages=c&&c.messages||0;var u=c&&c.notifications;this.notifications={invalid:u&&u.invalid||0,attempted:u&&u.attempted||0,successful:u&&u.successful||0,failed:u&&u.failed||0},this.directPublishes=c&&c.directPublishes||0}return w}(),y=function(){function w(c){this.succeeded=c&&c.succeeded||0,this.skipped=c&&c.skipped||0,this.failed=c&&c.failed||0}return w}(),d=function(){function w(c){var u=this;this.delta=void 0,c&&c.delta&&(this.delta={},a.forInOwnNonNullProperties(c.delta,function(l){u.delta[l]=new y(c.delta[l])}))}return w}(),h=function(w){i.__extends(c,w);function c(u){var l=w.call(this,u)||this;return l.persisted=new C(u&&u.persisted),l.connections=new R(u&&u.connections),l.channels=new S(u&&u.channels),l.apiRequests=new T(u&&u.apiRequests),l.tokenRequests=new T(u&&u.tokenRequests),l.xchgProducer=new E(u&&u.xchgProducer),l.xchgConsumer=new E(u&&u.xchgConsumer),l.push=new P(u&&u.pushStats),l.processed=new d(u&&u.processed),l.inProgress=u&&u.inProgress||void 0,l.unit=u&&u.unit||void 0,l.intervalId=u&&u.intervalId||void 0,l}return c.fromValues=function(u){return new c(u)},c}(f);r.default=h},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(30)),v=i.__importDefault(o(7)),S=i.__importDefault(o(2)),T=i.__importDefault(o(51)),R=i.__importDefault(o(38)),C=i.__importDefault(o(8)),O=i.__importDefault(o(4)),f=i.__importDefault(o(10)),E=i.__importDefault(o(35)),P=i.__importDefault(o(3)),y=i.__importDefault(o(9)),d=function(w){i.__extends(c,w);function c(u){var l=w.call(this,u)||this;return S.default.logAction(S.default.LOG_MINOR,"Realtime()",""),l.connection=new T.default(l,l.options),l.channels=new h(l),u.autoConnect!==!1&&l.connect(),l}return c.prototype.connect=function(){S.default.logAction(S.default.LOG_MINOR,"Realtime.connect()",""),this.connection.connect()},c.prototype.close=function(){S.default.logAction(S.default.LOG_MINOR,"Realtime.close()",""),this.connection.close()},c.Promise=function(u){return u=C.default.objectifyOptions(u),u.promises=!0,new c(u)},c.Callbacks=c,c.Utils=a,c.ConnectionManager=E.default,c.Platform=P.default,c.ProtocolMessage=f.default,c.Message=y.default,c}(m.default),h=function(w){i.__extends(c,w);function c(u){var l=w.call(this)||this;return l.realtime=u,l.all=Object.create(null),u.connection.connectionManager.on("transport.active",function(){l.onTransportActive()}),l}return c.prototype.channelSerials=function(){for(var u={},l=0,s=a.keysArray(this.all,!0);l<s.length;l++){var g=s[l],p=this.all[g];p.properties.channelSerial&&(u[g]=p.properties.channelSerial)}return u},c.prototype.recoverChannels=function(u){for(var l=0,s=a.keysArray(u,!0);l<s.length;l++){var g=s[l],p=this.get(g);p.properties.channelSerial=u[g]}},c.prototype.onChannelMessage=function(u){var l=u.channel;if(l===void 0){S.default.logAction(S.default.LOG_ERROR,"Channels.onChannelMessage()","received event unspecified channel, action = "+u.action);return}var s=this.all[l];if(!s){S.default.logAction(S.default.LOG_ERROR,"Channels.onChannelMessage()","received event for non-existent channel: "+l);return}s.onMessage(u)},c.prototype.onTransportActive=function(){for(var u in this.all){var l=this.all[u];l.state==="attaching"||l.state==="detaching"?l.checkPendingState():l.state==="suspended"?l._attach(!1,null):l.state==="attached"&&l.requestState("attaching")}},c.prototype.propogateConnectionInterruption=function(u,l){var s={closing:"detached",closed:"detached",failed:"failed",suspended:"suspended"},g=["attaching","attached","detaching","suspended"],p=s[u];for(var x in this.all){var D=this.all[x];a.arrIn(g,D.state)&&D.notifyState(p,l)}},c.prototype.get=function(u,l){u=String(u);var s=this.all[u];if(!s)s=this.all[u]=new R.default(this.realtime,u,l);else if(l){if(s._shouldReattachToSetOptions(l,s.channelOptions))throw new O.default("Channels.get() cannot be used to set channel options that would cause the channel to reattach. Please, use RealtimeChannel.setOptions() instead.",4e4,400);s.setOptions(l)}return s},c.prototype.getDerived=function(u,l,s){if(l.filter){var g=a.toBase64(l.filter),p=a.matchDerivedChannel(u);u="[filter=".concat(g).concat(p.qualifierParam,"]").concat(p.channelName)}return this.get(u,s)},c.prototype.release=function(u){u=String(u);var l=this.all[u];if(l){var s=l.getReleaseErr();if(s)throw s;delete this.all[u]}},c}(v.default);r.default=d},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(7)),v=i.__importDefault(o(35)),S=i.__importDefault(o(2)),T=i.__importDefault(o(37)),R=i.__importDefault(o(3));function C(){}var O=function(f){i.__extends(E,f);function E(P,y){var d=f.call(this)||this;return d.whenState=function(h,w){return m.default.prototype.whenState.call(d,h,d.state,w,new T.default(void 0,h))},d.ably=P,d.connectionManager=new v.default(P,y),d.state=d.connectionManager.state.state,d.key=void 0,d.id=void 0,d.errorReason=null,d.connectionManager.on("connectionstate",function(h){var w=d.state=h.current;R.default.Config.nextTick(function(){d.emit(w,h)})}),d.connectionManager.on("update",function(h){R.default.Config.nextTick(function(){d.emit("update",h)})}),d}return E.prototype.connect=function(){S.default.logAction(S.default.LOG_MINOR,"Connection.connect()",""),this.connectionManager.requestState({state:"connecting"})},E.prototype.ping=function(P){if(S.default.logAction(S.default.LOG_MINOR,"Connection.ping()",""),!P){if(this.ably.options.promises)return a.promisify(this,"ping",arguments);P=C}this.connectionManager.ping(null,P)},E.prototype.close=function(){S.default.logAction(S.default.LOG_MINOR,"Connection.close()","connectionKey = "+this.key),this.connectionManager.requestState({state:"closing"})},Object.defineProperty(E.prototype,"recoveryKey",{get:function(){return this.createRecoveryKey()},enumerable:!1,configurable:!0}),E.prototype.createRecoveryKey=function(){return this.connectionManager.createRecoveryKey()},E}(m.default);r.default=O},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.PendingMessage=void 0;var i=o(0),a=i.__importDefault(o(10)),m=i.__importStar(o(1)),v=i.__importDefault(o(7)),S=i.__importDefault(o(2)),T=i.__importDefault(o(36)),R=i.__importDefault(o(4)),C=a.default.Action,O=function(){function E(P,y){this.message=P,this.callback=y,this.merged=!1;var d=P.action;this.sendAttempted=!1,this.ackRequired=d==C.MESSAGE||d==C.PRESENCE}return E}();r.PendingMessage=O;var f=function(E){i.__extends(P,E);function P(y){var d=E.call(this)||this;return d.transport=y,d.messageQueue=new T.default,y.on("ack",function(h,w){d.onAck(h,w)}),y.on("nack",function(h,w,c){d.onNack(h,w,c)}),d}return P.prototype.onAck=function(y,d){S.default.logAction(S.default.LOG_MICRO,"Protocol.onAck()","serial = "+y+"; count = "+d),this.messageQueue.completeMessages(y,d)},P.prototype.onNack=function(y,d,h){S.default.logAction(S.default.LOG_ERROR,"Protocol.onNack()","serial = "+y+"; count = "+d+"; err = "+m.inspectError(h)),h||(h=new R.default("Unable to send message; channel not responding",50001,500)),this.messageQueue.completeMessages(y,d,h)},P.prototype.onceIdle=function(y){var d=this.messageQueue;if(d.count()===0){y();return}d.once("idle",y)},P.prototype.send=function(y){y.ackRequired&&this.messageQueue.push(y),S.default.shouldLog(S.default.LOG_MICRO)&&S.default.logAction(S.default.LOG_MICRO,"Protocol.send()","sending msg; "+a.default.stringify(y.message)),y.sendAttempted=!0,this.transport.send(y.message)},P.prototype.getTransport=function(){return this.transport},P.prototype.getPendingMessages=function(){return this.messageQueue.copyAll()},P.prototype.clearPendingMessages=function(){return this.messageQueue.clear()},P.prototype.finish=function(){var y=this.transport;this.onceIdle(function(){y.disconnect()})},P}(v.default);r.default=f},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(3)),m=i.__importStar(o(1)),v=i.__importDefault(o(26)),S=i.__importDefault(o(8)),T=i.__importDefault(o(2)),R=i.__importDefault(o(10)),C=i.__importDefault(o(4)),O="web_socket";function f(y){return!!y.on}var E=function(y){i.__extends(d,y);function d(h,w,c){var u=y.call(this,h,w,c)||this;return u.shortName=O,c.heartbeats=a.default.Config.useProtocolHeartbeats,u.wsHost=S.default.getHost(c.options,c.host,!0),u}return d.isAvailable=function(){return!!a.default.Config.WebSocket},d.prototype.createWebSocket=function(h,w){return this.uri=h+m.toQueryString(w),new a.default.Config.WebSocket(this.uri)},d.prototype.toString=function(){return"WebSocketTransport; uri="+this.uri},d.prototype.connect=function(){T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.connect()","starting"),v.default.prototype.connect.call(this);var h=this,w=this.params,c=w.options,u=c.tls?"wss://":"ws://",l=u+this.wsHost+":"+S.default.getPort(c)+"/";T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.connect()","uri: "+l),this.auth.getAuthParams(function(s,g){if(!h.isDisposed){var p="";for(var x in g)p+=" "+x+": "+g[x]+";";if(T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.connect()","authParams:"+p+" err: "+s),s){h.disconnect(s);return}var D=w.getConnectParams(g);try{var N=h.wsConnection=h.createWebSocket(l,D);N.binaryType=a.default.Config.binaryType,N.onopen=function(){h.onWsOpen()},N.onclose=function(k){h.onWsClose(k)},N.onmessage=function(k){h.onWsData(k.data)},N.onerror=function(k){h.onWsError(k)},f(N)&&N.on("ping",function(){h.onActivity()})}catch(k){T.default.logAction(T.default.LOG_ERROR,"WebSocketTransport.connect()","Unexpected exception creating websocket: err = "+(k.stack||k.message)),h.disconnect(k)}}})},d.prototype.send=function(h){var w=this.wsConnection;if(!w){T.default.logAction(T.default.LOG_ERROR,"WebSocketTransport.send()","No socket connection");return}try{w.send(R.default.serialize(h,this.params.format))}catch(u){var c="Exception from ws connection when trying to send: "+m.inspectError(u);T.default.logAction(T.default.LOG_ERROR,"WebSocketTransport.send()",c),this.finish("disconnected",new C.default(c,5e4,500))}},d.prototype.onWsData=function(h){T.default.logAction(T.default.LOG_MICRO,"WebSocketTransport.onWsData()","data received; length = "+h.length+"; type = "+typeof h);try{this.onProtocolMessage(R.default.deserialize(h,this.format))}catch(w){T.default.logAction(T.default.LOG_ERROR,"WebSocketTransport.onWsData()","Unexpected exception handing channel message: "+w.stack)}},d.prototype.onWsOpen=function(){T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.onWsOpen()","opened WebSocket"),this.emit("preconnect")},d.prototype.onWsClose=function(h){var w,c;if(typeof h=="object"?(c=h.code,w=h.wasClean||c===1e3):(c=h,w=c==1e3),delete this.wsConnection,w){T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.onWsClose()","Cleanly closed WebSocket");var u=new C.default("Websocket closed",80003,400);this.finish("disconnected",u)}else{var l="Unclean disconnection of WebSocket ; code = "+c,u=new C.default(l,80003,400);T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.onWsClose()",l),this.finish("disconnected",u)}this.emit("disposed")},d.prototype.onWsError=function(h){var w=this;T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.onError()","Error from WebSocket: "+h.message),a.default.Config.nextTick(function(){w.disconnect(Error(h.message))})},d.prototype.dispose=function(){T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.dispose()",""),this.isDisposed=!0;var h=this.wsConnection;h&&(h.onmessage=function(){},delete this.wsConnection,a.default.Config.nextTick(function(){if(T.default.logAction(T.default.LOG_MICRO,"WebSocketTransport.dispose()","closing websocket"),!h)throw new Error("WebSocketTransport.dispose(): wsConnection is not defined");h.close()}))},d}(v.default);function P(y){return E.isAvailable()&&(y.supportedTransports[O]=E),E}r.default=P},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(34)),v=i.__importDefault(o(7)),S=i.__importDefault(o(2)),T=i.__importDefault(o(16)),R=i.__importStar(o(4)),C=i.__importDefault(o(38)),O=i.__importDefault(o(24)),f=i.__importDefault(o(39)),E=function(){};function P(u){return u.channel.realtime.auth.clientId}function y(u){var l=u.channel.realtime,s=l.auth.clientId;return(!s||s==="*")&&l.connection.state==="connected"}function d(u,l,s){switch(u.state){case"attached":case"suspended":s();break;case"initialized":case"detached":case"detaching":case"attaching":u.attach(function(g){g?l(g):s()});break;default:l(R.default.fromValues(u.invalidStateError()))}}function h(u,l){if(u.isSynthesized()||l.isSynthesized())return u.timestamp>=l.timestamp;var s=u.parseId(),g=l.parseId();return s.msgSerial===g.msgSerial?s.index>g.index:s.msgSerial>g.msgSerial}var w=function(u){i.__extends(l,u);function l(s){var g=u.call(this,s)||this;return g.channel=s,g.syncComplete=!1,g.members=new c(g,function(p){return p.clientId+":"+p.connectionId}),g._myMembers=new c(g,function(p){return p.clientId}),g.subscriptions=new v.default,g.pendingPresence=[],g}return l.prototype.enter=function(s,g){if(y(this))throw new R.default("clientId must be specified to enter a presence channel",40012,400);return this._enterOrUpdateClient(void 0,void 0,s,"enter",g)},l.prototype.update=function(s,g){if(y(this))throw new R.default("clientId must be specified to update presence data",40012,400);return this._enterOrUpdateClient(void 0,void 0,s,"update",g)},l.prototype.enterClient=function(s,g,p){return this._enterOrUpdateClient(void 0,s,g,"enter",p)},l.prototype.updateClient=function(s,g,p){return this._enterOrUpdateClient(void 0,s,g,"update",p)},l.prototype._enterOrUpdateClient=function(s,g,p,x,D){var N=this;if(!D)if(typeof p=="function")D=p,p=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"_enterOrUpdateClient",[s,g,p,x]);D=E}var k=this.channel;if(!k.connectionManager.activeState()){D(k.connectionManager.getError());return}S.default.logAction(S.default.LOG_MICRO,"RealtimePresence."+x+"Client()","channel = "+k.name+", id = "+s+", client = "+(g||"(implicit) "+P(this)));var I=T.default.fromData(p);I.action=x,s&&(I.id=s),g&&(I.clientId=g),T.default.encode(I,k.channelOptions,function(M){if(M){D(M);return}switch(k.state){case"attached":k.sendPresence(I,D);break;case"initialized":case"detached":k.attach();case"attaching":N.pendingPresence.push({presence:I,callback:D});break;default:M=new R.PartialErrorInfo("Unable to "+x+" presence channel while in "+k.state+" state",90001),M.code=90001,D(M)}})},l.prototype.leave=function(s,g){if(y(this))throw new R.default("clientId must have been specified to enter or leave a presence channel",40012,400);return this.leaveClient(void 0,s,g)},l.prototype.leaveClient=function(s,g,p){if(!p)if(typeof g=="function")p=g,g=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"leaveClient",[s,g]);p=E}var x=this.channel;if(!x.connectionManager.activeState()){p==null||p(x.connectionManager.getError());return}S.default.logAction(S.default.LOG_MICRO,"RealtimePresence.leaveClient()","leaving; channel = "+this.channel.name+", client = "+s);var D=T.default.fromData(g);switch(D.action="leave",s&&(D.clientId=s),x.state){case"attached":x.sendPresence(D,p);break;case"attaching":this.pendingPresence.push({presence:D,callback:p});break;case"initialized":case"failed":{var N=new R.PartialErrorInfo("Unable to leave presence channel (incompatible state)",90001);p==null||p(N);break}default:p==null||p(x.invalidStateError())}},l.prototype.get=function(s,g){var p=this,x=Array.prototype.slice.call(arguments);x.length==1&&typeof x[0]=="function"&&x.unshift(null),s=x[0],g=x[1];var D=!s||("waitForSync"in s?s.waitForSync:!0);if(!g){if(this.channel.realtime.options.promises)return a.promisify(this,"get",x);g=E}function N(k){g(null,s?k.list(s):k.values())}if(this.channel.state==="suspended"){D?g(R.default.fromValues({statusCode:400,code:91005,message:"Presence state is out of sync due to channel being in the SUSPENDED state"})):N(this.members);return}d(this.channel,g,function(){var k=p.members;D?k.waitSync(function(){N(k)}):N(k)})},l.prototype.history=function(s,g){if(S.default.logAction(S.default.LOG_MICRO,"RealtimePresence.history()","channel = "+this.name),g===void 0)if(typeof s=="function")g=s,s=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"history",arguments);g=E}s&&s.untilAttach&&(this.channel.state==="attached"?(delete s.untilAttach,s.from_serial=this.channel.properties.attachSerial):g(new R.default("option untilAttach requires the channel to be attached, was: "+this.channel.state,4e4,400))),m.default.prototype._history.call(this,s,g)},l.prototype.setPresence=function(s,g,p){S.default.logAction(S.default.LOG_MICRO,"RealtimePresence.setPresence()","received presence for "+s.length+" participants; syncChannelSerial = "+p);var x,D,N=this.members,k=this._myMembers,I=[],M=this.channel.connectionManager.connectionId;g&&(this.members.startSync(),p&&(D=p.match(/^[\w-]+:(.*)$/))&&(x=D[1]));for(var A=0;A<s.length;A++){var j=T.default.fromValues(s[A]);switch(j.action){case"leave":N.remove(j)&&I.push(j),j.connectionId===M&&!j.isSynthesized()&&k.remove(j);break;case"enter":case"present":case"update":N.put(j)&&I.push(j),j.connectionId===M&&k.put(j);break}}g&&!x&&(N.endSync(),this.channel.syncChannelSerial=null);for(var A=0;A<I.length;A++){var j=I[A];this.subscriptions.emit(j.action,j)}},l.prototype.onAttached=function(s){S.default.logAction(S.default.LOG_MINOR,"RealtimePresence.onAttached()","channel = "+this.channel.name+", hasPresence = "+s),s?this.members.startSync():(this._synthesizeLeaves(this.members.values()),this.members.clear()),this._ensureMyMembersPresent();var g=this.pendingPresence,p=g.length;if(p){this.pendingPresence=[];var x=[],D=O.default.create();S.default.logAction(S.default.LOG_MICRO,"RealtimePresence.onAttached","sending "+p+" queued presence messages");for(var N=0;N<p;N++){var k=g[N];x.push(k.presence),D.push(k.callback)}this.channel.sendPresence(x,D)}},l.prototype.actOnChannelState=function(s,g,p){switch(s){case"attached":this.onAttached(g);break;case"detached":case"failed":this._clearMyMembers(),this.members.clear();case"suspended":this.failPendingPresence(p);break}},l.prototype.failPendingPresence=function(s){if(this.pendingPresence.length){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.failPendingPresence","channel; name = "+this.channel.name+", err = "+a.inspectError(s));for(var g=0;g<this.pendingPresence.length;g++)try{this.pendingPresence[g].callback(s)}catch(p){}this.pendingPresence=[]}},l.prototype._clearMyMembers=function(){this._myMembers.clear()},l.prototype._ensureMyMembersPresent=function(){var s=this,g=this._myMembers,p=function(N){if(N){var k="Presence auto-re-enter failed: "+N.toString(),I=new R.default(k,91004,400);S.default.logAction(S.default.LOG_ERROR,"RealtimePresence._ensureMyMembersPresent()",k);var M=new f.default(s.channel.state,s.channel.state,!0,!1,I);s.channel.emit("update",M)}};for(var x in g.map){var D=g.map[x];S.default.logAction(S.default.LOG_MICRO,"RealtimePresence._ensureMyMembersPresent()",'Auto-reentering clientId "'+D.clientId+'" into the presence set'),this._enterOrUpdateClient(D.id,D.clientId,D.data,"enter",p)}},l.prototype._synthesizeLeaves=function(s){var g=this.subscriptions;a.arrForEach(s,function(p){var x=T.default.fromValues({action:"leave",connectionId:p.connectionId,clientId:p.clientId,data:p.data,encoding:p.encoding,timestamp:a.now()});g.emit("leave",x)})},l.prototype.on=function(){for(var s=[],g=0;g<arguments.length;g++)s[g]=arguments[g];S.default.renamedMethod("RealtimePresence","on","subscribe"),this.subscribe.apply(this,s)},l.prototype.off=function(){for(var s=[],g=0;g<arguments.length;g++)s[g]=arguments[g];S.default.renamedMethod("RealtimePresence","off","unsubscribe"),this.unsubscribe.apply(this,s)},l.prototype.subscribe=function(){for(var s=[],g=0;g<arguments.length;g++)s[g]=arguments[g];var p=C.default.processListenerArgs(s),x=p[0],D=p[1],N=p[2],k=this.channel;if(!N){if(this.channel.realtime.options.promises)return a.promisify(this,"subscribe",[x,D]);N=E}if(k.state==="failed"){N(R.default.fromValues(k.invalidStateError()));return}this.subscriptions.on(x,D),k.attach(N)},l.prototype.unsubscribe=function(){for(var s=[],g=0;g<arguments.length;g++)s[g]=arguments[g];var p=C.default.processListenerArgs(s),x=p[0],D=p[1];this.subscriptions.off(x,D)},l}(m.default),c=function(u){i.__extends(l,u);function l(s,g){var p=u.call(this)||this;return p.presence=s,p.map=Object.create(null),p.syncInProgress=!1,p.residualMembers=null,p.memberKey=g,p}return l.prototype.get=function(s){return this.map[s]},l.prototype.getClient=function(s){var g=this.map,p=[];for(var x in g){var D=g[x];D.clientId==s&&D.action!="absent"&&p.push(D)}return p},l.prototype.list=function(s){var g=this.map,p=s&&s.clientId,x=s&&s.connectionId,D=[];for(var N in g){var k=g[N];k.action!=="absent"&&(p&&p!=k.clientId||x&&x!=k.connectionId||D.push(k))}return D},l.prototype.put=function(s){(s.action==="enter"||s.action==="update")&&(s=T.default.fromValues(s),s.action="present");var g=this.map,p=this.memberKey(s);this.residualMembers&&delete this.residualMembers[p];var x=g[p];return x&&!h(s,x)?!1:(g[p]=s,!0)},l.prototype.values=function(){var s=this.map,g=[];for(var p in s){var x=s[p];x.action!="absent"&&g.push(x)}return g},l.prototype.remove=function(s){var g=this.map,p=this.memberKey(s),x=g[p];return x&&!h(s,x)?!1:(this.syncInProgress?(s=T.default.fromValues(s),s.action="absent",g[p]=s):delete g[p],!0)},l.prototype.startSync=function(){var s=this.map,g=this.syncInProgress;S.default.logAction(S.default.LOG_MINOR,"PresenceMap.startSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+g),this.syncInProgress||(this.residualMembers=a.copy(s),this.setInProgress(!0))},l.prototype.endSync=function(){var s=this.map,g=this.syncInProgress;if(S.default.logAction(S.default.LOG_MINOR,"PresenceMap.endSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+g),g){for(var p in s){var x=s[p];x.action==="absent"&&delete s[p]}this.presence._synthesizeLeaves(a.valuesArray(this.residualMembers));for(var p in this.residualMembers)delete s[p];this.residualMembers=null,this.setInProgress(!1)}this.emit("sync")},l.prototype.waitSync=function(s){var g=this.syncInProgress;if(S.default.logAction(S.default.LOG_MINOR,"PresenceMap.waitSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+g),!g){s();return}this.once("sync",s)},l.prototype.clear=function(){this.map={},this.setInProgress(!1),this.residualMembers=null},l.prototype.setInProgress=function(s){S.default.logAction(S.default.LOG_MICRO,"PresenceMap.setInProgress()","inProgress = "+s),this.syncInProgress=s,this.presence.syncComplete=!s},l}(v.default);r.default=w},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=o(56),m=o(31),v=o(11),S=i.__importDefault(o(5)),T=i.__importDefault(o(3)),R=function(){function C(){this.base64CharSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",this.hexCharSet="0123456789abcdef"}return C.prototype.isWordArray=function(O){return O!=null&&O.sigBytes!==void 0},C.prototype.isArrayBuffer=function(O){return O!=null&&O.constructor===ArrayBuffer},C.prototype.isTypedArray=function(O){return!!ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(O)},C.prototype.uint8ViewToBase64=function(O){for(var f="",E=this.base64CharSet,P=O.byteLength,y=P%3,d=P-y,h,w,c,u,l,s=0;s<d;s=s+3)l=O[s]<<16|O[s+1]<<8|O[s+2],h=(l&16515072)>>18,w=(l&258048)>>12,c=(l&4032)>>6,u=l&63,f+=E[h]+E[w]+E[c]+E[u];return y==1?(l=O[d],h=(l&252)>>2,w=(l&3)<<4,f+=E[h]+E[w]+"=="):y==2&&(l=O[d]<<8|O[d+1],h=(l&64512)>>10,w=(l&1008)>>4,c=(l&15)<<2,f+=E[h]+E[w]+E[c]+"="),f},C.prototype.base64ToArrayBuffer=function(O){for(var f=atob==null?void 0:atob(O),E=f.length,P=new Uint8Array(E),y=0;y<E;y++){var d=f.charCodeAt(y);P[y]=d}return P.buffer},C.prototype.isBuffer=function(O){return this.isArrayBuffer(O)||this.isWordArray(O)||this.isTypedArray(O)},C.prototype.toBuffer=function(O){if(!ArrayBuffer)throw new Error("Can't convert to Buffer: browser does not support the necessary types");if(this.isArrayBuffer(O))return new Uint8Array(O);if(this.isTypedArray(O))return new Uint8Array(O.buffer);if(this.isWordArray(O)){for(var f=new ArrayBuffer(O.sigBytes),E=new Uint8Array(f),P=0;P<O.sigBytes;P++)E[P]=O.words[P>>>2]>>>24-P%4*8&255;return E}throw new Error("BufferUtils.toBuffer expected an arraybuffer, typed array, or CryptoJS wordarray")},C.prototype.toArrayBuffer=function(O){return this.isArrayBuffer(O)?O:this.toBuffer(O).buffer},C.prototype.toWordArray=function(O){return this.isTypedArray(O)&&(O=O.buffer),this.isWordArray(O)?O:S.default.create(O)},C.prototype.base64Encode=function(O){return this.isWordArray(O)?(0,v.stringify)(O):this.uint8ViewToBase64(this.toBuffer(O))},C.prototype.base64Decode=function(O){return ArrayBuffer&&T.default.Config.atob?this.base64ToArrayBuffer(O):(0,v.parse)(O)},C.prototype.hexEncode=function(O){return(0,a.stringify)(this.toWordArray(O))},C.prototype.hexDecode=function(O){var f=(0,a.parse)(O);return ArrayBuffer?this.toArrayBuffer(f):f},C.prototype.utf8Encode=function(O){return T.default.Config.TextEncoder?new T.default.Config.TextEncoder().encode(O).buffer:(0,m.parse)(O)},C.prototype.utf8Decode=function(O){if(!this.isBuffer(O))throw new Error("Expected input of utf8decode to be an arraybuffer, typed array, or CryptoJS wordarray");return TextDecoder&&!this.isWordArray(O)?new TextDecoder().decode(O):(O=this.toWordArray(O),(0,m.stringify)(O))},C.prototype.bufferCompare=function(O,f){if(!O)return-1;if(!f)return 1;var E=this.toWordArray(O),P=this.toWordArray(f);E.clamp(),P.clamp();var y=E.sigBytes-P.sigBytes;if(y!=0)return y;for(var d=E.words,h=P.words,w=0;w<d.length;w++)if(y=d[w]-h[w],y!=0)return y;return 0},C.prototype.byteLength=function(O){return this.isArrayBuffer(O)||this.isTypedArray(O)?O.byteLength:this.isWordArray(O)?O.sigBytes:-1},C.prototype.typedArrayToBuffer=function(O){return O.buffer},C}();r.default=new R},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return i.enc.Hex})},function(n,r,o){o.r(r);var i=o(5),a=o.n(i),m=o(11),v=o(23),S=o.n(v),T=o(2),R=o.n(T),C=o(4),O=o.n(C),f=function(E,P){var y="aes",d=256,h="cbc",w=16,c=4,u=4294967296,l=2147483648,s;if(E.getRandomWordArray)s=E.getRandomWordArray;else if(typeof Uint32Array!="undefined"&&E.getRandomValues){var g=new Uint32Array(c);s=function(A,j){var U=A/4,z=U==c?g:new Uint32Array(U);E.getRandomValues(z,function(V){typeof j!="undefined"&&j(V,P.toWordArray(z))})}}else s=function(A,j){R.a.logAction(R.a.LOG_MAJOR,"Ably.Crypto.generateRandom()","Warning: the browser you are using does not support secure cryptographically secure randomness generation; falling back to insecure Math.random()");for(var U=A/4,z=new Array(U),V=0;V<U;V++)z[V]=Math.floor(Math.random()*u)-l;j(null,a.a.create(z))};function p(A){return A+w&-16}function x(A){if(A.algorithm==="aes"&&A.mode==="cbc"){if(A.keyLength===128||A.keyLength===256)return;throw new Error("Unsupported key length "+A.keyLength+" for aes-cbc encryption. Encryption key must be 128 or 256 bits (16 or 32 ASCII characters)")}}function D(A){return A.replace("_","/").replace("-","+")}var N=[a.a.create([269488144,269488144,269488144,269488144],16),a.a.create([16777216],1),a.a.create([33685504],2),a.a.create([50529024],3),a.a.create([67372036],4),a.a.create([84215045,83886080],5),a.a.create([101058054,101056512],6),a.a.create([117901063,117901056],7),a.a.create([134744072,134744072],8),a.a.create([151587081,151587081,150994944],9),a.a.create([168430090,168430090,168427520],10),a.a.create([185273099,185273099,185273088],11),a.a.create([202116108,202116108,202116108],12),a.a.create([218959117,218959117,218959117,218103808],13),a.a.create([235802126,235802126,235802126,235798528],14),a.a.create([252645135,252645135,252645135,252645135],15),a.a.create([269488144,269488144,269488144,269488144],16)];function k(){}function I(){this.algorithm=null,this.keyLength=null,this.mode=null,this.key=null}k.CipherParams=I,k.getDefaultParams=function(A){var j;if(typeof A=="function"||typeof A=="string"){if(R.a.deprecated("The ability to pass a callback to `Crypto.getDefaultParams()`","This method now directly returns its result, instead of returning it asynchronously via a callback. Please update your code so that it uses the return value of this method instead of passing a callback."),typeof A=="function")R.a.deprecated("The ability to call `Crypto.getDefaultParams()` without specifying an encryption key","Please update your code so that it instead passes an object whose `key` property contains an encryption key. That is, replace `Crypto.getDefaultParams()` with `Crypto.getDefaultParams({ key })`, where `key` is an encryption key that you have generated (for example from the `Crypto.generateRandomKey()` method)."),k.generateRandomKey(function(z){A(null,k.getDefaultParams({key:z}))});else if(typeof arguments[1]=="function")R.a.deprecated("The ability to pass the encryption key as the first argument of `Crypto.getDefaultParams()`","Please update your code so that it instead passes an object whose `key` property contains the key. That is, replace `Crypto.getDefaultParams(key)` with `Crypto.getDefaultParams({ key })`."),arguments[1](null,k.getDefaultParams({key:A}));else throw new Error("Invalid arguments for Crypto.getDefaultParams");return}if(!A.key)throw new Error("Crypto.getDefaultParams: a key is required");typeof A.key=="string"?j=Object(m.parse)(D(A.key)):j=P.toWordArray(A.key);var U=new I;if(U.key=j,U.algorithm=A.algorithm||y,U.keyLength=j.words.length*(4*8),U.mode=A.mode||h,A.keyLength&&A.keyLength!==U.keyLength)throw new Error("Crypto.getDefaultParams: a keyLength of "+A.keyLength+" was specified, but the key actually has length "+U.keyLength);return x(U),U},k.generateRandomKey=function(A,j){arguments.length==1&&typeof A=="function"&&(j=A,A=void 0),s((A||d)/8,function(U,z){j!==void 0&&j(U?O.a.fromValues(U):null,z)})},k.getCipher=function(A){var j=A instanceof I?A:k.getDefaultParams(A);return{cipherParams:j,cipher:new M(j,c,A.iv)}};function M(A,j,U){this.algorithm=A.algorithm+"-"+String(A.keyLength)+"-"+A.mode,this.cjsAlgorithm=A.algorithm.toUpperCase().replace(/-\d+$/,""),this.key=P.toWordArray(A.key),U&&(this.iv=P.toWordArray(U).clone()),this.blockLengthWords=j}return M.prototype.encrypt=function(A,j){R.a.logAction(R.a.LOG_MICRO,"CBCCipher.encrypt()",""),A=P.toWordArray(A);var U=A.sigBytes,z=p(U),V=this,G=function(){V.getIv(function(F,b){if(F){j(F);return}var L=V.encryptCipher.process(A.concat(N[z-U])),B=b.concat(L);j(null,B)})};this.encryptCipher?G():this.iv?(this.encryptCipher=S.a.algo[this.cjsAlgorithm].createEncryptor(this.key,{iv:this.iv}),G()):s(w,function(F,b){if(F){j(F);return}V.encryptCipher=S.a.algo[V.cjsAlgorithm].createEncryptor(V.key,{iv:b}),V.iv=b,G()})},M.prototype.decrypt=function(A){R.a.logAction(R.a.LOG_MICRO,"CBCCipher.decrypt()",""),A=P.toWordArray(A);var j=this.blockLengthWords,U=A.words,z=a.a.create(U.slice(0,j)),V=a.a.create(U.slice(j)),G=S.a.algo[this.cjsAlgorithm].createDecryptor(this.key,{iv:z}),F=G.process(V),b=G.finalize();return G.reset(),b&&b.sigBytes&&F.concat(b),F},M.prototype.getIv=function(A){if(this.iv){var j=this.iv;this.iv=null,A(null,j);return}var U=this;s(w,function(z,V){if(z){A(z);return}A(null,U.encryptCipher.process(V))})},k};r.default=f},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){var a=i,m=a.lib,v=m.WordArray,S=a.enc;S.Utf16=S.Utf16BE={stringify:function(R){for(var C=R.words,O=R.sigBytes,f=[],E=0;E<O;E+=2){var P=C[E>>>2]>>>16-E%4*8&65535;f.push(String.fromCharCode(P))}return f.join("")},parse:function(R){for(var C=R.length,O=[],f=0;f<C;f++)O[f>>>1]|=R.charCodeAt(f)<<16-f%2*16;return v.create(O,C*2)}},S.Utf16LE={stringify:function(R){for(var C=R.words,O=R.sigBytes,f=[],E=0;E<O;E+=2){var P=T(C[E>>>2]>>>16-E%4*8&65535);f.push(String.fromCharCode(P))}return f.join("")},parse:function(R){for(var C=R.length,O=[],f=0;f<C;f++)O[f>>>1]|=T(R.charCodeAt(f)<<16-f%2*16);return v.create(O,C*2)}};function T(R){return R<<8&4278255360|R>>>8&16711935}}(),i.enc.Utf16})},function(n,r,o){(function(i,a){n.exports=a(o(6),o(28))})(this,function(i){return function(a){var m=i,v=m.lib,S=v.CipherParams,T=m.enc,R=T.Hex,C=m.format;C.Hex={stringify:function(O){return O.ciphertext.toString(R)},parse:function(O){var f=R.parse(O);return S.create({ciphertext:f})}}}(),i.format.Hex})},function(n,r,o){(function(i,a){n.exports=a(o(6),o(11),o(61),o(27),o(28))})(this,function(i){return function(){var a=i,m=a.lib,v=m.BlockCipher,S=a.algo,T=[],R=[],C=[],O=[],f=[],E=[],P=[],y=[],d=[],h=[];(function(){for(var u=[],l=0;l<256;l++)l<128?u[l]=l<<1:u[l]=l<<1^283;for(var s=0,g=0,l=0;l<256;l++){var p=g^g<<1^g<<2^g<<3^g<<4;p=p>>>8^p&255^99,T[s]=p,R[p]=s;var x=u[s],D=u[x],N=u[D],k=u[p]*257^p*16843008;C[s]=k<<24|k>>>8,O[s]=k<<16|k>>>16,f[s]=k<<8|k>>>24,E[s]=k;var k=N*16843009^D*65537^x*257^s*16843008;P[p]=k<<24|k>>>8,y[p]=k<<16|k>>>16,d[p]=k<<8|k>>>24,h[p]=k,s?(s=x^u[u[u[N^x]]],g^=u[u[g]]):s=g=1}})();var w=[0,1,2,4,8,16,32,64,128,27,54],c=S.AES=v.extend({_doReset:function(){var u;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var l=this._keyPriorReset=this._key,s=l.words,g=l.sigBytes/4,p=this._nRounds=g+6,x=(p+1)*4,D=this._keySchedule=[],N=0;N<x;N++)N<g?D[N]=s[N]:(u=D[N-1],N%g?g>6&&N%g==4&&(u=T[u>>>24]<<24|T[u>>>16&255]<<16|T[u>>>8&255]<<8|T[u&255]):(u=u<<8|u>>>24,u=T[u>>>24]<<24|T[u>>>16&255]<<16|T[u>>>8&255]<<8|T[u&255],u^=w[N/g|0]<<24),D[N]=D[N-g]^u);for(var k=this._invKeySchedule=[],I=0;I<x;I++){var N=x-I;if(I%4)var u=D[N];else var u=D[N-4];I<4||N<=4?k[I]=u:k[I]=P[T[u>>>24]]^y[T[u>>>16&255]]^d[T[u>>>8&255]]^h[T[u&255]]}}},encryptBlock:function(u,l){this._doCryptBlock(u,l,this._keySchedule,C,O,f,E,T)},decryptBlock:function(u,l){var s=u[l+1];u[l+1]=u[l+3],u[l+3]=s,this._doCryptBlock(u,l,this._invKeySchedule,P,y,d,h,R);var s=u[l+1];u[l+1]=u[l+3],u[l+3]=s},_doCryptBlock:function(u,l,s,g,p,x,D,N){for(var k=this._nRounds,I=u[l]^s[0],M=u[l+1]^s[1],A=u[l+2]^s[2],j=u[l+3]^s[3],U=4,z=1;z<k;z++){var V=g[I>>>24]^p[M>>>16&255]^x[A>>>8&255]^D[j&255]^s[U++],G=g[M>>>24]^p[A>>>16&255]^x[j>>>8&255]^D[I&255]^s[U++],F=g[A>>>24]^p[j>>>16&255]^x[I>>>8&255]^D[M&255]^s[U++],b=g[j>>>24]^p[I>>>16&255]^x[M>>>8&255]^D[A&255]^s[U++];I=V,M=G,A=F,j=b}var V=(N[I>>>24]<<24|N[M>>>16&255]<<16|N[A>>>8&255]<<8|N[j&255])^s[U++],G=(N[M>>>24]<<24|N[A>>>16&255]<<16|N[j>>>8&255]<<8|N[I&255])^s[U++],F=(N[A>>>24]<<24|N[j>>>16&255]<<16|N[I>>>8&255]<<8|N[M&255])^s[U++],b=(N[j>>>24]<<24|N[I>>>16&255]<<16|N[M>>>8&255]<<8|N[A&255])^s[U++];u[l]=V,u[l+1]=G,u[l+2]=F,u[l+3]=b},keySize:256/32});a.AES=v._createHelper(c)}(),i.AES})},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(a){var m=i,v=m.lib,S=v.WordArray,T=v.Hasher,R=m.algo,C=[];(function(){for(var d=0;d<64;d++)C[d]=a.abs(a.sin(d+1))*4294967296|0})();var O=R.MD5=T.extend({_doReset:function(){this._hash=new S.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(d,h){for(var w=0;w<16;w++){var c=h+w,u=d[c];d[c]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360}var l=this._hash.words,s=d[h+0],g=d[h+1],p=d[h+2],x=d[h+3],D=d[h+4],N=d[h+5],k=d[h+6],I=d[h+7],M=d[h+8],A=d[h+9],j=d[h+10],U=d[h+11],z=d[h+12],V=d[h+13],G=d[h+14],F=d[h+15],b=l[0],L=l[1],B=l[2],_=l[3];b=f(b,L,B,_,s,7,C[0]),_=f(_,b,L,B,g,12,C[1]),B=f(B,_,b,L,p,17,C[2]),L=f(L,B,_,b,x,22,C[3]),b=f(b,L,B,_,D,7,C[4]),_=f(_,b,L,B,N,12,C[5]),B=f(B,_,b,L,k,17,C[6]),L=f(L,B,_,b,I,22,C[7]),b=f(b,L,B,_,M,7,C[8]),_=f(_,b,L,B,A,12,C[9]),B=f(B,_,b,L,j,17,C[10]),L=f(L,B,_,b,U,22,C[11]),b=f(b,L,B,_,z,7,C[12]),_=f(_,b,L,B,V,12,C[13]),B=f(B,_,b,L,G,17,C[14]),L=f(L,B,_,b,F,22,C[15]),b=E(b,L,B,_,g,5,C[16]),_=E(_,b,L,B,k,9,C[17]),B=E(B,_,b,L,U,14,C[18]),L=E(L,B,_,b,s,20,C[19]),b=E(b,L,B,_,N,5,C[20]),_=E(_,b,L,B,j,9,C[21]),B=E(B,_,b,L,F,14,C[22]),L=E(L,B,_,b,D,20,C[23]),b=E(b,L,B,_,A,5,C[24]),_=E(_,b,L,B,G,9,C[25]),B=E(B,_,b,L,x,14,C[26]),L=E(L,B,_,b,M,20,C[27]),b=E(b,L,B,_,V,5,C[28]),_=E(_,b,L,B,p,9,C[29]),B=E(B,_,b,L,I,14,C[30]),L=E(L,B,_,b,z,20,C[31]),b=P(b,L,B,_,N,4,C[32]),_=P(_,b,L,B,M,11,C[33]),B=P(B,_,b,L,U,16,C[34]),L=P(L,B,_,b,G,23,C[35]),b=P(b,L,B,_,g,4,C[36]),_=P(_,b,L,B,D,11,C[37]),B=P(B,_,b,L,I,16,C[38]),L=P(L,B,_,b,j,23,C[39]),b=P(b,L,B,_,V,4,C[40]),_=P(_,b,L,B,s,11,C[41]),B=P(B,_,b,L,x,16,C[42]),L=P(L,B,_,b,k,23,C[43]),b=P(b,L,B,_,A,4,C[44]),_=P(_,b,L,B,z,11,C[45]),B=P(B,_,b,L,F,16,C[46]),L=P(L,B,_,b,p,23,C[47]),b=y(b,L,B,_,s,6,C[48]),_=y(_,b,L,B,I,10,C[49]),B=y(B,_,b,L,G,15,C[50]),L=y(L,B,_,b,N,21,C[51]),b=y(b,L,B,_,z,6,C[52]),_=y(_,b,L,B,x,10,C[53]),B=y(B,_,b,L,j,15,C[54]),L=y(L,B,_,b,g,21,C[55]),b=y(b,L,B,_,M,6,C[56]),_=y(_,b,L,B,F,10,C[57]),B=y(B,_,b,L,k,15,C[58]),L=y(L,B,_,b,V,21,C[59]),b=y(b,L,B,_,D,6,C[60]),_=y(_,b,L,B,U,10,C[61]),B=y(B,_,b,L,p,15,C[62]),L=y(L,B,_,b,A,21,C[63]),l[0]=l[0]+b|0,l[1]=l[1]+L|0,l[2]=l[2]+B|0,l[3]=l[3]+_|0},_doFinalize:function(){var d=this._data,h=d.words,w=this._nDataBytes*8,c=d.sigBytes*8;h[c>>>5]|=128<<24-c%32;var u=a.floor(w/4294967296),l=w;h[(c+64>>>9<<4)+15]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360,h[(c+64>>>9<<4)+14]=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360,d.sigBytes=(h.length+1)*4,this._process();for(var s=this._hash,g=s.words,p=0;p<4;p++){var x=g[p];g[p]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360}return s},clone:function(){var d=T.clone.call(this);return d._hash=this._hash.clone(),d}});function f(d,h,w,c,u,l,s){var g=d+(h&w|~h&c)+u+s;return(g<<l|g>>>32-l)+h}function E(d,h,w,c,u,l,s){var g=d+(h&c|w&~c)+u+s;return(g<<l|g>>>32-l)+h}function P(d,h,w,c,u,l,s){var g=d+(h^w^c)+u+s;return(g<<l|g>>>32-l)+h}function y(d,h,w,c,u,l,s){var g=d+(w^(h|~c))+u+s;return(g<<l|g>>>32-l)+h}m.MD5=T._createHelper(O),m.HmacMD5=T._createHmacHelper(O)}(Math),i.MD5})},function(n,r,o){var i;Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),m=a.__importDefault(o(3)),v=a.__importStar(o(1)),S=a.__importDefault(o(8)),T=o(4),R=a.__importDefault(o(19)),C=a.__importDefault(o(17)),O=a.__importDefault(o(22)),f=a.__importDefault(o(2)),E=o(29),P=a.__importDefault(o(63)),y=o(14);function d(c){var u=c.statusCode;return u===408&&!c.code||u===400&&!c.code||u>=500&&u<=504}function h(c){var u=c.connection,l=u&&u.connectionManager.host;return l?[l].concat(S.default.getFallbackHosts(c.options)):S.default.getHosts(c.options)}var w=(i=function(){function c(u){this.checksInProgress=null,this.checkConnectivity=void 0,this.supportsAuthHeaders=!1,this.supportsLinkHeaders=!1,this._getHosts=h,this.options=u||{};var l=this.options.connectivityCheckUrl||S.default.connectivityCheckUrl,s=this.options.connectivityCheckParams,g=!this.options.connectivityCheckUrl;m.default.Config.xhrSupported?(this.supportsAuthHeaders=!0,this.Request=function(p,x,D,N,k,I,M){var A=C.default.createRequest(D,N,k,I,O.default.REQ_SEND,x&&x.options.timeouts,p);return A.once("complete",M),A.exec(),A},this.options.disableConnectivityCheck?this.checkConnectivity=function(p){p(null,!0)}:this.checkConnectivity=function(p){f.default.logAction(f.default.LOG_MICRO,"(XHRRequest)Http.checkConnectivity()","Sending; "+l),this.doUri(R.default.Get,null,l,null,null,s,function(x,D,N,k,I){var M=!1;g?M=!x&&(D==null?void 0:D.replace(/\n/,""))=="yes":M=!x&&(0,y.isSuccessCode)(I),f.default.logAction(f.default.LOG_MICRO,"(XHRRequest)Http.checkConnectivity()","Result: "+M),p(null,M)})}):m.default.Config.jsonpSupported?(this.Request=function(p,x,D,N,k,I,M){var A=(0,E.createRequest)(D,N,k,I,O.default.REQ_SEND,x&&x.options.timeouts,p);return A.once("complete",M),m.default.Config.nextTick(function(){A.exec()}),A},this.options.disableConnectivityCheck?this.checkConnectivity=function(p){p(null,!0)}:this.checkConnectivity=function(p){var x=this,D=S.default.jsonpInternetUpUrl;if(this.checksInProgress){this.checksInProgress.push(p);return}this.checksInProgress=[p],f.default.logAction(f.default.LOG_MICRO,"(JSONP)Http.checkConnectivity()","Sending; "+D);var N=new E.Request("isTheInternetUp",D,null,null,null,O.default.REQ_SEND,S.default.TIMEOUTS);N.once("complete",function(k,I){var M=!k&&I;f.default.logAction(f.default.LOG_MICRO,"(JSONP)Http.checkConnectivity()","Result: "+M);for(var A=0;A<x.checksInProgress.length;A++)x.checksInProgress[A](null,M);x.checksInProgress=null}),m.default.Config.nextTick(function(){N.exec()})}):m.default.Config.fetchSupported?(this.supportsAuthHeaders=!0,this.Request=P.default,this.checkConnectivity=function(p){f.default.logAction(f.default.LOG_MICRO,"(Fetch)Http.checkConnectivity()","Sending; "+l),this.doUri(R.default.Get,null,l,null,null,null,function(x,D){var N=!x&&(D==null?void 0:D.replace(/\n/,""))=="yes";f.default.logAction(f.default.LOG_MICRO,"(Fetch)Http.checkConnectivity()","Result: "+N),p(null,N)})}):this.Request=function(p,x,D,N,k,I,M){M(new T.PartialErrorInfo("no supported HTTP transports available",null,400),null)}}return c.prototype.do=function(u,l,s,g,p,x,D){var N=this,k=typeof s=="function"?s:function(j){return l.baseUri(j)+s},I=l._currentFallback;if(I)if(I.validUntil>v.now()){if(!this.Request){D==null||D(new T.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(u,l,k(I.host),g,x,p,function(j){for(var U=[],z=1;z<arguments.length;z++)U[z-1]=arguments[z];if(j&&d(j)){l._currentFallback=null,N.do(u,l,s,g,p,x,D);return}D==null||D.apply(void 0,a.__spreadArray([j],U,!1))});return}else l._currentFallback=null;var M=h(l);if(M.length===1){this.doUri(u,l,k(M[0]),g,p,x,D);return}var A=function(j,U){var z=j.shift();N.doUri(u,l,k(z),g,p,x,function(V){for(var G=[],F=1;F<arguments.length;F++)G[F-1]=arguments[F];if(V&&d(V)&&j.length){A(j,!0);return}U&&(l._currentFallback={host:z,validUntil:v.now()+l.options.timeouts.fallbackRetryTimeout}),D==null||D.apply(void 0,a.__spreadArray([V],G,!1))})};A(M)},c.prototype.doUri=function(u,l,s,g,p,x,D){if(!this.Request){D(new T.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(u,l,s,g,x,p,D)},c}(),i.methods=[R.default.Get,R.default.Delete,R.default.Post,R.default.Put,R.default.Patch],i.methodsWithoutBody=[R.default.Get,R.default.Delete],i.methodsWithBody=[R.default.Post,R.default.Put,R.default.Patch],i);r.default=w},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(4)),m=i.__importDefault(o(3)),v=i.__importDefault(o(8)),S=i.__importStar(o(1)),T=o(1);function R(f,E){return!!E.get("x-ably-errorcode")}function C(f,E){if(R(f,E))return f.error&&a.default.fromValues(f.error)}function O(f,E,P,y,d,h,w){var c=new Headers(y||{}),u=f?f.toUpperCase():S.isEmptyArg(h)?"GET":"POST",l=new AbortController,s=setTimeout(function(){l.abort(),w(new a.PartialErrorInfo("Request timed out",null,408))},E?E.options.timeouts.httpRequestTimeout:v.default.TIMEOUTS.httpRequestTimeout),g={method:u,headers:c,body:h};m.default.Config.isWebworker||(g.credentials=c.has("authorization")?"include":"same-origin"),(0,T.getGlobalObject)().fetch(P+"?"+new URLSearchParams(d||{}),g).then(function(p){clearTimeout(s);var x=p.headers.get("Content-Type"),D;x&&x.indexOf("application/x-msgpack")>-1?D=p.arrayBuffer():x&&x.indexOf("application/json")>-1?D=p.json():D=p.text(),D.then(function(N){var k=!!x&&x.indexOf("application/x-msgpack")===-1;if(p.ok)w(null,N,p.headers,k,p.status);else{var I=C(N,p.headers)||new a.PartialErrorInfo("Error response received from server: "+p.status+" body was: "+m.default.Config.inspect(N),null,p.status);w(I,N,p.headers,k,p.status)}})}).catch(function(p){clearTimeout(s),w(p)})}r.default=O},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(41)),m=i.__importStar(o(1)),v=m.getGlobalObject();typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"&&console.log("Warning: this distribution of Ably is intended for browsers. On nodejs, please use the 'ably' package on npm");function S(){var O=v.location;return!v.WebSocket||!O||!O.origin||O.origin.indexOf("http")>-1}var T=v.navigator&&v.navigator.userAgent.toString(),R=v.location&&v.location.href,C={agent:"browser",logTimestamps:!0,userAgent:T,currentUrl:R,noUpgrade:T&&!!T.match(/MSIE\s8\.0/),binaryType:"arraybuffer",WebSocket:v.WebSocket,fetchSupported:!!v.fetch,xhrSupported:v.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,jsonpSupported:typeof document!="undefined",allowComet:S(),streamingSupported:!0,useProtocolHeartbeats:!0,createHmac:null,msgpack:a.default,supportsBinary:!!v.TextDecoder,preferBinary:!1,ArrayBuffer:v.ArrayBuffer,atob:v.atob,nextTick:typeof v.setImmediate!="undefined"?v.setImmediate.bind(v):function(O){setTimeout(O,0)},addEventListener:v.addEventListener,inspect:JSON.stringify,stringByteSize:function(O){return v.TextDecoder&&new v.TextEncoder().encode(O).length||O.length},TextEncoder:v.TextEncoder,TextDecoder:v.TextDecoder,Promise:v.Promise,getRandomValues:function(O){if(O!==void 0)return function(f,E){O.getRandomValues(f),E&&E(null)}}(v.crypto||msCrypto)};r.default=C},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),m=a.__importStar(o(1)),v="ablyjs-storage-test",S=function(){function T(){try{i.sessionStorage.setItem(v,v),i.sessionStorage.removeItem(v),this.sessionSupported=!0}catch(R){this.sessionSupported=!1}try{i.localStorage.setItem(v,v),i.localStorage.removeItem(v),this.localSupported=!0}catch(R){this.localSupported=!1}}return T.prototype.get=function(R){return this._get(R,!1)},T.prototype.getSession=function(R){return this._get(R,!0)},T.prototype.remove=function(R){return this._remove(R,!1)},T.prototype.removeSession=function(R){return this._remove(R,!0)},T.prototype.set=function(R,C,O){return this._set(R,C,O,!1)},T.prototype.setSession=function(R,C,O){return this._set(R,C,O,!0)},T.prototype._set=function(R,C,O,f){var E={value:C};return O&&(E.expires=m.now()+O),this.storageInterface(f).setItem(R,JSON.stringify(E))},T.prototype._get=function(R,C){if(C&&!this.sessionSupported)throw new Error("Session Storage not supported");if(!C&&!this.localSupported)throw new Error("Local Storage not supported");var O=this.storageInterface(C).getItem(R);if(!O)return null;var f=JSON.parse(O);return f.expires&&f.expires<m.now()?(this.storageInterface(C).removeItem(R),null):f.value},T.prototype._remove=function(R,C){return this.storageInterface(C).removeItem(R)},T.prototype.storageInterface=function(R){return R?i.sessionStorage:i.localStorage},T}();r.default=new S}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(67)),m={connectivityCheckUrl:"https://internet-up.ably-realtime.com/is-the-internet-up.txt",jsonpInternetUpUrl:"https://internet-up.ably-realtime.com/is-the-internet-up-0-9.js",defaultTransports:[a.default.XhrPolling,a.default.XhrStreaming,a.default.JsonP,a.default.WebSocket],baseTransportOrder:[a.default.XhrPolling,a.default.XhrStreaming,a.default.JsonP,a.default.WebSocket],transportPreferenceOrder:[a.default.JsonP,a.default.XhrPolling,a.default.XhrStreaming,a.default.WebSocket],upgradeTransports:[a.default.XhrStreaming,a.default.WebSocket]};r.default=m},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i;(function(a){a.WebSocket="web_socket",a.Comet="comet",a.XhrStreaming="xhr_streaming",a.XhrPolling="xhr_polling",a.JsonP="jsonp"})(i||(i={})),r.default=i},function(n,r,o){o.r(r);var i=o(29),a=o.n(i),m=o(1),v=o(3),S=o.n(v),T=o(12),R=o.n(T),C=o(17),O=o.n(C),f=function(d){var h="xhr_polling";function w(c,u,l){l.stream=!1,R.a.call(this,c,u,l),this.shortName=h}return m.inherits(w,R.a),w.isAvailable=function(){return S.a.Config.xhrSupported&&S.a.Config.allowComet},w.prototype.toString=function(){return"XHRPollingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},w.prototype.createRequest=function(c,u,l,s,g){return O.a.createRequest(c,u,l,s,g,this.timeouts)},typeof d!="undefined"&&w.isAvailable()&&(d.supportedTransports[h]=w),w},E=f,P=function(d){var h="xhr_streaming";function w(c,u,l){R.a.call(this,c,u,l),this.shortName=h}return m.inherits(w,R.a),w.isAvailable=function(){return S.a.Config.xhrSupported&&S.a.Config.streamingSupported&&S.a.Config.allowComet},w.prototype.toString=function(){return"XHRStreamingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},w.prototype.createRequest=function(c,u,l,s,g){return O.a.createRequest(c,u,l,s,g,this.timeouts)},typeof d!="undefined"&&w.isAvailable()&&(d.supportedTransports[h]=w),w},y=P;r.default=[a.a,E,y]}]).default})})(Zc);var Qh=Zc.exports;const Jh=Oe(Qh),ys=(e,t,n,r,o)=>dt(this,null,function*(){try{const i=new Jh.Realtime({token:e.token,clientId:e.clientId});i.connection.on("connected",()=>{o==null||o("connected")}),i.connection.on("failed",v=>{console.error("[❌ ABLY CONNECTION FAILED]",v),o==null||o("failed")}),i.connection.on("disconnected",()=>{o==null||o("disconnected")});const a=`room:${t}:${n}`,m=i.channels.get(a);return m.subscribe("messages",v=>{var S;try{const T=(S=v.data)==null?void 0:S.message;if(T&&T.role==="employee"){const R={id:T.id||Xt(),text:T.content||"",sender:"bot",timestamp:T.createdAt?new Date(T.createdAt):new Date};r(R)}}catch(T){console.error("[❌ MESSAGE PARSING ERROR]",T)}}),{client:i,channel:m}}catch(i){throw console.error("[❌ ABLY INITIALIZATION ERROR]",i),i}}),Yh=(e,t)=>dt(this,null,function*(){try{const n=Xc(),r=yield fetch(`${n}?conversationId=${e}&chatbotUid=${t}`);return r.ok?yield r.json():(console.error("Failed to fetch conversation data:",r.statusText),null)}catch(n){return console.error("[❌ ABLY TOKEN FETCH ERROR]",n),null}}),Xh=e=>{e&&e.close()},qc=()=>({id:Xt(),text:"Lo siento, hubo un problema con la conexión. Esta es una respuesta de demostración.",sender:"bot",timestamp:new Date}),Zh=(e,t,n,r)=>{const o=Kh(t,e),i={id:e,senderId:r||"unknown",createdAt:new Date().toISOString(),chatbotActivated:!0,updatedAt:new Date().toISOString(),source:"IFRAME",website:typeof window!="undefined"?window.location.origin:"",messages:o};return{conversationId:e,conversation:i,chatbotUid:n.apiKey}},qh=e=>dt(this,null,function*(){try{const t=Wh(),n=yield fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return n.ok?yield n.json():(console.error("WebChat: API request failed:",n.status,n.statusText),null)}catch(t){return console.error("WebChat: Error sending message to API:",t),null}}),ep=e=>e&&e.content?{id:e.id||Xt(),text:e.content,sender:"bot",timestamp:new Date}:null,tp=e=>`¡Hola! Soy ${e||"tu asistente"}, ¿En qué te puedo ayudar?
90
+ `;F.mac=F.mac||c(Y,G),a.default.logAction(a.default.LOG_MINOR,"Auth.getTokenRequest()","generated signed request"),A(null,F)})},k.prototype.getAuthParams=function(I){this.method=="basic"?I(null,{key:this.key}):this._ensureValidAuthCredentials(!1,function(M,A){if(M){I(M);return}if(!A)throw new Error("Auth.getAuthParams(): _ensureValidAuthCredentials returned no error or tokenDetails");I(null,{access_token:A.token})})},k.prototype.getAuthHeaders=function(I){this.method=="basic"?I(null,{authorization:"Basic "+this.basicKey}):this._ensureValidAuthCredentials(!1,function(M,A){if(M){I(M);return}if(!A)throw new Error("Auth.getAuthParams(): _ensureValidAuthCredentials returned no error or tokenDetails");I(null,{authorization:"Bearer "+m.toBase64(A.token)})})},k.prototype.getTimestamp=function(I,M){!this.isTimeOffsetSet()&&(I||this.authOptions.queryTime)?this.client.time(M):M(null,this.getTimestampUsingOffset())},k.prototype.getTimestampUsingOffset=function(){return m.now()+(this.client.serverTimeOffset||0)},k.prototype.isTimeOffsetSet=function(){return this.client.serverTimeOffset!==null},k.prototype._saveBasicOptions=function(I){this.method="basic",this.key=I.key,this.basicKey=m.toBase64(I.key),this.authOptions=I||{},"clientId"in I&&this._userSetClientId(I.clientId)},k.prototype._saveTokenOptions=function(I,M){this.method="token",I&&(this.tokenParams=I),M&&(M.token&&(M.tokenDetails=typeof M.token=="string"?{token:M.token}:M.token),M.tokenDetails&&(this.tokenDetails=M.tokenDetails),"clientId"in M&&this._userSetClientId(M.clientId),this.authOptions=M)},k.prototype._ensureValidAuthCredentials=function(I,M){var A=this,j=this.tokenDetails;if(j){if(this._tokenClientIdMismatch(j.clientId)){M(new S.default("Mismatch between clientId in token ("+j.clientId+") and current clientId ("+this.clientId+")",40102,403));return}if(!this.isTimeOffsetSet()||!j.expires||j.expires>=this.getTimestampUsingOffset()){a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","using cached token; expires = "+j.expires),M(null,j);return}a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","deleting expired token"),this.tokenDetails=null}if((this.waitingForTokenRequest||(this.waitingForTokenRequest=v.default.create())).push(M),!(this.currentTokenRequestId!==null&&!I)){var U=this.currentTokenRequestId=D();this.requestToken(this.tokenParams,this.authOptions,function(z,W){if(A.currentTokenRequestId>U){a.default.logAction(a.default.LOG_MINOR,"Auth._ensureValidAuthCredentials()","Discarding token request response; overtaken by newer one");return}A.currentTokenRequestId=null;var G=A.waitingForTokenRequest||y;if(A.waitingForTokenRequest=null,z){G(z);return}G(null,A.tokenDetails=W)})}},k.prototype._userSetClientId=function(I){if(typeof I=="string"||I===null){if(I==="*")throw new S.default('Can’t use "*" as a clientId as that string is reserved. (To change the default token request behaviour to use a wildcard clientId, instantiate the library with {defaultTokenParams: {clientId: "*"}}), or if calling authorize(), pass it in as a tokenParam: authorize({clientId: "*"}, authOptions)',40012,400);var M=this._uncheckedSetClientId(I);if(M)throw M}else throw new S.default("clientId must be either a string or null",40012,400)},k.prototype._uncheckedSetClientId=function(I){if(this._tokenClientIdMismatch(I)){var M="Unexpected clientId mismatch: client has "+this.clientId+", requested "+I,A=new S.default(M,40102,401);return a.default.logAction(a.default.LOG_ERROR,"Auth._uncheckedSetClientId()",M),A}else return this.clientId=this.tokenParams.clientId=I,null},k.prototype._tokenClientIdMismatch=function(I){return!!(this.clientId&&this.clientId!=="*"&&I&&I!=="*"&&this.clientId!==I)},k.isTokenErr=function(I){return I.code&&I.code>=40140&&I.code<40150},k.prototype.revokeTokens=function(I,M,A){if(g(this.client.options))throw new S.default("Cannot revoke tokens when using token auth",40162,401);var j=this.client.options.keyName,U;if(typeof M=="function"?(A=M,U={}):U=M!=null?M:{},A===void 0){if(this.client.options.promises)return m.promisify(this,"revokeTokens",[I,U]);A=y}var z=A,W=i.__assign({targets:I.map(function(L){return"".concat(L.type,":").concat(L.value)})},U),G=this.client.options.useBinaryProtocol?m.Format.msgpack:m.Format.json,F=m.defaultPostHeaders(this.client.options,G);this.client.options.headers&&m.mixin(F,this.client.options.headers);var b=m.encodeBody(W,G);E.default.post(this.client,"/keys/".concat(j,"/revokeTokens"),b,F,{newBatchResponse:"true"},null,function(L,B,_,V){if(L){z(L);return}var Y=V?B:m.decodeBody(B,G);z(null,Y)})},k}();r.default=N},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i;(function(a){a.Get="get",a.Delete="delete",a.Post="post",a.Put="put",a.Patch="patch"})(i||(i={})),r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.HttpPaginatedResponse=r.PaginatedResult=void 0;var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(2)),v=i.__importDefault(o(15)),S=i.__importDefault(o(14));function T(P){var y=P.match(/^\.\/(\w+)\?(.*)$/);return y&&y[2]&&a.parseQueryString(y[2])}function R(P){typeof P=="string"&&(P=P.split(","));for(var y={},d=0;d<P.length;d++){var h=P[d].match(/^\s*<(.+)>;\s*rel="(\w+)"$/);if(h){var w=T(h[1]);w&&(y[h[2]]=w)}}return y}function C(P,y,d){return!(d&&(y||typeof P.code=="number"))}var O=function(){function P(y,d,h,w,c,u){this.rest=y,this.path=d,this.headers=h,this.envelope=w!=null?w:null,this.bodyHandler=c,this.useHttpPaginatedResponse=u||!1}return P.prototype.get=function(y,d){var h=this;v.default.get(this.rest,this.path,this.headers,y,this.envelope,function(w,c,u,l,s){h.handlePage(w,c,u,l,s,d)})},P.prototype.delete=function(y,d){var h=this;v.default.delete(this.rest,this.path,this.headers,y,this.envelope,function(w,c,u,l,s){h.handlePage(w,c,u,l,s,d)})},P.prototype.post=function(y,d,h){var w=this;v.default.post(this.rest,this.path,d,this.headers,y,this.envelope,function(c,u,l,s,g){h&&w.handlePage(c,u,l,s,g,h)})},P.prototype.put=function(y,d,h){var w=this;v.default.put(this.rest,this.path,d,this.headers,y,this.envelope,function(c,u,l,s,g){h&&w.handlePage(c,u,l,s,g,h)})},P.prototype.patch=function(y,d,h){var w=this;v.default.patch(this.rest,this.path,d,this.headers,y,this.envelope,function(c,u,l,s,g){h&&w.handlePage(c,u,l,s,g,h)})},P.prototype.handlePage=function(y,d,h,w,c,u){if(y&&C(y,d,this.useHttpPaginatedResponse)){m.default.logAction(m.default.LOG_ERROR,"PaginatedResource.handlePage()","Unexpected error getting resource: err = "+a.inspectError(y)),u==null||u(y);return}var l,s,g;try{l=c==S.default.NoContent?[]:this.bodyHandler(d,h||{},w)}catch(p){u==null||u(y||p);return}h&&(s=h.Link||h.link)&&(g=R(s)),this.useHttpPaginatedResponse?u(null,new E(this,l,h||{},c,g,y)):u(null,new f(this,l,g))},P}(),f=function(){function P(y,d,h){var w=this;this.resource=y,this.items=d;var c=this;h&&("first"in h&&(this.first=function(u){if(!u&&c.resource.rest.options.promises)return a.promisify(c,"first",[]);c.get(h.first,u)}),"current"in h&&(this.current=function(u){if(!u&&c.resource.rest.options.promises)return a.promisify(c,"current",[]);c.get(h.current,u)}),this.next=function(u){if(!u&&c.resource.rest.options.promises)return a.promisify(c,"next",[]);"next"in h?c.get(h.next,u):u(null,null)},this.hasNext=function(){return"next"in h},this.isLast=function(){var u;return!(!((u=w.hasNext)===null||u===void 0)&&u.call(w))})}return P.prototype.get=function(y,d){var h=this.resource;v.default.get(h.rest,h.path,h.headers,y,h.envelope,function(w,c,u,l,s){h.handlePage(w,c,u,l,s,d)})},P}();r.PaginatedResult=f;var E=function(P){i.__extends(y,P);function y(d,h,w,c,u,l){var s=P.call(this,d,h,u)||this;return s.statusCode=c,s.success=c<300&&c>=200,s.headers=w,s.errorCode=l&&l.code,s.errorMessage=l&&l.message,s}return y.prototype.toJSON=function(){return{items:this.items,statusCode:this.statusCode,success:this.success,headers:this.headers,errorCode:this.errorCode,errorMessage:this.errorMessage}},y}(f);r.HttpPaginatedResponse=E,r.default=O},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.isRetriable=void 0;var i=o(0),a=i.__importDefault(o(4)),m={DISCONNECTED:80003,SUSPENDED:80002,FAILED:8e4,CLOSING:80017,CLOSED:80017,UNKNOWN_CONNECTION_ERR:50002,UNKNOWN_CHANNEL_ERR:50001},v={disconnected:function(){return a.default.fromValues({statusCode:400,code:m.DISCONNECTED,message:"Connection to server temporarily unavailable"})},suspended:function(){return a.default.fromValues({statusCode:400,code:m.SUSPENDED,message:"Connection to server unavailable"})},failed:function(){return a.default.fromValues({statusCode:400,code:m.FAILED,message:"Connection failed or disconnected by server"})},closing:function(){return a.default.fromValues({statusCode:400,code:m.CLOSING,message:"Connection closing"})},closed:function(){return a.default.fromValues({statusCode:400,code:m.CLOSED,message:"Connection closed"})},unknownConnectionErr:function(){return a.default.fromValues({statusCode:500,code:m.UNKNOWN_CONNECTION_ERR,message:"Internal connection error"})},unknownChannelErr:function(){return a.default.fromValues({statusCode:500,code:m.UNKNOWN_CONNECTION_ERR,message:"Internal channel error"})}};function S(T){return!T.statusCode||!T.code||T.statusCode>=500?!0:Object.values(m).includes(T.code)}r.isRetriable=S,r.default=v},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i;(function(a){a[a.REQ_SEND=0]="REQ_SEND",a[a.REQ_RECV=1]="REQ_RECV",a[a.REQ_RECV_POLL=2]="REQ_RECV_POLL",a[a.REQ_RECV_STREAM=3]="REQ_RECV_STREAM"})(i||(i={})),r.default=i},function(n,r,o){(function(i,a){n.exports=a(o(6),o(5),o(58),o(11),o(40),o(32),o(25),o(27),o(28),o(59),o(60))})(this,function(i){return i})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(2)),m=function(){function v(S){this.members=S||[]}return v.prototype.call=function(){for(var S=[],T=0;T<arguments.length;T++)S[T]=arguments[T];for(var R=0,C=this.members;R<C.length;R++){var O=C[R];if(O)try{O.apply(void 0,S)}catch(f){a.default.logAction(a.default.LOG_ERROR,"Multicaster multiple callback handler","Unexpected exception: "+f+"; stack = "+f.stack)}}},v.prototype.push=function(){for(var S,T=[],R=0;R<arguments.length;R++)T[R]=arguments[R];(S=this.members).push.apply(S,T)},v.create=function(S){var T=new v(S);return Object.assign(function(){for(var R=[],C=0;C<arguments.length;C++)R[C]=arguments[C];return T.call.apply(T,R)},{push:function(R){return T.push(R)}})},v}();r.default=m},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){(function(){var a=i,m=a.lib,v=m.Base,S=a.enc,T=S.Utf8,R=a.algo;R.HMAC=v.extend({init:function(C,O){C=this._hasher=new C.init,typeof O=="string"&&(O=T.parse(O));var f=C.blockSize,E=f*4;O.sigBytes>E&&(O=C.finalize(O)),O.clamp();for(var P=this._oKey=O.clone(),y=this._iKey=O.clone(),d=P.words,h=y.words,w=0;w<f;w++)d[w]^=1549556828,h[w]^=909522486;P.sigBytes=y.sigBytes=E,this.reset()},reset:function(){var C=this._hasher;C.reset(),C.update(this._iKey)},update:function(C){return this._hasher.update(C),this},finalize:function(C){var O=this._hasher,f=O.finalize(C);O.reset();var E=O.finalize(this._oKey.clone().concat(f));return E}})})()})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(10)),m=i.__importStar(o(1)),v=i.__importDefault(o(7)),S=i.__importDefault(o(2)),T=i.__importDefault(o(21)),R=i.__importDefault(o(4)),C=i.__importDefault(o(3)),O=a.default.Action,f=a.default.fromValues({action:O.CLOSE}),E=a.default.fromValues({action:O.DISCONNECT}),P=function(y){i.__extends(d,y);function d(h,w,c,u){var l=y.call(this)||this;return u&&(c.format=void 0,c.heartbeats=!0),l.connectionManager=h,h.registerProposedTransport(l),l.auth=w,l.params=c,l.timeouts=c.options.timeouts,l.format=c.format,l.isConnected=!1,l.isFinished=!1,l.isDisposed=!1,l.maxIdleInterval=null,l.idleTimer=null,l.lastActivity=null,l}return d.prototype.connect=function(){},d.prototype.close=function(){this.isConnected&&this.requestClose(),this.finish("closed",T.default.closed())},d.prototype.disconnect=function(h){this.isConnected&&this.requestDisconnect(),this.finish("disconnected",h||T.default.disconnected())},d.prototype.fail=function(h){this.isConnected&&this.requestDisconnect(),this.finish("failed",h||T.default.failed())},d.prototype.finish=function(h,w){var c;this.isFinished||(this.isFinished=!0,this.isConnected=!1,this.maxIdleInterval=null,clearTimeout((c=this.idleTimer)!==null&&c!==void 0?c:void 0),this.idleTimer=null,this.emit(h,w),this.dispose())},d.prototype.onProtocolMessage=function(h){switch(S.default.shouldLog(S.default.LOG_MICRO)&&S.default.logAction(S.default.LOG_MICRO,"Transport.onProtocolMessage()","received on "+this.shortName+": "+a.default.stringify(h)+"; connectionId = "+this.connectionManager.connectionId),this.onActivity(),h.action){case O.HEARTBEAT:S.default.logAction(S.default.LOG_MICRO,"Transport.onProtocolMessage()",this.shortName+" heartbeat; connectionId = "+this.connectionManager.connectionId),this.emit("heartbeat",h.id);break;case O.CONNECTED:this.onConnect(h),this.emit("connected",h.error,h.connectionId,h.connectionDetails,h);break;case O.CLOSED:this.onClose(h);break;case O.DISCONNECTED:this.onDisconnect(h);break;case O.ACK:this.emit("ack",h.msgSerial,h.count);break;case O.NACK:this.emit("nack",h.msgSerial,h.count,h.error);break;case O.SYNC:this.connectionManager.onChannelMessage(h,this);break;case O.ACTIVATE:break;case O.AUTH:this.auth.authorize(function(w){w&&S.default.logAction(S.default.LOG_ERROR,"Transport.onProtocolMessage()","Ably requested re-authentication, but unable to obtain a new token: "+m.inspectError(w))});break;case O.ERROR:if(S.default.logAction(S.default.LOG_MINOR,"Transport.onProtocolMessage()","received error action; connectionId = "+this.connectionManager.connectionId+"; err = "+C.default.Config.inspect(h.error)+(h.channel?", channel: "+h.channel:"")),h.channel===void 0){this.onFatalError(h);break}this.connectionManager.onChannelMessage(h,this);break;default:this.connectionManager.onChannelMessage(h,this)}},d.prototype.onConnect=function(h){if(this.isConnected=!0,!h.connectionDetails)throw new Error("Transport.onConnect(): Connect message recieved without connectionDetails");var w=h.connectionDetails.maxIdleInterval;w&&(this.maxIdleInterval=w+this.timeouts.realtimeRequestTimeout,this.onActivity())},d.prototype.onDisconnect=function(h){var w=h&&h.error;S.default.logAction(S.default.LOG_MINOR,"Transport.onDisconnect()","err = "+m.inspectError(w)),this.finish("disconnected",w)},d.prototype.onFatalError=function(h){var w=h&&h.error;S.default.logAction(S.default.LOG_MINOR,"Transport.onFatalError()","err = "+m.inspectError(w)),this.finish("failed",w)},d.prototype.onClose=function(h){var w=h&&h.error;S.default.logAction(S.default.LOG_MINOR,"Transport.onClose()","err = "+m.inspectError(w)),this.finish("closed",w)},d.prototype.requestClose=function(){S.default.logAction(S.default.LOG_MINOR,"Transport.requestClose()",""),this.send(f)},d.prototype.requestDisconnect=function(){S.default.logAction(S.default.LOG_MINOR,"Transport.requestDisconnect()",""),this.send(E)},d.prototype.ping=function(h){var w={action:a.default.Action.HEARTBEAT};h&&(w.id=h),this.send(a.default.fromValues(w))},d.prototype.dispose=function(){S.default.logAction(S.default.LOG_MINOR,"Transport.dispose()",""),this.isDisposed=!0,this.off()},d.prototype.onActivity=function(){this.maxIdleInterval&&(this.lastActivity=this.connectionManager.lastActivity=m.now(),this.setIdleTimer(this.maxIdleInterval+100))},d.prototype.setIdleTimer=function(h){var w=this;this.idleTimer||(this.idleTimer=setTimeout(function(){w.onIdleTimerExpire()},h))},d.prototype.onIdleTimerExpire=function(){if(!this.lastActivity||!this.maxIdleInterval)throw new Error("Transport.onIdleTimerExpire(): lastActivity/maxIdleInterval not set");this.idleTimer=null;var h=m.now()-this.lastActivity,w=this.maxIdleInterval-h;if(w<=0){var c="No activity seen from realtime in "+h+"ms; assuming connection has dropped";S.default.logAction(S.default.LOG_ERROR,"Transport.onIdleTimerExpire()",c),this.disconnect(new R.default(c,80003,408))}else this.setIdleTimer(w+100)},d.tryConnect=function(h,w,c,u,l){var s=new h(w,c,u),g,p=function(D){clearTimeout(g),l({event:this.event,error:D})},x=w.options.timeouts.realtimeRequestTimeout;g=setTimeout(function(){s.off(["preconnect","disconnected","failed"]),s.dispose(),p.call({event:"disconnected"},new R.default("Timeout waiting for transport to indicate itself viable",5e4,500))},x),s.on(["failed","disconnected"],p),s.on("preconnect",function(){S.default.logAction(S.default.LOG_MINOR,"Transport.tryConnect()","viable transport "+s),clearTimeout(g),s.off(["failed","disconnected"],p),l(null,s)}),s.connect()},d}(v.default);r.default=P},function(n,r,o){(function(i,a){n.exports=a(o(6),o(40),o(25))})(this,function(i){return function(){var a=i,m=a.lib,v=m.Base,S=m.WordArray,T=a.algo,R=T.MD5,C=T.EvpKDF=v.extend({cfg:v.extend({keySize:128/32,hasher:R,iterations:1}),init:function(O){this.cfg=this.cfg.extend(O)},compute:function(O,f){for(var E,P=this.cfg,y=P.hasher.create(),d=S.create(),h=d.words,w=P.keySize,c=P.iterations;h.length<w;){E&&y.update(E),E=y.update(O).finalize(f),y.reset();for(var u=1;u<c;u++)E=y.finalize(E),y.reset();d.concat(E)}return d.sigBytes=w*4,d}});a.EvpKDF=function(O,f,E){return C.create(E).compute(O,f)}}(),i.EvpKDF})},function(n,r,o){(function(i,a){n.exports=a(o(6),o(27))})(this,function(i){i.lib.Cipher||function(a){var m=i,v=m.lib,S=v.Base,T=v.WordArray,R=v.BufferedBlockAlgorithm,C=m.enc;C.Utf8;var O=C.Base64,f=m.algo,E=f.EvpKDF,P=v.Cipher=R.extend({cfg:S.extend(),createEncryptor:function(N,k){return this.create(this._ENC_XFORM_MODE,N,k)},createDecryptor:function(N,k){return this.create(this._DEC_XFORM_MODE,N,k)},init:function(N,k,I){this.cfg=this.cfg.extend(I),this._xformMode=N,this._key=k,this.reset()},reset:function(){R.reset.call(this),this._doReset()},process:function(N){return this._append(N),this._process()},finalize:function(N){N&&this._append(N);var k=this._doFinalize();return k},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(k){return typeof k=="string"?D:g}return function(k){return{encrypt:function(I,M,A){return N(M).encrypt(k,I,M,A)},decrypt:function(I,M,A){return N(M).decrypt(k,I,M,A)}}}}()});v.StreamCipher=P.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1});var y=m.mode={},d=v.BlockCipherMode=S.extend({createEncryptor:function(N,k){return this.Encryptor.create(N,k)},createDecryptor:function(N,k){return this.Decryptor.create(N,k)},init:function(N,k){this._cipher=N,this._iv=k}}),h=y.CBC=function(){var N=d.extend();N.Encryptor=N.extend({processBlock:function(I,M){var A=this._cipher,j=A.blockSize;k.call(this,I,M,j),A.encryptBlock(I,M),this._prevBlock=I.slice(M,M+j)}}),N.Decryptor=N.extend({processBlock:function(I,M){var A=this._cipher,j=A.blockSize,U=I.slice(M,M+j);A.decryptBlock(I,M),k.call(this,I,M,j),this._prevBlock=U}});function k(I,M,A){var j,U=this._iv;U?(j=U,this._iv=a):j=this._prevBlock;for(var z=0;z<A;z++)I[M+z]^=j[z]}return N}(),w=m.pad={},c=w.Pkcs7={pad:function(N,k){for(var I=k*4,M=I-N.sigBytes%I,A=M<<24|M<<16|M<<8|M,j=[],U=0;U<M;U+=4)j.push(A);var z=T.create(j,M);N.concat(z)},unpad:function(N){var k=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=k}};v.BlockCipher=P.extend({cfg:P.cfg.extend({mode:h,padding:c}),reset:function(){var N;P.reset.call(this);var k=this.cfg,I=k.iv,M=k.mode;this._xformMode==this._ENC_XFORM_MODE?N=M.createEncryptor:(N=M.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==N?this._mode.init(this,I&&I.words):(this._mode=N.call(M,this,I&&I.words),this._mode.__creator=N)},_doProcessBlock:function(N,k){this._mode.processBlock(N,k)},_doFinalize:function(){var N,k=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(k.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),k.unpad(N)),N},blockSize:128/32});var u=v.CipherParams=S.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),l=m.format={},s=l.OpenSSL={stringify:function(N){var k,I=N.ciphertext,M=N.salt;return M?k=T.create([1398893684,1701076831]).concat(M).concat(I):k=I,k.toString(O)},parse:function(N){var k,I=O.parse(N),M=I.words;return M[0]==1398893684&&M[1]==1701076831&&(k=T.create(M.slice(2,4)),M.splice(0,4),I.sigBytes-=16),u.create({ciphertext:I,salt:k})}},g=v.SerializableCipher=S.extend({cfg:S.extend({format:s}),encrypt:function(N,k,I,M){M=this.cfg.extend(M);var A=N.createEncryptor(I,M),j=A.finalize(k),U=A.cfg;return u.create({ciphertext:j,key:I,iv:U.iv,algorithm:N,mode:U.mode,padding:U.padding,blockSize:N.blockSize,formatter:M.format})},decrypt:function(N,k,I,M){M=this.cfg.extend(M),k=this._parse(k,M.format);var A=N.createDecryptor(I,M).finalize(k.ciphertext);return A},_parse:function(N,k){return typeof N=="string"?k.parse(N,this):N}}),p=m.kdf={},x=p.OpenSSL={execute:function(N,k,I,M){M||(M=T.random(64/8));var A=E.create({keySize:k+I}).compute(N,M),j=T.create(A.words.slice(k),I*4);return A.sigBytes=k*4,u.create({key:A,iv:j,salt:M})}},D=v.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:x}),encrypt:function(N,k,I,M){M=this.cfg.extend(M);var A=M.kdf.execute(I,N.keySize,N.ivSize);M.iv=A.iv;var j=g.encrypt.call(this,N,k,A.key,M);return j.mixIn(A),j},decrypt:function(N,k,I,M){M=this.cfg.extend(M),k=this._parse(k,M.format);var A=M.kdf.execute(I,N.keySize,N.ivSize,k.salt);M.iv=A.iv;var j=g.decrypt.call(this,N,k,A.key,M);return j}})}()})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.Request=r.createRequest=void 0;var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(12)),v=i.__importDefault(o(3)),S=i.__importDefault(o(7)),T=o(4),R=i.__importDefault(o(8)),C=i.__importDefault(o(2)),O=i.__importDefault(o(22)),f=a.getGlobalObject(),E=function(){},P=f._ablyjs_jsonp={};P._=function(l){return P["_"+l]||E};var y=1,d="jsonp";function h(l,s,g,p,x,D,N){return D=D||R.default.TIMEOUTS,new c(void 0,l,s,a.copy(g),p,x,D,N)}r.createRequest=h;var w=function(l){i.__extends(s,l);function s(g,p,x){var D=l.call(this,g,p,x)||this;return D.shortName=d,x.stream=!1,D}return s.isAvailable=function(){return v.default.Config.jsonpSupported&&v.default.Config.allowComet},s.prototype.toString=function(){return"JSONPTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},s.prototype.createRequest=function(g,p,x,D,N,k,I){return k=(this===null||this===void 0?void 0:this.timeouts)||k||R.default.TIMEOUTS,h(g,p,x,D,N,k,I)},s}(m.default),c=function(l){i.__extends(s,l);function s(g,p,x,D,N,k,I,M){var A=l.call(this)||this;return g===void 0&&(g=y++),A.id=g,A.uri=p,A.params=D||{},A.params.rnd=a.cheapRandStr(),x&&(x["X-Ably-Version"]&&(A.params.v=x["X-Ably-Version"]),x["X-Ably-Lib"]&&(A.params.lib=x["X-Ably-Lib"])),A.body=N,A.method=M,A.requestMode=k,A.timeouts=I,A.requestComplete=!1,A}return s.prototype.exec=function(){var g=this,p=this.id,x=this.body,D=this.method,N=this.uri,k=this.params;k.callback="_ablyjs_jsonp._("+p+")",k.envelope="jsonp",x&&(k.body=x),D&&D!=="get"&&(k.method=D);var I=this.script=document.createElement("script"),M=N+a.toQueryString(k);I.src=M,I.src.split("/").slice(-1)[0]!==M.split("/").slice(-1)[0]&&C.default.logAction(C.default.LOG_ERROR,"JSONP Request.exec()","Warning: the browser appears to have truncated the script URI. This will likely result in the request failing due to an unparseable body param"),I.async=!0,I.type="text/javascript",I.charset="UTF-8",I.onerror=function(U){g.complete(new T.PartialErrorInfo("JSONP script error (event: "+v.default.Config.inspect(U)+")",null,400))},P["_"+p]=function(U){if(U.statusCode){var z=U.response;if(U.statusCode==204)g.complete(null,null,null,U.statusCode);else if(!z)g.complete(new T.PartialErrorInfo("Invalid server response: no envelope detected",null,500));else if(U.statusCode<400||a.isArray(z))g.complete(null,z,U.headers,U.statusCode);else{var W=z.error||new T.PartialErrorInfo("Error response received from server",null,U.statusCode);g.complete(W)}}else g.complete(null,U)};var A=this.requestMode==O.default.REQ_SEND?this.timeouts.httpRequestTimeout:this.timeouts.recvTimeout;this.timer=setTimeout(this.abort.bind(this),A);var j=document.getElementsByTagName("head")[0];j.insertBefore(I,j.firstChild)},s.prototype.complete=function(g,p,x,D){if(x=x||{},!this.requestComplete){this.requestComplete=!0;var N=void 0;p&&(N=typeof p=="string"?"text/plain":"application/json",x["content-type"]=N,this.emit("data",p)),this.emit("complete",g,p,x,!0,D),this.dispose()}},s.prototype.abort=function(){this.dispose()},s.prototype.dispose=function(){var g=this.timer;g&&(clearTimeout(g),this.timer=null);var p=this.script;p.parentNode&&p.parentNode.removeChild(p),delete P[this.id],this.emit("disposed")},s}(S.default);r.Request=c;function u(l){return f.JSONPTransport=w,w.isAvailable()&&(l.supportedTransports[d]=w),w}r.default=u},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(2)),v=i.__importDefault(o(8)),S=i.__importDefault(o(18)),T=i.__importDefault(o(46)),R=i.__importDefault(o(20)),C=i.__importDefault(o(33)),O=i.__importDefault(o(4)),f=i.__importDefault(o(49)),E=i.__importDefault(o(19)),P=i.__importDefault(o(3)),y=i.__importDefault(o(9)),d=i.__importDefault(o(16)),h=i.__importDefault(o(15)),w=function(){},c=function(){function l(s){if(!s){var g="no options provided";throw m.default.logAction(m.default.LOG_ERROR,"Rest()",g),new Error(g)}var p=v.default.objectifyOptions(s);p.log?(m.default.setLog(p.log.level,p.log.handler),m.default.deprecated("The `log` client option","Equivalent functionality is provided by the `logLevel` and `logHandler` client options. Update your client options code of the form `{ log: { level: logLevel, handler: logHandler } }` to instead be `{ logLevel, logHandler }`.")):m.default.setLog(p.logLevel,p.logHandler),m.default.logAction(m.default.LOG_MICRO,"Rest()","initialized with clientOptions "+P.default.Config.inspect(s));var x=this.options=v.default.normaliseOptions(p);if(x.key){var D=x.key.match(/^([^:\s]+):([^:.\s]+)$/);if(!D){var g="invalid key parameter";throw m.default.logAction(m.default.LOG_ERROR,"Rest()",g),new O.default(g,40400,404)}x.keyName=D[1],x.keySecret=D[2]}if("clientId"in x)if(typeof x.clientId=="string"||x.clientId===null){if(x.clientId==="*")throw new O.default('Can’t use "*" as a clientId as that string is reserved. (To change the default token request behaviour to use a wildcard clientId, use {defaultTokenParams: {clientId: "*"}})',40012,400)}else throw new O.default("clientId must be either a string or null",40012,400);m.default.logAction(m.default.LOG_MINOR,"Rest()","started; version = "+v.default.version),this.baseUri=this.authority=function(N){return v.default.getHttpScheme(x)+N+":"+v.default.getPort(x,!1)},this._currentFallback=null,this.serverTimeOffset=null,this.http=new P.default.Http(x),this.auth=new S.default(this,x),this.channels=new u(this),this.push=new T.default(this)}return l.prototype.stats=function(s,g){if(g===void 0)if(typeof s=="function")g=s,s=null;else{if(this.options.promises)return a.promisify(this,"stats",[s]);g=w}var p=a.defaultGetHeaders(this.options),x=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,D=this.http.supportsLinkHeaders?void 0:x;this.options.headers&&a.mixin(p,this.options.headers),new R.default(this,"/stats",p,D,function(N,k,I){for(var M=I?N:JSON.parse(N),A=0;A<M.length;A++)M[A]=f.default.fromValues(M[A]);return M}).get(s,g)},l.prototype.time=function(s,g){var p=this;if(g===void 0){if(typeof s=="function")g=s,s=null;else if(this.options.promises)return a.promisify(this,"time",[s])}var x=g||w,D=a.defaultGetHeaders(this.options);this.options.headers&&a.mixin(D,this.options.headers);var N=function(k){return p.authority(k)+"/time"};this.http.do(E.default.Get,this,N,D,null,s,function(k,I,M,A){if(k){x(k);return}A||(I=JSON.parse(I));var j=I[0];if(!j){x(new O.default("Internal error (unexpected result type from GET /time)",5e4,500));return}p.serverTimeOffset=j-a.now(),x(null,j)})},l.prototype.request=function(s,g,p,x,D,N){var k=this.options.useBinaryProtocol,I=k?P.default.Config.msgpack.encode:JSON.stringify,M=k?P.default.Config.msgpack.decode:JSON.parse,A=k?a.Format.msgpack:a.Format.json,j=this.http.supportsLinkHeaders?void 0:A;p=p||{};var U=s.toLowerCase(),z=U=="get"?a.defaultGetHeaders(this.options,A):a.defaultPostHeaders(this.options,A);if(N===void 0){if(this.options.promises)return a.promisify(this,"request",[s,g,p,x,D]);N=w}typeof x!="string"&&(x=I(x)),this.options.headers&&a.mixin(z,this.options.headers),D&&a.mixin(z,D);var W=new R.default(this,g,z,j,function(G,F,b){return a.ensureArray(b?G:M(G))},!0);if(!a.arrIn(P.default.Http.methods,U))throw new O.default("Unsupported method "+U,40500,405);a.arrIn(P.default.Http.methodsWithBody,U)?W[U](p,x,N):W[U](p,N)},l.prototype.batchPublish=function(s,g){if(g===void 0){if(this.options.promises)return a.promisify(this,"batchPublish",[s]);g=w}var p=g,x,D;a.isArray(s)?(x=s,D=!1):(x=[s],D=!0);var N=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,k=a.defaultPostHeaders(this.options,N);this.options.headers&&a.mixin(k,this.options.headers);var I=a.encodeBody(x,N);h.default.post(this,"/messages",I,k,{newBatchResponse:"true"},null,function(M,A,j,U){if(M){p(M);return}var z=U?A:a.decodeBody(A,N);D?p(null,z[0]):p(null,z)})},l.prototype.batchPresence=function(s,g){if(g===void 0){if(this.options.promises)return a.promisify(this,"batchPresence",[s]);g=w}var p=g,x=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,D=a.defaultPostHeaders(this.options,x);this.options.headers&&a.mixin(D,this.options.headers);var N=s.join(",");h.default.get(this,"/presence",D,{newBatchResponse:"true",channels:N},null,function(k,I,M,A){if(k){p(k);return}var j=A?I:a.decodeBody(I,x);p(null,j)})},l.prototype.setLog=function(s){m.default.setLog(s.level,s.handler)},l.Promise=function(s){return s=v.default.objectifyOptions(s),s.promises=!0,new l(s)},l.Callbacks=l,l.Platform=P.default,l.Message=y.default,l.PresenceMessage=d.default,l}(),u=function(){function l(s){this.rest=s,this.all=Object.create(null)}return l.prototype.get=function(s,g){s=String(s);var p=this.all[s];return p?g&&p.setOptions(g):this.all[s]=p=new C.default(this.rest,s,g),p},l.prototype.release=function(s){delete this.all[String(s)]},l}();r.default=c},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return i.enc.Utf8})},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(a){var m=i,v=m.lib,S=v.WordArray,T=v.Hasher,R=m.algo,C=[],O=[];(function(){function P(w){for(var c=a.sqrt(w),u=2;u<=c;u++)if(!(w%u))return!1;return!0}function y(w){return(w-(w|0))*4294967296|0}for(var d=2,h=0;h<64;)P(d)&&(h<8&&(C[h]=y(a.pow(d,1/2))),O[h]=y(a.pow(d,1/3)),h++),d++})();var f=[],E=R.SHA256=T.extend({_doReset:function(){this._hash=new S.init(C.slice(0))},_doProcessBlock:function(P,y){for(var d=this._hash.words,h=d[0],w=d[1],c=d[2],u=d[3],l=d[4],s=d[5],g=d[6],p=d[7],x=0;x<64;x++){if(x<16)f[x]=P[y+x]|0;else{var D=f[x-15],N=(D<<25|D>>>7)^(D<<14|D>>>18)^D>>>3,k=f[x-2],I=(k<<15|k>>>17)^(k<<13|k>>>19)^k>>>10;f[x]=N+f[x-7]+I+f[x-16]}var M=l&s^~l&g,A=h&w^h&c^w&c,j=(h<<30|h>>>2)^(h<<19|h>>>13)^(h<<10|h>>>22),U=(l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25),z=p+U+M+O[x]+f[x],W=j+A;p=g,g=s,s=l,l=u+z|0,u=c,c=w,w=h,h=z+W|0}d[0]=d[0]+h|0,d[1]=d[1]+w|0,d[2]=d[2]+c|0,d[3]=d[3]+u|0,d[4]=d[4]+l|0,d[5]=d[5]+s|0,d[6]=d[6]+g|0,d[7]=d[7]+p|0},_doFinalize:function(){var P=this._data,y=P.words,d=this._nDataBytes*8,h=P.sigBytes*8;return y[h>>>5]|=128<<24-h%32,y[(h+64>>>9<<4)+14]=a.floor(d/4294967296),y[(h+64>>>9<<4)+15]=d,P.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var P=T.clone.call(this);return P._hash=this._hash.clone(),P}});m.SHA256=T._createHelper(E),m.HmacSHA256=T._createHmacHelper(E)}(Math),i.SHA256})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(7)),v=i.__importDefault(o(2)),S=i.__importDefault(o(34)),T=i.__importDefault(o(9)),R=i.__importDefault(o(4)),C=i.__importDefault(o(20)),O=i.__importDefault(o(15)),f=i.__importDefault(o(3));function E(){}var P=9;function y(w){return a.arrEvery(w,function(c){return!c.id})}function d(w){var c=w||{};if(c.cipher){if(!f.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var u=f.default.Crypto.getCipher(c.cipher);c.cipher=u.cipherParams,c.channelCipher=u.cipher}else"cipher"in c&&(c.cipher=void 0,c.channelCipher=null);return c}var h=function(w){i.__extends(c,w);function c(u,l,s){var g=w.call(this)||this;return v.default.logAction(v.default.LOG_MINOR,"Channel()","started; name = "+l),g.rest=u,g.name=l,g.basePath="/channels/"+encodeURIComponent(l),g.presence=new S.default(g),g.channelOptions=d(s),g}return c.prototype.setOptions=function(u){this.channelOptions=d(u)},c.prototype.history=function(u,l){if(v.default.logAction(v.default.LOG_MICRO,"Channel.history()","channel = "+this.name),l===void 0)if(typeof u=="function")l=u,u=null;else{if(this.rest.options.promises)return a.promisify(this,"history",arguments);l=E}this._history(u,l)},c.prototype._history=function(u,l){var s=this.rest,g=s.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,p=this.rest.http.supportsLinkHeaders?void 0:g,x=a.defaultGetHeaders(s.options,g);s.options.headers&&a.mixin(x,s.options.headers);var D=this.channelOptions;new C.default(s,this.basePath+"/messages",x,p,function(N,k,I){return T.default.fromResponseBody(N,D,I?void 0:g)}).get(u,l)},c.prototype.publish=function(){var u=this,l=arguments.length,s=arguments[0],g=arguments[1],p=arguments[l-1],x,D;if(typeof p!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);p=E}if(typeof s=="string"||s===null)x=[T.default.fromValues({name:s,data:g})],D=arguments[2];else if(a.isObject(s))x=[T.default.fromValues(s)],D=arguments[1];else if(a.isArray(s))x=T.default.fromValuesArray(s),D=arguments[1];else throw new R.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);(typeof D!="object"||!D)&&(D={});var N=this.rest,k=N.options,I=k.useBinaryProtocol?a.Format.msgpack:a.Format.json,M=N.options.idempotentRestPublishing,A=a.defaultPostHeaders(N.options,I);if(k.headers&&a.mixin(A,k.headers),M&&y(x)){var j=a.randomString(P);a.arrForEach(x,function(U,z){U.id=j+":"+z.toString()})}T.default.encodeArray(x,this.channelOptions,function(U){if(U){p(U);return}var z=T.default.getMessagesSize(x),W=k.maxMessageSize;if(z>W){p(new R.default("Maximum size of messages that can be published at once exceeded ( was "+z+" bytes; limit is "+W+" bytes)",40009,400));return}u._publish(T.default.serialize(x,I),A,D,p)})},c.prototype._publish=function(u,l,s,g){O.default.post(this.rest,this.basePath+"/messages",u,l,s,null,g)},c.prototype.status=function(u){if(typeof u!="function"&&this.rest.options.promises)return a.promisify(this,"status",[]);var l=this.rest.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,s=a.defaultPostHeaders(this.rest.options,l);O.default.get(this.rest,this.basePath,s,{},l,u||E)},c}(m.default);r.default=h},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(7)),v=i.__importDefault(o(2)),S=i.__importDefault(o(20)),T=i.__importDefault(o(16));function R(){}var C=function(O){i.__extends(f,O);function f(E){var P=O.call(this)||this;return P.channel=E,P.basePath=E.basePath+"/presence",P}return f.prototype.get=function(E,P){if(v.default.logAction(v.default.LOG_MICRO,"Presence.get()","channel = "+this.channel.name),P===void 0)if(typeof E=="function")P=E,E=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"get",arguments);P=R}var y=this.channel.rest,d=y.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,h=this.channel.rest.http.supportsLinkHeaders?void 0:d,w=a.defaultGetHeaders(y.options,d);y.options.headers&&a.mixin(w,y.options.headers);var c=this.channel.channelOptions;new S.default(y,this.basePath,w,h,function(u,l,s){return T.default.fromResponseBody(u,c,s?void 0:d)}).get(E,P)},f.prototype.history=function(E,P){return v.default.logAction(v.default.LOG_MICRO,"Presence.history()","channel = "+this.channel.name),this._history(E,P)},f.prototype._history=function(E,P){if(P===void 0)if(typeof E=="function")P=E,E=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"_history",[E]);P=R}var y=this.channel.rest,d=y.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,h=this.channel.rest.http.supportsLinkHeaders?void 0:d,w=a.defaultGetHeaders(y.options,d);y.options.headers&&a.mixin(w,y.options.headers);var c=this.channel.channelOptions;new S.default(y,this.basePath+"/history",w,h,function(u,l,s){return T.default.fromResponseBody(u,c,s?void 0:d)}).get(E,P)},f}(m.default);r.default=C},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0}),r.TransportParams=void 0;var a=o(0),m=a.__importDefault(o(10)),v=a.__importStar(o(1)),S=a.__importStar(o(52)),T=a.__importStar(o(8)),R=a.__importDefault(o(3)),C=a.__importDefault(o(7)),O=a.__importDefault(o(36)),f=a.__importDefault(o(2)),E=a.__importDefault(o(37)),P=a.__importStar(o(21)),y=a.__importStar(o(4)),d=a.__importDefault(o(18)),h=a.__importDefault(o(9)),w=a.__importDefault(o(24)),c=a.__importDefault(o(53)),u=a.__importDefault(o(26)),l=a.__importDefault(o(14)),s=function(){var G;return typeof R.default.WebStorage!="undefined"&&((G=R.default.WebStorage)===null||G===void 0?void 0:G.localSupported)},g=function(){var G;return typeof R.default.WebStorage!="undefined"&&((G=R.default.WebStorage)===null||G===void 0?void 0:G.sessionSupported)},p=m.default.Action,x=function(){},D="ably-transport-preference",N="ably-connection-recovery";function k(){var G,F;return g()&&((F=(G=R.default.WebStorage)===null||G===void 0?void 0:G.getSession)===null||F===void 0?void 0:F.call(G,N))}function I(G){var F,b;return g()&&((b=(F=R.default.WebStorage)===null||F===void 0?void 0:F.setSession)===null||b===void 0?void 0:b.call(F,N,G))}function M(){var G,F;return g()&&((F=(G=R.default.WebStorage)===null||G===void 0?void 0:G.removeSession)===null||F===void 0?void 0:F.call(G,N))}function A(G,F){return v.arrIndexOf(R.default.Defaults.transportPreferenceOrder,G.shortName)>v.arrIndexOf(R.default.Defaults.transportPreferenceOrder,F.shortName)}function j(G,F,b){var L;if(G.channel!==F.channel||(L=G.action)!==p.PRESENCE&&L!==p.MESSAGE||L!==F.action)return!1;var B=L===p.PRESENCE?"presence":"messages",_=G[B].concat(F[B]),V=h.default.getMessagesSize(_);return V>b||!v.allSame(_,"clientId")||!v.arrEvery(_,function(Y){return!Y.id})?!1:(G[B]=_,!0)}function U(G){try{return JSON.parse(G)}catch(F){return null}}var z=function(){function G(F,b,L,B){this.options=F,this.host=b,this.mode=L,this.connectionKey=B,this.format=F.useBinaryProtocol?v.Format.msgpack:v.Format.json}return G.prototype.getConnectParams=function(F){var b=F?v.copy(F):{},L=this.options;switch(this.mode){case"upgrade":b.upgrade=this.connectionKey;break;case"resume":b.resume=this.connectionKey;break;case"recover":{var B=U(L.recover);B&&(b.recover=B.connectionKey);break}}return L.clientId!==void 0&&(b.clientId=L.clientId),L.echoMessages===!1&&(b.echo="false"),this.format!==void 0&&(b.format=this.format),this.stream!==void 0&&(b.stream=this.stream),this.heartbeats!==void 0&&(b.heartbeats=this.heartbeats),b.v=T.default.protocolVersion,b.agent=(0,T.getAgentString)(this.options),L.transportParams!==void 0&&v.mixin(b,L.transportParams),b},G.prototype.toString=function(){var F="[mode="+this.mode;return this.host&&(F+=",host="+this.host),this.connectionKey&&(F+=",connectionKey="+this.connectionKey),this.format&&(F+=",format="+this.format),F+="]",F},G}();r.TransportParams=z;var W=function(G){a.__extends(F,G);function F(b,L){var B=G.call(this)||this;B.disconnectedRetryCount=0,F.initTransports(),B.realtime=b,B.options=L;var _=L.timeouts,V=_.preferenceConnectTimeout+_.realtimeRequestTimeout;if(B.states={initialized:{state:"initialized",terminal:!1,queueEvents:!0,sendEvents:!1,failState:"disconnected"},connecting:{state:"connecting",terminal:!1,queueEvents:!0,sendEvents:!1,retryDelay:V,failState:"disconnected"},connected:{state:"connected",terminal:!1,queueEvents:!1,sendEvents:!0,failState:"disconnected"},synchronizing:{state:"connected",terminal:!1,queueEvents:!0,sendEvents:!1,forceQueueEvents:!0,failState:"disconnected"},disconnected:{state:"disconnected",terminal:!1,queueEvents:!0,sendEvents:!1,retryDelay:_.disconnectedRetryTimeout,failState:"disconnected"},suspended:{state:"suspended",terminal:!1,queueEvents:!1,sendEvents:!1,retryDelay:_.suspendedRetryTimeout,failState:"suspended"},closing:{state:"closing",terminal:!1,queueEvents:!1,sendEvents:!1,retryDelay:_.realtimeRequestTimeout,failState:"closed"},closed:{state:"closed",terminal:!0,queueEvents:!1,sendEvents:!1,failState:"closed"},failed:{state:"failed",terminal:!0,queueEvents:!1,sendEvents:!1,failState:"failed"}},B.state=B.states.initialized,B.errorReason=null,B.queuedMessages=new O.default,B.msgSerial=0,B.connectionDetails=void 0,B.connectionId=void 0,B.connectionKey=void 0,B.connectionStateTtl=_.connectionStateTtl,B.maxIdleInterval=null,B.transports=v.intersect(L.transports||T.default.defaultTransports,F.supportedTransports),B.baseTransport=v.intersect(T.default.baseTransportOrder,B.transports)[0],B.upgradeTransports=v.intersect(B.transports,T.default.upgradeTransports),B.transportPreference=null,B.httpHosts=T.default.getHosts(L),B.activeProtocol=null,B.proposedTransports=[],B.pendingTransports=[],B.host=null,B.lastAutoReconnectAttempt=null,B.lastActivity=null,B.forceFallbackHost=!1,B.connectCounter=0,f.default.logAction(f.default.LOG_MINOR,"Realtime.ConnectionManager()","started"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","requested transports = ["+(L.transports||T.default.defaultTransports)+"]"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","available transports = ["+B.transports+"]"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","http hosts = ["+B.httpHosts+"]"),!B.transports.length){var Y="no requested transports available";throw f.default.logAction(f.default.LOG_ERROR,"realtime.ConnectionManager()",Y),new Error(Y)}var X=R.default.Config.addEventListener;return X&&(g()&&typeof L.recover=="function"&&X("beforeunload",B.persistConnection.bind(B)),L.closeOnUnload===!0&&X("beforeunload",function(){f.default.logAction(f.default.LOG_MAJOR,"Realtime.ConnectionManager()","beforeunload event has triggered the connection to close as closeOnUnload is true"),B.requestState({state:"closing"})}),X("online",function(){B.state==B.states.disconnected||B.state==B.states.suspended?(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager caught browser ‘online’ event","reattempting connection"),B.requestState({state:"connecting"})):B.state==B.states.connecting&&(B.pendingTransports.forEach(function(te){te.off()}),B.disconnectAllTransports(),B.startConnect())}),X("offline",function(){B.state==B.states.connected&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager caught browser ‘offline’ event","disconnecting active transport"),B.disconnectAllTransports())})),B}return F.initTransports=function(){(0,c.default)(F),v.arrForEach(R.default.Transports,function(b){b(F)})},F.prototype.createTransportParams=function(b,L){return new z(this.options,b,L,this.connectionKey)},F.prototype.getTransportParams=function(b){var L=this,B=function(_){if(L.connectionKey){_("resume");return}if(typeof L.options.recover=="string"){_("recover");return}var V=L.options.recover,Y=k();if(Y&&typeof V=="function"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Calling clientOptions-provided recover function with last session data"),V(Y,function(X){X?(L.options.recover=Y.recoveryKey,_("recover")):_("clean")});return}_("clean")};B(function(_){var V=L.createTransportParams(null,_);if(_==="recover"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport recovery mode = recover; recoveryKey = "+L.options.recover);var Y=U(L.options.recover);Y&&(L.msgSerial=Y.msgSerial)}else f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport params = "+V.toString());b(V)})},F.prototype.tryATransport=function(b,L,B){var _=this;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","trying "+L),u.default.tryConnect(F.supportedTransports[L],this,this.realtime.auth,b,function(V,Y){var X=_.state;if(X==_.states.closing||X==_.states.closed||X==_.states.failed){Y&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","connection "+X.state+" while we were attempting the transport; closing "+Y),Y.close()),B(!0);return}if(V){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","transport "+L+" "+V.event+", err: "+V.error.toString()),d.default.isTokenErr(V.error)&&!(_.errorReason&&d.default.isTokenErr(_.errorReason))?(_.errorReason=V.error,_.realtime.auth._forceNewToken(null,null,function(te){if(te){_.actOnErrorFromAuthorize(te);return}_.tryATransport(b,L,B)})):V.event==="failed"?(_.notifyState({state:"failed",error:V.error}),B(!0)):V.event==="disconnected"&&((0,P.isRetriable)(V.error)?B(!1):(_.notifyState({state:_.states.connecting.failState,error:V.error}),B(!0)));return}f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","viable transport "+L+"; setting pending"),_.setTransportPending(Y,b),B(null,Y)})},F.prototype.setTransportPending=function(b,L){var B=this,_=L.mode;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setTransportPending()","transport = "+b+"; mode = "+_),v.arrDeleteValue(this.proposedTransports,b),this.pendingTransports.push(b);var V=R.default.Defaults.transportPreferenceOrder[R.default.Defaults.transportPreferenceOrder.length-1];b.once("connected",function(X,te,re){_=="upgrade"&&B.activeProtocol?b.shortName!==V&&v.arrIn(B.getUpgradePossibilities(),V)&&B.activeProtocol?setTimeout(function(){B.scheduleTransportActivation(X,b,te,re)},B.options.timeouts.parallelUpgradeDelay):B.scheduleTransportActivation(X,b,te,re):(B.activateTransport(X,b,te,re),R.default.Config.nextTick(function(){B.connectImpl(L)})),_==="recover"&&B.options.recover&&(B.options.recover=null,B.unpersistConnection())});var Y=this;b.on(["disconnected","closed","failed"],function(X){Y.deactivateTransport(b,this.event,X)}),this.emit("transport.pending",b)},F.prototype.scheduleTransportActivation=function(b,L,B,_){var V=this,Y=this.activeProtocol&&this.activeProtocol.getTransport(),X=function(){L.disconnect(),v.arrDeleteValue(V.pendingTransports,L)};if(this.state!==this.states.connected&&this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Current connection state ("+this.state.state+(this.state===this.states.synchronizing?", but with an upgrade already in progress":"")+") is not valid to upgrade in; abandoning upgrade to "+L.shortName),X();return}if(Y&&!A(L,Y)){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+L.shortName+" is no better than current active transport "+Y.shortName+" - abandoning upgrade"),X();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Scheduling transport upgrade; transport = "+L);var te=null;if(!L.isConnected){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+L.shortName+"is no longer connected; abandoning upgrade"),X();return}if(this.state===this.states.connected)f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Currently connected, so temporarily pausing events until the upgrade is complete"),this.state=this.states.synchronizing,te=this.activeProtocol;else if(this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Current connection state ("+this.state.state+(this.state===this.states.synchronizing?", but with an upgrade already in progress":"")+") is not valid to upgrade in; abandoning upgrade to "+L.shortName),X();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Syncing transport; transport = "+L);var re=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Activating transport; transport = "+L),L.send(m.default.fromValues({action:p.ACTIVATE})),V.activateTransport(b,L,B,_),V.state===V.states.synchronizing?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, sending queued messages on upgraded transport; transport = "+L),V.state=V.states.connected):f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, but state is now "+V.state.state+", so leaving unchanged"),V.state.sendEvents&&V.sendQueuedMessages()};te?te.onceIdle(re):re()},F.prototype.activateTransport=function(b,L,B,_){var V=this;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","transport = "+L),b&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","error = "+b),B&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.activateTransport()","connectionId = "+B),_&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.activateTransport()","connectionDetails = "+JSON.stringify(_)),this.persistTransportPreference(L);var Y=this.state,X=this.states.connected.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","current state = "+Y.state),Y.state==this.states.closing.state||Y.state==this.states.closed.state||Y.state==this.states.failed.state)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Disconnecting transport and abandoning"),L.disconnect(),!1;if(v.arrDeleteValue(this.pendingTransports,L),!L.isConnected)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Declining to activate transport "+L+" since it appears to no longer be connected"),!1;var te=this.activeProtocol;this.activeProtocol=new S.default(L),this.host=L.params.host;var re=_.connectionKey;if(re&&this.connectionKey!=re&&this.setConnection(B,_,!!b),this.onConnectionDetailsUpdate(_,L),R.default.Config.nextTick(function(){L.on("connected",function(Z,he,Me){V.onConnectionDetailsUpdate(Me,L),V.emit("update",new E.default(X,X,null,Z))})}),Y.state===this.states.connected.state?b&&(this.errorReason=this.realtime.connection.errorReason=b,this.emit("update",new E.default(X,X,null,b))):(this.notifyState({state:"connected",error:b}),this.errorReason=this.realtime.connection.errorReason=b||null),this.emit("transport.active",L),te)if(te.messageQueue.count()>0&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Previous active protocol (for transport "+te.transport.shortName+", new one is "+L.shortName+") finishing with "+te.messageQueue.count()+" messages still pending"),te.transport===L){var le="Assumption violated: activating a transport that was also the transport for the previous active protocol; transport = "+L.shortName+"; stack = "+new Error().stack;f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()",le)}else te.finish();return v.safeArrForEach(this.pendingTransports,function(Z){if(Z===L){var he="Assumption violated: activating a transport that is still marked as a pending transport; transport = "+L.shortName+"; stack = "+new Error().stack;f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()",he),v.arrDeleteValue(V.pendingTransports,L)}else Z.disconnect()}),v.safeArrForEach(this.proposedTransports,function(Z){Z===L?(f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Assumption violated: activating a transport that is still marked as a proposed transport; transport = "+L.shortName+"; stack = "+new Error().stack),v.arrDeleteValue(V.proposedTransports,L)):Z.dispose()}),!0},F.prototype.deactivateTransport=function(b,L,B){var _=this.activeProtocol,V=_&&_.getTransport()===b,Y=v.arrDeleteValue(this.pendingTransports,b),X=v.arrDeleteValue(this.proposedTransports,b),te=this.noTransportsScheduledForActivation();if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.deactivateTransport()","transport = "+b),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.deactivateTransport()","state = "+L+(V?"; was active":Y?"; was pending":X?"; was proposed":"")+(te?"":"; another transport is scheduled for activation")),B&&B.message&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","reason = "+B.message),V&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","Getting, clearing, and requeuing "+this.activeProtocol.messageQueue.count()+" pending messages"),this.queuePendingMessages(_.getPendingMessages()),R.default.Config.nextTick(function(){_.clearPendingMessages()}),this.activeProtocol=this.host=null),this.emit("transport.inactive",b),V&&te||V&&L==="failed"||L==="closed"||_===null&&Y&&this.pendingTransports.length===0){if(L==="disconnected"&&B&&B.statusCode>500&&this.httpHosts.length>1){this.unpersistTransportPreference(),this.forceFallbackHost=!0,this.notifyState({state:L,error:B,retryImmediately:!0});return}var re=L==="failed"&&d.default.isTokenErr(B)?"disconnected":L;this.notifyState({state:re,error:B});return}V&&L==="disconnected"&&this.state!==this.states.synchronizing&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","wasActive but another transport is connected and scheduled for activation, so going into the connecting state until it activates"),this.startSuspendTimer(),this.startTransitionTimer(this.states.connecting),this.notifyState({state:"connecting",error:B}))},F.prototype.noTransportsScheduledForActivation=function(){return v.isEmpty(this.pendingTransports)||this.pendingTransports.every(function(b){return!b.isConnected})},F.prototype.setConnection=function(b,L,B){var _=this.connectionId,V=_&&_!==b,Y=!_&&B;(V||Y)&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setConnection()","Resetting msgSerial"),this.msgSerial=0,this.queuedMessages.resetSendAttempted()),this.connectionId!==b&&f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setConnection()","New connectionId; reattaching any attached channels"),this.realtime.connection.id=this.connectionId=b,this.realtime.connection.key=this.connectionKey=L.connectionKey},F.prototype.clearConnection=function(){this.realtime.connection.id=this.connectionId=void 0,this.realtime.connection.key=this.connectionKey=void 0,this.msgSerial=0,this.unpersistConnection()},F.prototype.createRecoveryKey=function(){return this.connectionKey?JSON.stringify({connectionKey:this.connectionKey,msgSerial:this.msgSerial,channelSerials:this.realtime.channels.channelSerials()}):null},F.prototype.checkConnectionStateFreshness=function(){if(!(!this.lastActivity||!this.connectionId)){var b=v.now()-this.lastActivity;b>this.connectionStateTtl+this.maxIdleInterval&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.checkConnectionStateFreshness()","Last known activity from realtime was "+b+"ms ago; discarding connection state"),this.clearConnection(),this.states.connecting.failState="suspended")}},F.prototype.persistConnection=function(){if(g()){var b=this.createRecoveryKey();b&&I({recoveryKey:b,disconnectedAt:v.now(),location:i.location,clientId:this.realtime.auth.clientId})}},F.prototype.unpersistConnection=function(){M()},F.prototype.getError=function(){return this.errorReason||this.getStateError()},F.prototype.getStateError=function(){var b,L;return(L=(b=P.default)[this.state.state])===null||L===void 0?void 0:L.call(b)},F.prototype.activeState=function(){return this.state.queueEvents||this.state.sendEvents},F.prototype.enactStateChange=function(b){var L=b.current==="failed"?f.default.LOG_ERROR:f.default.LOG_MAJOR;f.default.logAction(L,"Connection state",b.current+(b.reason?"; reason: "+b.reason:"")),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.enactStateChange","setting new state: "+b.current+"; reason = "+(b.reason&&b.reason.message));var B=this.state=this.states[b.current];b.reason&&(this.errorReason=b.reason,this.realtime.connection.errorReason=b.reason),(B.terminal||B.state==="suspended")&&this.clearConnection(),this.emit("connectionstate",b)},F.prototype.startTransitionTimer=function(b){var L=this;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startTransitionTimer()","transitionState: "+b.state),this.transitionTimer&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startTransitionTimer()","clearing already-running timer"),clearTimeout(this.transitionTimer)),this.transitionTimer=setTimeout(function(){L.transitionTimer&&(L.transitionTimer=null,f.default.logAction(f.default.LOG_MINOR,"ConnectionManager "+b.state+" timer expired","requesting new state: "+b.failState),L.notifyState({state:b.failState}))},b.retryDelay)},F.prototype.cancelTransitionTimer=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.cancelTransitionTimer()",""),this.transitionTimer&&(clearTimeout(this.transitionTimer),this.transitionTimer=null)},F.prototype.startSuspendTimer=function(){var b=this;this.suspendTimer||(this.suspendTimer=setTimeout(function(){b.suspendTimer&&(b.suspendTimer=null,f.default.logAction(f.default.LOG_MINOR,"ConnectionManager suspend timer expired","requesting new state: suspended"),b.states.connecting.failState="suspended",b.notifyState({state:"suspended"}))},this.connectionStateTtl))},F.prototype.checkSuspendTimer=function(b){b!=="disconnected"&&b!=="suspended"&&b!=="connecting"&&this.cancelSuspendTimer()},F.prototype.cancelSuspendTimer=function(){this.states.connecting.failState="disconnected",this.suspendTimer&&(clearTimeout(this.suspendTimer),this.suspendTimer=null)},F.prototype.startRetryTimer=function(b){var L=this;this.retryTimer=setTimeout(function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager retry timer expired","retrying"),L.retryTimer=null,L.requestState({state:"connecting"})},b)},F.prototype.cancelRetryTimer=function(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)},F.prototype.notifyState=function(b){var L=this,B,_,V=b.state,Y=V==="disconnected"&&(this.state===this.states.connected||this.state===this.states.synchronizing||b.retryImmediately||this.state===this.states.connecting&&b.error&&d.default.isTokenErr(b.error)&&!(this.errorReason&&d.default.isTokenErr(this.errorReason)));if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.notifyState()","new state: "+V+(Y?"; will retry connection immediately":"")),V!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(b.state),(V==="suspended"||V==="connected")&&(this.disconnectedRetryCount=0),!this.state.terminal)){var X=this.states[b.state],te=X.retryDelay;X.state==="disconnected"&&(this.disconnectedRetryCount++,te=v.getRetryTime(X.retryDelay,this.disconnectedRetryCount));var re=new E.default(this.state.state,X.state,te,b.error||((_=(B=P.default)[X.state])===null||_===void 0?void 0:_.call(B)));if(Y){var le=function(){L.state===L.states.disconnected&&(L.lastAutoReconnectAttempt=v.now(),L.requestState({state:"connecting"}))},Z=this.lastAutoReconnectAttempt&&v.now()-this.lastAutoReconnectAttempt+1;Z&&Z<1e3?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.notifyState()","Last reconnect attempt was only "+Z+"ms ago, waiting another "+(1e3-Z)+"ms before trying again"),setTimeout(le,1e3-Z)):R.default.Config.nextTick(le)}else(V==="disconnected"||V==="suspended")&&this.startRetryTimer(te);(V==="disconnected"&&!Y||V==="suspended"||X.terminal)&&R.default.Config.nextTick(function(){L.disconnectAllTransports()}),V=="connected"&&!this.activeProtocol&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.notifyState()","Broken invariant: attempted to go into connected state, but there is no active protocol"),this.enactStateChange(re),this.state.sendEvents?this.sendQueuedMessages():this.state.queueEvents||(this.realtime.channels.propogateConnectionInterruption(V,re.reason),this.failQueuedMessages(re.reason))}},F.prototype.requestState=function(b){var L=this,B,_,V=b.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.requestState()","requested state: "+V+"; current state: "+this.state.state),V!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(V),!(V=="connecting"&&this.state.state=="connected")&&!(V=="closing"&&this.state.state=="closed"))){var Y=this.states[V],X=new E.default(this.state.state,Y.state,null,b.error||((_=(B=P.default)[Y.state])===null||_===void 0?void 0:_.call(B)));this.enactStateChange(X),V=="connecting"&&R.default.Config.nextTick(function(){L.startConnect()}),V=="closing"&&this.closeImpl()}},F.prototype.startConnect=function(){var b=this;if(this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startConnect()","Must be in connecting state to connect, but was "+this.state.state);return}var L=this.realtime.auth,B=++this.connectCounter,_=function(){b.checkConnectionStateFreshness(),b.getTransportParams(function(Y){if(Y.mode==="recover"&&Y.options.recover){var X=U(Y.options.recover);X&&b.realtime.channels.recoverChannels(X.channelSerials)}B===b.connectCounter&&b.connectImpl(Y,B)})};if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startConnect()","starting connection"),this.startSuspendTimer(),this.startTransitionTimer(this.states.connecting),L.method==="basic")_();else{var V=function(Y){B===b.connectCounter&&(Y?b.actOnErrorFromAuthorize(Y):_())};this.errorReason&&d.default.isTokenErr(this.errorReason)?L._forceNewToken(null,null,V):L._ensureValidAuthCredentials(!1,V)}},F.prototype.connectImpl=function(b,L){var B=this.state.state;B!==this.states.connecting.state&&B!==this.states.connected.state?f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectImpl()","Must be in connecting state to connect (or connected to upgrade), but was "+B):this.pendingTransports.length?f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectImpl()","Transports "+this.pendingTransports[0].toString()+" currently pending; taking no action"):B==this.states.connected.state?this.upgradeIfNeeded(b):this.transports.length>1&&this.getTransportPreference()?this.connectPreference(b,L):this.connectBase(b,L)},F.prototype.connectPreference=function(b,L){var B=this,_=this.getTransportPreference(),V=!1;v.arrIn(this.transports,_)||(this.unpersistTransportPreference(),this.connectImpl(b,L)),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectPreference()","Trying to connect with stored transport preference "+_);var Y=setTimeout(function(){V=!0,B.state.state!==B.states.connected.state&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectPreference()","Shortcircuit connection attempt with "+_+" failed; clearing preference and trying from scratch"),B.disconnectAllTransports(),B.unpersistTransportPreference()),B.connectImpl(b,L)},this.options.timeouts.preferenceConnectTimeout);b.host=this.httpHosts[0],this.tryATransport(b,_,function(X,te){clearTimeout(Y),V&&te?(te.off(),te.disconnect(),v.arrDeleteValue(B.pendingTransports,te)):!te&&!X&&(B.unpersistTransportPreference(),B.connectImpl(b,L))})},F.prototype.connectBase=function(b,L){var B=this,_=function(re){B.notifyState({state:B.states.connecting.failState,error:re})},V=this.httpHosts.slice(),Y=function(re,le){L===B.connectCounter&&!le&&!re&&te()};f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectBase()","Trying to connect with base transport "+this.baseTransport);var X=V.shift();if(!X){_(new y.default("Unable to connect (no available host)",80003,404));return}b.host=X;var te=function(){if(!V.length){_(new y.default("Unable to connect (and no more fallback hosts to try)",80003,404));return}if(!B.realtime.http.checkConnectivity){_(new y.PartialErrorInfo("Internal error: Http.checkConnectivity not set",null,500));return}B.realtime.http.checkConnectivity(function(re,le){if(L===B.connectCounter){if(re){_(re);return}if(!le){_(new y.default("Unable to connect (network unreachable)",80003,404));return}b.host=v.arrPopRandomElement(V),B.tryATransport(b,B.baseTransport,Y)}})};if(this.forceFallbackHost&&V.length){this.forceFallbackHost=!1,te();return}this.tryATransport(b,this.baseTransport,Y)},F.prototype.getUpgradePossibilities=function(){var b=this.activeProtocol.getTransport().shortName,L=v.arrIndexOf(this.upgradeTransports,b);return this.upgradeTransports.slice(L+1)},F.prototype.upgradeIfNeeded=function(b){var L=this,B=this.getUpgradePossibilities();f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.upgradeIfNeeded()","upgrade possibilities: "+R.default.Config.inspect(B)),B.length&&v.arrForEach(B,function(_){var V=L.createTransportParams(b.host,"upgrade");L.tryATransport(V,_,x)})},F.prototype.closeImpl=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.closeImpl()","closing connection"),this.cancelSuspendTimer(),this.startTransitionTimer(this.states.closing),v.safeArrForEach(this.pendingTransports,function(b){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Closing pending transport: "+b),b&&b.close()}),v.safeArrForEach(this.proposedTransports,function(b){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Disposing of proposed transport: "+b),b&&b.dispose()}),this.activeProtocol&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Closing active transport: "+this.activeProtocol.getTransport()),this.activeProtocol.getTransport().close()),this.notifyState({state:"closed"})},F.prototype.onAuthUpdated=function(b,L){var B=this,_;switch(this.state.state){case"connected":{if(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Sending AUTH message on active transport"),(this.pendingTransports.length||this.proposedTransports.length)&&this.state!==this.states.synchronizing){this.disconnectAllTransports(!0);var V=this.activeProtocol.getTransport().params;R.default.Config.nextTick(function(){B.state.state==="connected"&&B.upgradeIfNeeded(V)})}var Y=(_=this.activeProtocol)===null||_===void 0?void 0:_.getTransport();Y&&Y.onAuthUpdated&&Y.onAuthUpdated(b);var X=m.default.fromValues({action:p.AUTH,auth:{accessToken:b.token}});this.send(X);var te=function(){B.off(re),L(null,b)},re=function(Z){Z.current==="failed"&&(B.off(te),B.off(re),L(Z.reason||B.getStateError()))};this.once("connectiondetails",te),this.on("connectionstate",re);break}case"connecting":f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Aborting current connection attempts in order to start again with the new auth details"),this.disconnectAllTransports();default:{f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Connection state is "+this.state.state+"; waiting until either connected or failed");var le=function(Z){switch(Z.current){case"connected":B.off(le),L(null,b);break;case"failed":case"closed":case"suspended":B.off(le),L(Z.reason||B.getStateError());break}};this.on("connectionstate",le),this.state.state==="connecting"?this.startConnect():this.requestState({state:"connecting"})}}},F.prototype.disconnectAllTransports=function(b){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.disconnectAllTransports()","Disconnecting all transports"+(b?" except the active transport":"")),this.connectCounter++,v.safeArrForEach(this.pendingTransports,function(L){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting pending transport: "+L),L&&L.disconnect()}),this.pendingTransports=[],v.safeArrForEach(this.proposedTransports,function(L){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disposing of proposed transport: "+L),L&&L.dispose()}),this.proposedTransports=[],this.activeProtocol&&!b&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting active transport: "+this.activeProtocol.getTransport()),this.activeProtocol.getTransport().disconnect())},F.prototype.send=function(b,L,B){B=B||x;var _=this.state;if(_.sendEvents){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","sending event"),this.sendImpl(new S.PendingMessage(b,B));return}var V=L&&_.queueEvents||_.forceQueueEvents;if(!V){var Y="rejecting event, queueEvent was "+L+", state was "+_.state;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()",Y),B(this.errorReason||new y.default(Y,9e4,400));return}f.default.shouldLog(f.default.LOG_MICRO)&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","queueing msg; "+m.default.stringify(b)),this.queue(b,B)},F.prototype.sendImpl=function(b){var L=b.message;b.ackRequired&&!b.sendAttempted&&(L.msgSerial=this.msgSerial++);try{this.activeProtocol.send(b)}catch(B){f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.sendImpl()","Unexpected exception in transport.send(): "+B.stack)}},F.prototype.queue=function(b,L){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.queue()","queueing event");var B=this.queuedMessages.last(),_=this.options.maxMessageSize;B&&!B.sendAttempted&&j(B.message,b,_)?(B.merged||(B.callback=w.default.create([B.callback]),B.merged=!0),B.callback.push(L)):this.queuedMessages.push(new S.PendingMessage(b,L))},F.prototype.sendQueuedMessages=function(){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.sendQueuedMessages()","sending "+this.queuedMessages.count()+" queued messages");for(var b;b=this.queuedMessages.shift();)this.sendImpl(b)},F.prototype.queuePendingMessages=function(b){b&&b.length&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.queuePendingMessages()","queueing "+b.length+" pending messages"),this.queuedMessages.prepend(b))},F.prototype.failQueuedMessages=function(b){var L=this.queuedMessages.count();L>0&&(f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.failQueuedMessages()","failing "+L+" queued messages, err = "+v.inspectError(b)),this.queuedMessages.completeAllMessages(b))},F.prototype.onChannelMessage=function(b,L){var B=this.activeProtocol&&L===this.activeProtocol.getTransport(),_=v.arrIn(this.pendingTransports,L)&&this.state==this.states.synchronizing;B||_?this.realtime.channels.onChannelMessage(b):v.arrIndexOf([p.ACK,p.NACK,p.ERROR],b.action)>-1?this.realtime.channels.onChannelMessage(b):f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onChannelMessage()","received message "+JSON.stringify(b)+"on defunct transport; discarding")},F.prototype.ping=function(b,L){var B=this;if(b){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.ping()","transport = "+b);var _=function(){b.off("heartbeat",X),L(new y.default("Timeout waiting for heartbeat response",5e4,500))},V=v.now(),Y=v.cheapRandStr(),X=function(he){if(he===Y){b.off("heartbeat",X),clearTimeout(te);var Me=v.now()-V;L(null,Me)}},te=setTimeout(_,this.options.timeouts.realtimeRequestTimeout);b.on("heartbeat",X),b.ping(Y);return}if(this.state.state!=="connected"){L(new y.default("Unable to ping service; not connected",4e4,400));return}var re=!1,le=function(he,Me){B.off("transport.active",Z),re||(re=!0,L(he,Me))},Z=function(){re||(re=!0,R.default.Config.nextTick(function(){B.ping(null,L)}))};this.on("transport.active",Z),this.ping(this.activeProtocol.getTransport(),le)},F.prototype.abort=function(b){this.activeProtocol.getTransport().fail(b)},F.prototype.registerProposedTransport=function(b){this.proposedTransports.push(b)},F.prototype.getTransportPreference=function(){var b,L;return this.transportPreference||s()&&((L=(b=R.default.WebStorage)===null||b===void 0?void 0:b.get)===null||L===void 0?void 0:L.call(b,D))},F.prototype.persistTransportPreference=function(b){var L,B;v.arrIn(T.default.upgradeTransports,b.shortName)&&(this.transportPreference=b.shortName,s()&&((B=(L=R.default.WebStorage)===null||L===void 0?void 0:L.set)===null||B===void 0||B.call(L,D,b.shortName)))},F.prototype.unpersistTransportPreference=function(){var b,L;this.transportPreference=null,s()&&((L=(b=R.default.WebStorage)===null||b===void 0?void 0:b.remove)===null||L===void 0||L.call(b,D))},F.prototype.actOnErrorFromAuthorize=function(b){if(b.code===40171)this.notifyState({state:"failed",error:b});else if(b.code===40102)this.notifyState({state:"failed",error:b});else if(b.statusCode===l.default.Forbidden){var L="Client configured authentication provider returned 403; failing the connection";f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.actOnErrorFromAuthorize()",L),this.notifyState({state:"failed",error:new y.default(L,80019,403,b)})}else{var L="Client configured authentication provider request failed";f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.actOnErrorFromAuthorize",L),this.notifyState({state:this.state.failState,error:new y.default(L,80019,401,b)})}},F.prototype.onConnectionDetailsUpdate=function(b,L){if(b){this.connectionDetails=b,b.maxMessageSize&&(this.options.maxMessageSize=b.maxMessageSize);var B=b.clientId;if(B){var _=this.realtime.auth._uncheckedSetClientId(B);if(_){f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.onConnectionDetailsUpdate()",_.message),L.fail(_);return}}var V=b.connectionStateTtl;V&&(this.connectionStateTtl=V),this.maxIdleInterval=b.maxIdleInterval,this.emit("connectiondetails",b)}},F.supportedTransports={},F}(C.default);r.default=W}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(7)),m=i.__importDefault(o(2)),v=function(S){i.__extends(T,S);function T(){var R=S.call(this)||this;return R.messages=[],R}return T.prototype.count=function(){return this.messages.length},T.prototype.push=function(R){this.messages.push(R)},T.prototype.shift=function(){return this.messages.shift()},T.prototype.last=function(){return this.messages[this.messages.length-1]},T.prototype.copyAll=function(){return this.messages.slice()},T.prototype.append=function(R){this.messages.push.apply(this.messages,R)},T.prototype.prepend=function(R){this.messages.unshift.apply(this.messages,R)},T.prototype.completeMessages=function(R,C,O){m.default.logAction(m.default.LOG_MICRO,"MessageQueue.completeMessages()","serial = "+R+"; count = "+C),O=O||null;var f=this.messages;if(f.length===0)throw new Error("MessageQueue.completeMessages(): completeMessages called on any empty MessageQueue");var E=f[0];if(E){var P=E.message.msgSerial,y=R+C;if(y>P)for(var d=f.splice(0,y-P),h=0,w=d;h<w.length;h++){var c=w[h];c.callback(O)}f.length==0&&this.emit("idle")}},T.prototype.completeAllMessages=function(R){this.completeMessages(0,Number.MAX_SAFE_INTEGER||Number.MAX_VALUE,R)},T.prototype.resetSendAttempted=function(){for(var R=0,C=this.messages;R<C.length;R++){var O=C[R];O.sendAttempted=!1}},T.prototype.clear=function(){m.default.logAction(m.default.LOG_MICRO,"MessageQueue.clear()","clearing "+this.messages.length+" messages"),this.messages=[],this.emit("idle")},T}(a.default);r.default=v},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function a(m,v,S,T){this.previous=m,this.current=v,S&&(this.retryIn=S),T&&(this.reason=T)}return a}();r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(10)),m=i.__importDefault(o(7)),v=i.__importStar(o(1)),S=i.__importDefault(o(33)),T=i.__importDefault(o(2)),R=i.__importDefault(o(54)),C=i.__importDefault(o(9)),O=i.__importDefault(o(39)),f=i.__importStar(o(4)),E=i.__importDefault(o(16)),P=i.__importDefault(o(21)),y=a.default.Action,d=function(){};function h(u){if(u&&"params"in u&&!v.isObject(u.params))return new f.default("options.params must be an object",4e4,400);if(u&&"modes"in u){if(!v.isArray(u.modes))return new f.default("options.modes must be an array",4e4,400);for(var l=0;l<u.modes.length;l++){var s=u.modes[l];if(!s||typeof s!="string"||!v.arrIn(a.default.channelModes,String.prototype.toUpperCase.call(s)))return new f.default("Invalid channel mode: "+s,4e4,400)}}}var w=function(u){i.__extends(l,u);function l(s,g,p){var x=u.call(this,s,g,p)||this;return x.retryCount=0,x.history=function(D,N){if(T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.history()","channel = "+this.name),N===void 0)if(typeof D=="function")N=D,D=null;else{if(this.rest.options.promises)return v.promisify(this,"history",arguments);N=d}if(D&&D.untilAttach){if(this.state!=="attached"){N(new f.default("option untilAttach requires the channel to be attached",4e4,400));return}if(!this.properties.attachSerial){N(new f.default("untilAttach was specified and channel is attached, but attachSerial is not defined",4e4,400));return}delete D.untilAttach,D.from_serial=this.properties.attachSerial}S.default.prototype._history.call(this,D,N)},x.whenState=function(D,N){return m.default.prototype.whenState.call(x,D,x.state,N)},T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel()","started; name = "+g),x.realtime=s,x.presence=new R.default(x),x.connectionManager=s.connection.connectionManager,x.state="initialized",x.subscriptions=new m.default,x.syncChannelSerial=void 0,x.properties={attachSerial:void 0,channelSerial:void 0},x.setOptions(p),x.errorReason=null,x._requestedFlags=null,x._mode=null,x._attachResume=!1,x._decodingContext={channelOptions:x.channelOptions,plugins:s.options.plugins||{},baseEncodedPreviousPayload:void 0},x._lastPayload={messageId:null,protocolMessageChannelSerial:null,decodeFailureRecoveryInProgress:null},x._allChannelChanges=new m.default,x}return l.prototype.invalidStateError=function(){return new f.default("Channel operation failed as channel state is "+this.state,90001,400,this.errorReason||void 0)},l.processListenerArgs=function(s){return s=Array.prototype.slice.call(s),typeof s[0]=="function"&&s.unshift(null),s[s.length-1]==null&&s.pop(),s},l.prototype.setOptions=function(s,g){var p=this.channelOptions;if(!g&&this.rest.options.promises)return v.promisify(this,"setOptions",arguments);var x=g||function(N){N&&T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel.setOptions()","Set options failed: "+N.toString())},D=h(s);if(D){x(D);return}S.default.prototype.setOptions.call(this,s),this._decodingContext&&(this._decodingContext.channelOptions=this.channelOptions),this._shouldReattachToSetOptions(s,p)?(this.attachImpl(),this._allChannelChanges.once(["attached","update","detached","failed"],function(N){switch(this.event){case"update":case"attached":x==null||x(null);return;default:x==null||x(N.reason);return}})):x()},l.prototype._shouldReattachToSetOptions=function(s,g){if(!(this.state==="attached"||this.state==="attaching"))return!1;if(s!=null&&s.params){var p=c(s.params),x=c(g.params);if(Object.keys(p).length!==Object.keys(x).length||!v.shallowEquals(x,p))return!0}return!!(s!=null&&s.modes&&(!g.modes||!v.arrEquals(s.modes,g.modes)))},l.prototype.publish=function(){for(var s=this,g=[],p=0;p<arguments.length;p++)g[p]=arguments[p];var x=g[0],D=g.length,N=g[D-1];if(typeof N!="function"){if(this.realtime.options.promises)return v.promisify(this,"publish",arguments);N=d,++D}if(!this.connectionManager.activeState()){N(this.connectionManager.getError());return}if(D==2)if(v.isObject(x))x=[C.default.fromValues(x)];else if(v.isArray(x))x=C.default.fromValuesArray(x);else throw new f.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);else x=[C.default.fromValues({name:g[0],data:g[1]})];var k=this.realtime.options.maxMessageSize;C.default.encodeArray(x,this.channelOptions,function(I){if(I){N(I);return}var M=C.default.getMessagesSize(x);if(M>k){N(new f.default("Maximum size of messages that can be published at once exceeded ( was "+M+" bytes; limit is "+k+" bytes)",40009,400));return}s.__publish(x,N)})},l.prototype.__publish=function(s,g){T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.publish()","message count = "+s.length);var p=this.state;switch(p){case"failed":case"suspended":g(f.default.fromValues(this.invalidStateError()));break;default:{T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.publish()","sending message; channel state is "+p);var x=new a.default;x.action=y.MESSAGE,x.channel=this.name,x.messages=s,this.sendMessage(x,g);break}}},l.prototype.onEvent=function(s){T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.onEvent()","received message");for(var g=this.subscriptions,p=0;p<s.length;p++){var x=s[p];g.emit(x.name,x)}},l.prototype.attach=function(s,g){var p;if(typeof s=="function"?(g=s,p=null):p=s,!g){if(this.realtime.options.promises)return v.promisify(this,"attach",arguments);g=function(x){x&&T.default.logAction(T.default.LOG_MAJOR,"RealtimeChannel.attach()","Channel attach failed: "+x.toString())}}if(p)T.default.deprecated("The ability to pass an array of channel mode flags as the first argument of `RealtimeChannel.attach()`","To set channel mode flags, populate the `modes` property of the channel options object that you pass to `Channels.get()` or `RealtimeChannel.setOptions()`."),this._requestedFlags=p;else if(this.state==="attached"){g(null,null);return}this._attach(!1,null,g)},l.prototype._attach=function(s,g,p){p||(p=function(D){D&&T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel._attach()","Channel attach failed: "+D.toString())});var x=this.connectionManager;if(!x.activeState()){p(x.getError());return}(this.state!=="attaching"||s)&&this.requestState("attaching",g),this.once(function(D){switch(this.event){case"attached":p==null||p(null,D);break;case"detached":case"suspended":case"failed":p==null||p(D.reason||x.getError()||new f.default("Unable to attach; reason unknown; state = "+this.event,9e4,500));break;case"detaching":p==null||p(new f.default("Attach request superseded by a subsequent detach request",9e4,409));break}})},l.prototype.attachImpl=function(){T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.attachImpl()","sending ATTACH message");var s=a.default.fromValues({action:y.ATTACH,channel:this.name,params:this.channelOptions.params,channelSerial:this.properties.channelSerial});this._requestedFlags?s.encodeModesToFlags(this._requestedFlags):this.channelOptions.modes&&s.encodeModesToFlags(v.allToUpperCase(this.channelOptions.modes)),this._attachResume&&s.setFlag("ATTACH_RESUME"),this._lastPayload.decodeFailureRecoveryInProgress&&(s.channelSerial=this._lastPayload.protocolMessageChannelSerial),this.sendMessage(s,d)},l.prototype.detach=function(s){if(!s){if(this.realtime.options.promises)return v.promisify(this,"detach",arguments);s=d}var g=this.connectionManager;if(!g.activeState()){s(g.getError());return}switch(this.state){case"suspended":this.notifyState("detached"),s();break;case"detached":s();break;case"failed":s(new f.default("Unable to detach; channel state = failed",90001,400));break;default:this.requestState("detaching");case"detaching":this.once(function(p){switch(this.event){case"detached":s();break;case"attached":case"suspended":case"failed":s(p.reason||g.getError()||new f.default("Unable to detach; reason unknown; state = "+this.event,9e4,500));break;case"attaching":s(new f.default("Detach request superseded by a subsequent attach request",9e4,409));break}})}},l.prototype.detachImpl=function(s){T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.detach()","sending DETACH message");var g=a.default.fromValues({action:y.DETACH,channel:this.name});this.sendMessage(g,s||d)},l.prototype.subscribe=function(){for(var s=[],g=0;g<arguments.length;g++)s[g]=arguments[g];var p=l.processListenerArgs(s),x=p[0],D=p[1],N=p[2];if(!N&&this.realtime.options.promises)return v.promisify(this,"subscribe",[x,D]);if(this.state==="failed"){N==null||N(f.default.fromValues(this.invalidStateError()));return}return x&&typeof x=="object"&&!Array.isArray(x)?this._subscribeFilter(x,D):this.subscriptions.on(x,D),this.attach(N||d)},l.prototype._subscribeFilter=function(s,g){var p=function(x){var D,N,k,I,M,A,j={name:x.name,refTimeserial:(N=(D=x.extras)===null||D===void 0?void 0:D.ref)===null||N===void 0?void 0:N.timeserial,refType:(I=(k=x.extras)===null||k===void 0?void 0:k.ref)===null||I===void 0?void 0:I.type,isRef:!!(!((A=(M=x.extras)===null||M===void 0?void 0:M.ref)===null||A===void 0)&&A.timeserial),clientId:x.clientId};Object.entries(s).find(function(U){var z=U[0],W=U[1];return W!==void 0?j[z]!==W:!1})||g(x)};this._addFilteredSubscription(s,g,p),this.subscriptions.on(p)},l.prototype._addFilteredSubscription=function(s,g,p){var x;if(this.filteredSubscriptions||(this.filteredSubscriptions=new Map),this.filteredSubscriptions.has(g)){var D=this.filteredSubscriptions.get(g);D.set(s,((x=D==null?void 0:D.get(s))===null||x===void 0?void 0:x.concat(p))||[p])}else this.filteredSubscriptions.set(g,new Map([[s,[p]]]))},l.prototype._getAndDeleteFilteredSubscriptions=function(s,g){var p=this;if(!this.filteredSubscriptions)return[];if(!g&&s)return Array.from(this.filteredSubscriptions.entries()).map(function(k){var I,M=k[0],A=k[1],j=A.get(s);return A.delete(s),A.size===0&&((I=p.filteredSubscriptions)===null||I===void 0||I.delete(M)),j}).reduce(function(k,I){var M;return I?(M=k).concat.apply(M,I):k},[]);if(!g||!this.filteredSubscriptions.has(g))return[];var x=this.filteredSubscriptions.get(g);if(!s){var D=Array.from(x.values()).reduce(function(k,I){return k.concat.apply(k,I)},[]);return this.filteredSubscriptions.delete(g),D}var N=x.get(s);return x.delete(s),N||[]},l.prototype.unsubscribe=function(){for(var s=this,g,p=[],x=0;x<arguments.length;x++)p[x]=arguments[x];var D=l.processListenerArgs(p),N=D[0],k=D[1];if(typeof N=="object"&&!k||!((g=this.filteredSubscriptions)===null||g===void 0)&&g.has(k)){this._getAndDeleteFilteredSubscriptions(N,k).forEach(function(I){return s.subscriptions.off(I)});return}this.subscriptions.off(N,k)},l.prototype.sync=function(){switch(this.state){case"initialized":case"detaching":case"detached":throw new f.PartialErrorInfo("Unable to sync to channel; not attached",4e4)}var s=this.connectionManager;if(!s.activeState())throw s.getError();var g=a.default.fromValues({action:y.SYNC,channel:this.name});this.syncChannelSerial&&(g.channelSerial=this.syncChannelSerial),s.send(g)},l.prototype.sendMessage=function(s,g){this.connectionManager.send(s,this.realtime.options.queueMessages,g)},l.prototype.sendPresence=function(s,g){var p=a.default.fromValues({action:y.PRESENCE,channel:this.name,presence:v.isArray(s)?E.default.fromValuesArray(s):[E.default.fromValues(s)]});this.sendMessage(p,g)},l.prototype.onMessage=function(s){(s.action===y.ATTACHED||s.action===y.MESSAGE||s.action===y.PRESENCE)&&this.setChannelSerial(s.channelSerial);var g,p=!1;switch(s.action){case y.ATTACHED:{this.properties.attachSerial=s.channelSerial,this._mode=s.getMode(),this.params=s.params||{};var x=s.decodeModesFromFlags();this.modes=x&&v.allToLowerCase(x)||void 0;var D=s.hasFlag("RESUMED"),N=s.hasFlag("HAS_PRESENCE"),k=s.hasFlag("HAS_BACKLOG");if(this.state==="attached"){D||this.presence.onAttached(N);var I=new O.default(this.state,this.state,D,k,s.error);this._allChannelChanges.emit("update",I),(!D||this.channelOptions.updateOnAttached)&&this.emit("update",I)}else this.state==="detaching"?this.checkPendingState():this.notifyState("attached",s.error,D,N,k);break}case y.DETACHED:{var M=s.error?f.default.fromValues(s.error):new f.default("Channel detached",90001,404);this.state==="detaching"?this.notifyState("detached",M):this.state==="attaching"?this.notifyState("suspended",M):this.requestState("attaching",M);break}case y.SYNC:if(p=!0,g=this.syncChannelSerial=s.channelSerial,!s.presence)break;case y.PRESENCE:{for(var A=s.presence,j=s.id,U=s.connectionId,z=s.timestamp,W=this.channelOptions,G=void 0,F=0;F<A.length;F++)try{G=A[F],E.default.decode(G,W),G.connectionId||(G.connectionId=U),G.timestamp||(G.timestamp=z),G.id||(G.id=j+":"+F)}catch(Y){T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel.onMessage()",Y.toString())}this.presence.setPresence(A,p,g);break}case y.MESSAGE:{if(this.state!=="attached"){T.default.logAction(T.default.LOG_MAJOR,"RealtimeChannel.onMessage()",'Message "'+s.id+'" skipped as this channel "'+this.name+'" state is not "attached" (state is "'+this.state+'").');return}var b=s.messages,L=b[0],B=b[b.length-1],j=s.id,U=s.connectionId,z=s.timestamp;if(L.extras&&L.extras.delta&&L.extras.delta.from!==this._lastPayload.messageId){var _='Delta message decode failure - previous message not available for message "'+s.id+'" on this channel "'+this.name+'".';T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel.onMessage()",_),this._startDecodeFailureRecovery(new f.default(_,40018,400));break}for(var F=0;F<b.length;F++){var _=b[F];try{C.default.decode(_,this._decodingContext)}catch(Z){switch(T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel.onMessage()",Z.toString()),Z.code){case 40018:this._startDecodeFailureRecovery(Z);return;case 40019:case 40021:this.notifyState("failed",Z);return}}_.connectionId||(_.connectionId=U),_.timestamp||(_.timestamp=z),_.id||(_.id=j+":"+F)}this._lastPayload.messageId=B.id,this._lastPayload.protocolMessageChannelSerial=s.channelSerial,this.onEvent(b);break}case y.ERROR:{var V=s.error;V&&V.code==80016?this.checkPendingState():this.notifyState("failed",f.default.fromValues(V));break}default:T.default.logAction(T.default.LOG_ERROR,"RealtimeChannel.onMessage()","Fatal protocol error: unrecognised action ("+s.action+")"),this.connectionManager.abort(P.default.unknownChannelErr())}},l.prototype._startDecodeFailureRecovery=function(s){var g=this;this._lastPayload.decodeFailureRecoveryInProgress||(T.default.logAction(T.default.LOG_MAJOR,"RealtimeChannel.onMessage()","Starting decode failure recovery process."),this._lastPayload.decodeFailureRecoveryInProgress=!0,this._attach(!0,s,function(){g._lastPayload.decodeFailureRecoveryInProgress=!1}))},l.prototype.onAttached=function(){T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel.onAttached","activating channel; name = "+this.name)},l.prototype.notifyState=function(s,g,p,x,D){if(T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.notifyState","name = "+this.name+", current state = "+this.state+", notifying state "+s),this.clearStateTimer(),v.arrIn(["detached","suspended","failed"],s)&&(this.properties.channelSerial=null),s!==this.state){this.presence.actOnChannelState(s,x,g),s==="suspended"&&this.connectionManager.state.sendEvents?this.startRetryTimer():this.cancelRetryTimer(),g&&(this.errorReason=g);var N=new O.default(this.state,s,p,D,g),k=s==="failed"?T.default.LOG_ERROR:T.default.LOG_MAJOR;T.default.logAction(k,'Channel state for channel "'+this.name+'"',s+(g?"; reason: "+g:"")),s!=="attaching"&&s!=="suspended"&&(this.retryCount=0),s==="attached"&&this.onAttached(),s==="attached"?this._attachResume=!0:(s==="detaching"||s==="failed")&&(this._attachResume=!1),this.state=s,this._allChannelChanges.emit(s,N),this.emit(s,N)}},l.prototype.requestState=function(s,g){T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel.requestState","name = "+this.name+", state = "+s),this.notifyState(s,g),this.checkPendingState()},l.prototype.checkPendingState=function(){var s=this.connectionManager.state;if(!(s.sendEvents||s.forceQueueEvents)){T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel.checkPendingState","sendEvents is false; state is "+this.connectionManager.state.state);return}switch(T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel.checkPendingState","name = "+this.name+", state = "+this.state),this.state){case"attaching":this.startStateTimerIfNotRunning(),this.attachImpl();break;case"detaching":this.startStateTimerIfNotRunning(),this.detachImpl();break;case"attached":this.sync();break}},l.prototype.timeoutPendingState=function(){switch(this.state){case"attaching":{var s=new f.default("Channel attach timed out",90007,408);this.notifyState("suspended",s);break}case"detaching":{var s=new f.default("Channel detach timed out",90007,408);this.notifyState("attached",s);break}default:this.checkPendingState();break}},l.prototype.startStateTimerIfNotRunning=function(){var s=this;this.stateTimer||(this.stateTimer=setTimeout(function(){T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel.startStateTimerIfNotRunning","timer expired"),s.stateTimer=null,s.timeoutPendingState()},this.realtime.options.timeouts.realtimeRequestTimeout))},l.prototype.clearStateTimer=function(){var s=this.stateTimer;s&&(clearTimeout(s),this.stateTimer=null)},l.prototype.startRetryTimer=function(){var s=this;if(!this.retryTimer){this.retryCount++;var g=v.getRetryTime(this.realtime.options.timeouts.channelRetryTimeout,this.retryCount);this.retryTimer=setTimeout(function(){s.state==="suspended"&&s.connectionManager.state.sendEvents&&(s.retryTimer=null,T.default.logAction(T.default.LOG_MINOR,"RealtimeChannel retry timer expired","attempting a new attach"),s.requestState("attaching"))},g)}},l.prototype.cancelRetryTimer=function(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)},l.prototype.getReleaseErr=function(){var s=this.state;return s==="initialized"||s==="detached"||s==="failed"?null:new f.default("Can only release a channel in a state where there is no possibility of further updates from the server being received (initialized, detached, or failed); was "+s,90001,400)},l.prototype.setChannelSerial=function(s){T.default.logAction(T.default.LOG_MICRO,"RealtimeChannel.setChannelSerial()","Updating channel serial; serial = "+s+"; previous = "+this.properties.channelSerial),s&&(this.properties.channelSerial=s)},l}(S.default);function c(u){var l=u||{};l.agent;var s=i.__rest(l,["agent"]);return s}r.default=w},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function a(m,v,S,T,R){this.previous=m,this.current=v,v==="attached"&&(this.resumed=S,this.hasBacklog=T),R&&(this.reason=R)}return a}();r.default=i},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){var a=i,m=a.lib,v=m.WordArray,S=m.Hasher,T=a.algo,R=[],C=T.SHA1=S.extend({_doReset:function(){this._hash=new v.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(O,f){for(var E=this._hash.words,P=E[0],y=E[1],d=E[2],h=E[3],w=E[4],c=0;c<80;c++){if(c<16)R[c]=O[f+c]|0;else{var u=R[c-3]^R[c-8]^R[c-14]^R[c-16];R[c]=u<<1|u>>>31}var l=(P<<5|P>>>27)+w+R[c];c<20?l+=(y&d|~y&h)+1518500249:c<40?l+=(y^d^h)+1859775393:c<60?l+=(y&d|y&h|d&h)-1894007588:l+=(y^d^h)-899497514,w=h,h=d,d=y<<30|y>>>2,y=P,P=l}E[0]=E[0]+P|0,E[1]=E[1]+y|0,E[2]=E[2]+d|0,E[3]=E[3]+h|0,E[4]=E[4]+w|0},_doFinalize:function(){var O=this._data,f=O.words,E=this._nDataBytes*8,P=O.sigBytes*8;return f[P>>>5]|=128<<24-P%32,f[(P+64>>>9<<4)+14]=Math.floor(E/4294967296),f[(P+64>>>9<<4)+15]=E,O.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var O=S.clone.call(this);return O._hash=this._hash.clone(),O}});a.SHA1=S._createHelper(C),a.HmacSHA1=S._createHmacHelper(C)}(),i.SHA1})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});function i(c){if(c===void 0)return"undefined";var u,l;if(c instanceof ArrayBuffer?(l="ArrayBuffer",u=new DataView(c)):c instanceof DataView&&(l="DataView",u=c),!u)return JSON.stringify(c);for(var s=[],g=0;g<c.byteLength;g++){if(g>20){s.push("...");break}var p=u.getUint8(g).toString(16);p.length===1&&(p="0"+p),s.push(p)}return"<"+l+" "+s.join(" ")+">"}function a(c,u,l){for(var s=0,g=l.length;s<g;s++){var p=l.charCodeAt(s);if(p<128){c.setUint8(u++,p>>>0&127|0);continue}if(p<2048){c.setUint8(u++,p>>>6&31|192),c.setUint8(u++,p>>>0&63|128);continue}if(p<65536){c.setUint8(u++,p>>>12&15|224),c.setUint8(u++,p>>>6&63|128),c.setUint8(u++,p>>>0&63|128);continue}if(p<1114112){c.setUint8(u++,p>>>18&7|240),c.setUint8(u++,p>>>12&63|128),c.setUint8(u++,p>>>6&63|128),c.setUint8(u++,p>>>0&63|128);continue}throw new Error("bad codepoint "+p)}}function m(c,u,l){for(var s="",g=u,p=u+l;g<p;g++){var x=c.getUint8(g);if(!(x&128)){s+=String.fromCharCode(x);continue}if((x&224)===192){s+=String.fromCharCode((x&15)<<6|c.getUint8(++g)&63);continue}if((x&240)===224){s+=String.fromCharCode((x&15)<<12|(c.getUint8(++g)&63)<<6|(c.getUint8(++g)&63)<<0);continue}if((x&248)===240){s+=String.fromCharCode((x&7)<<18|(c.getUint8(++g)&63)<<12|(c.getUint8(++g)&63)<<6|(c.getUint8(++g)&63)<<0);continue}throw new Error("Invalid byte "+x.toString(16))}return s}function v(c){for(var u=0,l=0,s=c.length;l<s;l++){var g=c.charCodeAt(l);if(g<128){u+=1;continue}if(g<2048){u+=2;continue}if(g<65536){u+=3;continue}if(g<1114112){u+=4;continue}throw new Error("bad codepoint "+g)}return u}function S(c,u){var l=w(c,u);if(l!==0){var s=new ArrayBuffer(l),g=new DataView(s);return h(c,g,0,u),s}}var T=65536*65536,R=1/T;function C(c,u){return u=u||0,c.getInt32(u)*T+c.getUint32(u+4)}function O(c,u){return u=u||0,c.getUint32(u)*T+c.getUint32(u+4)}function f(c,u,l){l<9223372036854776e3?(c.setInt32(u,Math.floor(l*R)),c.setInt32(u+4,l&-1)):(c.setUint32(u,2147483647),c.setUint32(u+4,2147483647))}function E(c,u,l){l<18446744073709552e3?(c.setUint32(u,Math.floor(l*R)),c.setInt32(u+4,l&-1)):(c.setUint32(u,4294967295),c.setUint32(u+4,4294967295))}var P=function(){function c(u,l){var s=this;this.map=function(g){for(var p={},x=0;x<g;x++){var D=s.parse();p[D]=s.parse()}return p},this.bin=function(g){var p=new ArrayBuffer(g);return new Uint8Array(p).set(new Uint8Array(s.view.buffer,s.offset,g),0),s.offset+=g,p},this.buf=this.bin,this.str=function(g){var p=m(s.view,s.offset,g);return s.offset+=g,p},this.array=function(g){for(var p=new Array(g),x=0;x<g;x++)p[x]=s.parse();return p},this.ext=function(g){return s.offset+=g,{type:s.view.getInt8(s.offset),data:s.buf(g)}},this.parse=function(){var g=s.view.getUint8(s.offset),p,x;if(!(g&128))return s.offset++,g;if((g&240)===128)return x=g&15,s.offset++,s.map(x);if((g&240)===144)return x=g&15,s.offset++,s.array(x);if((g&224)===160)return x=g&31,s.offset++,s.str(x);if((g&224)===224)return p=s.view.getInt8(s.offset),s.offset++,p;switch(g){case 192:return s.offset++,null;case 193:s.offset++;return;case 194:return s.offset++,!1;case 195:return s.offset++,!0;case 196:return x=s.view.getUint8(s.offset+1),s.offset+=2,s.bin(x);case 197:return x=s.view.getUint16(s.offset+1),s.offset+=3,s.bin(x);case 198:return x=s.view.getUint32(s.offset+1),s.offset+=5,s.bin(x);case 199:return x=s.view.getUint8(s.offset+1),s.offset+=2,s.ext(x);case 200:return x=s.view.getUint16(s.offset+1),s.offset+=3,s.ext(x);case 201:return x=s.view.getUint32(s.offset+1),s.offset+=5,s.ext(x);case 202:return p=s.view.getFloat32(s.offset+1),s.offset+=5,p;case 203:return p=s.view.getFloat64(s.offset+1),s.offset+=9,p;case 204:return p=s.view.getUint8(s.offset+1),s.offset+=2,p;case 205:return p=s.view.getUint16(s.offset+1),s.offset+=3,p;case 206:return p=s.view.getUint32(s.offset+1),s.offset+=5,p;case 207:return p=O(s.view,s.offset+1),s.offset+=9,p;case 208:return p=s.view.getInt8(s.offset+1),s.offset+=2,p;case 209:return p=s.view.getInt16(s.offset+1),s.offset+=3,p;case 210:return p=s.view.getInt32(s.offset+1),s.offset+=5,p;case 211:return p=C(s.view,s.offset+1),s.offset+=9,p;case 212:return x=1,s.offset++,s.ext(x);case 213:return x=2,s.offset++,s.ext(x);case 214:return x=4,s.offset++,s.ext(x);case 215:return x=8,s.offset++,s.ext(x);case 216:return x=16,s.offset++,s.ext(x);case 217:return x=s.view.getUint8(s.offset+1),s.offset+=2,s.str(x);case 218:return x=s.view.getUint16(s.offset+1),s.offset+=3,s.str(x);case 219:return x=s.view.getUint32(s.offset+1),s.offset+=5,s.str(x);case 220:return x=s.view.getUint16(s.offset+1),s.offset+=3,s.array(x);case 221:return x=s.view.getUint32(s.offset+1),s.offset+=5,s.array(x);case 222:return x=s.view.getUint16(s.offset+1),s.offset+=3,s.map(x);case 223:return x=s.view.getUint32(s.offset+1),s.offset+=5,s.map(x)}throw new Error("Unknown type 0x"+g.toString(16))},this.offset=l||0,this.view=u}return c}();function y(c){var u=new DataView(c),l=new P(u),s=l.parse();if(l.offset!==c.byteLength)throw new Error(c.byteLength-l.offset+" trailing bytes");return s}function d(c,u){return Object.keys(c).filter(function(l){var s=c[l],g=typeof s;return(!u||s!=null)&&(g!=="function"||!!s.toJSON)})}function h(c,u,l,s){var g=typeof c;if(typeof c=="string"){var p=v(c);if(p<32)return u.setUint8(l,p|160),a(u,l+1,c),1+p;if(p<256)return u.setUint8(l,217),u.setUint8(l+1,p),a(u,l+2,c),2+p;if(p<65536)return u.setUint8(l,218),u.setUint16(l+1,p),a(u,l+3,c),3+p;if(p<4294967296)return u.setUint8(l,219),u.setUint32(l+1,p),a(u,l+5,c),5+p}if(ArrayBuffer.isView&&ArrayBuffer.isView(c)&&(c=c.buffer),c instanceof ArrayBuffer){var x=c.byteLength;if(x<256)return u.setUint8(l,196),u.setUint8(l+1,x),new Uint8Array(u.buffer).set(new Uint8Array(c),l+2),2+x;if(x<65536)return u.setUint8(l,197),u.setUint16(l+1,x),new Uint8Array(u.buffer).set(new Uint8Array(c),l+3),3+x;if(x<4294967296)return u.setUint8(l,198),u.setUint32(l+1,x),new Uint8Array(u.buffer).set(new Uint8Array(c),l+5),5+x}if(typeof c=="number"){if(Math.floor(c)!==c)return u.setUint8(l,203),u.setFloat64(l+1,c),9;if(c>=0){if(c<128)return u.setUint8(l,c),1;if(c<256)return u.setUint8(l,204),u.setUint8(l+1,c),2;if(c<65536)return u.setUint8(l,205),u.setUint16(l+1,c),3;if(c<4294967296)return u.setUint8(l,206),u.setUint32(l+1,c),5;if(c<18446744073709552e3)return u.setUint8(l,207),E(u,l+1,c),9;throw new Error("Number too big 0x"+c.toString(16))}if(c>=-32)return u.setInt8(l,c),1;if(c>=-128)return u.setUint8(l,208),u.setInt8(l+1,c),2;if(c>=-32768)return u.setUint8(l,209),u.setInt16(l+1,c),3;if(c>=-2147483648)return u.setUint8(l,210),u.setInt32(l+1,c),5;if(c>=-9223372036854776e3)return u.setUint8(l,211),f(u,l+1,c),9;throw new Error("Number too small -0x"+(-c).toString(16).substr(1))}if(g==="undefined")return s?0:(u.setUint8(l,212),u.setUint8(l+1,0),u.setUint8(l+2,0),3);if(c===null)return s?0:(u.setUint8(l,192),1);if(g==="boolean")return u.setUint8(l,c?195:194),1;if(typeof c.toJSON=="function")return h(c.toJSON(),u,l,s);if(g==="object"){var D,N=0,k=void 0,I=Array.isArray(c);if(I?D=c.length:(k=d(c,s),D=k.length),D<16?(u.setUint8(l,D|(I?144:128)),N=1):D<65536?(u.setUint8(l,I?220:222),u.setUint16(l+1,D),N=3):D<4294967296&&(u.setUint8(l,I?221:223),u.setUint32(l+1,D),N=5),I)for(var M=0;M<D;M++)N+=h(c[M],u,l+N,s);else if(k)for(var M=0;M<D;M++){var A=k[M];N+=h(A,u,l+N),N+=h(c[A],u,l+N,s)}return N}if(g==="function")return 0;throw new Error("Unknown type "+g)}function w(c,u){var l=typeof c;if(l==="string"){var s=v(c);if(s<32)return 1+s;if(s<256)return 2+s;if(s<65536)return 3+s;if(s<4294967296)return 5+s}if(ArrayBuffer.isView&&ArrayBuffer.isView(c)&&(c=c.buffer),c instanceof ArrayBuffer){var g=c.byteLength;if(g<256)return 2+g;if(g<65536)return 3+g;if(g<4294967296)return 5+g}if(typeof c=="number"){if(Math.floor(c)!==c)return 9;if(c>=0){if(c<128)return 1;if(c<256)return 2;if(c<65536)return 3;if(c<4294967296)return 5;if(c<18446744073709552e3)return 9;throw new Error("Number too big 0x"+c.toString(16))}if(c>=-32)return 1;if(c>=-128)return 2;if(c>=-32768)return 3;if(c>=-2147483648)return 5;if(c>=-9223372036854776e3)return 9;throw new Error("Number too small -0x"+c.toString(16).substr(1))}if(l==="boolean")return 1;if(c===null)return u?0:1;if(c===void 0)return u?0:3;if(typeof c.toJSON=="function")return w(c.toJSON(),u);if(l==="object"){var p,x=0;if(Array.isArray(c)){p=c.length;for(var D=0;D<p;D++)x+=w(c[D],u)}else{var N=d(c,u);p=N.length;for(var D=0;D<p;D++){var k=N[D];x+=w(k)+w(c[k],u)}}if(p<16)return 1+x;if(p<65536)return 3+x;if(p<4294967296)return 5+x;throw new Error("Array or object too long 0x"+p.toString(16))}if(l==="function")return 0;throw new Error("Unknown type "+l)}r.default={encode:S,decode:y,inspect:i,utf8Write:a,utf8Read:m,utf8ByteCount:v}},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(30)),m=i.__importDefault(o(50)),v=i.__importDefault(o(3)),S=i.__importDefault(o(4)),T=i.__importDefault(o(55)),R=i.__importDefault(o(57)),C=i.__importDefault(o(62)),O=i.__importDefault(o(64)),f=i.__importDefault(o(68)),E=i.__importDefault(o(2)),P=o(8),y=i.__importDefault(o(65)),d=i.__importDefault(o(66)),h=i.__importDefault(o(41)),w=(0,R.default)(O.default,T.default);v.default.Crypto=w,v.default.BufferUtils=T.default,v.default.Http=C.default,v.default.Config=O.default,v.default.Transports=f.default,v.default.WebStorage=y.default,a.default.Crypto=w,m.default.Crypto=w,E.default.initLogHandlers(),v.default.Defaults=(0,P.getDefaults)(d.default),v.default.Config.agent&&(v.default.Defaults.agent+=" "+v.default.Config.agent),v.default.Config.noUpgrade&&(v.default.Defaults.upgradeTransports=[]),r.default={ErrorInfo:S.default,Rest:a.default,Realtime:m.default,msgpack:h.default}},function(n){n.exports=JSON.parse('{"name":"ably","description":"Realtime client library for Ably, the realtime messaging service","version":"1.2.50","license":"Apache-2.0","bugs":{"url":"https://github.com/ably/ably-js/issues","email":"support@ably.com"},"main":"./build/ably-node.js","typings":"./ably.d.ts","react-native":{"./build/ably-node.js":"./build/ably-reactnative.js"},"browser":{"./build/ably-node.js":"./build/ably-commonjs.js"},"files":["build/**","ably.d.ts","callbacks.d.ts","callbacks.js","promises.d.ts","promises.js","resources/**","src/**","react/**"],"dependencies":{"@ably/msgpack-js":"^0.4.0","got":"^11.8.5","ws":"^8.14.2"},"peerDependencies":{"react":">=16.8.0","react-dom":">=16.8.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}},"devDependencies":{"@ably/vcdiff-decoder":"1.0.4","@arethetypeswrong/cli":"^0.13.1","@babel/preset-env":"^7.23.6","@testing-library/react":"^13.3.0","@types/crypto-js":"^4.0.1","@types/jmespath":"^0.15.2","@types/node":"^15.0.0","@types/request":"^2.48.7","@types/ws":"^8.2.0","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","@vitejs/plugin-react":"^1.3.2","async":"ably-forks/async#requirejs","aws-sdk":"^2.1413.0","babel-loader":"^8.3.0","chai":"^4.2.0","copy-webpack-plugin":"^6.4.1","cors":"^2.8.5","crypto-js":"ably-forks/crypto-js#crypto-lite","eslint":"^7.13.0","eslint-plugin-import":"^2.28.0","eslint-plugin-jsdoc":"^40.0.0","eslint-plugin-react":"^7.32.2","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-security":"^1.4.0","express":"^4.17.1","glob":"~4.4","google-closure-compiler":"^20180610.0.1","grunt":"^1.6.1","grunt-bump":"^0.3.1","grunt-cli":"~1.2.0","grunt-closure-tools":"^1.0.0","grunt-contrib-concat":"~0.5","grunt-shell":"~1.1","grunt-webpack":"^4.0.2","hexy":"~0.2","jmespath":"^0.16.0","jsdom":"^20.0.0","kexec":"ably-forks/node-kexec#update-for-node-12","minimist":"^1.2.5","mocha":"^8.1.3","mocha-junit-reporter":"^2.2.1","null-loader":"^4.0.1","playwright":"^1.39.0","prettier":"^2.5.1","react":">=18.1.0","react-dom":">=18.1.0","requirejs":"~2.1","shelljs":"~0.8","source-map-explorer":"^2.5.2","ts-loader":"^8.2.0","tsconfig-paths-webpack-plugin":"^4.0.1","tslib":"^2.3.1","typedoc":"^0.23.8","typescript":"^4.6.4","vite":"^4.4.9","vitest":"^0.18.0","webpack":"^4.44.2","webpack-cli":"^4.2.0","webpack-node-externals":"^3.0.0"},"engines":{"node":">=5.10.x"},"repository":"ably/ably-js","jspm":{"registry":"npm","directories":{"lib":"build"},"main":"ably"},"scripts":{"start:react":"npx vite serve","grunt":"grunt","test":"grunt test","test:node":"grunt test:node","test:node:skip-build":"grunt mocha","test:webserver":"grunt test:webserver","test:playwright":"node test/support/runPlaywrightTests.js","test:react":"vitest run","concat":"grunt concat","build":"grunt build:all && npm run build:react","build:node":"grunt build:node","build:browser":"grunt build:browser","build:react":"npm run build:react:mjs && npm run build:react:cjs && cp src/platform/react-hooks/res/package.react.json react/package.json","build:react:mjs":"tsc --project src/platform/react-hooks/tsconfig.mjs.json && cp src/platform/react-hooks/res/package.mjs.json react/mjs/package.json","build:react:cjs":"tsc --project src/platform/react-hooks/tsconfig.cjs.json && cp src/platform/react-hooks/res/package.cjs.json react/cjs/package.json","requirejs":"grunt requirejs","lint":"eslint .","lint:fix":"eslint --fix .","check-closure-compiler":"grunt check-closure-compiler","prepare":"npm run build","format":"prettier --write --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/cdn_deploy.js docs/chrome-mv3.md","format:check":"prettier --check --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/cdn_deploy.js","sourcemap":"source-map-explorer build/ably.min.js","sourcemap:noencryption":"source-map-explorer build/ably.noencryption.min.js","docs":"typedoc --entryPoints ably.d.ts --out docs/generated/default --readme docs/landing-pages/default.md && typedoc --entryPoints promises.d.ts --out docs/generated/promises --name \\"ably (Promise-based)\\" --readme docs/landing-pages/promises.md && cp docs/landing-pages/choose-library.html docs/generated/index.html"}}')},function(n,r){},function(n,r,o){(function(i,a){n.exports=a(o(6),o(32),o(25))})(this,function(i){return i.HmacSHA256})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(47)),v=i.__importDefault(o(15)),S=i.__importDefault(o(20)),T=i.__importDefault(o(4)),R=i.__importDefault(o(48)),C=function(){},O=function(){function y(d){this.rest=d,this.admin=new f(d)}return y}(),f=function(){function y(d){this.rest=d,this.deviceRegistrations=new E(d),this.channelSubscriptions=new P(d)}return y.prototype.publish=function(d,h,w){var c=this.rest,u=c.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,l=a.defaultPostHeaders(c.options,u),s={},g=a.mixin({recipient:d},h);if(typeof w!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);w=C}c.options.headers&&a.mixin(l,c.options.headers),c.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var p=a.encodeBody(g,u);v.default.post(c,"/push/publish",p,l,s,null,function(x){return w(x)})},y}(),E=function(){function y(d){this.rest=d}return y.prototype.save=function(d,h){var w=this.rest,c=m.default.fromValues(d),u=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,l=a.defaultPostHeaders(w.options,u),s={};if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);h=C}w.options.headers&&a.mixin(l,w.options.headers),w.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var g=a.encodeBody(c,u);v.default.put(w,"/push/deviceRegistrations/"+encodeURIComponent(d.id),g,l,s,null,function(p,x,D,N){h(p,p?void 0:m.default.fromResponseBody(x,N?void 0:u))})},y.prototype.get=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultGetHeaders(w.options,c),l=d.id||d;if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"get",arguments);h=C}if(typeof l!="string"||!l.length){h(new T.default("First argument to DeviceRegistrations#get must be a deviceId string or DeviceDetails",4e4,400));return}w.options.headers&&a.mixin(u,w.options.headers),v.default.get(w,"/push/deviceRegistrations/"+encodeURIComponent(l),u,{},null,function(s,g,p,x){h(s,s?void 0:m.default.fromResponseBody(g,x?void 0:c))})},y.prototype.list=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=this.rest.http.supportsLinkHeaders?void 0:c,l=a.defaultGetHeaders(w.options,c);if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);h=C}w.options.headers&&a.mixin(l,w.options.headers),new S.default(w,"/push/deviceRegistrations",l,u,function(s,g,p){return m.default.fromResponseBody(s,p?void 0:c)}).get(d,h)},y.prototype.remove=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultGetHeaders(w.options,c),l={},s=d.id||d;if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"remove",arguments);h=C}if(typeof s!="string"||!s.length){h(new T.default("First argument to DeviceRegistrations#remove must be a deviceId string or DeviceDetails",4e4,400));return}w.options.headers&&a.mixin(u,w.options.headers),w.options.pushFullWait&&a.mixin(l,{fullWait:"true"}),v.default.delete(w,"/push/deviceRegistrations/"+encodeURIComponent(s),u,l,null,function(g){return h(g)})},y.prototype.removeWhere=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultGetHeaders(w.options,c);if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);h=C}w.options.headers&&a.mixin(u,w.options.headers),w.options.pushFullWait&&a.mixin(d,{fullWait:"true"}),v.default.delete(w,"/push/deviceRegistrations",u,d,null,function(l){return h(l)})},y}(),P=function(){function y(d){this.remove=y.prototype.removeWhere,this.rest=d}return y.prototype.save=function(d,h){var w=this.rest,c=R.default.fromValues(d),u=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,l=a.defaultPostHeaders(w.options,u),s={};if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);h=C}w.options.headers&&a.mixin(l,w.options.headers),w.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var g=a.encodeBody(c,u);v.default.post(w,"/push/channelSubscriptions",g,l,s,null,function(p,x,D,N){h(p,!p&&R.default.fromResponseBody(x,N?void 0:u))})},y.prototype.list=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=this.rest.http.supportsLinkHeaders?void 0:c,l=a.defaultGetHeaders(w.options,c);if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);h=C}w.options.headers&&a.mixin(l,w.options.headers),new S.default(w,"/push/channelSubscriptions",l,u,function(s,g,p){return R.default.fromResponseBody(s,p?void 0:c)}).get(d,h)},y.prototype.removeWhere=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultGetHeaders(w.options,c);if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);h=C}w.options.headers&&a.mixin(u,w.options.headers),w.options.pushFullWait&&a.mixin(d,{fullWait:"true"}),v.default.delete(w,"/push/channelSubscriptions",u,d,null,function(l){return h(l)})},y.prototype.listChannels=function(d,h){var w=this.rest,c=w.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=this.rest.http.supportsLinkHeaders?void 0:c,l=a.defaultGetHeaders(w.options,c);if(typeof h!="function"){if(this.rest.options.promises)return a.promisify(this,"listChannels",arguments);h=C}w.options.headers&&a.mixin(l,w.options.headers),w.options.pushFullWait&&a.mixin(d,{fullWait:"true"}),new S.default(w,"/push/channels",l,u,function(s,g,p){for(var x=!p&&c?a.decodeBody(s,c):s,D=0;D<x.length;D++)x[D]=String(x[D]);return x}).get(d,h)},y}();r.default=O},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(4)),v;(function(R){R.Phone="phone",R.Tablet="tablet",R.Desktop="desktop",R.TV="tv",R.Watch="watch",R.Car="car",R.Embedded="embedded",R.Other="other"})(v||(v={}));var S;(function(R){R.Android="android",R.IOS="ios",R.Browser="browser"})(S||(S={}));var T=function(){function R(){}return R.prototype.toJSON=function(){var C,O,f;return{id:this.id,deviceSecret:this.deviceSecret,platform:this.platform,formFactor:this.formFactor,clientId:this.clientId,metadata:this.metadata,deviceIdentityToken:this.deviceIdentityToken,push:{recipient:(C=this.push)===null||C===void 0?void 0:C.recipient,state:(O=this.push)===null||O===void 0?void 0:O.state,error:(f=this.push)===null||f===void 0?void 0:f.error}}},R.prototype.toString=function(){var C,O,f,E,P="[DeviceDetails";return this.id&&(P+="; id="+this.id),this.platform&&(P+="; platform="+this.platform),this.formFactor&&(P+="; formFactor="+this.formFactor),this.clientId&&(P+="; clientId="+this.clientId),this.metadata&&(P+="; metadata="+this.metadata),this.deviceIdentityToken&&(P+="; deviceIdentityToken="+JSON.stringify(this.deviceIdentityToken)),!((C=this.push)===null||C===void 0)&&C.recipient&&(P+="; push.recipient="+JSON.stringify(this.push.recipient)),!((O=this.push)===null||O===void 0)&&O.state&&(P+="; push.state="+this.push.state),!((f=this.push)===null||f===void 0)&&f.error&&(P+="; push.error="+JSON.stringify(this.push.error)),!((E=this.push)===null||E===void 0)&&E.metadata&&(P+="; push.metadata="+this.push.metadata),P+="]",P},R.fromResponseBody=function(C,O){return O&&(C=a.decodeBody(C,O)),a.isArray(C)?R.fromValuesArray(C):R.fromValues(C)},R.fromValues=function(C){return C.error=C.error&&m.default.fromValues(C.error),Object.assign(new R,C)},R.fromValuesArray=function(C){for(var O=C.length,f=new Array(O),E=0;E<O;E++)f[E]=R.fromValues(C[E]);return f},R.toRequestBody=a.encodeBody,R}();r.default=T},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=function(){function v(){}return v.prototype.toJSON=function(){return{channel:this.channel,deviceId:this.deviceId,clientId:this.clientId}},v.prototype.toString=function(){var S="[PushChannelSubscription";return this.channel&&(S+="; channel="+this.channel),this.deviceId&&(S+="; deviceId="+this.deviceId),this.clientId&&(S+="; clientId="+this.clientId),S+="]",S},v.fromResponseBody=function(S,T){return T&&(S=a.decodeBody(S,T)),a.isArray(S)?v.fromValuesArray(S):v.fromValues(S)},v.fromValues=function(S){return Object.assign(new v,S)},v.fromValuesArray=function(S){for(var T=S.length,R=new Array(T),C=0;C<T;C++)R[C]=v.fromValues(S[C]);return R},v.toRequestBody=a.encodeBody,v}();r.default=m},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=function(){function w(c){this.count=c&&c.count||0,this.data=c&&c.data||0,this.uncompressedData=c&&c.uncompressedData||0,this.failed=c&&c.failed||0,this.refused=c&&c.refused||0}return w}(),v=function(w){i.__extends(c,w);function c(u){var l=w.call(this,u)||this;return u&&u.category&&(l.category={},a.forInOwnNonNullProperties(u.category,function(s){l.category[s]=new m(u.category[s])})),l}return c}(m),S=function(){function w(c){this.peak=c&&c.peak||0,this.min=c&&c.min||0,this.mean=c&&c.mean||0,this.opened=c&&c.opened||0,this.refused=c&&c.refused||0}return w}(),T=function(){function w(c){this.succeeded=c&&c.succeeded||0,this.failed=c&&c.failed||0,this.refused=c&&c.refused||0}return w}(),R=function(){function w(c){this.plain=new S(c&&c.plain),this.tls=new S(c&&c.tls),this.all=new S(c&&c.all)}return w}(),C=function(){function w(c){this.messages=new v(c&&c.messages),this.presence=new v(c&&c.presence),this.all=new v(c&&c.all)}return w}(),O=function(){function w(c){this.realtime=new C(c&&c.realtime),this.rest=new C(c&&c.rest),this.webhook=new C(c&&c.webhook),this.sharedQueue=new C(c&&c.sharedQueue),this.externalQueue=new C(c&&c.externalQueue),this.httpEvent=new C(c&&c.httpEvent),this.push=new C(c&&c.push),this.all=new C(c&&c.all)}return w}(),f=function(){function w(c){this.all=new C(c&&c.all),this.inbound=new O(c&&c.inbound),this.outbound=new O(c&&c.outbound)}return w}(),E=function(){function w(c){this.all=new C(c&&c.all),this.producerPaid=new f(c&&c.producerPaid),this.consumerPaid=new f(c&&c.consumerPaid)}return w}(),P=function(){function w(c){this.messages=c&&c.messages||0;var u=c&&c.notifications;this.notifications={invalid:u&&u.invalid||0,attempted:u&&u.attempted||0,successful:u&&u.successful||0,failed:u&&u.failed||0},this.directPublishes=c&&c.directPublishes||0}return w}(),y=function(){function w(c){this.succeeded=c&&c.succeeded||0,this.skipped=c&&c.skipped||0,this.failed=c&&c.failed||0}return w}(),d=function(){function w(c){var u=this;this.delta=void 0,c&&c.delta&&(this.delta={},a.forInOwnNonNullProperties(c.delta,function(l){u.delta[l]=new y(c.delta[l])}))}return w}(),h=function(w){i.__extends(c,w);function c(u){var l=w.call(this,u)||this;return l.persisted=new C(u&&u.persisted),l.connections=new R(u&&u.connections),l.channels=new S(u&&u.channels),l.apiRequests=new T(u&&u.apiRequests),l.tokenRequests=new T(u&&u.tokenRequests),l.xchgProducer=new E(u&&u.xchgProducer),l.xchgConsumer=new E(u&&u.xchgConsumer),l.push=new P(u&&u.pushStats),l.processed=new d(u&&u.processed),l.inProgress=u&&u.inProgress||void 0,l.unit=u&&u.unit||void 0,l.intervalId=u&&u.intervalId||void 0,l}return c.fromValues=function(u){return new c(u)},c}(f);r.default=h},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(30)),v=i.__importDefault(o(7)),S=i.__importDefault(o(2)),T=i.__importDefault(o(51)),R=i.__importDefault(o(38)),C=i.__importDefault(o(8)),O=i.__importDefault(o(4)),f=i.__importDefault(o(10)),E=i.__importDefault(o(35)),P=i.__importDefault(o(3)),y=i.__importDefault(o(9)),d=function(w){i.__extends(c,w);function c(u){var l=w.call(this,u)||this;return S.default.logAction(S.default.LOG_MINOR,"Realtime()",""),l.connection=new T.default(l,l.options),l.channels=new h(l),u.autoConnect!==!1&&l.connect(),l}return c.prototype.connect=function(){S.default.logAction(S.default.LOG_MINOR,"Realtime.connect()",""),this.connection.connect()},c.prototype.close=function(){S.default.logAction(S.default.LOG_MINOR,"Realtime.close()",""),this.connection.close()},c.Promise=function(u){return u=C.default.objectifyOptions(u),u.promises=!0,new c(u)},c.Callbacks=c,c.Utils=a,c.ConnectionManager=E.default,c.Platform=P.default,c.ProtocolMessage=f.default,c.Message=y.default,c}(m.default),h=function(w){i.__extends(c,w);function c(u){var l=w.call(this)||this;return l.realtime=u,l.all=Object.create(null),u.connection.connectionManager.on("transport.active",function(){l.onTransportActive()}),l}return c.prototype.channelSerials=function(){for(var u={},l=0,s=a.keysArray(this.all,!0);l<s.length;l++){var g=s[l],p=this.all[g];p.properties.channelSerial&&(u[g]=p.properties.channelSerial)}return u},c.prototype.recoverChannels=function(u){for(var l=0,s=a.keysArray(u,!0);l<s.length;l++){var g=s[l],p=this.get(g);p.properties.channelSerial=u[g]}},c.prototype.onChannelMessage=function(u){var l=u.channel;if(l===void 0){S.default.logAction(S.default.LOG_ERROR,"Channels.onChannelMessage()","received event unspecified channel, action = "+u.action);return}var s=this.all[l];if(!s){S.default.logAction(S.default.LOG_ERROR,"Channels.onChannelMessage()","received event for non-existent channel: "+l);return}s.onMessage(u)},c.prototype.onTransportActive=function(){for(var u in this.all){var l=this.all[u];l.state==="attaching"||l.state==="detaching"?l.checkPendingState():l.state==="suspended"?l._attach(!1,null):l.state==="attached"&&l.requestState("attaching")}},c.prototype.propogateConnectionInterruption=function(u,l){var s={closing:"detached",closed:"detached",failed:"failed",suspended:"suspended"},g=["attaching","attached","detaching","suspended"],p=s[u];for(var x in this.all){var D=this.all[x];a.arrIn(g,D.state)&&D.notifyState(p,l)}},c.prototype.get=function(u,l){u=String(u);var s=this.all[u];if(!s)s=this.all[u]=new R.default(this.realtime,u,l);else if(l){if(s._shouldReattachToSetOptions(l,s.channelOptions))throw new O.default("Channels.get() cannot be used to set channel options that would cause the channel to reattach. Please, use RealtimeChannel.setOptions() instead.",4e4,400);s.setOptions(l)}return s},c.prototype.getDerived=function(u,l,s){if(l.filter){var g=a.toBase64(l.filter),p=a.matchDerivedChannel(u);u="[filter=".concat(g).concat(p.qualifierParam,"]").concat(p.channelName)}return this.get(u,s)},c.prototype.release=function(u){u=String(u);var l=this.all[u];if(l){var s=l.getReleaseErr();if(s)throw s;delete this.all[u]}},c}(v.default);r.default=d},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(7)),v=i.__importDefault(o(35)),S=i.__importDefault(o(2)),T=i.__importDefault(o(37)),R=i.__importDefault(o(3));function C(){}var O=function(f){i.__extends(E,f);function E(P,y){var d=f.call(this)||this;return d.whenState=function(h,w){return m.default.prototype.whenState.call(d,h,d.state,w,new T.default(void 0,h))},d.ably=P,d.connectionManager=new v.default(P,y),d.state=d.connectionManager.state.state,d.key=void 0,d.id=void 0,d.errorReason=null,d.connectionManager.on("connectionstate",function(h){var w=d.state=h.current;R.default.Config.nextTick(function(){d.emit(w,h)})}),d.connectionManager.on("update",function(h){R.default.Config.nextTick(function(){d.emit("update",h)})}),d}return E.prototype.connect=function(){S.default.logAction(S.default.LOG_MINOR,"Connection.connect()",""),this.connectionManager.requestState({state:"connecting"})},E.prototype.ping=function(P){if(S.default.logAction(S.default.LOG_MINOR,"Connection.ping()",""),!P){if(this.ably.options.promises)return a.promisify(this,"ping",arguments);P=C}this.connectionManager.ping(null,P)},E.prototype.close=function(){S.default.logAction(S.default.LOG_MINOR,"Connection.close()","connectionKey = "+this.key),this.connectionManager.requestState({state:"closing"})},Object.defineProperty(E.prototype,"recoveryKey",{get:function(){return this.createRecoveryKey()},enumerable:!1,configurable:!0}),E.prototype.createRecoveryKey=function(){return this.connectionManager.createRecoveryKey()},E}(m.default);r.default=O},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.PendingMessage=void 0;var i=o(0),a=i.__importDefault(o(10)),m=i.__importStar(o(1)),v=i.__importDefault(o(7)),S=i.__importDefault(o(2)),T=i.__importDefault(o(36)),R=i.__importDefault(o(4)),C=a.default.Action,O=function(){function E(P,y){this.message=P,this.callback=y,this.merged=!1;var d=P.action;this.sendAttempted=!1,this.ackRequired=d==C.MESSAGE||d==C.PRESENCE}return E}();r.PendingMessage=O;var f=function(E){i.__extends(P,E);function P(y){var d=E.call(this)||this;return d.transport=y,d.messageQueue=new T.default,y.on("ack",function(h,w){d.onAck(h,w)}),y.on("nack",function(h,w,c){d.onNack(h,w,c)}),d}return P.prototype.onAck=function(y,d){S.default.logAction(S.default.LOG_MICRO,"Protocol.onAck()","serial = "+y+"; count = "+d),this.messageQueue.completeMessages(y,d)},P.prototype.onNack=function(y,d,h){S.default.logAction(S.default.LOG_ERROR,"Protocol.onNack()","serial = "+y+"; count = "+d+"; err = "+m.inspectError(h)),h||(h=new R.default("Unable to send message; channel not responding",50001,500)),this.messageQueue.completeMessages(y,d,h)},P.prototype.onceIdle=function(y){var d=this.messageQueue;if(d.count()===0){y();return}d.once("idle",y)},P.prototype.send=function(y){y.ackRequired&&this.messageQueue.push(y),S.default.shouldLog(S.default.LOG_MICRO)&&S.default.logAction(S.default.LOG_MICRO,"Protocol.send()","sending msg; "+a.default.stringify(y.message)),y.sendAttempted=!0,this.transport.send(y.message)},P.prototype.getTransport=function(){return this.transport},P.prototype.getPendingMessages=function(){return this.messageQueue.copyAll()},P.prototype.clearPendingMessages=function(){return this.messageQueue.clear()},P.prototype.finish=function(){var y=this.transport;this.onceIdle(function(){y.disconnect()})},P}(v.default);r.default=f},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(3)),m=i.__importStar(o(1)),v=i.__importDefault(o(26)),S=i.__importDefault(o(8)),T=i.__importDefault(o(2)),R=i.__importDefault(o(10)),C=i.__importDefault(o(4)),O="web_socket";function f(y){return!!y.on}var E=function(y){i.__extends(d,y);function d(h,w,c){var u=y.call(this,h,w,c)||this;return u.shortName=O,c.heartbeats=a.default.Config.useProtocolHeartbeats,u.wsHost=S.default.getHost(c.options,c.host,!0),u}return d.isAvailable=function(){return!!a.default.Config.WebSocket},d.prototype.createWebSocket=function(h,w){return this.uri=h+m.toQueryString(w),new a.default.Config.WebSocket(this.uri)},d.prototype.toString=function(){return"WebSocketTransport; uri="+this.uri},d.prototype.connect=function(){T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.connect()","starting"),v.default.prototype.connect.call(this);var h=this,w=this.params,c=w.options,u=c.tls?"wss://":"ws://",l=u+this.wsHost+":"+S.default.getPort(c)+"/";T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.connect()","uri: "+l),this.auth.getAuthParams(function(s,g){if(!h.isDisposed){var p="";for(var x in g)p+=" "+x+": "+g[x]+";";if(T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.connect()","authParams:"+p+" err: "+s),s){h.disconnect(s);return}var D=w.getConnectParams(g);try{var N=h.wsConnection=h.createWebSocket(l,D);N.binaryType=a.default.Config.binaryType,N.onopen=function(){h.onWsOpen()},N.onclose=function(k){h.onWsClose(k)},N.onmessage=function(k){h.onWsData(k.data)},N.onerror=function(k){h.onWsError(k)},f(N)&&N.on("ping",function(){h.onActivity()})}catch(k){T.default.logAction(T.default.LOG_ERROR,"WebSocketTransport.connect()","Unexpected exception creating websocket: err = "+(k.stack||k.message)),h.disconnect(k)}}})},d.prototype.send=function(h){var w=this.wsConnection;if(!w){T.default.logAction(T.default.LOG_ERROR,"WebSocketTransport.send()","No socket connection");return}try{w.send(R.default.serialize(h,this.params.format))}catch(u){var c="Exception from ws connection when trying to send: "+m.inspectError(u);T.default.logAction(T.default.LOG_ERROR,"WebSocketTransport.send()",c),this.finish("disconnected",new C.default(c,5e4,500))}},d.prototype.onWsData=function(h){T.default.logAction(T.default.LOG_MICRO,"WebSocketTransport.onWsData()","data received; length = "+h.length+"; type = "+typeof h);try{this.onProtocolMessage(R.default.deserialize(h,this.format))}catch(w){T.default.logAction(T.default.LOG_ERROR,"WebSocketTransport.onWsData()","Unexpected exception handing channel message: "+w.stack)}},d.prototype.onWsOpen=function(){T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.onWsOpen()","opened WebSocket"),this.emit("preconnect")},d.prototype.onWsClose=function(h){var w,c;if(typeof h=="object"?(c=h.code,w=h.wasClean||c===1e3):(c=h,w=c==1e3),delete this.wsConnection,w){T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.onWsClose()","Cleanly closed WebSocket");var u=new C.default("Websocket closed",80003,400);this.finish("disconnected",u)}else{var l="Unclean disconnection of WebSocket ; code = "+c,u=new C.default(l,80003,400);T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.onWsClose()",l),this.finish("disconnected",u)}this.emit("disposed")},d.prototype.onWsError=function(h){var w=this;T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.onError()","Error from WebSocket: "+h.message),a.default.Config.nextTick(function(){w.disconnect(Error(h.message))})},d.prototype.dispose=function(){T.default.logAction(T.default.LOG_MINOR,"WebSocketTransport.dispose()",""),this.isDisposed=!0;var h=this.wsConnection;h&&(h.onmessage=function(){},delete this.wsConnection,a.default.Config.nextTick(function(){if(T.default.logAction(T.default.LOG_MICRO,"WebSocketTransport.dispose()","closing websocket"),!h)throw new Error("WebSocketTransport.dispose(): wsConnection is not defined");h.close()}))},d}(v.default);function P(y){return E.isAvailable()&&(y.supportedTransports[O]=E),E}r.default=P},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),m=i.__importDefault(o(34)),v=i.__importDefault(o(7)),S=i.__importDefault(o(2)),T=i.__importDefault(o(16)),R=i.__importStar(o(4)),C=i.__importDefault(o(38)),O=i.__importDefault(o(24)),f=i.__importDefault(o(39)),E=function(){};function P(u){return u.channel.realtime.auth.clientId}function y(u){var l=u.channel.realtime,s=l.auth.clientId;return(!s||s==="*")&&l.connection.state==="connected"}function d(u,l,s){switch(u.state){case"attached":case"suspended":s();break;case"initialized":case"detached":case"detaching":case"attaching":u.attach(function(g){g?l(g):s()});break;default:l(R.default.fromValues(u.invalidStateError()))}}function h(u,l){if(u.isSynthesized()||l.isSynthesized())return u.timestamp>=l.timestamp;var s=u.parseId(),g=l.parseId();return s.msgSerial===g.msgSerial?s.index>g.index:s.msgSerial>g.msgSerial}var w=function(u){i.__extends(l,u);function l(s){var g=u.call(this,s)||this;return g.channel=s,g.syncComplete=!1,g.members=new c(g,function(p){return p.clientId+":"+p.connectionId}),g._myMembers=new c(g,function(p){return p.clientId}),g.subscriptions=new v.default,g.pendingPresence=[],g}return l.prototype.enter=function(s,g){if(y(this))throw new R.default("clientId must be specified to enter a presence channel",40012,400);return this._enterOrUpdateClient(void 0,void 0,s,"enter",g)},l.prototype.update=function(s,g){if(y(this))throw new R.default("clientId must be specified to update presence data",40012,400);return this._enterOrUpdateClient(void 0,void 0,s,"update",g)},l.prototype.enterClient=function(s,g,p){return this._enterOrUpdateClient(void 0,s,g,"enter",p)},l.prototype.updateClient=function(s,g,p){return this._enterOrUpdateClient(void 0,s,g,"update",p)},l.prototype._enterOrUpdateClient=function(s,g,p,x,D){var N=this;if(!D)if(typeof p=="function")D=p,p=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"_enterOrUpdateClient",[s,g,p,x]);D=E}var k=this.channel;if(!k.connectionManager.activeState()){D(k.connectionManager.getError());return}S.default.logAction(S.default.LOG_MICRO,"RealtimePresence."+x+"Client()","channel = "+k.name+", id = "+s+", client = "+(g||"(implicit) "+P(this)));var I=T.default.fromData(p);I.action=x,s&&(I.id=s),g&&(I.clientId=g),T.default.encode(I,k.channelOptions,function(M){if(M){D(M);return}switch(k.state){case"attached":k.sendPresence(I,D);break;case"initialized":case"detached":k.attach();case"attaching":N.pendingPresence.push({presence:I,callback:D});break;default:M=new R.PartialErrorInfo("Unable to "+x+" presence channel while in "+k.state+" state",90001),M.code=90001,D(M)}})},l.prototype.leave=function(s,g){if(y(this))throw new R.default("clientId must have been specified to enter or leave a presence channel",40012,400);return this.leaveClient(void 0,s,g)},l.prototype.leaveClient=function(s,g,p){if(!p)if(typeof g=="function")p=g,g=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"leaveClient",[s,g]);p=E}var x=this.channel;if(!x.connectionManager.activeState()){p==null||p(x.connectionManager.getError());return}S.default.logAction(S.default.LOG_MICRO,"RealtimePresence.leaveClient()","leaving; channel = "+this.channel.name+", client = "+s);var D=T.default.fromData(g);switch(D.action="leave",s&&(D.clientId=s),x.state){case"attached":x.sendPresence(D,p);break;case"attaching":this.pendingPresence.push({presence:D,callback:p});break;case"initialized":case"failed":{var N=new R.PartialErrorInfo("Unable to leave presence channel (incompatible state)",90001);p==null||p(N);break}default:p==null||p(x.invalidStateError())}},l.prototype.get=function(s,g){var p=this,x=Array.prototype.slice.call(arguments);x.length==1&&typeof x[0]=="function"&&x.unshift(null),s=x[0],g=x[1];var D=!s||("waitForSync"in s?s.waitForSync:!0);if(!g){if(this.channel.realtime.options.promises)return a.promisify(this,"get",x);g=E}function N(k){g(null,s?k.list(s):k.values())}if(this.channel.state==="suspended"){D?g(R.default.fromValues({statusCode:400,code:91005,message:"Presence state is out of sync due to channel being in the SUSPENDED state"})):N(this.members);return}d(this.channel,g,function(){var k=p.members;D?k.waitSync(function(){N(k)}):N(k)})},l.prototype.history=function(s,g){if(S.default.logAction(S.default.LOG_MICRO,"RealtimePresence.history()","channel = "+this.name),g===void 0)if(typeof s=="function")g=s,s=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"history",arguments);g=E}s&&s.untilAttach&&(this.channel.state==="attached"?(delete s.untilAttach,s.from_serial=this.channel.properties.attachSerial):g(new R.default("option untilAttach requires the channel to be attached, was: "+this.channel.state,4e4,400))),m.default.prototype._history.call(this,s,g)},l.prototype.setPresence=function(s,g,p){S.default.logAction(S.default.LOG_MICRO,"RealtimePresence.setPresence()","received presence for "+s.length+" participants; syncChannelSerial = "+p);var x,D,N=this.members,k=this._myMembers,I=[],M=this.channel.connectionManager.connectionId;g&&(this.members.startSync(),p&&(D=p.match(/^[\w-]+:(.*)$/))&&(x=D[1]));for(var A=0;A<s.length;A++){var j=T.default.fromValues(s[A]);switch(j.action){case"leave":N.remove(j)&&I.push(j),j.connectionId===M&&!j.isSynthesized()&&k.remove(j);break;case"enter":case"present":case"update":N.put(j)&&I.push(j),j.connectionId===M&&k.put(j);break}}g&&!x&&(N.endSync(),this.channel.syncChannelSerial=null);for(var A=0;A<I.length;A++){var j=I[A];this.subscriptions.emit(j.action,j)}},l.prototype.onAttached=function(s){S.default.logAction(S.default.LOG_MINOR,"RealtimePresence.onAttached()","channel = "+this.channel.name+", hasPresence = "+s),s?this.members.startSync():(this._synthesizeLeaves(this.members.values()),this.members.clear()),this._ensureMyMembersPresent();var g=this.pendingPresence,p=g.length;if(p){this.pendingPresence=[];var x=[],D=O.default.create();S.default.logAction(S.default.LOG_MICRO,"RealtimePresence.onAttached","sending "+p+" queued presence messages");for(var N=0;N<p;N++){var k=g[N];x.push(k.presence),D.push(k.callback)}this.channel.sendPresence(x,D)}},l.prototype.actOnChannelState=function(s,g,p){switch(s){case"attached":this.onAttached(g);break;case"detached":case"failed":this._clearMyMembers(),this.members.clear();case"suspended":this.failPendingPresence(p);break}},l.prototype.failPendingPresence=function(s){if(this.pendingPresence.length){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.failPendingPresence","channel; name = "+this.channel.name+", err = "+a.inspectError(s));for(var g=0;g<this.pendingPresence.length;g++)try{this.pendingPresence[g].callback(s)}catch(p){}this.pendingPresence=[]}},l.prototype._clearMyMembers=function(){this._myMembers.clear()},l.prototype._ensureMyMembersPresent=function(){var s=this,g=this._myMembers,p=function(N){if(N){var k="Presence auto-re-enter failed: "+N.toString(),I=new R.default(k,91004,400);S.default.logAction(S.default.LOG_ERROR,"RealtimePresence._ensureMyMembersPresent()",k);var M=new f.default(s.channel.state,s.channel.state,!0,!1,I);s.channel.emit("update",M)}};for(var x in g.map){var D=g.map[x];S.default.logAction(S.default.LOG_MICRO,"RealtimePresence._ensureMyMembersPresent()",'Auto-reentering clientId "'+D.clientId+'" into the presence set'),this._enterOrUpdateClient(D.id,D.clientId,D.data,"enter",p)}},l.prototype._synthesizeLeaves=function(s){var g=this.subscriptions;a.arrForEach(s,function(p){var x=T.default.fromValues({action:"leave",connectionId:p.connectionId,clientId:p.clientId,data:p.data,encoding:p.encoding,timestamp:a.now()});g.emit("leave",x)})},l.prototype.on=function(){for(var s=[],g=0;g<arguments.length;g++)s[g]=arguments[g];S.default.renamedMethod("RealtimePresence","on","subscribe"),this.subscribe.apply(this,s)},l.prototype.off=function(){for(var s=[],g=0;g<arguments.length;g++)s[g]=arguments[g];S.default.renamedMethod("RealtimePresence","off","unsubscribe"),this.unsubscribe.apply(this,s)},l.prototype.subscribe=function(){for(var s=[],g=0;g<arguments.length;g++)s[g]=arguments[g];var p=C.default.processListenerArgs(s),x=p[0],D=p[1],N=p[2],k=this.channel;if(!N){if(this.channel.realtime.options.promises)return a.promisify(this,"subscribe",[x,D]);N=E}if(k.state==="failed"){N(R.default.fromValues(k.invalidStateError()));return}this.subscriptions.on(x,D),k.attach(N)},l.prototype.unsubscribe=function(){for(var s=[],g=0;g<arguments.length;g++)s[g]=arguments[g];var p=C.default.processListenerArgs(s),x=p[0],D=p[1];this.subscriptions.off(x,D)},l}(m.default),c=function(u){i.__extends(l,u);function l(s,g){var p=u.call(this)||this;return p.presence=s,p.map=Object.create(null),p.syncInProgress=!1,p.residualMembers=null,p.memberKey=g,p}return l.prototype.get=function(s){return this.map[s]},l.prototype.getClient=function(s){var g=this.map,p=[];for(var x in g){var D=g[x];D.clientId==s&&D.action!="absent"&&p.push(D)}return p},l.prototype.list=function(s){var g=this.map,p=s&&s.clientId,x=s&&s.connectionId,D=[];for(var N in g){var k=g[N];k.action!=="absent"&&(p&&p!=k.clientId||x&&x!=k.connectionId||D.push(k))}return D},l.prototype.put=function(s){(s.action==="enter"||s.action==="update")&&(s=T.default.fromValues(s),s.action="present");var g=this.map,p=this.memberKey(s);this.residualMembers&&delete this.residualMembers[p];var x=g[p];return x&&!h(s,x)?!1:(g[p]=s,!0)},l.prototype.values=function(){var s=this.map,g=[];for(var p in s){var x=s[p];x.action!="absent"&&g.push(x)}return g},l.prototype.remove=function(s){var g=this.map,p=this.memberKey(s),x=g[p];return x&&!h(s,x)?!1:(this.syncInProgress?(s=T.default.fromValues(s),s.action="absent",g[p]=s):delete g[p],!0)},l.prototype.startSync=function(){var s=this.map,g=this.syncInProgress;S.default.logAction(S.default.LOG_MINOR,"PresenceMap.startSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+g),this.syncInProgress||(this.residualMembers=a.copy(s),this.setInProgress(!0))},l.prototype.endSync=function(){var s=this.map,g=this.syncInProgress;if(S.default.logAction(S.default.LOG_MINOR,"PresenceMap.endSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+g),g){for(var p in s){var x=s[p];x.action==="absent"&&delete s[p]}this.presence._synthesizeLeaves(a.valuesArray(this.residualMembers));for(var p in this.residualMembers)delete s[p];this.residualMembers=null,this.setInProgress(!1)}this.emit("sync")},l.prototype.waitSync=function(s){var g=this.syncInProgress;if(S.default.logAction(S.default.LOG_MINOR,"PresenceMap.waitSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+g),!g){s();return}this.once("sync",s)},l.prototype.clear=function(){this.map={},this.setInProgress(!1),this.residualMembers=null},l.prototype.setInProgress=function(s){S.default.logAction(S.default.LOG_MICRO,"PresenceMap.setInProgress()","inProgress = "+s),this.syncInProgress=s,this.presence.syncComplete=!s},l}(v.default);r.default=w},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=o(56),m=o(31),v=o(11),S=i.__importDefault(o(5)),T=i.__importDefault(o(3)),R=function(){function C(){this.base64CharSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",this.hexCharSet="0123456789abcdef"}return C.prototype.isWordArray=function(O){return O!=null&&O.sigBytes!==void 0},C.prototype.isArrayBuffer=function(O){return O!=null&&O.constructor===ArrayBuffer},C.prototype.isTypedArray=function(O){return!!ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(O)},C.prototype.uint8ViewToBase64=function(O){for(var f="",E=this.base64CharSet,P=O.byteLength,y=P%3,d=P-y,h,w,c,u,l,s=0;s<d;s=s+3)l=O[s]<<16|O[s+1]<<8|O[s+2],h=(l&16515072)>>18,w=(l&258048)>>12,c=(l&4032)>>6,u=l&63,f+=E[h]+E[w]+E[c]+E[u];return y==1?(l=O[d],h=(l&252)>>2,w=(l&3)<<4,f+=E[h]+E[w]+"=="):y==2&&(l=O[d]<<8|O[d+1],h=(l&64512)>>10,w=(l&1008)>>4,c=(l&15)<<2,f+=E[h]+E[w]+E[c]+"="),f},C.prototype.base64ToArrayBuffer=function(O){for(var f=atob==null?void 0:atob(O),E=f.length,P=new Uint8Array(E),y=0;y<E;y++){var d=f.charCodeAt(y);P[y]=d}return P.buffer},C.prototype.isBuffer=function(O){return this.isArrayBuffer(O)||this.isWordArray(O)||this.isTypedArray(O)},C.prototype.toBuffer=function(O){if(!ArrayBuffer)throw new Error("Can't convert to Buffer: browser does not support the necessary types");if(this.isArrayBuffer(O))return new Uint8Array(O);if(this.isTypedArray(O))return new Uint8Array(O.buffer);if(this.isWordArray(O)){for(var f=new ArrayBuffer(O.sigBytes),E=new Uint8Array(f),P=0;P<O.sigBytes;P++)E[P]=O.words[P>>>2]>>>24-P%4*8&255;return E}throw new Error("BufferUtils.toBuffer expected an arraybuffer, typed array, or CryptoJS wordarray")},C.prototype.toArrayBuffer=function(O){return this.isArrayBuffer(O)?O:this.toBuffer(O).buffer},C.prototype.toWordArray=function(O){return this.isTypedArray(O)&&(O=O.buffer),this.isWordArray(O)?O:S.default.create(O)},C.prototype.base64Encode=function(O){return this.isWordArray(O)?(0,v.stringify)(O):this.uint8ViewToBase64(this.toBuffer(O))},C.prototype.base64Decode=function(O){return ArrayBuffer&&T.default.Config.atob?this.base64ToArrayBuffer(O):(0,v.parse)(O)},C.prototype.hexEncode=function(O){return(0,a.stringify)(this.toWordArray(O))},C.prototype.hexDecode=function(O){var f=(0,a.parse)(O);return ArrayBuffer?this.toArrayBuffer(f):f},C.prototype.utf8Encode=function(O){return T.default.Config.TextEncoder?new T.default.Config.TextEncoder().encode(O).buffer:(0,m.parse)(O)},C.prototype.utf8Decode=function(O){if(!this.isBuffer(O))throw new Error("Expected input of utf8decode to be an arraybuffer, typed array, or CryptoJS wordarray");return TextDecoder&&!this.isWordArray(O)?new TextDecoder().decode(O):(O=this.toWordArray(O),(0,m.stringify)(O))},C.prototype.bufferCompare=function(O,f){if(!O)return-1;if(!f)return 1;var E=this.toWordArray(O),P=this.toWordArray(f);E.clamp(),P.clamp();var y=E.sigBytes-P.sigBytes;if(y!=0)return y;for(var d=E.words,h=P.words,w=0;w<d.length;w++)if(y=d[w]-h[w],y!=0)return y;return 0},C.prototype.byteLength=function(O){return this.isArrayBuffer(O)||this.isTypedArray(O)?O.byteLength:this.isWordArray(O)?O.sigBytes:-1},C.prototype.typedArrayToBuffer=function(O){return O.buffer},C}();r.default=new R},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return i.enc.Hex})},function(n,r,o){o.r(r);var i=o(5),a=o.n(i),m=o(11),v=o(23),S=o.n(v),T=o(2),R=o.n(T),C=o(4),O=o.n(C),f=function(E,P){var y="aes",d=256,h="cbc",w=16,c=4,u=4294967296,l=2147483648,s;if(E.getRandomWordArray)s=E.getRandomWordArray;else if(typeof Uint32Array!="undefined"&&E.getRandomValues){var g=new Uint32Array(c);s=function(A,j){var U=A/4,z=U==c?g:new Uint32Array(U);E.getRandomValues(z,function(W){typeof j!="undefined"&&j(W,P.toWordArray(z))})}}else s=function(A,j){R.a.logAction(R.a.LOG_MAJOR,"Ably.Crypto.generateRandom()","Warning: the browser you are using does not support secure cryptographically secure randomness generation; falling back to insecure Math.random()");for(var U=A/4,z=new Array(U),W=0;W<U;W++)z[W]=Math.floor(Math.random()*u)-l;j(null,a.a.create(z))};function p(A){return A+w&-16}function x(A){if(A.algorithm==="aes"&&A.mode==="cbc"){if(A.keyLength===128||A.keyLength===256)return;throw new Error("Unsupported key length "+A.keyLength+" for aes-cbc encryption. Encryption key must be 128 or 256 bits (16 or 32 ASCII characters)")}}function D(A){return A.replace("_","/").replace("-","+")}var N=[a.a.create([269488144,269488144,269488144,269488144],16),a.a.create([16777216],1),a.a.create([33685504],2),a.a.create([50529024],3),a.a.create([67372036],4),a.a.create([84215045,83886080],5),a.a.create([101058054,101056512],6),a.a.create([117901063,117901056],7),a.a.create([134744072,134744072],8),a.a.create([151587081,151587081,150994944],9),a.a.create([168430090,168430090,168427520],10),a.a.create([185273099,185273099,185273088],11),a.a.create([202116108,202116108,202116108],12),a.a.create([218959117,218959117,218959117,218103808],13),a.a.create([235802126,235802126,235802126,235798528],14),a.a.create([252645135,252645135,252645135,252645135],15),a.a.create([269488144,269488144,269488144,269488144],16)];function k(){}function I(){this.algorithm=null,this.keyLength=null,this.mode=null,this.key=null}k.CipherParams=I,k.getDefaultParams=function(A){var j;if(typeof A=="function"||typeof A=="string"){if(R.a.deprecated("The ability to pass a callback to `Crypto.getDefaultParams()`","This method now directly returns its result, instead of returning it asynchronously via a callback. Please update your code so that it uses the return value of this method instead of passing a callback."),typeof A=="function")R.a.deprecated("The ability to call `Crypto.getDefaultParams()` without specifying an encryption key","Please update your code so that it instead passes an object whose `key` property contains an encryption key. That is, replace `Crypto.getDefaultParams()` with `Crypto.getDefaultParams({ key })`, where `key` is an encryption key that you have generated (for example from the `Crypto.generateRandomKey()` method)."),k.generateRandomKey(function(z){A(null,k.getDefaultParams({key:z}))});else if(typeof arguments[1]=="function")R.a.deprecated("The ability to pass the encryption key as the first argument of `Crypto.getDefaultParams()`","Please update your code so that it instead passes an object whose `key` property contains the key. That is, replace `Crypto.getDefaultParams(key)` with `Crypto.getDefaultParams({ key })`."),arguments[1](null,k.getDefaultParams({key:A}));else throw new Error("Invalid arguments for Crypto.getDefaultParams");return}if(!A.key)throw new Error("Crypto.getDefaultParams: a key is required");typeof A.key=="string"?j=Object(m.parse)(D(A.key)):j=P.toWordArray(A.key);var U=new I;if(U.key=j,U.algorithm=A.algorithm||y,U.keyLength=j.words.length*(4*8),U.mode=A.mode||h,A.keyLength&&A.keyLength!==U.keyLength)throw new Error("Crypto.getDefaultParams: a keyLength of "+A.keyLength+" was specified, but the key actually has length "+U.keyLength);return x(U),U},k.generateRandomKey=function(A,j){arguments.length==1&&typeof A=="function"&&(j=A,A=void 0),s((A||d)/8,function(U,z){j!==void 0&&j(U?O.a.fromValues(U):null,z)})},k.getCipher=function(A){var j=A instanceof I?A:k.getDefaultParams(A);return{cipherParams:j,cipher:new M(j,c,A.iv)}};function M(A,j,U){this.algorithm=A.algorithm+"-"+String(A.keyLength)+"-"+A.mode,this.cjsAlgorithm=A.algorithm.toUpperCase().replace(/-\d+$/,""),this.key=P.toWordArray(A.key),U&&(this.iv=P.toWordArray(U).clone()),this.blockLengthWords=j}return M.prototype.encrypt=function(A,j){R.a.logAction(R.a.LOG_MICRO,"CBCCipher.encrypt()",""),A=P.toWordArray(A);var U=A.sigBytes,z=p(U),W=this,G=function(){W.getIv(function(F,b){if(F){j(F);return}var L=W.encryptCipher.process(A.concat(N[z-U])),B=b.concat(L);j(null,B)})};this.encryptCipher?G():this.iv?(this.encryptCipher=S.a.algo[this.cjsAlgorithm].createEncryptor(this.key,{iv:this.iv}),G()):s(w,function(F,b){if(F){j(F);return}W.encryptCipher=S.a.algo[W.cjsAlgorithm].createEncryptor(W.key,{iv:b}),W.iv=b,G()})},M.prototype.decrypt=function(A){R.a.logAction(R.a.LOG_MICRO,"CBCCipher.decrypt()",""),A=P.toWordArray(A);var j=this.blockLengthWords,U=A.words,z=a.a.create(U.slice(0,j)),W=a.a.create(U.slice(j)),G=S.a.algo[this.cjsAlgorithm].createDecryptor(this.key,{iv:z}),F=G.process(W),b=G.finalize();return G.reset(),b&&b.sigBytes&&F.concat(b),F},M.prototype.getIv=function(A){if(this.iv){var j=this.iv;this.iv=null,A(null,j);return}var U=this;s(w,function(z,W){if(z){A(z);return}A(null,U.encryptCipher.process(W))})},k};r.default=f},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){var a=i,m=a.lib,v=m.WordArray,S=a.enc;S.Utf16=S.Utf16BE={stringify:function(R){for(var C=R.words,O=R.sigBytes,f=[],E=0;E<O;E+=2){var P=C[E>>>2]>>>16-E%4*8&65535;f.push(String.fromCharCode(P))}return f.join("")},parse:function(R){for(var C=R.length,O=[],f=0;f<C;f++)O[f>>>1]|=R.charCodeAt(f)<<16-f%2*16;return v.create(O,C*2)}},S.Utf16LE={stringify:function(R){for(var C=R.words,O=R.sigBytes,f=[],E=0;E<O;E+=2){var P=T(C[E>>>2]>>>16-E%4*8&65535);f.push(String.fromCharCode(P))}return f.join("")},parse:function(R){for(var C=R.length,O=[],f=0;f<C;f++)O[f>>>1]|=T(R.charCodeAt(f)<<16-f%2*16);return v.create(O,C*2)}};function T(R){return R<<8&4278255360|R>>>8&16711935}}(),i.enc.Utf16})},function(n,r,o){(function(i,a){n.exports=a(o(6),o(28))})(this,function(i){return function(a){var m=i,v=m.lib,S=v.CipherParams,T=m.enc,R=T.Hex,C=m.format;C.Hex={stringify:function(O){return O.ciphertext.toString(R)},parse:function(O){var f=R.parse(O);return S.create({ciphertext:f})}}}(),i.format.Hex})},function(n,r,o){(function(i,a){n.exports=a(o(6),o(11),o(61),o(27),o(28))})(this,function(i){return function(){var a=i,m=a.lib,v=m.BlockCipher,S=a.algo,T=[],R=[],C=[],O=[],f=[],E=[],P=[],y=[],d=[],h=[];(function(){for(var u=[],l=0;l<256;l++)l<128?u[l]=l<<1:u[l]=l<<1^283;for(var s=0,g=0,l=0;l<256;l++){var p=g^g<<1^g<<2^g<<3^g<<4;p=p>>>8^p&255^99,T[s]=p,R[p]=s;var x=u[s],D=u[x],N=u[D],k=u[p]*257^p*16843008;C[s]=k<<24|k>>>8,O[s]=k<<16|k>>>16,f[s]=k<<8|k>>>24,E[s]=k;var k=N*16843009^D*65537^x*257^s*16843008;P[p]=k<<24|k>>>8,y[p]=k<<16|k>>>16,d[p]=k<<8|k>>>24,h[p]=k,s?(s=x^u[u[u[N^x]]],g^=u[u[g]]):s=g=1}})();var w=[0,1,2,4,8,16,32,64,128,27,54],c=S.AES=v.extend({_doReset:function(){var u;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var l=this._keyPriorReset=this._key,s=l.words,g=l.sigBytes/4,p=this._nRounds=g+6,x=(p+1)*4,D=this._keySchedule=[],N=0;N<x;N++)N<g?D[N]=s[N]:(u=D[N-1],N%g?g>6&&N%g==4&&(u=T[u>>>24]<<24|T[u>>>16&255]<<16|T[u>>>8&255]<<8|T[u&255]):(u=u<<8|u>>>24,u=T[u>>>24]<<24|T[u>>>16&255]<<16|T[u>>>8&255]<<8|T[u&255],u^=w[N/g|0]<<24),D[N]=D[N-g]^u);for(var k=this._invKeySchedule=[],I=0;I<x;I++){var N=x-I;if(I%4)var u=D[N];else var u=D[N-4];I<4||N<=4?k[I]=u:k[I]=P[T[u>>>24]]^y[T[u>>>16&255]]^d[T[u>>>8&255]]^h[T[u&255]]}}},encryptBlock:function(u,l){this._doCryptBlock(u,l,this._keySchedule,C,O,f,E,T)},decryptBlock:function(u,l){var s=u[l+1];u[l+1]=u[l+3],u[l+3]=s,this._doCryptBlock(u,l,this._invKeySchedule,P,y,d,h,R);var s=u[l+1];u[l+1]=u[l+3],u[l+3]=s},_doCryptBlock:function(u,l,s,g,p,x,D,N){for(var k=this._nRounds,I=u[l]^s[0],M=u[l+1]^s[1],A=u[l+2]^s[2],j=u[l+3]^s[3],U=4,z=1;z<k;z++){var W=g[I>>>24]^p[M>>>16&255]^x[A>>>8&255]^D[j&255]^s[U++],G=g[M>>>24]^p[A>>>16&255]^x[j>>>8&255]^D[I&255]^s[U++],F=g[A>>>24]^p[j>>>16&255]^x[I>>>8&255]^D[M&255]^s[U++],b=g[j>>>24]^p[I>>>16&255]^x[M>>>8&255]^D[A&255]^s[U++];I=W,M=G,A=F,j=b}var W=(N[I>>>24]<<24|N[M>>>16&255]<<16|N[A>>>8&255]<<8|N[j&255])^s[U++],G=(N[M>>>24]<<24|N[A>>>16&255]<<16|N[j>>>8&255]<<8|N[I&255])^s[U++],F=(N[A>>>24]<<24|N[j>>>16&255]<<16|N[I>>>8&255]<<8|N[M&255])^s[U++],b=(N[j>>>24]<<24|N[I>>>16&255]<<16|N[M>>>8&255]<<8|N[A&255])^s[U++];u[l]=W,u[l+1]=G,u[l+2]=F,u[l+3]=b},keySize:256/32});a.AES=v._createHelper(c)}(),i.AES})},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(a){var m=i,v=m.lib,S=v.WordArray,T=v.Hasher,R=m.algo,C=[];(function(){for(var d=0;d<64;d++)C[d]=a.abs(a.sin(d+1))*4294967296|0})();var O=R.MD5=T.extend({_doReset:function(){this._hash=new S.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(d,h){for(var w=0;w<16;w++){var c=h+w,u=d[c];d[c]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360}var l=this._hash.words,s=d[h+0],g=d[h+1],p=d[h+2],x=d[h+3],D=d[h+4],N=d[h+5],k=d[h+6],I=d[h+7],M=d[h+8],A=d[h+9],j=d[h+10],U=d[h+11],z=d[h+12],W=d[h+13],G=d[h+14],F=d[h+15],b=l[0],L=l[1],B=l[2],_=l[3];b=f(b,L,B,_,s,7,C[0]),_=f(_,b,L,B,g,12,C[1]),B=f(B,_,b,L,p,17,C[2]),L=f(L,B,_,b,x,22,C[3]),b=f(b,L,B,_,D,7,C[4]),_=f(_,b,L,B,N,12,C[5]),B=f(B,_,b,L,k,17,C[6]),L=f(L,B,_,b,I,22,C[7]),b=f(b,L,B,_,M,7,C[8]),_=f(_,b,L,B,A,12,C[9]),B=f(B,_,b,L,j,17,C[10]),L=f(L,B,_,b,U,22,C[11]),b=f(b,L,B,_,z,7,C[12]),_=f(_,b,L,B,W,12,C[13]),B=f(B,_,b,L,G,17,C[14]),L=f(L,B,_,b,F,22,C[15]),b=E(b,L,B,_,g,5,C[16]),_=E(_,b,L,B,k,9,C[17]),B=E(B,_,b,L,U,14,C[18]),L=E(L,B,_,b,s,20,C[19]),b=E(b,L,B,_,N,5,C[20]),_=E(_,b,L,B,j,9,C[21]),B=E(B,_,b,L,F,14,C[22]),L=E(L,B,_,b,D,20,C[23]),b=E(b,L,B,_,A,5,C[24]),_=E(_,b,L,B,G,9,C[25]),B=E(B,_,b,L,x,14,C[26]),L=E(L,B,_,b,M,20,C[27]),b=E(b,L,B,_,W,5,C[28]),_=E(_,b,L,B,p,9,C[29]),B=E(B,_,b,L,I,14,C[30]),L=E(L,B,_,b,z,20,C[31]),b=P(b,L,B,_,N,4,C[32]),_=P(_,b,L,B,M,11,C[33]),B=P(B,_,b,L,U,16,C[34]),L=P(L,B,_,b,G,23,C[35]),b=P(b,L,B,_,g,4,C[36]),_=P(_,b,L,B,D,11,C[37]),B=P(B,_,b,L,I,16,C[38]),L=P(L,B,_,b,j,23,C[39]),b=P(b,L,B,_,W,4,C[40]),_=P(_,b,L,B,s,11,C[41]),B=P(B,_,b,L,x,16,C[42]),L=P(L,B,_,b,k,23,C[43]),b=P(b,L,B,_,A,4,C[44]),_=P(_,b,L,B,z,11,C[45]),B=P(B,_,b,L,F,16,C[46]),L=P(L,B,_,b,p,23,C[47]),b=y(b,L,B,_,s,6,C[48]),_=y(_,b,L,B,I,10,C[49]),B=y(B,_,b,L,G,15,C[50]),L=y(L,B,_,b,N,21,C[51]),b=y(b,L,B,_,z,6,C[52]),_=y(_,b,L,B,x,10,C[53]),B=y(B,_,b,L,j,15,C[54]),L=y(L,B,_,b,g,21,C[55]),b=y(b,L,B,_,M,6,C[56]),_=y(_,b,L,B,F,10,C[57]),B=y(B,_,b,L,k,15,C[58]),L=y(L,B,_,b,W,21,C[59]),b=y(b,L,B,_,D,6,C[60]),_=y(_,b,L,B,U,10,C[61]),B=y(B,_,b,L,p,15,C[62]),L=y(L,B,_,b,A,21,C[63]),l[0]=l[0]+b|0,l[1]=l[1]+L|0,l[2]=l[2]+B|0,l[3]=l[3]+_|0},_doFinalize:function(){var d=this._data,h=d.words,w=this._nDataBytes*8,c=d.sigBytes*8;h[c>>>5]|=128<<24-c%32;var u=a.floor(w/4294967296),l=w;h[(c+64>>>9<<4)+15]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360,h[(c+64>>>9<<4)+14]=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360,d.sigBytes=(h.length+1)*4,this._process();for(var s=this._hash,g=s.words,p=0;p<4;p++){var x=g[p];g[p]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360}return s},clone:function(){var d=T.clone.call(this);return d._hash=this._hash.clone(),d}});function f(d,h,w,c,u,l,s){var g=d+(h&w|~h&c)+u+s;return(g<<l|g>>>32-l)+h}function E(d,h,w,c,u,l,s){var g=d+(h&c|w&~c)+u+s;return(g<<l|g>>>32-l)+h}function P(d,h,w,c,u,l,s){var g=d+(h^w^c)+u+s;return(g<<l|g>>>32-l)+h}function y(d,h,w,c,u,l,s){var g=d+(w^(h|~c))+u+s;return(g<<l|g>>>32-l)+h}m.MD5=T._createHelper(O),m.HmacMD5=T._createHmacHelper(O)}(Math),i.MD5})},function(n,r,o){var i;Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),m=a.__importDefault(o(3)),v=a.__importStar(o(1)),S=a.__importDefault(o(8)),T=o(4),R=a.__importDefault(o(19)),C=a.__importDefault(o(17)),O=a.__importDefault(o(22)),f=a.__importDefault(o(2)),E=o(29),P=a.__importDefault(o(63)),y=o(14);function d(c){var u=c.statusCode;return u===408&&!c.code||u===400&&!c.code||u>=500&&u<=504}function h(c){var u=c.connection,l=u&&u.connectionManager.host;return l?[l].concat(S.default.getFallbackHosts(c.options)):S.default.getHosts(c.options)}var w=(i=function(){function c(u){this.checksInProgress=null,this.checkConnectivity=void 0,this.supportsAuthHeaders=!1,this.supportsLinkHeaders=!1,this._getHosts=h,this.options=u||{};var l=this.options.connectivityCheckUrl||S.default.connectivityCheckUrl,s=this.options.connectivityCheckParams,g=!this.options.connectivityCheckUrl;m.default.Config.xhrSupported?(this.supportsAuthHeaders=!0,this.Request=function(p,x,D,N,k,I,M){var A=C.default.createRequest(D,N,k,I,O.default.REQ_SEND,x&&x.options.timeouts,p);return A.once("complete",M),A.exec(),A},this.options.disableConnectivityCheck?this.checkConnectivity=function(p){p(null,!0)}:this.checkConnectivity=function(p){f.default.logAction(f.default.LOG_MICRO,"(XHRRequest)Http.checkConnectivity()","Sending; "+l),this.doUri(R.default.Get,null,l,null,null,s,function(x,D,N,k,I){var M=!1;g?M=!x&&(D==null?void 0:D.replace(/\n/,""))=="yes":M=!x&&(0,y.isSuccessCode)(I),f.default.logAction(f.default.LOG_MICRO,"(XHRRequest)Http.checkConnectivity()","Result: "+M),p(null,M)})}):m.default.Config.jsonpSupported?(this.Request=function(p,x,D,N,k,I,M){var A=(0,E.createRequest)(D,N,k,I,O.default.REQ_SEND,x&&x.options.timeouts,p);return A.once("complete",M),m.default.Config.nextTick(function(){A.exec()}),A},this.options.disableConnectivityCheck?this.checkConnectivity=function(p){p(null,!0)}:this.checkConnectivity=function(p){var x=this,D=S.default.jsonpInternetUpUrl;if(this.checksInProgress){this.checksInProgress.push(p);return}this.checksInProgress=[p],f.default.logAction(f.default.LOG_MICRO,"(JSONP)Http.checkConnectivity()","Sending; "+D);var N=new E.Request("isTheInternetUp",D,null,null,null,O.default.REQ_SEND,S.default.TIMEOUTS);N.once("complete",function(k,I){var M=!k&&I;f.default.logAction(f.default.LOG_MICRO,"(JSONP)Http.checkConnectivity()","Result: "+M);for(var A=0;A<x.checksInProgress.length;A++)x.checksInProgress[A](null,M);x.checksInProgress=null}),m.default.Config.nextTick(function(){N.exec()})}):m.default.Config.fetchSupported?(this.supportsAuthHeaders=!0,this.Request=P.default,this.checkConnectivity=function(p){f.default.logAction(f.default.LOG_MICRO,"(Fetch)Http.checkConnectivity()","Sending; "+l),this.doUri(R.default.Get,null,l,null,null,null,function(x,D){var N=!x&&(D==null?void 0:D.replace(/\n/,""))=="yes";f.default.logAction(f.default.LOG_MICRO,"(Fetch)Http.checkConnectivity()","Result: "+N),p(null,N)})}):this.Request=function(p,x,D,N,k,I,M){M(new T.PartialErrorInfo("no supported HTTP transports available",null,400),null)}}return c.prototype.do=function(u,l,s,g,p,x,D){var N=this,k=typeof s=="function"?s:function(j){return l.baseUri(j)+s},I=l._currentFallback;if(I)if(I.validUntil>v.now()){if(!this.Request){D==null||D(new T.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(u,l,k(I.host),g,x,p,function(j){for(var U=[],z=1;z<arguments.length;z++)U[z-1]=arguments[z];if(j&&d(j)){l._currentFallback=null,N.do(u,l,s,g,p,x,D);return}D==null||D.apply(void 0,a.__spreadArray([j],U,!1))});return}else l._currentFallback=null;var M=h(l);if(M.length===1){this.doUri(u,l,k(M[0]),g,p,x,D);return}var A=function(j,U){var z=j.shift();N.doUri(u,l,k(z),g,p,x,function(W){for(var G=[],F=1;F<arguments.length;F++)G[F-1]=arguments[F];if(W&&d(W)&&j.length){A(j,!0);return}U&&(l._currentFallback={host:z,validUntil:v.now()+l.options.timeouts.fallbackRetryTimeout}),D==null||D.apply(void 0,a.__spreadArray([W],G,!1))})};A(M)},c.prototype.doUri=function(u,l,s,g,p,x,D){if(!this.Request){D(new T.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(u,l,s,g,x,p,D)},c}(),i.methods=[R.default.Get,R.default.Delete,R.default.Post,R.default.Put,R.default.Patch],i.methodsWithoutBody=[R.default.Get,R.default.Delete],i.methodsWithBody=[R.default.Post,R.default.Put,R.default.Patch],i);r.default=w},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(4)),m=i.__importDefault(o(3)),v=i.__importDefault(o(8)),S=i.__importStar(o(1)),T=o(1);function R(f,E){return!!E.get("x-ably-errorcode")}function C(f,E){if(R(f,E))return f.error&&a.default.fromValues(f.error)}function O(f,E,P,y,d,h,w){var c=new Headers(y||{}),u=f?f.toUpperCase():S.isEmptyArg(h)?"GET":"POST",l=new AbortController,s=setTimeout(function(){l.abort(),w(new a.PartialErrorInfo("Request timed out",null,408))},E?E.options.timeouts.httpRequestTimeout:v.default.TIMEOUTS.httpRequestTimeout),g={method:u,headers:c,body:h};m.default.Config.isWebworker||(g.credentials=c.has("authorization")?"include":"same-origin"),(0,T.getGlobalObject)().fetch(P+"?"+new URLSearchParams(d||{}),g).then(function(p){clearTimeout(s);var x=p.headers.get("Content-Type"),D;x&&x.indexOf("application/x-msgpack")>-1?D=p.arrayBuffer():x&&x.indexOf("application/json")>-1?D=p.json():D=p.text(),D.then(function(N){var k=!!x&&x.indexOf("application/x-msgpack")===-1;if(p.ok)w(null,N,p.headers,k,p.status);else{var I=C(N,p.headers)||new a.PartialErrorInfo("Error response received from server: "+p.status+" body was: "+m.default.Config.inspect(N),null,p.status);w(I,N,p.headers,k,p.status)}})}).catch(function(p){clearTimeout(s),w(p)})}r.default=O},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(41)),m=i.__importStar(o(1)),v=m.getGlobalObject();typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"&&console.log("Warning: this distribution of Ably is intended for browsers. On nodejs, please use the 'ably' package on npm");function S(){var O=v.location;return!v.WebSocket||!O||!O.origin||O.origin.indexOf("http")>-1}var T=v.navigator&&v.navigator.userAgent.toString(),R=v.location&&v.location.href,C={agent:"browser",logTimestamps:!0,userAgent:T,currentUrl:R,noUpgrade:T&&!!T.match(/MSIE\s8\.0/),binaryType:"arraybuffer",WebSocket:v.WebSocket,fetchSupported:!!v.fetch,xhrSupported:v.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,jsonpSupported:typeof document!="undefined",allowComet:S(),streamingSupported:!0,useProtocolHeartbeats:!0,createHmac:null,msgpack:a.default,supportsBinary:!!v.TextDecoder,preferBinary:!1,ArrayBuffer:v.ArrayBuffer,atob:v.atob,nextTick:typeof v.setImmediate!="undefined"?v.setImmediate.bind(v):function(O){setTimeout(O,0)},addEventListener:v.addEventListener,inspect:JSON.stringify,stringByteSize:function(O){return v.TextDecoder&&new v.TextEncoder().encode(O).length||O.length},TextEncoder:v.TextEncoder,TextDecoder:v.TextDecoder,Promise:v.Promise,getRandomValues:function(O){if(O!==void 0)return function(f,E){O.getRandomValues(f),E&&E(null)}}(v.crypto||msCrypto)};r.default=C},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),m=a.__importStar(o(1)),v="ablyjs-storage-test",S=function(){function T(){try{i.sessionStorage.setItem(v,v),i.sessionStorage.removeItem(v),this.sessionSupported=!0}catch(R){this.sessionSupported=!1}try{i.localStorage.setItem(v,v),i.localStorage.removeItem(v),this.localSupported=!0}catch(R){this.localSupported=!1}}return T.prototype.get=function(R){return this._get(R,!1)},T.prototype.getSession=function(R){return this._get(R,!0)},T.prototype.remove=function(R){return this._remove(R,!1)},T.prototype.removeSession=function(R){return this._remove(R,!0)},T.prototype.set=function(R,C,O){return this._set(R,C,O,!1)},T.prototype.setSession=function(R,C,O){return this._set(R,C,O,!0)},T.prototype._set=function(R,C,O,f){var E={value:C};return O&&(E.expires=m.now()+O),this.storageInterface(f).setItem(R,JSON.stringify(E))},T.prototype._get=function(R,C){if(C&&!this.sessionSupported)throw new Error("Session Storage not supported");if(!C&&!this.localSupported)throw new Error("Local Storage not supported");var O=this.storageInterface(C).getItem(R);if(!O)return null;var f=JSON.parse(O);return f.expires&&f.expires<m.now()?(this.storageInterface(C).removeItem(R),null):f.value},T.prototype._remove=function(R,C){return this.storageInterface(C).removeItem(R)},T.prototype.storageInterface=function(R){return R?i.sessionStorage:i.localStorage},T}();r.default=new S}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(67)),m={connectivityCheckUrl:"https://internet-up.ably-realtime.com/is-the-internet-up.txt",jsonpInternetUpUrl:"https://internet-up.ably-realtime.com/is-the-internet-up-0-9.js",defaultTransports:[a.default.XhrPolling,a.default.XhrStreaming,a.default.JsonP,a.default.WebSocket],baseTransportOrder:[a.default.XhrPolling,a.default.XhrStreaming,a.default.JsonP,a.default.WebSocket],transportPreferenceOrder:[a.default.JsonP,a.default.XhrPolling,a.default.XhrStreaming,a.default.WebSocket],upgradeTransports:[a.default.XhrStreaming,a.default.WebSocket]};r.default=m},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i;(function(a){a.WebSocket="web_socket",a.Comet="comet",a.XhrStreaming="xhr_streaming",a.XhrPolling="xhr_polling",a.JsonP="jsonp"})(i||(i={})),r.default=i},function(n,r,o){o.r(r);var i=o(29),a=o.n(i),m=o(1),v=o(3),S=o.n(v),T=o(12),R=o.n(T),C=o(17),O=o.n(C),f=function(d){var h="xhr_polling";function w(c,u,l){l.stream=!1,R.a.call(this,c,u,l),this.shortName=h}return m.inherits(w,R.a),w.isAvailable=function(){return S.a.Config.xhrSupported&&S.a.Config.allowComet},w.prototype.toString=function(){return"XHRPollingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},w.prototype.createRequest=function(c,u,l,s,g){return O.a.createRequest(c,u,l,s,g,this.timeouts)},typeof d!="undefined"&&w.isAvailable()&&(d.supportedTransports[h]=w),w},E=f,P=function(d){var h="xhr_streaming";function w(c,u,l){R.a.call(this,c,u,l),this.shortName=h}return m.inherits(w,R.a),w.isAvailable=function(){return S.a.Config.xhrSupported&&S.a.Config.streamingSupported&&S.a.Config.allowComet},w.prototype.toString=function(){return"XHRStreamingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},w.prototype.createRequest=function(c,u,l,s,g){return O.a.createRequest(c,u,l,s,g,this.timeouts)},typeof d!="undefined"&&w.isAvailable()&&(d.supportedTransports[h]=w),w},y=P;r.default=[a.a,E,y]}]).default})})(qc);var Yh=qc.exports;const Xh=Oe(Yh),ws=(e,t,n,r,o)=>dt(this,null,function*(){try{const i=new Xh.Realtime({token:e.token,clientId:e.clientId});i.connection.on("connected",()=>{o==null||o("connected")}),i.connection.on("failed",v=>{console.error("[❌ ABLY CONNECTION FAILED]",v),o==null||o("failed")}),i.connection.on("disconnected",()=>{o==null||o("disconnected")});const a=`room:${t}:${n}`,m=i.channels.get(a);return m.subscribe("messages",v=>{var S;try{const T=(S=v.data)==null?void 0:S.message;if(T&&T.role==="employee"){const R={id:T.id||Xt(),text:T.content||"",sender:"bot",timestamp:T.createdAt?new Date(T.createdAt):new Date};r(R)}}catch(T){console.error("[❌ MESSAGE PARSING ERROR]",T)}}),{client:i,channel:m}}catch(i){throw console.error("[❌ ABLY INITIALIZATION ERROR]",i),i}}),Zh=(e,t)=>dt(this,null,function*(){try{const n=Zc(),r=yield fetch(`${n}?conversationId=${e}&chatbotUid=${t}`);return r.ok?yield r.json():(console.error("Failed to fetch conversation data:",r.statusText),null)}catch(n){return console.error("[❌ ABLY TOKEN FETCH ERROR]",n),null}}),qh=e=>{e&&e.close()},ef=()=>({id:Xt(),text:"Lo siento, hubo un problema con la conexión. Esta es una respuesta de demostración.",sender:"bot",timestamp:new Date().toISOString()}),ep=(e,t,n,r)=>{const o=Jh(t,e),i={id:e,senderId:r||"unknown",createdAt:new Date().toISOString(),chatbotActivated:!0,updatedAt:new Date().toISOString(),source:"IFRAME",website:typeof window!="undefined"?window.location.origin:"",messages:o};return{conversationId:e,conversation:i,chatbotUid:n.apiKey}},tp=e=>dt(this,null,function*(){try{const t=$h(),n=yield fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return n.ok?yield n.json():(console.error("WebChat: API request failed:",n.status,n.statusText),null)}catch(t){return console.error("WebChat: Error sending message to API:",t),null}}),np=e=>{if(e&&e.content){let t;return e.createdAt?t=e.createdAt.endsWith("Z")?e.createdAt:`${e.createdAt}Z`:t=new Date().toISOString(),{id:e.id||Xt(),text:e.content,sender:"bot",timestamp:t}}return null},rp=e=>`¡Hola! Soy ${e||"tu asistente"}, ¿En qué te puedo ayudar?
91
91
 
92
92
  Aunque no lo creas, soy una inteligencia artificial! Puedo resolver todas tus dudas 😊
93
93
 
94
- También puedes pedir hablar con nuestro equipo de los sueños!`,np=e=>({id:Xt(),text:tp(e),sender:"bot",timestamp:new Date}),ef=()=>typeof window!="undefined"&&window.innerWidth<640,rp=({config:e})=>{e.apiKey||console.warn("WebChat: apiKey is required but not provided in config");const[t,n]=oe.useState(()=>Zo(e)),[r,o]=oe.useState(!1),[i,a]=oe.useState(()=>ef()),[m,v]=oe.useState(""),[S,T]=oe.useState(!1),[R,C]=oe.useState(!1),[O,f]=oe.useState(!1),[E,P]=oe.useState(""),[,y]=oe.useState(null),d=oe.useRef(null),[h,w]=oe.useState(!1),[c,u]=oe.useState(!1),[l,s]=oe.useState(""),[g,p]=oe.useState([e.initialMessage?{id:Xt(),text:e.initialMessage,sender:"bot",timestamp:new Date}:np(e.title)]),x=oe.useCallback((U,z="bot")=>{p(V=>[...V,U]),!r&&(U.sender==="bot"||z==="bot")&&U.id!==l&&w(!0)},[r,l]);oe.useEffect(()=>{const U=()=>{const z=ef();a(z)};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),oe.useEffect(()=>zh(()=>{n(Zo(e))}),[e]),oe.useEffect(()=>{n(Zo(e))},[e]),oe.useEffect(()=>{dt(this,null,function*(){const z=Qc();v(z);const V=yield Fh();P(V)})},[]),oe.useEffect(()=>{if(g.length>0){const U=g[g.length-1];U.sender==="bot"&&s(U.id)}},[]);const D=oe.useCallback(U=>{x(U,"ably")},[x]),N=oe.useCallback(U=>dt(this,null,function*(){if(!(c||d.current))try{if(U.tokenDetails){const z=yield ys(U.tokenDetails,e.apiKey||"",m,D);y(z),d.current=z.client,u(!0)}}catch(z){console.error("[❌ ABLY SETUP ERROR from history]",z)}}),[c,m,D]),k=oe.useCallback(()=>dt(this,null,function*(){if(!(c||d.current))try{const U=yield Yh(m,e.apiKey||"");if(U!=null&&U.tokenDetails){const z=yield ys(U.tokenDetails,e.apiKey||"",m,D);y(z),d.current=z.client,u(!0)}}catch(U){console.error("[❌ ABLY SETUP ERROR from endpoint]",U)}}),[c,m,e.apiKey,D]),I=oe.useCallback(()=>dt(this,null,function*(){var z,V;const U=r;if(o(G=>!G),!U){w(!1);const G=g.filter(F=>F.sender==="bot").slice(-1)[0];G&&s(G.id)}if(!U&&!S&&m&&Jc()&&!c){C(!0);const G=yield Vh(m,e.apiKey||"");if(((V=(z=G==null?void 0:G.conversation)==null?void 0:z.messages)==null?void 0:V.length)>0){const F=$h(G.conversation.messages);p(F);const b=F.filter(L=>L.sender==="bot").slice(-1)[0];b&&s(b.id),yield N(G)}else console.warn("WebChat: No conversation history found, showing initial message");C(!1),T(!0)}else!U&&Jc()&&!c?yield k():U||console.warn("WebChat: Chat opened - no existing conversation to fetch")}),[r,m,S,c,e.apiKey,N,k,g]),M=oe.useCallback(()=>{o(!1)},[]),A=oe.useCallback(U=>dt(this,null,function*(){const z={id:Xt(),text:U,sender:"user",timestamp:new Date};p(G=>[...G,z]),f(!0);const V=[...g,z];try{const G=Zh(m,V,{apiKey:e.apiKey||""},E),F=yield qh(G);if(F){if(F.response.tokenDetails&&!d.current){const L=yield ys(F.response.tokenDetails,e.apiKey||"",m,D);y(L),d.current=L.client,u(!0)}const b=ep(F.response.message);b&&x(b,"bot")}else{setTimeout(()=>{const b=qc();x(b,"bot"),f(!1)},1e3);return}}catch(G){console.error("WebChat: Error in message handling:",G),setTimeout(()=>{const F=qc();x(F,"bot"),f(!1)},1e3);return}f(!1),Bh(!0)}),[m,g,e.apiKey,E,D,x]),j=Hh(e);return oe.useEffect(()=>()=>{Xh(d.current),d.current=null},[]),J.jsxs("div",{className:"nbc-font-sans",style:{zIndex:2147483647},children:[J.jsx(bh,{isOpen:r,onClick:I,primaryColor:t.primaryColor,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,hasNewMessages:h,isMobile:i}),J.jsx(Lh,{isOpen:r,onClose:M,config:t,messages:g,onSendMessage:A,isLoading:R,isAiTyping:O,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,isMobile:i,apiKeyMissing:!e.apiKey})]})},op='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.nbc-fixed{position:fixed}.nbc-absolute{position:absolute}.nbc-relative{position:relative}.nbc-inset-0{inset:0}.nbc-inset-auto{inset:auto}.nbc-right-0{right:0}.nbc-right-2{right:.5rem}.nbc-top-0{top:0}.nbc-top-1\\/2{top:50%}.nbc-m-0{margin:0}.nbc-mb-1{margin-bottom:.25rem}.nbc-mb-4{margin-bottom:1rem}.nbc-ml-2{margin-left:.5rem}.nbc-mt-1{margin-top:.25rem}.nbc-flex{display:flex}.nbc-hidden{display:none}.nbc-h-10{height:2.5rem}.nbc-h-16{height:4rem}.nbc-h-2{height:.5rem}.nbc-h-3{height:.75rem}.nbc-h-4{height:1rem}.nbc-h-5{height:1.25rem}.nbc-h-7{height:1.75rem}.nbc-h-8{height:2rem}.nbc-h-auto{height:auto}.nbc-h-full{height:100%}.nbc-min-h-\\[220px\\]{min-height:220px}.nbc-w-10{width:2.5rem}.nbc-w-16{width:4rem}.nbc-w-2{width:.5rem}.nbc-w-3{width:.75rem}.nbc-w-4{width:1rem}.nbc-w-5{width:1.25rem}.nbc-w-7{width:1.75rem}.nbc-w-8{width:2rem}.nbc-w-auto{width:auto}.nbc-w-full{width:100%}.nbc-max-w-xs{max-width:20rem}.nbc-flex-1{flex:1 1 0%}.nbc-flex-shrink-0{flex-shrink:0}.nbc--translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes nbc-bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.nbc-animate-bounce{animation:nbc-bounce 1s infinite}@keyframes nbc-ping{75%,to{transform:scale(2);opacity:0}}.nbc-animate-ping{animation:nbc-ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes nbc-pulse{50%{opacity:.5}}.nbc-animate-pulse{animation:nbc-pulse 2s cubic-bezier(.4,0,.6,1) infinite}.nbc-cursor-pointer{cursor:pointer}.nbc-flex-col{flex-direction:column}.nbc-items-start{align-items:flex-start}.nbc-items-end{align-items:flex-end}.nbc-items-center{align-items:center}.nbc-justify-start{justify-content:flex-start}.nbc-justify-end{justify-content:flex-end}.nbc-justify-center{justify-content:center}.nbc-justify-between{justify-content:space-between}.nbc-gap-2{gap:.5rem}.nbc-space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.nbc-space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.nbc-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.nbc-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.nbc-overflow-hidden{overflow:hidden}.nbc-overflow-y-auto{overflow-y:auto}.nbc-whitespace-nowrap{white-space:nowrap}.nbc-whitespace-pre-wrap{white-space:pre-wrap}.nbc-break-words{overflow-wrap:break-word}.nbc-rounded{border-radius:.25rem}.nbc-rounded-2xl{border-radius:1rem}.nbc-rounded-full{border-radius:9999px}.nbc-rounded-lg{border-radius:.5rem}.nbc-rounded-none{border-radius:0}.nbc-rounded-bl-md{border-bottom-left-radius:.375rem}.nbc-rounded-br-md{border-bottom-right-radius:.375rem}.nbc-border-0{border-width:0px}.nbc-border-2{border-width:2px}.nbc-border-t{border-top-width:1px}.nbc-border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.nbc-border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.nbc-bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.nbc-bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.nbc-bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.nbc-bg-transparent{background-color:transparent}.nbc-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.nbc-bg-none{background-image:none}.nbc-object-cover{-o-object-fit:cover;object-fit:cover}.nbc-p-0{padding:0}.nbc-p-1{padding:.25rem}.nbc-p-2{padding:.5rem}.nbc-p-4{padding:1rem}.nbc-px-2{padding-left:.5rem;padding-right:.5rem}.nbc-px-4{padding-left:1rem;padding-right:1rem}.nbc-py-3{padding-top:.75rem;padding-bottom:.75rem}.nbc-pr-12{padding-right:3rem}.nbc-pt-4{padding-top:1rem}.nbc-text-center{text-align:center}.nbc-text-right{text-align:right}.nbc-font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.nbc-text-\\[15px\\]{font-size:15px}.nbc-text-base{font-size:1rem;line-height:1.5rem}.nbc-text-lg{font-size:1.125rem;line-height:1.75rem}.nbc-text-sm{font-size:.875rem;line-height:1.25rem}.nbc-text-xs{font-size:.75rem;line-height:1rem}.nbc-font-bold{font-weight:700}.nbc-font-medium{font-weight:500}.nbc-leading-none{line-height:1}.nbc-leading-relaxed{line-height:1.625}.nbc-text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.nbc-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.nbc-text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.nbc-text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.nbc-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.nbc-opacity-0{opacity:0}.nbc-opacity-100{opacity:1}.nbc-opacity-50{opacity:.5}.nbc-opacity-70{opacity:.7}.nbc-opacity-75{opacity:.75}.nbc-shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-outline-none{outline:2px solid transparent;outline-offset:2px}.nbc-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.nbc-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.nbc-duration-200{transition-duration:.2s}.nbc-duration-300{transition-duration:.3s}.nbc-ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover\\:nbc-scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:nbc-bg-black:hover{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.hover\\:nbc-bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\\:nbc-bg-opacity-20:hover{--tw-bg-opacity: .2}.hover\\:nbc-text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.disabled\\:nbc-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:nbc-opacity-50:disabled{opacity:.5}',ip={apiKey:"",primaryColor:"#111111",avatar:"",title:"ChatBot - NotChatBot",placeholder:"Escribe tu mensaje...",initialMessage:"¡Hola! ¿En qué puedo ayudarte?",position:"bottom-right",marginBottom:20,marginSide:20,mobile:{position:"bottom-right",marginBottom:15,marginSide:15},desktop:{position:"bottom-right",marginBottom:25,marginSide:25},closeButtonIcon:"default",closeButtonText:"Cerrar",closeButtonCustomIcon:""},ap=()=>{if(typeof document!="undefined"&&!document.getElementById("webchat-styles")){const t=document.createElement("style");t.id="webchat-styles",t.textContent=op,document.head.appendChild(t)}},tf=e=>{try{const t=yt(yt({elementId:"webchat-notchatbot"},ip),e);ap();const n=document.getElementById(t.elementId);if(!n)return console.error(`WebChat: Element with id "${t.elementId}" not found`),null;const r=Bc(n);return r.render(mf.createElement(rp,{config:t})),console.log("WebChat: Successfully initialized"),{root:r,destroy:()=>{r.unmount(),console.log("WebChat: Destroyed")},getConversationId:()=>Qc()}}catch(t){return console.error("WebChat: Failed to initialize",t),null}},nf={initialize:tf};if(typeof window!="undefined"){const e=()=>{let t=document.getElementById("webchat-notchatbot");t||(t=document.createElement("div"),t.id="webchat-notchatbot",document.body.appendChild(t)),tf()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}return typeof window!="undefined"&&(window.WebChat=nf),nf});
94
+ También puedes pedir hablar con nuestro equipo de los sueños!`,op=e=>({id:Xt(),text:rp(e),sender:"bot",timestamp:new Date().toISOString()}),tf=()=>typeof window!="undefined"&&window.innerWidth<640,ip=({config:e})=>{if(!e.apiKey)return console.warn("WebChat: apiKey is required but not provided in config"),null;const[t,n]=oe.useState(()=>qo(e)),[r,o]=oe.useState(!1),[i,a]=oe.useState(()=>tf()),[m,v]=oe.useState(""),[S,T]=oe.useState(!1),[R,C]=oe.useState(!1),[O,f]=oe.useState(!1),[E,P]=oe.useState(""),[,y]=oe.useState(null),d=oe.useRef(null),[h,w]=oe.useState(!1),[c,u]=oe.useState(!1),[l,s]=oe.useState(""),[g,p]=oe.useState([e.initialMessage?{id:Xt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString()}:op(e.title)]),x=oe.useCallback((U,z="bot")=>{p(W=>[...W,U]),!r&&(U.sender==="bot"||z==="bot")&&U.id!==l&&w(!0)},[r,l]);oe.useEffect(()=>{const U=()=>{const z=tf();a(z)};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),oe.useEffect(()=>Fh(()=>{n(qo(e))}),[e]),oe.useEffect(()=>{n(qo(e))},[e]),oe.useEffect(()=>{dt(this,null,function*(){const z=Jc();v(z);const W=yield Wh();P(W)})},[]),oe.useEffect(()=>{if(g.length>0){const U=g[g.length-1];U.sender==="bot"&&s(U.id)}},[]);const D=oe.useCallback(U=>{x(U,"ably")},[x]),N=oe.useCallback(U=>dt(this,null,function*(){if(!(c||d.current))try{if(U.tokenDetails){const z=yield ws(U.tokenDetails,e.apiKey||"",m,D);y(z),d.current=z.client,u(!0)}}catch(z){console.error("[❌ ABLY SETUP ERROR from history]",z)}}),[c,m,D]),k=oe.useCallback(()=>dt(this,null,function*(){if(!(c||d.current))try{const U=yield Zh(m,e.apiKey||"");if(U!=null&&U.tokenDetails){const z=yield ws(U.tokenDetails,e.apiKey||"",m,D);y(z),d.current=z.client,u(!0)}}catch(U){console.error("[❌ ABLY SETUP ERROR from endpoint]",U)}}),[c,m,e.apiKey,D]),I=oe.useCallback(()=>dt(this,null,function*(){var z,W;const U=r;if(o(G=>!G),!U){w(!1);const G=g.filter(F=>F.sender==="bot").slice(-1)[0];G&&s(G.id)}if(!U&&!S&&m&&Yc()&&!c){C(!0);const G=yield Kh(m,e.apiKey||"");if(((W=(z=G==null?void 0:G.conversation)==null?void 0:z.messages)==null?void 0:W.length)>0){const F=Qh(G.conversation.messages);p(F);const b=F.filter(L=>L.sender==="bot").slice(-1)[0];b&&s(b.id),yield N(G)}else console.warn("WebChat: No conversation history found, showing initial message");C(!1),T(!0)}else!U&&Yc()&&!c?yield k():U||console.warn("WebChat: Chat opened - no existing conversation to fetch")}),[r,m,S,c,e.apiKey,N,k,g]),M=oe.useCallback(()=>{o(!1)},[]),A=oe.useCallback(U=>dt(this,null,function*(){const z=new Date().toISOString(),W={id:Xt(),text:U,sender:"user",timestamp:z};p(F=>[...F,W]),f(!0);const G=[...g,W];try{const F=ep(m,G,{apiKey:e.apiKey||""},E),b=yield tp(F);if(b){if(b.response.tokenDetails&&!d.current){const B=yield ws(b.response.tokenDetails,e.apiKey||"",m,D);y(B),d.current=B.client,u(!0)}const L=np(b.response.message);L&&x(L,"bot")}else{setTimeout(()=>{const L=ef();x(L,"bot"),f(!1)},1e3);return}}catch(F){console.error("WebChat: Error in message handling:",F),setTimeout(()=>{const b=ef();x(b,"bot"),f(!1)},1e3);return}f(!1),zh(!0)}),[m,g,e.apiKey,E,D,x]),j=Gh(e);return oe.useEffect(()=>()=>{qh(d.current),d.current=null},[]),J.jsxs("div",{className:"nbc-font-sans",style:{zIndex:2147483647},children:[J.jsx(Ih,{isOpen:r,onClick:I,primaryColor:t.primaryColor,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,hasNewMessages:h,isMobile:i}),J.jsx(Uh,{isOpen:r,onClose:M,config:t,messages:g,onSendMessage:A,isLoading:R,isAiTyping:O,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,isMobile:i,apiKeyMissing:!e.apiKey})]})},ap='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.nbc-fixed{position:fixed}.nbc-absolute{position:absolute}.nbc-relative{position:relative}.nbc-inset-0{inset:0}.nbc-inset-auto{inset:auto}.nbc-right-0{right:0}.nbc-right-2{right:.5rem}.nbc-top-0{top:0}.nbc-top-1\\/2{top:50%}.nbc-m-0{margin:0}.nbc-mb-1{margin-bottom:.25rem}.nbc-mb-4{margin-bottom:1rem}.nbc-ml-2{margin-left:.5rem}.nbc-mt-1{margin-top:.25rem}.nbc-flex{display:flex}.nbc-hidden{display:none}.nbc-h-10{height:2.5rem}.nbc-h-16{height:4rem}.nbc-h-2{height:.5rem}.nbc-h-3{height:.75rem}.nbc-h-4{height:1rem}.nbc-h-5{height:1.25rem}.nbc-h-7{height:1.75rem}.nbc-h-8{height:2rem}.nbc-h-auto{height:auto}.nbc-h-full{height:100%}.nbc-min-h-\\[220px\\]{min-height:220px}.nbc-w-10{width:2.5rem}.nbc-w-16{width:4rem}.nbc-w-2{width:.5rem}.nbc-w-3{width:.75rem}.nbc-w-4{width:1rem}.nbc-w-5{width:1.25rem}.nbc-w-7{width:1.75rem}.nbc-w-8{width:2rem}.nbc-w-auto{width:auto}.nbc-w-full{width:100%}.nbc-max-w-xs{max-width:20rem}.nbc-flex-1{flex:1 1 0%}.nbc-flex-shrink-0{flex-shrink:0}.nbc--translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes nbc-bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.nbc-animate-bounce{animation:nbc-bounce 1s infinite}@keyframes nbc-ping{75%,to{transform:scale(2);opacity:0}}.nbc-animate-ping{animation:nbc-ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes nbc-pulse{50%{opacity:.5}}.nbc-animate-pulse{animation:nbc-pulse 2s cubic-bezier(.4,0,.6,1) infinite}.nbc-cursor-pointer{cursor:pointer}.nbc-flex-col{flex-direction:column}.nbc-items-start{align-items:flex-start}.nbc-items-end{align-items:flex-end}.nbc-items-center{align-items:center}.nbc-justify-start{justify-content:flex-start}.nbc-justify-end{justify-content:flex-end}.nbc-justify-center{justify-content:center}.nbc-justify-between{justify-content:space-between}.nbc-gap-2{gap:.5rem}.nbc-space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.nbc-space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.nbc-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.nbc-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.nbc-overflow-hidden{overflow:hidden}.nbc-overflow-y-auto{overflow-y:auto}.nbc-whitespace-nowrap{white-space:nowrap}.nbc-whitespace-pre-wrap{white-space:pre-wrap}.nbc-break-words{overflow-wrap:break-word}.nbc-rounded{border-radius:.25rem}.nbc-rounded-2xl{border-radius:1rem}.nbc-rounded-full{border-radius:9999px}.nbc-rounded-lg{border-radius:.5rem}.nbc-rounded-none{border-radius:0}.nbc-rounded-bl-md{border-bottom-left-radius:.375rem}.nbc-rounded-br-md{border-bottom-right-radius:.375rem}.nbc-border-0{border-width:0px}.nbc-border-2{border-width:2px}.nbc-border-t{border-top-width:1px}.nbc-border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.nbc-border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.nbc-bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.nbc-bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.nbc-bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.nbc-bg-transparent{background-color:transparent}.nbc-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.nbc-bg-none{background-image:none}.nbc-object-cover{-o-object-fit:cover;object-fit:cover}.nbc-p-0{padding:0}.nbc-p-1{padding:.25rem}.nbc-p-2{padding:.5rem}.nbc-p-4{padding:1rem}.nbc-px-2{padding-left:.5rem;padding-right:.5rem}.nbc-px-4{padding-left:1rem;padding-right:1rem}.nbc-py-3{padding-top:.75rem;padding-bottom:.75rem}.nbc-pr-12{padding-right:3rem}.nbc-pt-4{padding-top:1rem}.nbc-text-center{text-align:center}.nbc-text-right{text-align:right}.nbc-font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.nbc-text-\\[15px\\]{font-size:15px}.nbc-text-base{font-size:1rem;line-height:1.5rem}.nbc-text-lg{font-size:1.125rem;line-height:1.75rem}.nbc-text-sm{font-size:.875rem;line-height:1.25rem}.nbc-text-xs{font-size:.75rem;line-height:1rem}.nbc-font-bold{font-weight:700}.nbc-font-medium{font-weight:500}.nbc-leading-none{line-height:1}.nbc-leading-relaxed{line-height:1.625}.nbc-text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.nbc-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.nbc-text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.nbc-text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.nbc-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.nbc-opacity-0{opacity:0}.nbc-opacity-100{opacity:1}.nbc-opacity-50{opacity:.5}.nbc-opacity-70{opacity:.7}.nbc-opacity-75{opacity:.75}.nbc-shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-outline-none{outline:2px solid transparent;outline-offset:2px}.nbc-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.nbc-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.nbc-duration-200{transition-duration:.2s}.nbc-duration-300{transition-duration:.3s}.nbc-ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover\\:nbc-scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:nbc-bg-black:hover{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.hover\\:nbc-bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\\:nbc-bg-opacity-20:hover{--tw-bg-opacity: .2}.hover\\:nbc-text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.disabled\\:nbc-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:nbc-opacity-50:disabled{opacity:.5}',sp={apiKey:"",primaryColor:"#111111",avatar:"",title:"ChatBot - NotChatBot",placeholder:"Escribe tu mensaje...",initialMessage:"¡Hola! ¿En qué puedo ayudarte?",position:"bottom-right",marginBottom:20,marginSide:20,mobile:{position:"bottom-right",marginBottom:15,marginSide:15},desktop:{position:"bottom-right",marginBottom:25,marginSide:25},closeButtonIcon:"default",closeButtonText:"Cerrar",closeButtonCustomIcon:""};(()=>{if(typeof document!="undefined"&&!document.getElementById("webchat-styles")){const t=document.createElement("style");t.id="webchat-styles",t.textContent=ap,document.head.appendChild(t)}})();let nf=!1,Dr=null;const rf=e=>{try{e&&(nf=!0),Dr&&(Dr.destroy(),Dr=null);const t=yt(yt({elementId:"webchat-notchatbot"},sp),e),n=document.getElementById(t.elementId);if(!n)return console.error(`WebChat: Element with id "${t.elementId}" not found`),null;const r=_c(n);return r.render(gf.createElement(ip,{config:t})),{root:r,destroy:()=>{r.unmount(),Dr=null},getConversationId:()=>Jc()};return Dr}catch(t){return console.error("WebChat: Failed to initialize",t),null}},of={initialize:rf};if(typeof window!="undefined"){window.WebChat=of;const e=()=>{if(!nf){let n=document.getElementById("webchat-notchatbot");n||(n=document.createElement("div"),n.id="webchat-notchatbot",document.body.appendChild(n)),rf()}const t=new CustomEvent("WebChatReady");document.dispatchEvent(t)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e,0)}return of});