@developer.notchatbot/webchat 1.0.8 → 1.0.9
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.
- package/README.md +733 -733
- package/dist/components/embedchat/EmbedChat.d.ts +4 -0
- package/dist/components/embedchat/EmbedChatFooter.d.ts +4 -0
- package/dist/components/embedchat/EmbedChatHeader.d.ts +4 -0
- package/dist/components/embedchat/EmbedChatWindow.d.ts +4 -0
- package/dist/config/company-config.d.ts +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/types.d.ts +48 -1
- package/dist/utils/messaging.d.ts +2 -2
- package/dist/utils/user.d.ts +3 -3
- package/dist/webchat-bundle.min.js +8834 -7026
- package/dist/webchat-bundle.min.umd.cjs +77 -22
- package/package.json +55 -54
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(be,he){typeof exports=="object"&&typeof module!="undefined"?he(exports):typeof define=="function"&&define.amd?define(["exports"],he):(be=typeof globalThis!="undefined"?globalThis:be||self,he(be.WebChat={}))})(this,function(be){"use strict";var Xg=Object.defineProperty,Yg=Object.defineProperties;var Zg=Object.getOwnPropertyDescriptors;var md=Object.getOwnPropertySymbols;var qg=Object.prototype.hasOwnProperty,em=Object.prototype.propertyIsEnumerable;var nl=(be,he,Re)=>he in be?Xg(be,he,{enumerable:!0,configurable:!0,writable:!0,value:Re}):be[he]=Re,me=(be,he)=>{for(var Re in he||(he={}))qg.call(he,Re)&&nl(be,Re,he[Re]);if(md)for(var Re of md(he))em.call(he,Re)&&nl(be,Re,he[Re]);return be},it=(be,he)=>Yg(be,Zg(he));var fe=(be,he,Re)=>nl(be,typeof he!="symbol"?he+"":he,Re);var ot=(be,he,Re)=>new Promise((ie,Ht)=>{var ko=Ot=>{try{er(Re.next(Ot))}catch(tr){Ht(tr)}},Ro=Ot=>{try{er(Re.throw(Ot))}catch(tr){Ht(tr)}},er=Ot=>Ot.done?ie(Ot.value):Promise.resolve(Ot.value).then(ko,Ro);er((Re=Re.apply(be,he)).next())});var qs;function he(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re={exports:{}},ie={};/**
|
|
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
|
|
9
|
+
*/var Ht=Symbol.for("react.element"),ko=Symbol.for("react.portal"),Ro=Symbol.for("react.fragment"),er=Symbol.for("react.strict_mode"),Ot=Symbol.for("react.profiler"),tr=Symbol.for("react.provider"),vd=Symbol.for("react.context"),yd=Symbol.for("react.forward_ref"),wd=Symbol.for("react.suspense"),xd=Symbol.for("react.memo"),Sd=Symbol.for("react.lazy"),ol=Symbol.iterator;function Cd(e){return e===null||typeof e!="object"?null:(e=ol&&e[ol]||e["@@iterator"],typeof e=="function"?e:null)}var al={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},sl=Object.assign,ll={};function Rn(e,t,n){this.props=e,this.context=t,this.refs=ll,this.updater=n||al}Rn.prototype.isReactComponent={},Rn.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")},Rn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ul(){}ul.prototype=Rn.prototype;function Eo(e,t,n){this.props=e,this.context=t,this.refs=ll,this.updater=n||al}var Oo=Eo.prototype=new ul;Oo.constructor=Eo,sl(Oo,Rn.prototype),Oo.isPureReactComponent=!0;var cl=Array.isArray,fl=Object.prototype.hasOwnProperty,To={current:null},dl={key:!0,ref:!0,__self:!0,__source:!0};function hl(e,t,n){var r,i={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)fl.call(t,r)&&!dl.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){for(var h=Array(l),m=0;m<l;m++)h[m]=arguments[m+2];i.children=h}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:Ht,type:e,key:o,ref:a,props:i,_owner:To.current}}function bd(e,t){return{$$typeof:Ht,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Ao(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ht}function kd(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var pl=/\/+/g;function Io(e,t){return typeof e=="object"&&e!==null&&e.key!=null?kd(""+e.key):t.toString(36)}function Jr(e,t,n,r,i){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Ht:case ko:a=!0}}if(a)return a=e,i=i(a),e=r===""?"."+Io(a,0):r,cl(i)?(n="",e!=null&&(n=e.replace(pl,"$&/")+"/"),Jr(i,t,n,"",function(m){return m})):i!=null&&(Ao(i)&&(i=bd(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(pl,"$&/")+"/")+e)),t.push(i)),1;if(a=0,r=r===""?".":r+":",cl(e))for(var l=0;l<e.length;l++){o=e[l];var h=r+Io(o,l);a+=Jr(o,t,n,h,i)}else if(h=Cd(e),typeof h=="function")for(e=h.call(e),l=0;!(o=e.next()).done;)o=o.value,h=r+Io(o,l++),a+=Jr(o,t,n,h,i);else if(o==="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 Xr(e,t,n){if(e==null)return e;var r=[],i=0;return Jr(e,r,"","",function(o){return t.call(n,o,i++)}),r}function Rd(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 ze={current:null},Yr={transition:null},Ed={ReactCurrentDispatcher:ze,ReactCurrentBatchConfig:Yr,ReactCurrentOwner:To};function gl(){throw Error("act(...) is not supported in production builds of React.")}ie.Children={map:Xr,forEach:function(e,t,n){Xr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xr(e,function(){t++}),t},toArray:function(e){return Xr(e,function(t){return t})||[]},only:function(e){if(!Ao(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},ie.Component=Rn,ie.Fragment=Ro,ie.Profiler=Ot,ie.PureComponent=Eo,ie.StrictMode=er,ie.Suspense=wd,ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ed,ie.act=gl,ie.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=sl({},e.props),i=e.key,o=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,a=To.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(h in t)fl.call(t,h)&&!dl.hasOwnProperty(h)&&(r[h]=t[h]===void 0&&l!==void 0?l[h]:t[h])}var h=arguments.length-2;if(h===1)r.children=n;else if(1<h){l=Array(h);for(var m=0;m<h;m++)l[m]=arguments[m+2];r.children=l}return{$$typeof:Ht,type:e.type,key:i,ref:o,props:r,_owner:a}},ie.createContext=function(e){return e={$$typeof:vd,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:tr,_context:e},e.Consumer=e},ie.createElement=hl,ie.createFactory=function(e){var t=hl.bind(null,e);return t.type=e,t},ie.createRef=function(){return{current:null}},ie.forwardRef=function(e){return{$$typeof:yd,render:e}},ie.isValidElement=Ao,ie.lazy=function(e){return{$$typeof:Sd,_payload:{_status:-1,_result:e},_init:Rd}},ie.memo=function(e,t){return{$$typeof:xd,type:e,compare:t===void 0?null:t}},ie.startTransition=function(e){var t=Yr.transition;Yr.transition={};try{e()}finally{Yr.transition=t}},ie.unstable_act=gl,ie.useCallback=function(e,t){return ze.current.useCallback(e,t)},ie.useContext=function(e){return ze.current.useContext(e)},ie.useDebugValue=function(){},ie.useDeferredValue=function(e){return ze.current.useDeferredValue(e)},ie.useEffect=function(e,t){return ze.current.useEffect(e,t)},ie.useId=function(){return ze.current.useId()},ie.useImperativeHandle=function(e,t,n){return ze.current.useImperativeHandle(e,t,n)},ie.useInsertionEffect=function(e,t){return ze.current.useInsertionEffect(e,t)},ie.useLayoutEffect=function(e,t){return ze.current.useLayoutEffect(e,t)},ie.useMemo=function(e,t){return ze.current.useMemo(e,t)},ie.useReducer=function(e,t,n){return ze.current.useReducer(e,t,n)},ie.useRef=function(e){return ze.current.useRef(e)},ie.useState=function(e){return ze.current.useState(e)},ie.useSyncExternalStore=function(e,t,n){return ze.current.useSyncExternalStore(e,t,n)},ie.useTransition=function(){return ze.current.useTransition()},ie.version="18.3.1",Re.exports=ie;var ne=Re.exports;const Mo=he(ne);var ml={exports:{}},Ze={},vl={exports:{}},yl={};/**
|
|
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 W=z-1>>>1,G=j[W];if(0<
|
|
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<i(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 O=2*(W+1)-1,D=j[O],B=O+1,_=j[B];if(0>i(D,z))B<G&&0>i(_,D)?(j[W]=_,j[B]=z,W=B):(j[W]=D,j[O]=z,W=O);else if(B<G&&0>i(_,z))j[W]=_,j[B]=z,W=B;else break e}}return U}function i(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 o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var h=[],m=[],S=1,E=null,y=3,R=!1,f=!1,b=!1,T=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(j){for(var U=n(m);U!==null;){if(U.callback===null)r(m);else if(U.startTime<=j)r(m),U.sortIndex=U.expirationTime,t(h,U);else break;U=n(m)}}function C(j){if(b=!1,g(j),!f)if(n(h)!==null)f=!0,M(d);else{var U=n(m);U!==null&&A(C,U.startTime-j)}}function d(j,U){f=!1,b&&(b=!1,x(s),s=-1),R=!0;var z=y;try{for(g(U),E=n(h);E!==null&&(!(E.expirationTime>U)||j&&!k());){var W=E.callback;if(typeof W=="function"){E.callback=null,y=E.priorityLevel;var G=W(E.expirationTime<=U);U=e.unstable_now(),typeof G=="function"?E.callback=G:E===n(h)&&r(h),g(U)}else r(h);E=n(h)}if(E!==null)var F=!0;else{var O=n(m);O!==null&&A(C,O.startTime-U),F=!1}return F}finally{E=null,y=z,R=!1}}var c=!1,u=null,s=-1,w=5,v=-1;function k(){return!(e.unstable_now()-v<w)}function L(){if(u!==null){var j=e.unstable_now();v=j;var U=!0;try{U=u(!0,j)}finally{U?N():(c=!1,u=null)}}else c=!1}var N;if(typeof p=="function")N=function(){p(L)};else if(typeof MessageChannel!="undefined"){var P=new MessageChannel,I=P.port2;P.port1.onmessage=L,N=function(){I.postMessage(null)}}else N=function(){T(L,0)};function M(j){u=j,c||(c=!0,N())}function A(j,U){s=T(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||R||(f=!0,M(d))},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"):w=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(j){switch(y){case 1:case 2:case 3:var U=3;break;default:U=y}var z=y;y=U;try{return j()}finally{y=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=y;y=j;try{return U()}finally{y=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:S++,callback:U,priorityLevel:j,startTime:z,expirationTime:G,sortIndex:-1},z>W?(j.sortIndex=z,t(m,j),n(h)===null&&j===n(m)&&(b?(x(s),s=-1):b=!0,A(C,z-W))):(j.sortIndex=G,t(h,j),f||R||(f=!0,M(d))),j},e.unstable_shouldYield=k,e.unstable_wrapCallback=function(j){var U=y;return function(){var z=y;y=U;try{return j.apply(this,arguments)}finally{y=z}}}})(yl),vl.exports=yl;var Od=vl.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
|
|
26
|
-
`+
|
|
27
|
-
`),
|
|
28
|
-
`),a=
|
|
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 zr(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 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 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"||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 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 Fr,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(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},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=fo(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=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 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,Gr=null,Wr=!1,Li=null,Mf={onError:function(e){er=!0,Gr=e}};function Pf(e,t,n,r,o,i,a,m,v){er=!1,Gr=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=Gr;er=!1,Gr=null}else throw Error(Q(198));Wr||(Wr=!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,Vr=Ke.unstable_NormalPriority,Uf=Ke.unstable_LowPriority,pl=Ke.unstable_IdlePriority,$r=null,ht=null;function Bf(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:Hf,_f=Math.log,zf=Math.LN2;function Hf(e){return e>>>=0,e===0?32:31-(_f(e)/zf|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 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=Kr;return Kr<<=1,!(Kr&4194240)&&(Kr=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,Yr=[],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 Xr(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){Xr(e)&&n.delete(t)}function Kf(){Hi=!1,Nt!==null&&Xr(Nt)&&(Nt=null),Dt!==null&&Xr(Dt)&&(Dt=null),Lt!==null&&Xr(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<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);)xl(n),n.blockedOn===null&&jt.shift()}var xn=Ct.ReactCurrentBatchConfig,Zr=!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(Zr){var o=Gi(e,t,n,r);if(o===null)aa(e,t,r,qr,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,qr,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else aa(e,t,r,null,n)}}var qr=null;function Gi(e,t,n,r){if(qr=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 qr=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 Vr:case Uf:return 16;case pl:return 536870912;default:return 16}default:return 16}}var Ut=null,Wi=null,eo=null;function Rl(){if(eo)return eo;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 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 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)?no: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=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},Vi=Qe(En),lr=pe({},En,{view:0,detail:0}),Yf=Qe(lr),$i,Ki,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: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(ro),Xf=pe({},ro,{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=to(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"?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}}),cd=Qe(ud),fd=pe({},ro,{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({},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}),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(),eo=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=lo(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 oo(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"&&oo(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 oo(dr)}function bd(e,t){if(e==="click")return oo(t)}function Ad(e,t){if(e==="input"||e==="change")return oo(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=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 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!==Hr(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=lo(ea,"onSelect"),0<r.length&&(t=new Vi("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")},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 ao(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=ao("animationend"),Ql=ao("animationiteration"),Jl=ao("animationstart"),Yl=ao("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(Wr)throw e=Li,Wr=!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 so="_reactListening"+Math.random().toString(36).slice(2);function vr(e){if(!e[so]){e[so]=!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[so]||(t[so]=!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(to(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=lo(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=lo(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 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 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 uo(e,t,n){if(t=ru(t),ru(e)!==t&&n)throw Error(Q(425))}function co(){}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 fo(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 ho(){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 po(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,mo=!1,pa=!1;function uu(e){Et===null?Et=[e]:Et.push(e)}function Fd(e){mo=!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,mo=!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,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 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===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 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 yo(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 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 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=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=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 _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=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;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&&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=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=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);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=cs(h,y.mode,w),d.return=y,y=d),a(y)):n(y,d)}return P}var Ln=vu(!0),gu=vu(!1),So=zt(null),Co=null,jn=null,Sa=null;function Ca(){Sa=jn=Co=null}function xa(e){var t=So.current;fe(So),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){Co=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(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 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 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,_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 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 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 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 Aa=[];function Ia(){for(var e=0;e<Aa.length;e++)Aa[e]._workInProgressVersionPrimary=null;Aa.length=0}var Ro=Ct.ReactCurrentDispatcher,Ma=Ct.ReactCurrentBatchConfig,un=0,ve=null,Ce=null,Re=null,To=!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,Ro.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,Ro.current=Yd,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 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 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&&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 bo(8390656,8,e,t)}function ja(e,t){return Ao(2048,8,e,t)}function Nu(e,t){return Ao(4,2,e,t)}function Du(e,t){return Ao(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,Ao(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=To=!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 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},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,bo(4194308,4,Lu.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=$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 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 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=Mo,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&&Mo.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&&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+=Of(r),r=r.return;while(r);var o=n}catch(i){o=`
|
|
31
|
-
Error generating stack: `+
|
|
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(){Uo||(Uo=!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=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 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;po(t)}else i=!1;if(Un(t,o),t.stateNode===null)ko(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,Eo(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,Eo(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=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=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=Wo({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Po(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))),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=Va(a),t.memoizedState=Wa,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=za(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 ls(),r=za(Error(Q(421))),Po(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&&Oo(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&&Oo(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 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 eh(e,t,n){switch(t.tag){case 3:oc(t),Dn();break;case 5:xu(t);break;case 1:He(t.type)&&po(t);break;case 4:Ta(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?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=co)}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)&&ho(),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)&&(yo(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),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":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&&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),Ks(r,i,!0);break;case"textarea":zr(r),Ys(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=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":zr(e),Ks(e,r,!1);break;case"textarea":zr(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=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)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),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))pu(),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&&(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)&&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 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)&&ho(),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 No=!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=Zr,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},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=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 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 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=co));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($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?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),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&&$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||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?xc(o):v!==null?(v.return=a,q=v):xc(o);for(;i!==null;)q=i,wc(i),i=i.sibling;q=o,No=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||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&&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{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{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,Lo=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,jo=0,es=0,Pr=null,Ge=null,ts=0,Fn=1/0,It=null,Uo=!1,ns=null,$t=null,Bo=!1,Kt=null,_o=0,kr=0,rs=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:Gd.transition!==null?(Ho===0&&(Ho=ml()),Ho):(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)&&(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;Gf(e,t);var r=Jr(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=Vr;break;case 536870912:n=pl;break;default:n=Vr}n=kc(n,Ec.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Ec(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=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(),Lo.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=Fo(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(Jr(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=Fo(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&=~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 Oc(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=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,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 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&&ho();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=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 Rc(e,t){do{var n=Se;try{if(Ca(),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,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=Lo.current;return Lo.current=Io,e===null?Io:e}function ls(){(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=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,Lo.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)||Bo||(Bo=!0,kc(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,qa.current=null,oh(e,n),yc(n,e),Md(la),Zr=!!sa,la=sa=null,e.current=n,ih(n),Lf(),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),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(Uo)throw Uo=!1,e=ns,ns=null,e;return _o&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(_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(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: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 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=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 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,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=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,po(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Ra(t),o.updater=Mo,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(ko(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),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=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(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),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),ko(e,t),t.tag=1,He(r)?(e=!0,po(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 Go(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 Wo(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 Wo(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 Vo(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),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 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}Ko.prototype.render=ps.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));Vo(e,t,null,null)},Ko.prototype.unmount=ps.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=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 Qo(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=$o(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=$o(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(){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=wh(n,t,e,o,r);return $o(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=fo(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,fo,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 Yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yo.isDisabled&&Yo.supportsFiber)try{$r=Yo.inject(Ch),ht=Yo}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(!Qo(t))throw Error(Q(200));return Jo(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 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=as,$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 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:{}},Xo={};/**
|
|
25
|
+
*/var Td=ne,qe=Od;function J(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 wl=new Set,nr={};function un(e,t){En(e,t),En(e+"Capture",t)}function En(e,t){for(nr[e]=t,e=0;e<t.length;e++)wl.add(t[e])}var Tt=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),Po=Object.prototype.hasOwnProperty,Ad=/^[: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]*$/,xl={},Sl={};function Id(e){return Po.call(Sl,e)?!0:Po.call(xl,e)?!1:Ad.test(e)?Sl[e]=!0:(xl[e]=!0,!1)}function Md(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 Pd(e,t,n,r){if(t===null||typeof t=="undefined"||Md(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 He(e,t,n,r,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var Pe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Pe[e]=new He(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Pe[t]=new He(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){Pe[e]=new He(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Pe[e]=new He(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){Pe[e]=new He(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){Pe[e]=new He(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){Pe[e]=new He(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){Pe[e]=new He(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){Pe[e]=new He(e,5,!1,e.toLowerCase(),null,!1,!1)});var No=/[\-:]([a-z])/g;function Lo(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(No,Lo);Pe[t]=new He(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(No,Lo);Pe[t]=new He(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(No,Lo);Pe[t]=new He(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){Pe[e]=new He(e,1,!1,e.toLowerCase(),null,!1,!1)}),Pe.xlinkHref=new He("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){Pe[e]=new He(e,1,!1,e.toLowerCase(),null,!0,!0)});function Do(e,t,n,r){var i=Pe.hasOwnProperty(t)?Pe[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Pd(t,n,i,r)&&(n=null),r||i===null?Id(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var At=Td.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Zr=Symbol.for("react.element"),On=Symbol.for("react.portal"),Tn=Symbol.for("react.fragment"),jo=Symbol.for("react.strict_mode"),Uo=Symbol.for("react.profiler"),Cl=Symbol.for("react.provider"),bl=Symbol.for("react.context"),Bo=Symbol.for("react.forward_ref"),_o=Symbol.for("react.suspense"),zo=Symbol.for("react.suspense_list"),Ho=Symbol.for("react.memo"),Ft=Symbol.for("react.lazy"),kl=Symbol.for("react.offscreen"),Rl=Symbol.iterator;function rr(e){return e===null||typeof e!="object"?null:(e=Rl&&e[Rl]||e["@@iterator"],typeof e=="function"?e:null)}var we=Object.assign,Fo;function ir(e){if(Fo===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Fo=t&&t[1]||""}return`
|
|
26
|
+
`+Fo+e}var Go=!1;function Wo(e,t){if(!e||Go)return"";Go=!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(m){var r=m}Reflect.construct(e,[],t)}else{try{t.call()}catch(m){r=m}e.call(t.prototype)}else{try{throw Error()}catch(m){r=m}e()}}catch(m){if(m&&r&&typeof m.stack=="string"){for(var i=m.stack.split(`
|
|
27
|
+
`),o=r.stack.split(`
|
|
28
|
+
`),a=i.length-1,l=o.length-1;1<=a&&0<=l&&i[a]!==o[l];)l--;for(;1<=a&&0<=l;a--,l--)if(i[a]!==o[l]){if(a!==1||l!==1)do if(a--,l--,0>l||i[a]!==o[l]){var h=`
|
|
29
|
+
`+i[a].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),h}while(1<=a&&0<=l);break}}}finally{Go=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ir(e):""}function Nd(e){switch(e.tag){case 5:return ir(e.type);case 16:return ir("Lazy");case 13:return ir("Suspense");case 19:return ir("SuspenseList");case 0:case 2:case 15:return e=Wo(e.type,!1),e;case 11:return e=Wo(e.type.render,!1),e;case 1:return e=Wo(e.type,!0),e;default:return""}}function $o(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 Tn:return"Fragment";case On:return"Portal";case Uo:return"Profiler";case jo:return"StrictMode";case _o:return"Suspense";case zo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case bl:return(e.displayName||"Context")+".Consumer";case Cl:return(e._context.displayName||"Context")+".Provider";case Bo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ho:return t=e.displayName||null,t!==null?t:$o(e.type)||"Memo";case Ft:t=e._payload,e=e._init;try{return $o(e(t))}catch(n){}}return null}function Ld(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 $o(t);case 8:return t===jo?"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 Gt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function El(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Dd(e){var t=El(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 i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.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 qr(e){e._valueTracker||(e._valueTracker=Dd(e))}function Ol(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=El(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ei(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 Vo(e,t){var n=t.checked;return we({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n!=null?n:e._wrapperState.initialChecked})}function Tl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Gt(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 Al(e,t){t=t.checked,t!=null&&Do(e,"checked",t,!1)}function Qo(e,t){Al(e,t);var n=Gt(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")?Ko(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ko(e,t.type,Gt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Il(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 Ko(e,t,n){(t!=="number"||ei(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var or=Array.isArray;function An(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Gt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Jo(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(J(91));return we({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ml(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(J(92));if(or(n)){if(1<n.length)throw Error(J(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Gt(n)}}function Pl(e,t){var n=Gt(t.value),r=Gt(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 Nl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Ll(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 Xo(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Ll(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ti,Dl=function(e){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ti=ti||document.createElement("div"),ti.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ti.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ar(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var sr={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},jd=["Webkit","ms","Moz","O"];Object.keys(sr).forEach(function(e){jd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),sr[t]=sr[e]})});function jl(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||sr.hasOwnProperty(e)&&sr[e]?(""+t).trim():t+"px"}function Ul(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=jl(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Ud=we({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 Yo(e,t){if(t){if(Ud[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(J(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(J(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(J(61))}if(t.style!=null&&typeof t.style!="object")throw Error(J(62))}}function Zo(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 qo=null;function ea(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ta=null,In=null,Mn=null;function Bl(e){if(e=Ar(e)){if(typeof ta!="function")throw Error(J(280));var t=e.stateNode;t&&(t=ki(t),ta(e.stateNode,e.type,t))}}function _l(e){In?Mn?Mn.push(e):Mn=[e]:In=e}function zl(){if(In){var e=In,t=Mn;if(Mn=In=null,Bl(e),t)for(e=0;e<t.length;e++)Bl(t[e])}}function Hl(e,t){return e(t)}function Fl(){}var na=!1;function Gl(e,t,n){if(na)return e(t,n);na=!0;try{return Hl(e,t,n)}finally{na=!1,(In!==null||Mn!==null)&&(Fl(),zl())}}function lr(e,t){var n=e.stateNode;if(n===null)return null;var r=ki(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(J(231,t,typeof n));return n}var ra=!1;if(Tt)try{var ur={};Object.defineProperty(ur,"passive",{get:function(){ra=!0}}),window.addEventListener("test",ur,ur),window.removeEventListener("test",ur,ur)}catch(e){ra=!1}function Bd(e,t,n,r,i,o,a,l,h){var m=Array.prototype.slice.call(arguments,3);try{t.apply(n,m)}catch(S){this.onError(S)}}var cr=!1,ni=null,ri=!1,ia=null,_d={onError:function(e){cr=!0,ni=e}};function zd(e,t,n,r,i,o,a,l,h){cr=!1,ni=null,Bd.apply(_d,arguments)}function Hd(e,t,n,r,i,o,a,l,h){if(zd.apply(this,arguments),cr){if(cr){var m=ni;cr=!1,ni=null}else throw Error(J(198));ri||(ri=!0,ia=m)}}function cn(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 Wl(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 $l(e){if(cn(e)!==e)throw Error(J(188))}function Fd(e){var t=e.alternate;if(!t){if(t=cn(e),t===null)throw Error(J(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return $l(i),e;if(o===r)return $l(i),t;o=o.sibling}throw Error(J(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,l=i.child;l;){if(l===n){a=!0,n=i,r=o;break}if(l===r){a=!0,r=i,n=o;break}l=l.sibling}if(!a){for(l=o.child;l;){if(l===n){a=!0,n=o,r=i;break}if(l===r){a=!0,r=o,n=i;break}l=l.sibling}if(!a)throw Error(J(189))}}if(n.alternate!==r)throw Error(J(190))}if(n.tag!==3)throw Error(J(188));return n.stateNode.current===n?e:t}function Vl(e){return e=Fd(e),e!==null?Ql(e):null}function Ql(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Ql(e);if(t!==null)return t;e=e.sibling}return null}var Kl=qe.unstable_scheduleCallback,Jl=qe.unstable_cancelCallback,Gd=qe.unstable_shouldYield,Wd=qe.unstable_requestPaint,ke=qe.unstable_now,$d=qe.unstable_getCurrentPriorityLevel,oa=qe.unstable_ImmediatePriority,Xl=qe.unstable_UserBlockingPriority,ii=qe.unstable_NormalPriority,Vd=qe.unstable_LowPriority,Yl=qe.unstable_IdlePriority,oi=null,St=null;function Qd(e){if(St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(oi,e,void 0,(e.current.flags&128)===128)}catch(t){}}var dt=Math.clz32?Math.clz32:Xd,Kd=Math.log,Jd=Math.LN2;function Xd(e){return e>>>=0,e===0?32:31-(Kd(e)/Jd|0)|0}var ai=64,si=4194304;function fr(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 li(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~i;l!==0?r=fr(l):(o&=a,o!==0&&(r=fr(o)))}else a=n&~i,a!==0?r=fr(a):o!==0&&(r=fr(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&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-dt(t),i=1<<n,r|=e[n],t&=~i;return r}function Yd(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 Zd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-dt(o),l=1<<a,h=i[a];h===-1?(!(l&n)||l&r)&&(i[a]=Yd(l,t)):h<=t&&(e.expiredLanes|=l),o&=~l}}function aa(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Zl(){var e=ai;return ai<<=1,!(ai&4194240)&&(ai=64),e}function sa(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function dr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-dt(t),e[t]=n}function qd(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 i=31-dt(n),o=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~o}}function la(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-dt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var ue=0;function ql(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var eu,ua,tu,nu,ru,ca=!1,ui=[],Wt=null,$t=null,Vt=null,hr=new Map,pr=new Map,Qt=[],eh="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 iu(e,t){switch(e){case"focusin":case"focusout":Wt=null;break;case"dragenter":case"dragleave":$t=null;break;case"mouseover":case"mouseout":Vt=null;break;case"pointerover":case"pointerout":hr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":pr.delete(t.pointerId)}}function gr(e,t,n,r,i,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},t!==null&&(t=Ar(t),t!==null&&ua(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function th(e,t,n,r,i){switch(t){case"focusin":return Wt=gr(Wt,e,t,n,r,i),!0;case"dragenter":return $t=gr($t,e,t,n,r,i),!0;case"mouseover":return Vt=gr(Vt,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return hr.set(o,gr(hr.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,pr.set(o,gr(pr.get(o)||null,e,t,n,r,i)),!0}return!1}function ou(e){var t=fn(e.target);if(t!==null){var n=cn(t);if(n!==null){if(t=n.tag,t===13){if(t=Wl(n),t!==null){e.blockedOn=t,ru(e.priority,function(){tu(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 ci(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=da(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qo=r,n.target.dispatchEvent(r),qo=null}else return t=Ar(n),t!==null&&ua(t),e.blockedOn=n,!1;t.shift()}return!0}function au(e,t,n){ci(e)&&n.delete(t)}function nh(){ca=!1,Wt!==null&&ci(Wt)&&(Wt=null),$t!==null&&ci($t)&&($t=null),Vt!==null&&ci(Vt)&&(Vt=null),hr.forEach(au),pr.forEach(au)}function mr(e,t){e.blockedOn===t&&(e.blockedOn=null,ca||(ca=!0,qe.unstable_scheduleCallback(qe.unstable_NormalPriority,nh)))}function vr(e){function t(i){return mr(i,e)}if(0<ui.length){mr(ui[0],e);for(var n=1;n<ui.length;n++){var r=ui[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Wt!==null&&mr(Wt,e),$t!==null&&mr($t,e),Vt!==null&&mr(Vt,e),hr.forEach(t),pr.forEach(t),n=0;n<Qt.length;n++)r=Qt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Qt.length&&(n=Qt[0],n.blockedOn===null);)ou(n),n.blockedOn===null&&Qt.shift()}var Pn=At.ReactCurrentBatchConfig,fi=!0;function rh(e,t,n,r){var i=ue,o=Pn.transition;Pn.transition=null;try{ue=1,fa(e,t,n,r)}finally{ue=i,Pn.transition=o}}function ih(e,t,n,r){var i=ue,o=Pn.transition;Pn.transition=null;try{ue=4,fa(e,t,n,r)}finally{ue=i,Pn.transition=o}}function fa(e,t,n,r){if(fi){var i=da(e,t,n,r);if(i===null)Aa(e,t,r,di,n),iu(e,r);else if(th(i,e,t,n,r))r.stopPropagation();else if(iu(e,r),t&4&&-1<eh.indexOf(e)){for(;i!==null;){var o=Ar(i);if(o!==null&&eu(o),o=da(e,t,n,r),o===null&&Aa(e,t,r,di,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else Aa(e,t,r,null,n)}}var di=null;function da(e,t,n,r){if(di=null,e=ea(r),e=fn(e),e!==null)if(t=cn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Wl(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 di=e,null}function su(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($d()){case oa:return 1;case Xl:return 4;case ii:case Vd:return 16;case Yl:return 536870912;default:return 16}default:return 16}}var Kt=null,ha=null,hi=null;function lu(){if(hi)return hi;var e,t=ha,n=t.length,r,i="value"in Kt?Kt.value:Kt.textContent,o=i.length;for(e=0;e<n&&t[e]===i[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===i[o-r];r++);return hi=i.slice(e,1<r?1-r:void 0)}function pi(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 gi(){return!0}function uu(){return!1}function et(e){function t(n,r,i,o,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=o,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?gi:uu,this.isPropagationStopped=uu,this}return we(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=gi)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=gi)},persist:function(){},isPersistent:gi}),t}var Nn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pa=et(Nn),yr=we({},Nn,{view:0,detail:0}),oh=et(yr),ga,ma,wr,mi=we({},yr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ya,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!==wr&&(wr&&e.type==="mousemove"?(ga=e.screenX-wr.screenX,ma=e.screenY-wr.screenY):ma=ga=0,wr=e),ga)},movementY:function(e){return"movementY"in e?e.movementY:ma}}),cu=et(mi),ah=we({},mi,{dataTransfer:0}),sh=et(ah),lh=we({},yr,{relatedTarget:0}),va=et(lh),uh=we({},Nn,{animationName:0,elapsedTime:0,pseudoElement:0}),ch=et(uh),fh=we({},Nn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),dh=et(fh),hh=we({},Nn,{data:0}),fu=et(hh),ph={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gh={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"},mh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=mh[e])?!!t[e]:!1}function ya(){return vh}var yh=we({},yr,{key:function(e){if(e.key){var t=ph[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=pi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ya,charCode:function(e){return e.type==="keypress"?pi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?pi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),wh=et(yh),xh=we({},mi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),du=et(xh),Sh=we({},yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ya}),Ch=et(Sh),bh=we({},Nn,{propertyName:0,elapsedTime:0,pseudoElement:0}),kh=et(bh),Rh=we({},mi,{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}),Eh=et(Rh),Oh=[9,13,27,32],wa=Tt&&"CompositionEvent"in window,xr=null;Tt&&"documentMode"in document&&(xr=document.documentMode);var Th=Tt&&"TextEvent"in window&&!xr,hu=Tt&&(!wa||xr&&8<xr&&11>=xr),pu=" ",gu=!1;function mu(e,t){switch(e){case"keyup":return Oh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ln=!1;function Ah(e,t){switch(e){case"compositionend":return vu(t);case"keypress":return t.which!==32?null:(gu=!0,pu);case"textInput":return e=t.data,e===pu&&gu?null:e;default:return null}}function Ih(e,t){if(Ln)return e==="compositionend"||!wa&&mu(e,t)?(e=lu(),hi=ha=Kt=null,Ln=!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 hu&&t.locale!=="ko"?null:t.data;default:return null}}var Mh={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 yu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Mh[e.type]:t==="textarea"}function wu(e,t,n,r){_l(r),t=Si(t,"onChange"),0<t.length&&(n=new pa("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Sr=null,Cr=null;function Ph(e){Uu(e,0)}function vi(e){var t=_n(e);if(Ol(t))return e}function Nh(e,t){if(e==="change")return t}var xu=!1;if(Tt){var xa;if(Tt){var Sa="oninput"in document;if(!Sa){var Su=document.createElement("div");Su.setAttribute("oninput","return;"),Sa=typeof Su.oninput=="function"}xa=Sa}else xa=!1;xu=xa&&(!document.documentMode||9<document.documentMode)}function Cu(){Sr&&(Sr.detachEvent("onpropertychange",bu),Cr=Sr=null)}function bu(e){if(e.propertyName==="value"&&vi(Cr)){var t=[];wu(t,Cr,e,ea(e)),Gl(Ph,t)}}function Lh(e,t,n){e==="focusin"?(Cu(),Sr=t,Cr=n,Sr.attachEvent("onpropertychange",bu)):e==="focusout"&&Cu()}function Dh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vi(Cr)}function jh(e,t){if(e==="click")return vi(t)}function Uh(e,t){if(e==="input"||e==="change")return vi(t)}function Bh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ht=typeof Object.is=="function"?Object.is:Bh;function br(e,t){if(ht(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 i=n[r];if(!Po.call(t,i)||!ht(e[i],t[i]))return!1}return!0}function ku(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ru(e,t){var n=ku(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=ku(n)}}function Eu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Eu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ou(){for(var e=window,t=ei();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=ei(e.document)}return t}function Ca(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 _h(e){var t=Ou(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Eu(n.ownerDocument.documentElement,n)){if(r!==null&&Ca(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 i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=Ru(n,o);var a=Ru(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>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 zh=Tt&&"documentMode"in document&&11>=document.documentMode,Dn=null,ba=null,kr=null,ka=!1;function Tu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ka||Dn==null||Dn!==ei(r)||(r=Dn,"selectionStart"in r&&Ca(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}),kr&&br(kr,r)||(kr=r,r=Si(ba,"onSelect"),0<r.length&&(t=new pa("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Dn)))}function yi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var jn={animationend:yi("Animation","AnimationEnd"),animationiteration:yi("Animation","AnimationIteration"),animationstart:yi("Animation","AnimationStart"),transitionend:yi("Transition","TransitionEnd")},Ra={},Au={};Tt&&(Au=document.createElement("div").style,"AnimationEvent"in window||(delete jn.animationend.animation,delete jn.animationiteration.animation,delete jn.animationstart.animation),"TransitionEvent"in window||delete jn.transitionend.transition);function wi(e){if(Ra[e])return Ra[e];if(!jn[e])return e;var t=jn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Au)return Ra[e]=t[n];return e}var Iu=wi("animationend"),Mu=wi("animationiteration"),Pu=wi("animationstart"),Nu=wi("transitionend"),Lu=new Map,Du="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 Jt(e,t){Lu.set(e,t),un(t,[e])}for(var Ea=0;Ea<Du.length;Ea++){var Oa=Du[Ea],Hh=Oa.toLowerCase(),Fh=Oa[0].toUpperCase()+Oa.slice(1);Jt(Hh,"on"+Fh)}Jt(Iu,"onAnimationEnd"),Jt(Mu,"onAnimationIteration"),Jt(Pu,"onAnimationStart"),Jt("dblclick","onDoubleClick"),Jt("focusin","onFocus"),Jt("focusout","onBlur"),Jt(Nu,"onTransitionEnd"),En("onMouseEnter",["mouseout","mouseover"]),En("onMouseLeave",["mouseout","mouseover"]),En("onPointerEnter",["pointerout","pointerover"]),En("onPointerLeave",["pointerout","pointerover"]),un("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),un("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),un("onBeforeInput",["compositionend","keypress","textInput","paste"]),un("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),un("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),un("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Rr="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(" "),Gh=new Set("cancel close invalid load scroll toggle".split(" ").concat(Rr));function ju(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Hd(r,t,void 0,e),e.currentTarget=null}function Uu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],h=l.instance,m=l.currentTarget;if(l=l.listener,h!==o&&i.isPropagationStopped())break e;ju(i,l,m),o=h}else for(a=0;a<r.length;a++){if(l=r[a],h=l.instance,m=l.currentTarget,l=l.listener,h!==o&&i.isPropagationStopped())break e;ju(i,l,m),o=h}}}if(ri)throw e=ia,ri=!1,ia=null,e}function pe(e,t){var n=t[Da];n===void 0&&(n=t[Da]=new Set);var r=e+"__bubble";n.has(r)||(Bu(t,e,2,!1),n.add(r))}function Ta(e,t,n){var r=0;t&&(r|=4),Bu(n,e,r,t)}var xi="_reactListening"+Math.random().toString(36).slice(2);function Er(e){if(!e[xi]){e[xi]=!0,wl.forEach(function(n){n!=="selectionchange"&&(Gh.has(n)||Ta(n,!1,e),Ta(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xi]||(t[xi]=!0,Ta("selectionchange",!1,t))}}function Bu(e,t,n,r){switch(su(t)){case 1:var i=rh;break;case 4:i=ih;break;default:i=fa}n=i.bind(null,t,n,e),i=void 0,!ra||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Aa(e,t,n,r,i){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var h=a.tag;if((h===3||h===4)&&(h=a.stateNode.containerInfo,h===i||h.nodeType===8&&h.parentNode===i))return;a=a.return}for(;l!==null;){if(a=fn(l),a===null)return;if(h=a.tag,h===5||h===6){r=o=a;continue e}l=l.parentNode}}r=r.return}Gl(function(){var m=o,S=ea(n),E=[];e:{var y=Lu.get(e);if(y!==void 0){var R=pa,f=e;switch(e){case"keypress":if(pi(n)===0)break e;case"keydown":case"keyup":R=wh;break;case"focusin":f="focus",R=va;break;case"focusout":f="blur",R=va;break;case"beforeblur":case"afterblur":R=va;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":R=cu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":R=sh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":R=Ch;break;case Iu:case Mu:case Pu:R=ch;break;case Nu:R=kh;break;case"scroll":R=oh;break;case"wheel":R=Eh;break;case"copy":case"cut":case"paste":R=dh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":R=du}var b=(t&4)!==0,T=!b&&e==="scroll",x=b?y!==null?y+"Capture":null:y;b=[];for(var p=m,g;p!==null;){g=p;var C=g.stateNode;if(g.tag===5&&C!==null&&(g=C,x!==null&&(C=lr(p,x),C!=null&&b.push(Or(p,C,g)))),T)break;p=p.return}0<b.length&&(y=new R(y,f,null,n,S),E.push({event:y,listeners:b}))}}if(!(t&7)){e:{if(y=e==="mouseover"||e==="pointerover",R=e==="mouseout"||e==="pointerout",y&&n!==qo&&(f=n.relatedTarget||n.fromElement)&&(fn(f)||f[It]))break e;if((R||y)&&(y=S.window===S?S:(y=S.ownerDocument)?y.defaultView||y.parentWindow:window,R?(f=n.relatedTarget||n.toElement,R=m,f=f?fn(f):null,f!==null&&(T=cn(f),f!==T||f.tag!==5&&f.tag!==6)&&(f=null)):(R=null,f=m),R!==f)){if(b=cu,C="onMouseLeave",x="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(b=du,C="onPointerLeave",x="onPointerEnter",p="pointer"),T=R==null?y:_n(R),g=f==null?y:_n(f),y=new b(C,p+"leave",R,n,S),y.target=T,y.relatedTarget=g,C=null,fn(S)===m&&(b=new b(x,p+"enter",f,n,S),b.target=g,b.relatedTarget=T,C=b),T=C,R&&f)t:{for(b=R,x=f,p=0,g=b;g;g=Un(g))p++;for(g=0,C=x;C;C=Un(C))g++;for(;0<p-g;)b=Un(b),p--;for(;0<g-p;)x=Un(x),g--;for(;p--;){if(b===x||x!==null&&b===x.alternate)break t;b=Un(b),x=Un(x)}b=null}else b=null;R!==null&&_u(E,y,R,b,!1),f!==null&&T!==null&&_u(E,T,f,b,!0)}}e:{if(y=m?_n(m):window,R=y.nodeName&&y.nodeName.toLowerCase(),R==="select"||R==="input"&&y.type==="file")var d=Nh;else if(yu(y))if(xu)d=Uh;else{d=Dh;var c=Lh}else(R=y.nodeName)&&R.toLowerCase()==="input"&&(y.type==="checkbox"||y.type==="radio")&&(d=jh);if(d&&(d=d(e,m))){wu(E,d,n,S);break e}c&&c(e,y,m),e==="focusout"&&(c=y._wrapperState)&&c.controlled&&y.type==="number"&&Ko(y,"number",y.value)}switch(c=m?_n(m):window,e){case"focusin":(yu(c)||c.contentEditable==="true")&&(Dn=c,ba=m,kr=null);break;case"focusout":kr=ba=Dn=null;break;case"mousedown":ka=!0;break;case"contextmenu":case"mouseup":case"dragend":ka=!1,Tu(E,n,S);break;case"selectionchange":if(zh)break;case"keydown":case"keyup":Tu(E,n,S)}var u;if(wa)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 Ln?mu(e,n)&&(s="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(s="onCompositionStart");s&&(hu&&n.locale!=="ko"&&(Ln||s!=="onCompositionStart"?s==="onCompositionEnd"&&Ln&&(u=lu()):(Kt=S,ha="value"in Kt?Kt.value:Kt.textContent,Ln=!0)),c=Si(m,s),0<c.length&&(s=new fu(s,e,null,n,S),E.push({event:s,listeners:c}),u?s.data=u:(u=vu(n),u!==null&&(s.data=u)))),(u=Th?Ah(e,n):Ih(e,n))&&(m=Si(m,"onBeforeInput"),0<m.length&&(S=new fu("onBeforeInput","beforeinput",null,n,S),E.push({event:S,listeners:m}),S.data=u))}Uu(E,t)})}function Or(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Si(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=lr(e,n),o!=null&&r.unshift(Or(e,o,i)),o=lr(e,t),o!=null&&r.push(Or(e,o,i))),e=e.return}return r}function Un(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function _u(e,t,n,r,i){for(var o=t._reactName,a=[];n!==null&&n!==r;){var l=n,h=l.alternate,m=l.stateNode;if(h!==null&&h===r)break;l.tag===5&&m!==null&&(l=m,i?(h=lr(n,o),h!=null&&a.unshift(Or(n,h,l))):i||(h=lr(n,o),h!=null&&a.push(Or(n,h,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var Wh=/\r\n?/g,$h=/\u0000|\uFFFD/g;function zu(e){return(typeof e=="string"?e:""+e).replace(Wh,`
|
|
30
|
+
`).replace($h,"")}function Ci(e,t,n){if(t=zu(t),zu(e)!==t&&n)throw Error(J(425))}function bi(){}var Ia=null,Ma=null;function Pa(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 Na=typeof setTimeout=="function"?setTimeout:void 0,Vh=typeof clearTimeout=="function"?clearTimeout:void 0,Hu=typeof Promise=="function"?Promise:void 0,Qh=typeof queueMicrotask=="function"?queueMicrotask:typeof Hu!="undefined"?function(e){return Hu.resolve(null).then(e).catch(Kh)}:Na;function Kh(e){setTimeout(function(){throw e})}function La(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),vr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);vr(t)}function Xt(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 Fu(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 Bn=Math.random().toString(36).slice(2),Ct="__reactFiber$"+Bn,Tr="__reactProps$"+Bn,It="__reactContainer$"+Bn,Da="__reactEvents$"+Bn,Jh="__reactListeners$"+Bn,Xh="__reactHandles$"+Bn;function fn(e){var t=e[Ct];if(t)return t;for(var n=e.parentNode;n;){if(t=n[It]||n[Ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Fu(e);e!==null;){if(n=e[Ct])return n;e=Fu(e)}return t}e=n,n=e.parentNode}return null}function Ar(e){return e=e[Ct]||e[It],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function _n(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(J(33))}function ki(e){return e[Tr]||null}var ja=[],zn=-1;function Yt(e){return{current:e}}function ge(e){0>zn||(e.current=ja[zn],ja[zn]=null,zn--)}function de(e,t){zn++,ja[zn]=e.current,e.current=t}var Zt={},je=Yt(Zt),Ve=Yt(!1),dn=Zt;function Hn(e,t){var n=e.type.contextTypes;if(!n)return Zt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Qe(e){return e=e.childContextTypes,e!=null}function Ri(){ge(Ve),ge(je)}function Gu(e,t,n){if(je.current!==Zt)throw Error(J(168));de(je,t),de(Ve,n)}function Wu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(J(108,Ld(e)||"Unknown",i));return we({},n,r)}function Ei(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zt,dn=je.current,de(je,e),de(Ve,Ve.current),!0}function $u(e,t,n){var r=e.stateNode;if(!r)throw Error(J(169));n?(e=Wu(e,t,dn),r.__reactInternalMemoizedMergedChildContext=e,ge(Ve),ge(je),de(je,e)):ge(Ve),de(Ve,n)}var Mt=null,Oi=!1,Ua=!1;function Vu(e){Mt===null?Mt=[e]:Mt.push(e)}function Yh(e){Oi=!0,Vu(e)}function qt(){if(!Ua&&Mt!==null){Ua=!0;var e=0,t=ue;try{var n=Mt;for(ue=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Mt=null,Oi=!1}catch(i){throw Mt!==null&&(Mt=Mt.slice(e+1)),Kl(oa,qt),i}finally{ue=t,Ua=!1}}return null}var Fn=[],Gn=0,Ti=null,Ai=0,at=[],st=0,hn=null,Pt=1,Nt="";function pn(e,t){Fn[Gn++]=Ai,Fn[Gn++]=Ti,Ti=e,Ai=t}function Qu(e,t,n){at[st++]=Pt,at[st++]=Nt,at[st++]=hn,hn=e;var r=Pt;e=Nt;var i=32-dt(r)-1;r&=~(1<<i),n+=1;var o=32-dt(t)+i;if(30<o){var a=i-i%5;o=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Pt=1<<32-dt(t)+i|n<<i|r,Nt=o+e}else Pt=1<<o|n<<i|r,Nt=e}function Ba(e){e.return!==null&&(pn(e,1),Qu(e,1,0))}function _a(e){for(;e===Ti;)Ti=Fn[--Gn],Fn[Gn]=null,Ai=Fn[--Gn],Fn[Gn]=null;for(;e===hn;)hn=at[--st],at[st]=null,Nt=at[--st],at[st]=null,Pt=at[--st],at[st]=null}var tt=null,nt=null,ve=!1,pt=null;function Ku(e,t){var n=ft(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 Ju(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,tt=e,nt=Xt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,tt=e,nt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=hn!==null?{id:Pt,overflow:Nt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ft(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,tt=e,nt=null,!0):!1;default:return!1}}function za(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ha(e){if(ve){var t=nt;if(t){var n=t;if(!Ju(e,t)){if(za(e))throw Error(J(418));t=Xt(n.nextSibling);var r=tt;t&&Ju(e,t)?Ku(r,n):(e.flags=e.flags&-4097|2,ve=!1,tt=e)}}else{if(za(e))throw Error(J(418));e.flags=e.flags&-4097|2,ve=!1,tt=e}}}function Xu(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;tt=e}function Ii(e){if(e!==tt)return!1;if(!ve)return Xu(e),ve=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Pa(e.type,e.memoizedProps)),t&&(t=nt)){if(za(e))throw Yu(),Error(J(418));for(;t;)Ku(e,t),t=Xt(t.nextSibling)}if(Xu(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(J(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){nt=Xt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}nt=null}}else nt=tt?Xt(e.stateNode.nextSibling):null;return!0}function Yu(){for(var e=nt;e;)e=Xt(e.nextSibling)}function Wn(){nt=tt=null,ve=!1}function Fa(e){pt===null?pt=[e]:pt.push(e)}var Zh=At.ReactCurrentBatchConfig;function Ir(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(J(309));var r=n.stateNode}if(!r)throw Error(J(147,e));var i=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(a){var l=i.refs;a===null?delete l[o]:l[o]=a},t._stringRef=o,t)}if(typeof e!="string")throw Error(J(284));if(!n._owner)throw Error(J(290,e))}return e}function Mi(e,t){throw e=Object.prototype.toString.call(t),Error(J(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Zu(e){var t=e._init;return t(e._payload)}function qu(e){function t(x,p){if(e){var g=x.deletions;g===null?(x.deletions=[p],x.flags|=16):g.push(p)}}function n(x,p){if(!e)return null;for(;p!==null;)t(x,p),p=p.sibling;return null}function r(x,p){for(x=new Map;p!==null;)p.key!==null?x.set(p.key,p):x.set(p.index,p),p=p.sibling;return x}function i(x,p){return x=ln(x,p),x.index=0,x.sibling=null,x}function o(x,p,g){return x.index=g,e?(g=x.alternate,g!==null?(g=g.index,g<p?(x.flags|=2,p):g):(x.flags|=2,p)):(x.flags|=1048576,p)}function a(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,p,g,C){return p===null||p.tag!==6?(p=Ns(g,x.mode,C),p.return=x,p):(p=i(p,g),p.return=x,p)}function h(x,p,g,C){var d=g.type;return d===Tn?S(x,p,g.props.children,C,g.key):p!==null&&(p.elementType===d||typeof d=="object"&&d!==null&&d.$$typeof===Ft&&Zu(d)===p.type)?(C=i(p,g.props),C.ref=Ir(x,p,g),C.return=x,C):(C=to(g.type,g.key,g.props,null,x.mode,C),C.ref=Ir(x,p,g),C.return=x,C)}function m(x,p,g,C){return p===null||p.tag!==4||p.stateNode.containerInfo!==g.containerInfo||p.stateNode.implementation!==g.implementation?(p=Ls(g,x.mode,C),p.return=x,p):(p=i(p,g.children||[]),p.return=x,p)}function S(x,p,g,C,d){return p===null||p.tag!==7?(p=Cn(g,x.mode,C,d),p.return=x,p):(p=i(p,g),p.return=x,p)}function E(x,p,g){if(typeof p=="string"&&p!==""||typeof p=="number")return p=Ns(""+p,x.mode,g),p.return=x,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Zr:return g=to(p.type,p.key,p.props,null,x.mode,g),g.ref=Ir(x,null,p),g.return=x,g;case On:return p=Ls(p,x.mode,g),p.return=x,p;case Ft:var C=p._init;return E(x,C(p._payload),g)}if(or(p)||rr(p))return p=Cn(p,x.mode,g,null),p.return=x,p;Mi(x,p)}return null}function y(x,p,g,C){var d=p!==null?p.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return d!==null?null:l(x,p,""+g,C);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Zr:return g.key===d?h(x,p,g,C):null;case On:return g.key===d?m(x,p,g,C):null;case Ft:return d=g._init,y(x,p,d(g._payload),C)}if(or(g)||rr(g))return d!==null?null:S(x,p,g,C,null);Mi(x,g)}return null}function R(x,p,g,C,d){if(typeof C=="string"&&C!==""||typeof C=="number")return x=x.get(g)||null,l(p,x,""+C,d);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Zr:return x=x.get(C.key===null?g:C.key)||null,h(p,x,C,d);case On:return x=x.get(C.key===null?g:C.key)||null,m(p,x,C,d);case Ft:var c=C._init;return R(x,p,g,c(C._payload),d)}if(or(C)||rr(C))return x=x.get(g)||null,S(p,x,C,d,null);Mi(p,C)}return null}function f(x,p,g,C){for(var d=null,c=null,u=p,s=p=0,w=null;u!==null&&s<g.length;s++){u.index>s?(w=u,u=null):w=u.sibling;var v=y(x,u,g[s],C);if(v===null){u===null&&(u=w);break}e&&u&&v.alternate===null&&t(x,u),p=o(v,p,s),c===null?d=v:c.sibling=v,c=v,u=w}if(s===g.length)return n(x,u),ve&&pn(x,s),d;if(u===null){for(;s<g.length;s++)u=E(x,g[s],C),u!==null&&(p=o(u,p,s),c===null?d=u:c.sibling=u,c=u);return ve&&pn(x,s),d}for(u=r(x,u);s<g.length;s++)w=R(u,x,s,g[s],C),w!==null&&(e&&w.alternate!==null&&u.delete(w.key===null?s:w.key),p=o(w,p,s),c===null?d=w:c.sibling=w,c=w);return e&&u.forEach(function(k){return t(x,k)}),ve&&pn(x,s),d}function b(x,p,g,C){var d=rr(g);if(typeof d!="function")throw Error(J(150));if(g=d.call(g),g==null)throw Error(J(151));for(var c=d=null,u=p,s=p=0,w=null,v=g.next();u!==null&&!v.done;s++,v=g.next()){u.index>s?(w=u,u=null):w=u.sibling;var k=y(x,u,v.value,C);if(k===null){u===null&&(u=w);break}e&&u&&k.alternate===null&&t(x,u),p=o(k,p,s),c===null?d=k:c.sibling=k,c=k,u=w}if(v.done)return n(x,u),ve&&pn(x,s),d;if(u===null){for(;!v.done;s++,v=g.next())v=E(x,v.value,C),v!==null&&(p=o(v,p,s),c===null?d=v:c.sibling=v,c=v);return ve&&pn(x,s),d}for(u=r(x,u);!v.done;s++,v=g.next())v=R(u,x,s,v.value,C),v!==null&&(e&&v.alternate!==null&&u.delete(v.key===null?s:v.key),p=o(v,p,s),c===null?d=v:c.sibling=v,c=v);return e&&u.forEach(function(L){return t(x,L)}),ve&&pn(x,s),d}function T(x,p,g,C){if(typeof g=="object"&&g!==null&&g.type===Tn&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Zr:e:{for(var d=g.key,c=p;c!==null;){if(c.key===d){if(d=g.type,d===Tn){if(c.tag===7){n(x,c.sibling),p=i(c,g.props.children),p.return=x,x=p;break e}}else if(c.elementType===d||typeof d=="object"&&d!==null&&d.$$typeof===Ft&&Zu(d)===c.type){n(x,c.sibling),p=i(c,g.props),p.ref=Ir(x,c,g),p.return=x,x=p;break e}n(x,c);break}else t(x,c);c=c.sibling}g.type===Tn?(p=Cn(g.props.children,x.mode,C,g.key),p.return=x,x=p):(C=to(g.type,g.key,g.props,null,x.mode,C),C.ref=Ir(x,p,g),C.return=x,x=C)}return a(x);case On:e:{for(c=g.key;p!==null;){if(p.key===c)if(p.tag===4&&p.stateNode.containerInfo===g.containerInfo&&p.stateNode.implementation===g.implementation){n(x,p.sibling),p=i(p,g.children||[]),p.return=x,x=p;break e}else{n(x,p);break}else t(x,p);p=p.sibling}p=Ls(g,x.mode,C),p.return=x,x=p}return a(x);case Ft:return c=g._init,T(x,p,c(g._payload),C)}if(or(g))return f(x,p,g,C);if(rr(g))return b(x,p,g,C);Mi(x,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,p!==null&&p.tag===6?(n(x,p.sibling),p=i(p,g),p.return=x,x=p):(n(x,p),p=Ns(g,x.mode,C),p.return=x,x=p),a(x)):n(x,p)}return T}var $n=qu(!0),ec=qu(!1),Pi=Yt(null),Ni=null,Vn=null,Ga=null;function Wa(){Ga=Vn=Ni=null}function $a(e){var t=Pi.current;ge(Pi),e._currentValue=t}function Va(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 Qn(e,t){Ni=e,Ga=Vn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ke=!0),e.firstContext=null)}function lt(e){var t=e._currentValue;if(Ga!==e)if(e={context:e,memoizedValue:t,next:null},Vn===null){if(Ni===null)throw Error(J(308));Vn=e,Ni.dependencies={lanes:0,firstContext:e}}else Vn=Vn.next=e;return t}var gn=null;function Qa(e){gn===null?gn=[e]:gn.push(e)}function tc(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Qa(t)):(n.next=i.next,i.next=n),t.interleaved=n,Lt(e,r)}function Lt(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 en=!1;function Ka(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nc(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 Dt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function tn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ae&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Lt(e,n)}return i=r.interleaved,i===null?(t.next=t,Qa(r)):(t.next=i.next,i.next=t),r.interleaved=t,Lt(e,n)}function Li(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,la(e,n)}}function rc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=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};o===null?i=o=a:o=o.next=a,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,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 Di(e,t,n,r){var i=e.updateQueue;en=!1;var o=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var h=l,m=h.next;h.next=null,a===null?o=m:a.next=m,a=h;var S=e.alternate;S!==null&&(S=S.updateQueue,l=S.lastBaseUpdate,l!==a&&(l===null?S.firstBaseUpdate=m:l.next=m,S.lastBaseUpdate=h))}if(o!==null){var E=i.baseState;a=0,S=m=h=null,l=o;do{var y=l.lane,R=l.eventTime;if((r&y)===y){S!==null&&(S=S.next={eventTime:R,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var f=e,b=l;switch(y=t,R=n,b.tag){case 1:if(f=b.payload,typeof f=="function"){E=f.call(R,E,y);break e}E=f;break e;case 3:f.flags=f.flags&-65537|128;case 0:if(f=b.payload,y=typeof f=="function"?f.call(R,E,y):f,y==null)break e;E=we({},E,y);break e;case 2:en=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,y=i.effects,y===null?i.effects=[l]:y.push(l))}else R={eventTime:R,lane:y,tag:l.tag,payload:l.payload,callback:l.callback,next:null},S===null?(m=S=R,h=E):S=S.next=R,a|=y;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;y=l,l=y.next,y.next=null,i.lastBaseUpdate=y,i.shared.pending=null}}while(!0);if(S===null&&(h=E),i.baseState=h,i.firstBaseUpdate=m,i.lastBaseUpdate=S,t=i.shared.interleaved,t!==null){i=t;do a|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);yn|=a,e.lanes=a,e.memoizedState=E}}function ic(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(J(191,i));i.call(r)}}}var Mr={},bt=Yt(Mr),Pr=Yt(Mr),Nr=Yt(Mr);function mn(e){if(e===Mr)throw Error(J(174));return e}function Ja(e,t){switch(de(Nr,t),de(Pr,e),de(bt,Mr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Xo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Xo(t,e)}ge(bt),de(bt,t)}function Kn(){ge(bt),ge(Pr),ge(Nr)}function oc(e){mn(Nr.current);var t=mn(bt.current),n=Xo(t,e.type);t!==n&&(de(Pr,e),de(bt,n))}function Xa(e){Pr.current===e&&(ge(bt),ge(Pr))}var xe=Yt(0);function ji(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 Ya=[];function Za(){for(var e=0;e<Ya.length;e++)Ya[e]._workInProgressVersionPrimary=null;Ya.length=0}var Ui=At.ReactCurrentDispatcher,qa=At.ReactCurrentBatchConfig,vn=0,Se=null,Oe=null,Ie=null,Bi=!1,Lr=!1,Dr=0,qh=0;function Ue(){throw Error(J(321))}function es(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ht(e[n],t[n]))return!1;return!0}function ts(e,t,n,r,i,o){if(vn=o,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ui.current=e===null||e.memoizedState===null?rp:ip,e=n(r,i),Lr){o=0;do{if(Lr=!1,Dr=0,25<=o)throw Error(J(301));o+=1,Ie=Oe=null,t.updateQueue=null,Ui.current=op,e=n(r,i)}while(Lr)}if(Ui.current=Hi,t=Oe!==null&&Oe.next!==null,vn=0,Ie=Oe=Se=null,Bi=!1,t)throw Error(J(300));return e}function ns(){var e=Dr!==0;return Dr=0,e}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ie===null?Se.memoizedState=Ie=e:Ie=Ie.next=e,Ie}function ut(){if(Oe===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Oe.next;var t=Ie===null?Se.memoizedState:Ie.next;if(t!==null)Ie=t,Oe=e;else{if(e===null)throw Error(J(310));Oe=e,e={memoizedState:Oe.memoizedState,baseState:Oe.baseState,baseQueue:Oe.baseQueue,queue:Oe.queue,next:null},Ie===null?Se.memoizedState=Ie=e:Ie=Ie.next=e}return Ie}function jr(e,t){return typeof t=="function"?t(e):t}function rs(e){var t=ut(),n=t.queue;if(n===null)throw Error(J(311));n.lastRenderedReducer=e;var r=Oe,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var l=a=null,h=null,m=o;do{var S=m.lane;if((vn&S)===S)h!==null&&(h=h.next={lane:0,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null}),r=m.hasEagerState?m.eagerState:e(r,m.action);else{var E={lane:S,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null};h===null?(l=h=E,a=r):h=h.next=E,Se.lanes|=S,yn|=S}m=m.next}while(m!==null&&m!==o);h===null?a=r:h.next=l,ht(r,t.memoizedState)||(Ke=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=h,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do o=i.lane,Se.lanes|=o,yn|=o,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function is(e){var t=ut(),n=t.queue;if(n===null)throw Error(J(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do o=e(o,a.action),a=a.next;while(a!==i);ht(o,t.memoizedState)||(Ke=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ac(){}function sc(e,t){var n=Se,r=ut(),i=t(),o=!ht(r.memoizedState,i);if(o&&(r.memoizedState=i,Ke=!0),r=r.queue,os(cc.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||Ie!==null&&Ie.memoizedState.tag&1){if(n.flags|=2048,Ur(9,uc.bind(null,n,r,i,t),void 0,null),Me===null)throw Error(J(349));vn&30||lc(n,t,i)}return i}function lc(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Se.updateQueue,t===null?(t={lastEffect:null,stores:null},Se.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function uc(e,t,n,r){t.value=n,t.getSnapshot=r,fc(t)&&dc(e)}function cc(e,t,n){return n(function(){fc(t)&&dc(e)})}function fc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ht(e,n)}catch(r){return!0}}function dc(e){var t=Lt(e,1);t!==null&&yt(t,e,1,-1)}function hc(e){var t=kt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:e},t.queue=e,e=e.dispatch=np.bind(null,Se,e),[t.memoizedState,e]}function Ur(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Se.updateQueue,t===null?(t={lastEffect:null,stores:null},Se.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 pc(){return ut().memoizedState}function _i(e,t,n,r){var i=kt();Se.flags|=e,i.memoizedState=Ur(1|t,n,void 0,r===void 0?null:r)}function zi(e,t,n,r){var i=ut();r=r===void 0?null:r;var o=void 0;if(Oe!==null){var a=Oe.memoizedState;if(o=a.destroy,r!==null&&es(r,a.deps)){i.memoizedState=Ur(t,n,o,r);return}}Se.flags|=e,i.memoizedState=Ur(1|t,n,o,r)}function gc(e,t){return _i(8390656,8,e,t)}function os(e,t){return zi(2048,8,e,t)}function mc(e,t){return zi(4,2,e,t)}function vc(e,t){return zi(4,4,e,t)}function yc(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 wc(e,t,n){return n=n!=null?n.concat([e]):null,zi(4,4,yc.bind(null,t,e),n)}function as(){}function xc(e,t){var n=ut();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&es(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Sc(e,t){var n=ut();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&es(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Cc(e,t,n){return vn&21?(ht(n,t)||(n=Zl(),Se.lanes|=n,yn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ke=!0),e.memoizedState=n)}function ep(e,t){var n=ue;ue=n!==0&&4>n?n:4,e(!0);var r=qa.transition;qa.transition={};try{e(!1),t()}finally{ue=n,qa.transition=r}}function bc(){return ut().memoizedState}function tp(e,t,n){var r=an(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},kc(e))Rc(t,n);else if(n=tc(e,t,n,r),n!==null){var i=Ge();yt(n,e,r,i),Ec(n,t,r)}}function np(e,t,n){var r=an(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(kc(e))Rc(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,l=o(a,n);if(i.hasEagerState=!0,i.eagerState=l,ht(l,a)){var h=t.interleaved;h===null?(i.next=i,Qa(t)):(i.next=h.next,h.next=i),t.interleaved=i;return}}catch(m){}finally{}n=tc(e,t,i,r),n!==null&&(i=Ge(),yt(n,e,r,i),Ec(n,t,r))}}function kc(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Rc(e,t){Lr=Bi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ec(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,la(e,n)}}var Hi={readContext:lt,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useInsertionEffect:Ue,useLayoutEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useMutableSource:Ue,useSyncExternalStore:Ue,useId:Ue,unstable_isNewReconciler:!1},rp={readContext:lt,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:lt,useEffect:gc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,_i(4194308,4,yc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _i(4194308,4,e,t)},useInsertionEffect:function(e,t){return _i(4,2,e,t)},useMemo:function(e,t){var n=kt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=kt();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=tp.bind(null,Se,e),[r.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:hc,useDebugValue:as,useDeferredValue:function(e){return kt().memoizedState=e},useTransition:function(){var e=hc(!1),t=e[0];return e=ep.bind(null,e[1]),kt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Se,i=kt();if(ve){if(n===void 0)throw Error(J(407));n=n()}else{if(n=t(),Me===null)throw Error(J(349));vn&30||lc(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,gc(cc.bind(null,r,o,e),[e]),r.flags|=2048,Ur(9,uc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=kt(),t=Me.identifierPrefix;if(ve){var n=Nt,r=Pt;n=(r&~(1<<32-dt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Dr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=qh++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ip={readContext:lt,useCallback:xc,useContext:lt,useEffect:os,useImperativeHandle:wc,useInsertionEffect:mc,useLayoutEffect:vc,useMemo:Sc,useReducer:rs,useRef:pc,useState:function(){return rs(jr)},useDebugValue:as,useDeferredValue:function(e){var t=ut();return Cc(t,Oe.memoizedState,e)},useTransition:function(){var e=rs(jr)[0],t=ut().memoizedState;return[e,t]},useMutableSource:ac,useSyncExternalStore:sc,useId:bc,unstable_isNewReconciler:!1},op={readContext:lt,useCallback:xc,useContext:lt,useEffect:os,useImperativeHandle:wc,useInsertionEffect:mc,useLayoutEffect:vc,useMemo:Sc,useReducer:is,useRef:pc,useState:function(){return is(jr)},useDebugValue:as,useDeferredValue:function(e){var t=ut();return Oe===null?t.memoizedState=e:Cc(t,Oe.memoizedState,e)},useTransition:function(){var e=is(jr)[0],t=ut().memoizedState;return[e,t]},useMutableSource:ac,useSyncExternalStore:sc,useId:bc,unstable_isNewReconciler:!1};function gt(e,t){if(e&&e.defaultProps){t=we({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function ss(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:we({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Fi={isMounted:function(e){return(e=e._reactInternals)?cn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ge(),i=an(e),o=Dt(r,i);o.payload=t,n!=null&&(o.callback=n),t=tn(e,o,i),t!==null&&(yt(t,e,i,r),Li(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ge(),i=an(e),o=Dt(r,i);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=tn(e,o,i),t!==null&&(yt(t,e,i,r),Li(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ge(),r=an(e),i=Dt(n,r);i.tag=2,t!=null&&(i.callback=t),t=tn(e,i,r),t!==null&&(yt(t,e,r,n),Li(t,e,r))}};function Oc(e,t,n,r,i,o,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,a):t.prototype&&t.prototype.isPureReactComponent?!br(n,r)||!br(i,o):!0}function Tc(e,t,n){var r=!1,i=Zt,o=t.contextType;return typeof o=="object"&&o!==null?o=lt(o):(i=Qe(t)?dn:je.current,r=t.contextTypes,o=(r=r!=null)?Hn(e,i):Zt),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Fi,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function Ac(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&&Fi.enqueueReplaceState(t,t.state,null)}function ls(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Ka(e);var o=t.contextType;typeof o=="object"&&o!==null?i.context=lt(o):(o=Qe(t)?dn:je.current,i.context=Hn(e,o)),i.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(ss(e,t,o,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Fi.enqueueReplaceState(i,i.state,null),Di(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Jn(e,t){try{var n="",r=t;do n+=Nd(r),r=r.return;while(r);var i=n}catch(o){i=`
|
|
31
|
+
Error generating stack: `+o.message+`
|
|
32
|
+
`+o.stack}return{value:e,source:t,stack:i,digest:null}}function us(e,t,n){return{value:e,source:null,stack:n!=null?n:null,digest:t!=null?t:null}}function cs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ap=typeof WeakMap=="function"?WeakMap:Map;function Ic(e,t,n){n=Dt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ji||(Ji=!0,Rs=r),cs(e,t)},n}function Mc(e,t,n){n=Dt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){cs(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){cs(e,t),typeof r!="function"&&(rn===null?rn=new Set([this]):rn.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Pc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ap;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=xp.bind(null,e,t,n),t.then(e,e))}function Nc(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 Lc(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,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=Dt(-1,1),t.tag=2,tn(n,t,1))),n.lanes|=1),e)}var sp=At.ReactCurrentOwner,Ke=!1;function Fe(e,t,n,r){t.child=e===null?ec(t,null,n,r):$n(t,e.child,n,r)}function Dc(e,t,n,r,i){n=n.render;var o=t.ref;return Qn(t,i),r=ts(e,t,n,r,o,i),n=ns(),e!==null&&!Ke?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,jt(e,t,i)):(ve&&n&&Ba(t),t.flags|=1,Fe(e,t,r,i),t.child)}function jc(e,t,n,r,i){if(e===null){var o=n.type;return typeof o=="function"&&!Ps(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Uc(e,t,o,r,i)):(e=to(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&i)){var a=o.memoizedProps;if(n=n.compare,n=n!==null?n:br,n(a,r)&&e.ref===t.ref)return jt(e,t,i)}return t.flags|=1,e=ln(o,r),e.ref=t.ref,e.return=t,t.child=e}function Uc(e,t,n,r,i){if(e!==null){var o=e.memoizedProps;if(br(o,r)&&e.ref===t.ref)if(Ke=!1,t.pendingProps=r=o,(e.lanes&i)!==0)e.flags&131072&&(Ke=!0);else return t.lanes=e.lanes,jt(e,t,i)}return fs(e,t,n,r,i)}function Bc(e,t,n){var r=t.pendingProps,i=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},de(Yn,rt),rt|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,de(Yn,rt),rt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,de(Yn,rt),rt|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,de(Yn,rt),rt|=r;return Fe(e,t,i,n),t.child}function _c(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function fs(e,t,n,r,i){var o=Qe(n)?dn:je.current;return o=Hn(t,o),Qn(t,i),n=ts(e,t,n,r,o,i),r=ns(),e!==null&&!Ke?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,jt(e,t,i)):(ve&&r&&Ba(t),t.flags|=1,Fe(e,t,n,i),t.child)}function zc(e,t,n,r,i){if(Qe(n)){var o=!0;Ei(t)}else o=!1;if(Qn(t,i),t.stateNode===null)Wi(e,t),Tc(t,n,r),ls(t,n,r,i),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var h=a.context,m=n.contextType;typeof m=="object"&&m!==null?m=lt(m):(m=Qe(n)?dn:je.current,m=Hn(t,m));var S=n.getDerivedStateFromProps,E=typeof S=="function"||typeof a.getSnapshotBeforeUpdate=="function";E||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||h!==m)&&Ac(t,a,r,m),en=!1;var y=t.memoizedState;a.state=y,Di(t,r,a,i),h=t.memoizedState,l!==r||y!==h||Ve.current||en?(typeof S=="function"&&(ss(t,n,S,r),h=t.memoizedState),(l=en||Oc(t,n,l,r,y,h,m))?(E||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=h),a.props=r,a.state=h,a.context=m,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,nc(e,t),l=t.memoizedProps,m=t.type===t.elementType?l:gt(t.type,l),a.props=m,E=t.pendingProps,y=a.context,h=n.contextType,typeof h=="object"&&h!==null?h=lt(h):(h=Qe(n)?dn:je.current,h=Hn(t,h));var R=n.getDerivedStateFromProps;(S=typeof R=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==E||y!==h)&&Ac(t,a,r,h),en=!1,y=t.memoizedState,a.state=y,Di(t,r,a,i);var f=t.memoizedState;l!==E||y!==f||Ve.current||en?(typeof R=="function"&&(ss(t,n,R,r),f=t.memoizedState),(m=en||Oc(t,n,m,r,y,f,h)||!1)?(S||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,f,h),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,f,h)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),a.props=r,a.state=f,a.context=h,r=m):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),r=!1)}return ds(e,t,n,r,o,i)}function ds(e,t,n,r,i,o){_c(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return i&&$u(t,n,!1),jt(e,t,o);r=t.stateNode,sp.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=$n(t,e.child,null,o),t.child=$n(t,null,l,o)):Fe(e,t,l,o),t.memoizedState=r.state,i&&$u(t,n,!0),t.child}function Hc(e){var t=e.stateNode;t.pendingContext?Gu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Gu(e,t.context,!1),Ja(e,t.containerInfo)}function Fc(e,t,n,r,i){return Wn(),Fa(i),t.flags|=256,Fe(e,t,n,r),t.child}var hs={dehydrated:null,treeContext:null,retryLane:0};function ps(e){return{baseLanes:e,cachePool:null,transitions:null}}function Gc(e,t,n){var r=t.pendingProps,i=xe.current,o=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),de(xe,i&1),e===null)return Ha(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,o?(r=t.mode,o=t.child,a={mode:"hidden",children:a},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=a):o=no(a,r,0,null),e=Cn(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=ps(n),t.memoizedState=hs,e):gs(t,a));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return lp(e,t,a,r,l,i,n);if(o){o=r.fallback,a=t.mode,i=e.child,l=i.sibling;var h={mode:"hidden",children:r.children};return!(a&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=h,t.deletions=null):(r=ln(i,h),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?o=ln(l,o):(o=Cn(o,a,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,a=e.child.memoizedState,a=a===null?ps(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=hs,r}return o=e.child,e=o.sibling,r=ln(o,{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 gs(e,t){return t=no({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Gi(e,t,n,r){return r!==null&&Fa(r),$n(t,e.child,null,n),e=gs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function lp(e,t,n,r,i,o,a){if(n)return t.flags&256?(t.flags&=-257,r=us(Error(J(422))),Gi(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,i=t.mode,r=no({mode:"visible",children:r.children},i,0,null),o=Cn(o,i,a,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&$n(t,e.child,null,a),t.child.memoizedState=ps(a),t.memoizedState=hs,o);if(!(t.mode&1))return Gi(e,t,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,o=Error(J(419)),r=us(o,r,void 0),Gi(e,t,a,r)}if(l=(a&e.childLanes)!==0,Ke||l){if(r=Me,r!==null){switch(a&-a){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|a)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,Lt(e,i),yt(r,e,i,-1))}return Ms(),r=us(Error(J(421))),Gi(e,t,a,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Sp.bind(null,e),i._reactRetry=t,null):(e=o.treeContext,nt=Xt(i.nextSibling),tt=t,ve=!0,pt=null,e!==null&&(at[st++]=Pt,at[st++]=Nt,at[st++]=hn,Pt=e.id,Nt=e.overflow,hn=t),t=gs(t,r.children),t.flags|=4096,t)}function Wc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Va(e.return,t,n)}function ms(e,t,n,r,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function $c(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Fe(e,t,r.children,n),r=xe.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&&Wc(e,n,t);else if(e.tag===19)Wc(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(de(xe,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ji(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ms(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ji(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ms(t,!0,n,null,o);break;case"together":ms(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Wi(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function jt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),yn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(J(153));if(t.child!==null){for(e=t.child,n=ln(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ln(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function up(e,t,n){switch(t.tag){case 3:Hc(t),Wn();break;case 5:oc(t);break;case 1:Qe(t.type)&&Ei(t);break;case 4:Ja(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;de(Pi,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(de(xe,xe.current&1),t.flags|=128,null):n&t.child.childLanes?Gc(e,t,n):(de(xe,xe.current&1),e=jt(e,t,n),e!==null?e.sibling:null);de(xe,xe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $c(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),de(xe,xe.current),r)break;return null;case 22:case 23:return t.lanes=0,Bc(e,t,n)}return jt(e,t,n)}var Vc,vs,Qc,Kc;Vc=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}},vs=function(){},Qc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,mn(bt.current);var o=null;switch(n){case"input":i=Vo(e,i),r=Vo(e,r),o=[];break;case"select":i=we({},i,{value:void 0}),r=we({},r,{value:void 0}),o=[];break;case"textarea":i=Jo(e,i),r=Jo(e,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=bi)}Yo(n,r);var a;n=null;for(m in i)if(!r.hasOwnProperty(m)&&i.hasOwnProperty(m)&&i[m]!=null)if(m==="style"){var l=i[m];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else m!=="dangerouslySetInnerHTML"&&m!=="children"&&m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(nr.hasOwnProperty(m)?o||(o=[]):(o=o||[]).push(m,null));for(m in r){var h=r[m];if(l=i!=null?i[m]:void 0,r.hasOwnProperty(m)&&h!==l&&(h!=null||l!=null))if(m==="style")if(l){for(a in l)!l.hasOwnProperty(a)||h&&h.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in h)h.hasOwnProperty(a)&&l[a]!==h[a]&&(n||(n={}),n[a]=h[a])}else n||(o||(o=[]),o.push(m,n)),n=h;else m==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,l=l?l.__html:void 0,h!=null&&l!==h&&(o=o||[]).push(m,h)):m==="children"?typeof h!="string"&&typeof h!="number"||(o=o||[]).push(m,""+h):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&(nr.hasOwnProperty(m)?(h!=null&&m==="onScroll"&&pe("scroll",e),o||l===h||(o=[])):(o=o||[]).push(m,h))}n&&(o=o||[]).push("style",n);var m=o;(t.updateQueue=m)&&(t.flags|=4)}},Kc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Br(e,t){if(!ve)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 Be(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function cp(e,t,n){var r=t.pendingProps;switch(_a(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Be(t),null;case 1:return Qe(t.type)&&Ri(),Be(t),null;case 3:return r=t.stateNode,Kn(),ge(Ve),ge(je),Za(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ii(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pt!==null&&(Ts(pt),pt=null))),vs(e,t),Be(t),null;case 5:Xa(t);var i=mn(Nr.current);if(n=t.type,e!==null&&t.stateNode!=null)Qc(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(J(166));return Be(t),null}if(e=mn(bt.current),Ii(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Ct]=t,r[Tr]=o,e=(t.mode&1)!==0,n){case"dialog":pe("cancel",r),pe("close",r);break;case"iframe":case"object":case"embed":pe("load",r);break;case"video":case"audio":for(i=0;i<Rr.length;i++)pe(Rr[i],r);break;case"source":pe("error",r);break;case"img":case"image":case"link":pe("error",r),pe("load",r);break;case"details":pe("toggle",r);break;case"input":Tl(r,o),pe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},pe("invalid",r);break;case"textarea":Ml(r,o),pe("invalid",r)}Yo(n,o),i=null;for(var a in o)if(o.hasOwnProperty(a)){var l=o[a];a==="children"?typeof l=="string"?r.textContent!==l&&(o.suppressHydrationWarning!==!0&&Ci(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&Ci(r.textContent,l,e),i=["children",""+l]):nr.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&pe("scroll",r)}switch(n){case"input":qr(r),Il(r,o,!0);break;case"textarea":qr(r),Nl(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=bi)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Ll(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[Ct]=t,e[Tr]=r,Vc(e,t,!1,!1),t.stateNode=e;e:{switch(a=Zo(n,r),n){case"dialog":pe("cancel",e),pe("close",e),i=r;break;case"iframe":case"object":case"embed":pe("load",e),i=r;break;case"video":case"audio":for(i=0;i<Rr.length;i++)pe(Rr[i],e);i=r;break;case"source":pe("error",e),i=r;break;case"img":case"image":case"link":pe("error",e),pe("load",e),i=r;break;case"details":pe("toggle",e),i=r;break;case"input":Tl(e,r),i=Vo(e,r),pe("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=we({},r,{value:void 0}),pe("invalid",e);break;case"textarea":Ml(e,r),i=Jo(e,r),pe("invalid",e);break;default:i=r}Yo(n,i),l=i;for(o in l)if(l.hasOwnProperty(o)){var h=l[o];o==="style"?Ul(e,h):o==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,h!=null&&Dl(e,h)):o==="children"?typeof h=="string"?(n!=="textarea"||h!=="")&&ar(e,h):typeof h=="number"&&ar(e,""+h):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(nr.hasOwnProperty(o)?h!=null&&o==="onScroll"&&pe("scroll",e):h!=null&&Do(e,o,h,a))}switch(n){case"input":qr(e),Il(e,r,!1);break;case"textarea":qr(e),Nl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Gt(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?An(e,!!r.multiple,o,!1):r.defaultValue!=null&&An(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=bi)}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 Be(t),null;case 6:if(e&&t.stateNode!=null)Kc(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(J(166));if(n=mn(Nr.current),mn(bt.current),Ii(t)){if(r=t.stateNode,n=t.memoizedProps,r[Ct]=t,(o=r.nodeValue!==n)&&(e=tt,e!==null))switch(e.tag){case 3:Ci(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ci(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Ct]=t,t.stateNode=r}return Be(t),null;case 13:if(ge(xe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ve&&nt!==null&&t.mode&1&&!(t.flags&128))Yu(),Wn(),t.flags|=98560,o=!1;else if(o=Ii(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(J(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(J(317));o[Ct]=t}else Wn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Be(t),o=!1}else pt!==null&&(Ts(pt),pt=null),o=!0;if(!o)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||xe.current&1?Te===0&&(Te=3):Ms())),t.updateQueue!==null&&(t.flags|=4),Be(t),null);case 4:return Kn(),vs(e,t),e===null&&Er(t.stateNode.containerInfo),Be(t),null;case 10:return $a(t.type._context),Be(t),null;case 17:return Qe(t.type)&&Ri(),Be(t),null;case 19:if(ge(xe),o=t.memoizedState,o===null)return Be(t),null;if(r=(t.flags&128)!==0,a=o.rendering,a===null)if(r)Br(o,!1);else{if(Te!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=ji(e),a!==null){for(t.flags|=128,Br(o,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,a=o.alternate,a===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,e=a.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return de(xe,xe.current&1|2),t.child}e=e.sibling}o.tail!==null&&ke()>Zn&&(t.flags|=128,r=!0,Br(o,!1),t.lanes=4194304)}else{if(!r)if(e=ji(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Br(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!ve)return Be(t),null}else 2*ke()-o.renderingStartTime>Zn&&n!==1073741824&&(t.flags|=128,r=!0,Br(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ke(),t.sibling=null,n=xe.current,de(xe,r?n&1|2:n&1),t):(Be(t),null);case 22:case 23:return Is(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?rt&1073741824&&(Be(t),t.subtreeFlags&6&&(t.flags|=8192)):Be(t),null;case 24:return null;case 25:return null}throw Error(J(156,t.tag))}function fp(e,t){switch(_a(t),t.tag){case 1:return Qe(t.type)&&Ri(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(),ge(Ve),ge(je),Za(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xa(t),null;case 13:if(ge(xe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(J(340));Wn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ge(xe),null;case 4:return Kn(),null;case 10:return $a(t.type._context),null;case 22:case 23:return Is(),null;case 24:return null;default:return null}}var $i=!1,_e=!1,dp=typeof WeakSet=="function"?WeakSet:Set,q=null;function Xn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ce(e,t,r)}else n.current=null}function ys(e,t,n){try{n()}catch(r){Ce(e,t,r)}}var Jc=!1;function hp(e,t){if(Ia=fi,e=Ou(),Ca(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 i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(C){n=null;break e}var a=0,l=-1,h=-1,m=0,S=0,E=e,y=null;t:for(;;){for(var R;E!==n||i!==0&&E.nodeType!==3||(l=a+i),E!==o||r!==0&&E.nodeType!==3||(h=a+r),E.nodeType===3&&(a+=E.nodeValue.length),(R=E.firstChild)!==null;)y=E,E=R;for(;;){if(E===e)break t;if(y===n&&++m===i&&(l=a),y===o&&++S===r&&(h=a),(R=E.nextSibling)!==null)break;E=y,y=E.parentNode}E=R}n=l===-1||h===-1?null:{start:l,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ma={focusedElem:e,selectionRange:n},fi=!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 b=f.memoizedProps,T=f.memoizedState,x=t.stateNode,p=x.getSnapshotBeforeUpdate(t.elementType===t.type?b:gt(t.type,b),T);x.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(C){Ce(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return f=Jc,Jc=!1,f}function _r(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&ys(t,n,o)}i=i.next}while(i!==r)}}function Vi(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 ws(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 Xc(e){var t=e.alternate;t!==null&&(e.alternate=null,Xc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ct],delete t[Tr],delete t[Da],delete t[Jh],delete t[Xh])),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 Yc(e){return e.tag===5||e.tag===3||e.tag===4}function Zc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yc(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 xs(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=bi));else if(r!==4&&(e=e.child,e!==null))for(xs(e,t,n),e=e.sibling;e!==null;)xs(e,t,n),e=e.sibling}function Ss(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(Ss(e,t,n),e=e.sibling;e!==null;)Ss(e,t,n),e=e.sibling}var Ne=null,mt=!1;function nn(e,t,n){for(n=n.child;n!==null;)qc(e,t,n),n=n.sibling}function qc(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(oi,n)}catch(l){}switch(n.tag){case 5:_e||Xn(n,t);case 6:var r=Ne,i=mt;Ne=null,nn(e,t,n),Ne=r,mt=i,Ne!==null&&(mt?(e=Ne,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ne.removeChild(n.stateNode));break;case 18:Ne!==null&&(mt?(e=Ne,n=n.stateNode,e.nodeType===8?La(e.parentNode,n):e.nodeType===1&&La(e,n),vr(e)):La(Ne,n.stateNode));break;case 4:r=Ne,i=mt,Ne=n.stateNode.containerInfo,mt=!0,nn(e,t,n),Ne=r,mt=i;break;case 0:case 11:case 14:case 15:if(!_e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&ys(n,t,a),i=i.next}while(i!==r)}nn(e,t,n);break;case 1:if(!_e&&(Xn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Ce(n,t,l)}nn(e,t,n);break;case 21:nn(e,t,n);break;case 22:n.mode&1?(_e=(r=_e)||n.memoizedState!==null,nn(e,t,n),_e=r):nn(e,t,n);break;default:nn(e,t,n)}}function ef(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new dp),t.forEach(function(r){var i=Cp.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function vt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:Ne=l.stateNode,mt=!1;break e;case 3:Ne=l.stateNode.containerInfo,mt=!0;break e;case 4:Ne=l.stateNode.containerInfo,mt=!0;break e}l=l.return}if(Ne===null)throw Error(J(160));qc(o,a,i),Ne=null,mt=!1;var h=i.alternate;h!==null&&(h.return=null),i.return=null}catch(m){Ce(i,t,m)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)tf(t,e),t=t.sibling}function tf(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(vt(t,e),Rt(e),r&4){try{_r(3,e,e.return),Vi(3,e)}catch(b){Ce(e,e.return,b)}try{_r(5,e,e.return)}catch(b){Ce(e,e.return,b)}}break;case 1:vt(t,e),Rt(e),r&512&&n!==null&&Xn(n,n.return);break;case 5:if(vt(t,e),Rt(e),r&512&&n!==null&&Xn(n,n.return),e.flags&32){var i=e.stateNode;try{ar(i,"")}catch(b){Ce(e,e.return,b)}}if(r&4&&(i=e.stateNode,i!=null)){var o=e.memoizedProps,a=n!==null?n.memoizedProps:o,l=e.type,h=e.updateQueue;if(e.updateQueue=null,h!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&Al(i,o),Zo(l,a);var m=Zo(l,o);for(a=0;a<h.length;a+=2){var S=h[a],E=h[a+1];S==="style"?Ul(i,E):S==="dangerouslySetInnerHTML"?Dl(i,E):S==="children"?ar(i,E):Do(i,S,E,m)}switch(l){case"input":Qo(i,o);break;case"textarea":Pl(i,o);break;case"select":var y=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var R=o.value;R!=null?An(i,!!o.multiple,R,!1):y!==!!o.multiple&&(o.defaultValue!=null?An(i,!!o.multiple,o.defaultValue,!0):An(i,!!o.multiple,o.multiple?[]:"",!1))}i[Tr]=o}catch(b){Ce(e,e.return,b)}}break;case 6:if(vt(t,e),Rt(e),r&4){if(e.stateNode===null)throw Error(J(162));i=e.stateNode,o=e.memoizedProps;try{i.nodeValue=o}catch(b){Ce(e,e.return,b)}}break;case 3:if(vt(t,e),Rt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{vr(t.containerInfo)}catch(b){Ce(e,e.return,b)}break;case 4:vt(t,e),Rt(e);break;case 13:vt(t,e),Rt(e),i=e.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(ks=ke())),r&4&&ef(e);break;case 22:if(S=n!==null&&n.memoizedState!==null,e.mode&1?(_e=(m=_e)||S,vt(t,e),_e=m):vt(t,e),Rt(e),r&8192){if(m=e.memoizedState!==null,(e.stateNode.isHidden=m)&&!S&&e.mode&1)for(q=e,S=e.child;S!==null;){for(E=q=S;q!==null;){switch(y=q,R=y.child,y.tag){case 0:case 11:case 14:case 15:_r(4,y,y.return);break;case 1:Xn(y,y.return);var f=y.stateNode;if(typeof f.componentWillUnmount=="function"){r=y,n=y.return;try{t=r,f.props=t.memoizedProps,f.state=t.memoizedState,f.componentWillUnmount()}catch(b){Ce(r,n,b)}}break;case 5:Xn(y,y.return);break;case 22:if(y.memoizedState!==null){of(E);continue}}R!==null?(R.return=y,q=R):of(E)}S=S.sibling}e:for(S=null,E=e;;){if(E.tag===5){if(S===null){S=E;try{i=E.stateNode,m?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=E.stateNode,h=E.memoizedProps.style,a=h!=null&&h.hasOwnProperty("display")?h.display:null,l.style.display=jl("display",a))}catch(b){Ce(e,e.return,b)}}}else if(E.tag===6){if(S===null)try{E.stateNode.nodeValue=m?"":E.memoizedProps}catch(b){Ce(e,e.return,b)}}else if((E.tag!==22&&E.tag!==23||E.memoizedState===null||E===e)&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===e)break e;for(;E.sibling===null;){if(E.return===null||E.return===e)break e;S===E&&(S=null),E=E.return}S===E&&(S=null),E.sibling.return=E.return,E=E.sibling}}break;case 19:vt(t,e),Rt(e),r&4&&ef(e);break;case 21:break;default:vt(t,e),Rt(e)}}function Rt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Yc(n)){var r=n;break e}n=n.return}throw Error(J(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(ar(i,""),r.flags&=-33);var o=Zc(e);Ss(e,o,i);break;case 3:case 4:var a=r.stateNode.containerInfo,l=Zc(e);xs(e,l,a);break;default:throw Error(J(161))}}catch(h){Ce(e,e.return,h)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pp(e,t,n){q=e,nf(e)}function nf(e,t,n){for(var r=(e.mode&1)!==0;q!==null;){var i=q,o=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||$i;if(!a){var l=i.alternate,h=l!==null&&l.memoizedState!==null||_e;l=$i;var m=_e;if($i=a,(_e=h)&&!m)for(q=i;q!==null;)a=q,h=a.child,a.tag===22&&a.memoizedState!==null?af(i):h!==null?(h.return=a,q=h):af(i);for(;o!==null;)q=o,nf(o),o=o.sibling;q=i,$i=l,_e=m}rf(e)}else i.subtreeFlags&8772&&o!==null?(o.return=i,q=o):rf(e)}}function rf(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:_e||Vi(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!_e)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:gt(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&ic(t,o,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}ic(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var h=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":h.autoFocus&&n.focus();break;case"img":h.src&&(n.src=h.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var m=t.alternate;if(m!==null){var S=m.memoizedState;if(S!==null){var E=S.dehydrated;E!==null&&vr(E)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(J(163))}_e||t.flags&512&&ws(t)}catch(y){Ce(t,t.return,y)}}if(t===e){q=null;break}if(n=t.sibling,n!==null){n.return=t.return,q=n;break}q=t.return}}function of(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 af(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Vi(4,t)}catch(h){Ce(t,n,h)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(h){Ce(t,i,h)}}var o=t.return;try{ws(t)}catch(h){Ce(t,o,h)}break;case 5:var a=t.return;try{ws(t)}catch(h){Ce(t,a,h)}}}catch(h){Ce(t,t.return,h)}if(t===e){q=null;break}var l=t.sibling;if(l!==null){l.return=t.return,q=l;break}q=t.return}}var gp=Math.ceil,Qi=At.ReactCurrentDispatcher,Cs=At.ReactCurrentOwner,ct=At.ReactCurrentBatchConfig,ae=0,Me=null,Ee=null,Le=0,rt=0,Yn=Yt(0),Te=0,zr=null,yn=0,Ki=0,bs=0,Hr=null,Je=null,ks=0,Zn=1/0,Ut=null,Ji=!1,Rs=null,rn=null,Xi=!1,on=null,Yi=0,Fr=0,Es=null,Zi=-1,qi=0;function Ge(){return ae&6?ke():Zi!==-1?Zi:Zi=ke()}function an(e){return e.mode&1?ae&2&&Le!==0?Le&-Le:Zh.transition!==null?(qi===0&&(qi=Zl()),qi):(e=ue,e!==0||(e=window.event,e=e===void 0?16:su(e.type)),e):1}function yt(e,t,n,r){if(50<Fr)throw Fr=0,Es=null,Error(J(185));dr(e,n,r),(!(ae&2)||e!==Me)&&(e===Me&&(!(ae&2)&&(Ki|=n),Te===4&&sn(e,Le)),Xe(e,r),n===1&&ae===0&&!(t.mode&1)&&(Zn=ke()+500,Oi&&qt()))}function Xe(e,t){var n=e.callbackNode;Zd(e,t);var r=li(e,e===Me?Le:0);if(r===0)n!==null&&Jl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Jl(n),t===1)e.tag===0?Yh(lf.bind(null,e)):Vu(lf.bind(null,e)),Qh(function(){!(ae&6)&&qt()}),n=null;else{switch(ql(r)){case 1:n=oa;break;case 4:n=Xl;break;case 16:n=ii;break;case 536870912:n=Yl;break;default:n=ii}n=mf(n,sf.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function sf(e,t){if(Zi=-1,qi=0,ae&6)throw Error(J(327));var n=e.callbackNode;if(qn()&&e.callbackNode!==n)return null;var r=li(e,e===Me?Le:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=eo(e,r);else{t=r;var i=ae;ae|=2;var o=cf();(Me!==e||Le!==t)&&(Ut=null,Zn=ke()+500,xn(e,t));do try{yp();break}catch(l){uf(e,l)}while(!0);Wa(),Qi.current=o,ae=i,Ee!==null?t=0:(Me=null,Le=0,t=Te)}if(t!==0){if(t===2&&(i=aa(e),i!==0&&(r=i,t=Os(e,i))),t===1)throw n=zr,xn(e,0),sn(e,r),Xe(e,ke()),n;if(t===6)sn(e,r);else{if(i=e.current.alternate,!(r&30)&&!mp(i)&&(t=eo(e,r),t===2&&(o=aa(e),o!==0&&(r=o,t=Os(e,o))),t===1))throw n=zr,xn(e,0),sn(e,r),Xe(e,ke()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(J(345));case 2:Sn(e,Je,Ut);break;case 3:if(sn(e,r),(r&130023424)===r&&(t=ks+500-ke(),10<t)){if(li(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Ge(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Na(Sn.bind(null,e,Je,Ut),t);break}Sn(e,Je,Ut);break;case 4:if(sn(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var a=31-dt(r);o=1<<a,a=t[a],a>i&&(i=a),r&=~o}if(r=i,r=ke()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*gp(r/1960))-r,10<r){e.timeoutHandle=Na(Sn.bind(null,e,Je,Ut),r);break}Sn(e,Je,Ut);break;case 5:Sn(e,Je,Ut);break;default:throw Error(J(329))}}}return Xe(e,ke()),e.callbackNode===n?sf.bind(null,e):null}function Os(e,t){var n=Hr;return e.current.memoizedState.isDehydrated&&(xn(e,t).flags|=256),e=eo(e,t),e!==2&&(t=Je,Je=n,t!==null&&Ts(t)),e}function Ts(e){Je===null?Je=e:Je.push.apply(Je,e)}function mp(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 i=n[r],o=i.getSnapshot;i=i.value;try{if(!ht(o(),i))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 sn(e,t){for(t&=~bs,t&=~Ki,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-dt(t),r=1<<n;e[n]=-1,t&=~r}}function lf(e){if(ae&6)throw Error(J(327));qn();var t=li(e,0);if(!(t&1))return Xe(e,ke()),null;var n=eo(e,t);if(e.tag!==0&&n===2){var r=aa(e);r!==0&&(t=r,n=Os(e,r))}if(n===1)throw n=zr,xn(e,0),sn(e,t),Xe(e,ke()),n;if(n===6)throw Error(J(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Sn(e,Je,Ut),Xe(e,ke()),null}function As(e,t){var n=ae;ae|=1;try{return e(t)}finally{ae=n,ae===0&&(Zn=ke()+500,Oi&&qt())}}function wn(e){on!==null&&on.tag===0&&!(ae&6)&&qn();var t=ae;ae|=1;var n=ct.transition,r=ue;try{if(ct.transition=null,ue=1,e)return e()}finally{ue=r,ct.transition=n,ae=t,!(ae&6)&&qt()}}function Is(){rt=Yn.current,ge(Yn)}function xn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Vh(n)),Ee!==null)for(n=Ee.return;n!==null;){var r=n;switch(_a(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ri();break;case 3:Kn(),ge(Ve),ge(je),Za();break;case 5:Xa(r);break;case 4:Kn();break;case 13:ge(xe);break;case 19:ge(xe);break;case 10:$a(r.type._context);break;case 22:case 23:Is()}n=n.return}if(Me=e,Ee=e=ln(e.current,null),Le=rt=t,Te=0,zr=null,bs=Ki=yn=0,Je=Hr=null,gn!==null){for(t=0;t<gn.length;t++)if(n=gn[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,o=n.pending;if(o!==null){var a=o.next;o.next=i,r.next=a}n.pending=r}gn=null}return e}function uf(e,t){do{var n=Ee;try{if(Wa(),Ui.current=Hi,Bi){for(var r=Se.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Bi=!1}if(vn=0,Ie=Oe=Se=null,Lr=!1,Dr=0,Cs.current=null,n===null||n.return===null){Te=1,zr=t,Ee=null;break}e:{var o=e,a=n.return,l=n,h=t;if(t=Le,l.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){var m=h,S=l,E=S.tag;if(!(S.mode&1)&&(E===0||E===11||E===15)){var y=S.alternate;y?(S.updateQueue=y.updateQueue,S.memoizedState=y.memoizedState,S.lanes=y.lanes):(S.updateQueue=null,S.memoizedState=null)}var R=Nc(a);if(R!==null){R.flags&=-257,Lc(R,a,l,o,t),R.mode&1&&Pc(o,m,t),t=R,h=m;var f=t.updateQueue;if(f===null){var b=new Set;b.add(h),t.updateQueue=b}else f.add(h);break e}else{if(!(t&1)){Pc(o,m,t),Ms();break e}h=Error(J(426))}}else if(ve&&l.mode&1){var T=Nc(a);if(T!==null){!(T.flags&65536)&&(T.flags|=256),Lc(T,a,l,o,t),Fa(Jn(h,l));break e}}o=h=Jn(h,l),Te!==4&&(Te=2),Hr===null?Hr=[o]:Hr.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var x=Ic(o,h,t);rc(o,x);break e;case 1:l=h;var p=o.type,g=o.stateNode;if(!(o.flags&128)&&(typeof p.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(rn===null||!rn.has(g)))){o.flags|=65536,t&=-t,o.lanes|=t;var C=Mc(o,l,t);rc(o,C);break e}}o=o.return}while(o!==null)}df(n)}catch(d){t=d,Ee===n&&n!==null&&(Ee=n=n.return);continue}break}while(!0)}function cf(){var e=Qi.current;return Qi.current=Hi,e===null?Hi:e}function Ms(){(Te===0||Te===3||Te===2)&&(Te=4),Me===null||!(yn&268435455)&&!(Ki&268435455)||sn(Me,Le)}function eo(e,t){var n=ae;ae|=2;var r=cf();(Me!==e||Le!==t)&&(Ut=null,xn(e,t));do try{vp();break}catch(i){uf(e,i)}while(!0);if(Wa(),ae=n,Qi.current=r,Ee!==null)throw Error(J(261));return Me=null,Le=0,Te}function vp(){for(;Ee!==null;)ff(Ee)}function yp(){for(;Ee!==null&&!Gd();)ff(Ee)}function ff(e){var t=gf(e.alternate,e,rt);e.memoizedProps=e.pendingProps,t===null?df(e):Ee=t,Cs.current=null}function df(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=fp(n,t),n!==null){n.flags&=32767,Ee=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Te=6,Ee=null;return}}else if(n=cp(n,t,rt),n!==null){Ee=n;return}if(t=t.sibling,t!==null){Ee=t;return}Ee=t=e}while(t!==null);Te===0&&(Te=5)}function Sn(e,t,n){var r=ue,i=ct.transition;try{ct.transition=null,ue=1,wp(e,t,n,r)}finally{ct.transition=i,ue=r}return null}function wp(e,t,n,r){do qn();while(on!==null);if(ae&6)throw Error(J(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(J(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(qd(e,o),e===Me&&(Ee=Me=null,Le=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xi||(Xi=!0,mf(ii,function(){return qn(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=ct.transition,ct.transition=null;var a=ue;ue=1;var l=ae;ae|=4,Cs.current=null,hp(e,n),tf(n,e),_h(Ma),fi=!!Ia,Ma=Ia=null,e.current=n,pp(n),Wd(),ae=l,ue=a,ct.transition=o}else e.current=n;if(Xi&&(Xi=!1,on=e,Yi=i),o=e.pendingLanes,o===0&&(rn=null),Qd(n.stateNode),Xe(e,ke()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ji)throw Ji=!1,e=Rs,Rs=null,e;return Yi&1&&e.tag!==0&&qn(),o=e.pendingLanes,o&1?e===Es?Fr++:(Fr=0,Es=e):Fr=0,qt(),null}function qn(){if(on!==null){var e=ql(Yi),t=ct.transition,n=ue;try{if(ct.transition=null,ue=16>e?16:e,on===null)var r=!1;else{if(e=on,on=null,Yi=0,ae&6)throw Error(J(331));var i=ae;for(ae|=4,q=e.current;q!==null;){var o=q,a=o.child;if(q.flags&16){var l=o.deletions;if(l!==null){for(var h=0;h<l.length;h++){var m=l[h];for(q=m;q!==null;){var S=q;switch(S.tag){case 0:case 11:case 15:_r(8,S,o)}var E=S.child;if(E!==null)E.return=S,q=E;else for(;q!==null;){S=q;var y=S.sibling,R=S.return;if(Xc(S),S===m){q=null;break}if(y!==null){y.return=R,q=y;break}q=R}}}var f=o.alternate;if(f!==null){var b=f.child;if(b!==null){f.child=null;do{var T=b.sibling;b.sibling=null,b=T}while(b!==null)}}q=o}}if(o.subtreeFlags&2064&&a!==null)a.return=o,q=a;else e:for(;q!==null;){if(o=q,o.flags&2048)switch(o.tag){case 0:case 11:case 15:_r(9,o,o.return)}var x=o.sibling;if(x!==null){x.return=o.return,q=x;break e}q=o.return}}var p=e.current;for(q=p;q!==null;){a=q;var g=a.child;if(a.subtreeFlags&2064&&g!==null)g.return=a,q=g;else e:for(a=p;q!==null;){if(l=q,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Vi(9,l)}}catch(d){Ce(l,l.return,d)}if(l===a){q=null;break e}var C=l.sibling;if(C!==null){C.return=l.return,q=C;break e}q=l.return}}if(ae=i,qt(),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(oi,e)}catch(d){}r=!0}return r}finally{ue=n,ct.transition=t}}return!1}function hf(e,t,n){t=Jn(n,t),t=Ic(e,t,1),e=tn(e,t,1),t=Ge(),e!==null&&(dr(e,1,t),Xe(e,t))}function Ce(e,t,n){if(e.tag===3)hf(e,e,n);else for(;t!==null;){if(t.tag===3){hf(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(rn===null||!rn.has(r))){e=Jn(n,e),e=Mc(t,e,1),t=tn(t,e,1),e=Ge(),t!==null&&(dr(t,1,e),Xe(t,e));break}}t=t.return}}function xp(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ge(),e.pingedLanes|=e.suspendedLanes&n,Me===e&&(Le&n)===n&&(Te===4||Te===3&&(Le&130023424)===Le&&500>ke()-ks?xn(e,0):bs|=n),Xe(e,t)}function pf(e,t){t===0&&(e.mode&1?(t=si,si<<=1,!(si&130023424)&&(si=4194304)):t=1);var n=Ge();e=Lt(e,t),e!==null&&(dr(e,t,n),Xe(e,n))}function Sp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),pf(e,n)}function Cp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(J(314))}r!==null&&r.delete(t),pf(e,n)}var gf;gf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ve.current)Ke=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ke=!1,up(e,t,n);Ke=!!(e.flags&131072)}else Ke=!1,ve&&t.flags&1048576&&Qu(t,Ai,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Wi(e,t),e=t.pendingProps;var i=Hn(t,je.current);Qn(t,n),i=ts(null,t,r,e,i,n);var o=ns();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Qe(r)?(o=!0,Ei(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ka(t),i.updater=Fi,t.stateNode=i,i._reactInternals=t,ls(t,r,e,n),t=ds(null,t,r,!0,o,n)):(t.tag=0,ve&&o&&Ba(t),Fe(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Wi(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=kp(r),e=gt(r,e),i){case 0:t=fs(null,t,r,e,n);break e;case 1:t=zc(null,t,r,e,n);break e;case 11:t=Dc(null,t,r,e,n);break e;case 14:t=jc(null,t,r,gt(r.type,e),n);break e}throw Error(J(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gt(r,i),fs(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gt(r,i),zc(e,t,r,i,n);case 3:e:{if(Hc(t),e===null)throw Error(J(387));r=t.pendingProps,o=t.memoizedState,i=o.element,nc(e,t),Di(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Jn(Error(J(423)),t),t=Fc(e,t,r,n,i);break e}else if(r!==i){i=Jn(Error(J(424)),t),t=Fc(e,t,r,n,i);break e}else for(nt=Xt(t.stateNode.containerInfo.firstChild),tt=t,ve=!0,pt=null,n=ec(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Wn(),r===i){t=jt(e,t,n);break e}Fe(e,t,r,n)}t=t.child}return t;case 5:return oc(t),e===null&&Ha(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,Pa(r,i)?a=null:o!==null&&Pa(r,o)&&(t.flags|=32),_c(e,t),Fe(e,t,a,n),t.child;case 6:return e===null&&Ha(t),null;case 13:return Gc(e,t,n);case 4:return Ja(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=$n(t,null,r,n):Fe(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gt(r,i),Dc(e,t,r,i,n);case 7:return Fe(e,t,t.pendingProps,n),t.child;case 8:return Fe(e,t,t.pendingProps.children,n),t.child;case 12:return Fe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,de(Pi,r._currentValue),r._currentValue=a,o!==null)if(ht(o.value,a)){if(o.children===i.children&&!Ve.current){t=jt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){a=o.child;for(var h=l.firstContext;h!==null;){if(h.context===r){if(o.tag===1){h=Dt(-1,n&-n),h.tag=2;var m=o.updateQueue;if(m!==null){m=m.shared;var S=m.pending;S===null?h.next=h:(h.next=S.next,S.next=h),m.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),Va(o.return,n,t),l.lanes|=n;break}h=h.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(J(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Va(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Fe(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Qn(t,n),i=lt(i),r=r(i),t.flags|=1,Fe(e,t,r,n),t.child;case 14:return r=t.type,i=gt(r,t.pendingProps),i=gt(r.type,i),jc(e,t,r,i,n);case 15:return Uc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gt(r,i),Wi(e,t),t.tag=1,Qe(r)?(e=!0,Ei(t)):e=!1,Qn(t,n),Tc(t,r,i),ls(t,r,i,n),ds(null,t,r,!0,e,n);case 19:return $c(e,t,n);case 22:return Bc(e,t,n)}throw Error(J(156,t.tag))};function mf(e,t){return Kl(e,t)}function bp(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 ft(e,t,n,r){return new bp(e,t,n,r)}function Ps(e){return e=e.prototype,!(!e||!e.isReactComponent)}function kp(e){if(typeof e=="function")return Ps(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Bo)return 11;if(e===Ho)return 14}return 2}function ln(e,t){var n=e.alternate;return n===null?(n=ft(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 to(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")Ps(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Tn:return Cn(n.children,i,o,t);case jo:a=8,i|=8;break;case Uo:return e=ft(12,n,t,i|2),e.elementType=Uo,e.lanes=o,e;case _o:return e=ft(13,n,t,i),e.elementType=_o,e.lanes=o,e;case zo:return e=ft(19,n,t,i),e.elementType=zo,e.lanes=o,e;case kl:return no(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Cl:a=10;break e;case bl:a=9;break e;case Bo:a=11;break e;case Ho:a=14;break e;case Ft:a=16,r=null;break e}throw Error(J(130,e==null?e:typeof e,""))}return t=ft(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function Cn(e,t,n,r){return e=ft(7,e,r,t),e.lanes=n,e}function no(e,t,n,r){return e=ft(22,e,r,t),e.elementType=kl,e.lanes=n,e.stateNode={isHidden:!1},e}function Ns(e,t,n){return e=ft(6,e,null,t),e.lanes=n,e}function Ls(e,t,n){return t=ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Rp(e,t,n,r,i){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=sa(0),this.expirationTimes=sa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sa(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Ds(e,t,n,r,i,o,a,l,h){return e=new Rp(e,t,n,l,h),t===1?(t=1,o===!0&&(t|=8)):t=0,o=ft(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ka(o),e}function Ep(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:On,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function vf(e){if(!e)return Zt;e=e._reactInternals;e:{if(cn(e)!==e||e.tag!==1)throw Error(J(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Qe(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(J(171))}if(e.tag===1){var n=e.type;if(Qe(n))return Wu(e,n,t)}return t}function yf(e,t,n,r,i,o,a,l,h){return e=Ds(n,r,!0,e,i,o,a,l,h),e.context=vf(null),n=e.current,r=Ge(),i=an(n),o=Dt(r,i),o.callback=t!=null?t:null,tn(n,o,i),e.current.lanes=i,dr(e,i,r),Xe(e,r),e}function ro(e,t,n,r){var i=t.current,o=Ge(),a=an(i);return n=vf(n),t.context===null?t.context=n:t.pendingContext=n,t=Dt(o,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=tn(i,t,a),e!==null&&(yt(e,i,a,o),Li(e,i,a)),a}function io(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 wf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function js(e,t){wf(e,t),(e=e.alternate)&&wf(e,t)}function Op(){return null}var xf=typeof reportError=="function"?reportError:function(e){console.error(e)};function Us(e){this._internalRoot=e}oo.prototype.render=Us.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(J(409));ro(e,t,null,null)},oo.prototype.unmount=Us.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wn(function(){ro(null,e,null,null)}),t[It]=null}};function oo(e){this._internalRoot=e}oo.prototype.unstable_scheduleHydration=function(e){if(e){var t=nu();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qt.length&&t!==0&&t<Qt[n].priority;n++);Qt.splice(n,0,e),n===0&&ou(e)}};function Bs(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ao(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Sf(){}function Tp(e,t,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var m=io(a);o.call(m)}}var a=yf(t,r,e,0,null,!1,!1,"",Sf);return e._reactRootContainer=a,e[It]=a.current,Er(e.nodeType===8?e.parentNode:e),wn(),a}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var m=io(h);l.call(m)}}var h=Ds(e,0,!1,null,null,!1,!1,"",Sf);return e._reactRootContainer=h,e[It]=h.current,Er(e.nodeType===8?e.parentNode:e),wn(function(){ro(t,h,n,r)}),h}function so(e,t,n,r,i){var o=n._reactRootContainer;if(o){var a=o;if(typeof i=="function"){var l=i;i=function(){var h=io(a);l.call(h)}}ro(t,a,e,i)}else a=Tp(n,t,e,i,r);return io(a)}eu=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=fr(t.pendingLanes);n!==0&&(la(t,n|1),Xe(t,ke()),!(ae&6)&&(Zn=ke()+500,qt()))}break;case 13:wn(function(){var r=Lt(e,1);if(r!==null){var i=Ge();yt(r,e,1,i)}}),js(e,1)}},ua=function(e){if(e.tag===13){var t=Lt(e,134217728);if(t!==null){var n=Ge();yt(t,e,134217728,n)}js(e,134217728)}},tu=function(e){if(e.tag===13){var t=an(e),n=Lt(e,t);if(n!==null){var r=Ge();yt(n,e,t,r)}js(e,t)}},nu=function(){return ue},ru=function(e,t){var n=ue;try{return ue=e,t()}finally{ue=n}},ta=function(e,t,n){switch(t){case"input":if(Qo(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 i=ki(r);if(!i)throw Error(J(90));Ol(r),Qo(r,i)}}}break;case"textarea":Pl(e,n);break;case"select":t=n.value,t!=null&&An(e,!!n.multiple,t,!1)}},Hl=As,Fl=wn;var Ap={usingClientEntryPoint:!1,Events:[Ar,_n,ki,_l,zl,As]},Gr={findFiberByHostInstance:fn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ip={bundleType:Gr.bundleType,version:Gr.version,rendererPackageName:Gr.rendererPackageName,rendererConfig:Gr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:At.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Vl(e),e===null?null:e.stateNode},findFiberByHostInstance:Gr.findFiberByHostInstance||Op,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 lo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lo.isDisabled&&lo.supportsFiber)try{oi=lo.inject(Ip),St=lo}catch(e){}}Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ap,Ze.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bs(t))throw Error(J(200));return Ep(e,t,null,n)},Ze.createRoot=function(e,t){if(!Bs(e))throw Error(J(299));var n=!1,r="",i=xf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Ds(e,1,!1,null,null,n,!1,r,i),e[It]=t.current,Er(e.nodeType===8?e.parentNode:e),new Us(t)},Ze.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(J(188)):(e=Object.keys(e).join(","),Error(J(268,e)));return e=Vl(t),e=e===null?null:e.stateNode,e},Ze.flushSync=function(e){return wn(e)},Ze.hydrate=function(e,t,n){if(!ao(t))throw Error(J(200));return so(null,e,t,!0,n)},Ze.hydrateRoot=function(e,t,n){if(!Bs(e))throw Error(J(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",a=xf;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=yf(t,null,e,1,n!=null?n:null,i,!1,o,a),e[It]=t.current,Er(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new oo(t)},Ze.render=function(e,t,n){if(!ao(t))throw Error(J(200));return so(null,e,t,!1,n)},Ze.unmountComponentAtNode=function(e){if(!ao(e))throw Error(J(40));return e._reactRootContainer?(wn(function(){so(null,null,e,!1,function(){e._reactRootContainer=null,e[It]=null})}),!0):!1},Ze.unstable_batchedUpdates=As,Ze.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ao(n))throw Error(J(200));if(e==null||e._reactInternals===void 0)throw Error(J(38));return so(e,t,n,!1,r)},Ze.version="18.3.1-next-f1338f8080-20240426";function Cf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Cf)}catch(e){console.error(e)}}Cf(),ml.exports=Ze;var Mp=ml.exports,_s,bf=Mp;_s=bf.createRoot,bf.hydrateRoot;var kf={exports:{}},uo={};/**
|
|
33
33
|
* @license React
|
|
34
34
|
* react-jsx-runtime.production.min.js
|
|
35
35
|
*
|
|
@@ -37,7 +37,62 @@ 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 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}}Xo.Fragment=Rh,Xo.jsx=Fc,Xo.jsxs=Fc,Hc.exports=Xo;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:`
|
|
40
|
+
*/var Pp=ne,Np=Symbol.for("react.element"),Lp=Symbol.for("react.fragment"),Dp=Object.prototype.hasOwnProperty,jp=Pp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Up={key:!0,ref:!0,__self:!0,__source:!0};function Rf(e,t,n){var r,i={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Dp.call(t,r)&&!Up.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:Np,type:e,key:o,ref:a,props:i,_owner:jp.current}}uo.Fragment=Lp,uo.jsx=Rf,uo.jsxs=Rf,kf.exports=uo;var V=kf.exports;const Bp=({isOpen:e,onClick:t,primaryColor:n="#007bff",position:r="bottom-right",marginBottom:i=16,marginSide:o=16,hasNewMessages:a=!1,isMobile:l=!1})=>{const h=()=>{const S={backgroundColor:n,zIndex:2147483647,bottom:`${i}px`};return r==="bottom-left"?it(me({},S),{left:`${o}px`}):it(me({},S),{right:`${o}px`})},m=()=>{const S="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 E="";return l?E=e?"nbc-hidden":"nbc-flex":E="nbc-flex",`${S} ${E} ${e?"nbc-rotate-180":""}`};return V.jsxs("button",{onClick:t,className:m(),style:h(),"aria-label":e?"Close chat":"Open chat",children:[a&&!e&&V.jsxs(V.Fragment,{children:[V.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"}),V.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:V.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-white nbc-rounded-full"})})]}),e?V.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):V.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.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"})})]})},_p=({title:e,onClose:t,primaryColor:n="#f59e0b",avatar:r,closeButtonIcon:i="default",closeButtonText:o="×",closeButtonCustomIcon:a})=>{const l=()=>{switch(i){case"text":return V.jsx("span",{className:"nbc-text-sm nbc-font-bold nbc-leading-none",children:o});case"custom":return a?a.startsWith("<svg")?V.jsx("div",{className:"nbc-w-5 nbc-h-5 nbc-flex nbc-items-center nbc-justify-center",dangerouslySetInnerHTML:{__html:a}}):V.jsx("img",{src:a,alt:"Close",className:"nbc-w-5 nbc-h-5"}):V.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});default:return V.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}};return V.jsxs("div",{className:"nbc-p-2 nbc-text-white nbc-flex nbc-justify-between nbc-items-center nbc-font-medium",style:{backgroundColor:n},children:[V.jsxs("div",{className:"nbc-flex nbc-items-center nbc-space-x-3 nbc-text-black",children:[r?V.jsx("img",{src:r,alt:"Avatar",className:"nbc-w-10 nbc-h-10 nbc-rounded-full nbc-object-cover"}):V.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:[V.jsx("path",{d:"M12 6V2H8"}),V.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"}),V.jsx("path",{d:"M2 12h2"}),V.jsx("path",{d:"M9 11v2"}),V.jsx("path",{d:"M15 11v2"}),V.jsx("path",{d:"M20 12h2"})]}),V.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]}),V.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:l()})]})};function zs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var bn=zs();function Ef(e){bn=e}var Wr={exec:()=>null};function le(e,t=""){let n=typeof e=="string"?e:e.source;const r={replace:(i,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(We.caret,"$1"),n=n.replace(i,a),r},getRegex:()=>new RegExp(n,t)};return r}var We={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},zp=/^(?:[ \t]*(?:\n|$))+/,Hp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fp=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$r=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Gp=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Hs=/(?:[*+-]|\d{1,9}[.)])/,Of=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Tf=le(Of).replace(/bull/g,Hs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Wp=le(Of).replace(/bull/g,Hs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Fs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$p=/^[^\n]+/,Gs=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Vp=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Gs).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Qp=le(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Hs).getRegex(),co="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ws=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Kp=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ws).replace("tag",co).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Af=le(Fs).replace("hr",$r).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",co).getRegex(),Jp=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Af).getRegex(),$s={blockquote:Jp,code:Hp,def:Vp,fences:Fp,heading:Gp,hr:$r,html:Kp,lheading:Tf,list:Qp,newline:zp,paragraph:Af,table:Wr,text:$p},If=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",$r).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",co).getRegex(),Xp=it(me({},$s),{lheading:Wp,table:If,paragraph:le(Fs).replace("hr",$r).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",If).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",co).getRegex()}),Yp=it(me({},$s),{html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ws).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Wr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(Fs).replace("hr",$r).replace("heading",` *#{1,6} *[^
|
|
41
|
+
]`).replace("lheading",Tf).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Zp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,qp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Mf=/^( {2,}|\\)\n(?!\s*$)/,eg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,fo=/[\p{P}\p{S}]/u,Vs=/[\s\p{P}\p{S}]/u,Pf=/[^\s\p{P}\p{S}]/u,tg=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Vs).getRegex(),Nf=/(?!~)[\p{P}\p{S}]/u,ng=/(?!~)[\s\p{P}\p{S}]/u,rg=/(?:[^\s\p{P}\p{S}]|~)/u,ig=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Lf=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,og=le(Lf,"u").replace(/punct/g,fo).getRegex(),ag=le(Lf,"u").replace(/punct/g,Nf).getRegex(),Df="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",sg=le(Df,"gu").replace(/notPunctSpace/g,Pf).replace(/punctSpace/g,Vs).replace(/punct/g,fo).getRegex(),lg=le(Df,"gu").replace(/notPunctSpace/g,rg).replace(/punctSpace/g,ng).replace(/punct/g,Nf).getRegex(),ug=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Pf).replace(/punctSpace/g,Vs).replace(/punct/g,fo).getRegex(),cg=le(/\\(punct)/,"gu").replace(/punct/g,fo).getRegex(),fg=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),dg=le(Ws).replace("(?:-->|$)","-->").getRegex(),hg=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",dg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ho=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,pg=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ho).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),jf=le(/^!?\[(label)\]\[(ref)\]/).replace("label",ho).replace("ref",Gs).getRegex(),Uf=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Gs).getRegex(),gg=le("reflink|nolink(?!\\()","g").replace("reflink",jf).replace("nolink",Uf).getRegex(),Qs={_backpedal:Wr,anyPunctuation:cg,autolink:fg,blockSkip:ig,br:Mf,code:qp,del:Wr,emStrongLDelim:og,emStrongRDelimAst:sg,emStrongRDelimUnd:ug,escape:Zp,link:pg,nolink:Uf,punctuation:tg,reflink:jf,reflinkSearch:gg,tag:hg,text:eg,url:Wr},mg=it(me({},Qs),{link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",ho).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ho).getRegex()}),Ks=it(me({},Qs),{emStrongRDelimAst:lg,emStrongLDelim:ag,url:le(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),vg=it(me({},Ks),{br:le(Mf).replace("{2,}","*").getRegex(),text:le(Ks.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),po={normal:$s,gfm:Xp,pedantic:Yp},Vr={normal:Qs,gfm:Ks,breaks:vg,pedantic:mg},yg={"&":"&","<":"<",">":">",'"':""","'":"'"},Bf=e=>yg[e];function Et(e,t){if(t){if(We.escapeTest.test(e))return e.replace(We.escapeReplace,Bf)}else if(We.escapeTestNoEncode.test(e))return e.replace(We.escapeReplaceNoEncode,Bf);return e}function _f(e){try{e=encodeURI(e).replace(We.percentDecode,"%")}catch(t){return null}return e}function zf(e,t){var o;const n=e.replace(We.findPipe,(a,l,h)=>{let m=!1,S=l;for(;--S>=0&&h[S]==="\\";)m=!m;return m?"|":" |"}),r=n.split(We.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!((o=r.at(-1))!=null&&o.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(We.slashPipe,"|");return r}function Qr(e,t,n){const r=e.length;if(r===0)return"";let i=0;for(;i<r&&e.charAt(r-i-1)===t;)i++;return e.slice(0,r-i)}function wg(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Hf(e,t,n,r,i){const o=t.href,a=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;const h={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,h}function xg(e,t,n){const r=e.match(n.other.indentCodeCompensation);if(r===null)return t;const i=r[1];return t.split(`
|
|
42
|
+
`).map(o=>{const a=o.match(n.other.beginningSpace);if(a===null)return o;const[l]=a;return l.length>=i.length?o.slice(i.length):o}).join(`
|
|
43
|
+
`)}var go=class{constructor(e){fe(this,"options");fe(this,"rules");fe(this,"lexer");this.options=e||bn}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Qr(n,`
|
|
44
|
+
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],r=xg(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){const r=Qr(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Qr(t[0],`
|
|
45
|
+
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=Qr(t[0],`
|
|
46
|
+
`).split(`
|
|
47
|
+
`),r="",i="";const o=[];for(;n.length>0;){let a=!1;const l=[];let h;for(h=0;h<n.length;h++)if(this.rules.other.blockquoteStart.test(n[h]))l.push(n[h]),a=!0;else if(!a)l.push(n[h]);else break;n=n.slice(h);const m=l.join(`
|
|
48
|
+
`),S=m.replace(this.rules.other.blockquoteSetextReplace,`
|
|
49
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
50
|
+
${m}`:m,i=i?`${i}
|
|
51
|
+
${S}`:S;const E=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(S,o,!0),this.lexer.state.top=E,n.length===0)break;const y=o.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){const R=y,f=R.raw+`
|
|
52
|
+
`+n.join(`
|
|
53
|
+
`),b=this.blockquote(f);o[o.length-1]=b,r=r.substring(0,r.length-R.raw.length)+b.raw,i=i.substring(0,i.length-R.text.length)+b.text;break}else if((y==null?void 0:y.type)==="list"){const R=y,f=R.raw+`
|
|
54
|
+
`+n.join(`
|
|
55
|
+
`),b=this.list(f);o[o.length-1]=b,r=r.substring(0,r.length-y.raw.length)+b.raw,i=i.substring(0,i.length-R.raw.length)+b.raw,n=f.substring(o.at(-1).raw.length).split(`
|
|
56
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:o,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const o=this.rules.other.listItemRegex(n);let a=!1;for(;e;){let h=!1,m="",S="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;m=t[0],e=e.substring(m.length);let E=t[2].split(`
|
|
57
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,x=>" ".repeat(3*x.length)),y=e.split(`
|
|
58
|
+
`,1)[0],R=!E.trim(),f=0;if(this.options.pedantic?(f=2,S=E.trimStart()):R?f=t[1].length+1:(f=t[2].search(this.rules.other.nonSpaceChar),f=f>4?1:f,S=E.slice(f),f+=t[1].length),R&&this.rules.other.blankLine.test(y)&&(m+=y+`
|
|
59
|
+
`,e=e.substring(y.length+1),h=!0),!h){const x=this.rules.other.nextBulletRegex(f),p=this.rules.other.hrRegex(f),g=this.rules.other.fencesBeginRegex(f),C=this.rules.other.headingBeginRegex(f),d=this.rules.other.htmlBeginRegex(f);for(;e;){const c=e.split(`
|
|
60
|
+
`,1)[0];let u;if(y=c,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),u=y):u=y.replace(this.rules.other.tabCharGlobal," "),g.test(y)||C.test(y)||d.test(y)||x.test(y)||p.test(y))break;if(u.search(this.rules.other.nonSpaceChar)>=f||!y.trim())S+=`
|
|
61
|
+
`+u.slice(f);else{if(R||E.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||g.test(E)||C.test(E)||p.test(E))break;S+=`
|
|
62
|
+
`+y}!R&&!y.trim()&&(R=!0),m+=c+`
|
|
63
|
+
`,e=e.substring(c.length+1),E=u.slice(f)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(a=!0));let b=null,T;this.options.gfm&&(b=this.rules.other.listIsTask.exec(S),b&&(T=b[0]!=="[ ] ",S=S.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:m,task:!!b,checked:T,loose:!1,text:S,tokens:[]}),i.raw+=m}const l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let h=0;h<i.items.length;h++)if(this.lexer.state.top=!1,i.items[h].tokens=this.lexer.blockTokens(i.items[h].text,[]),!i.loose){const m=i.items[h].tokens.filter(E=>E.type==="space"),S=m.length>0&&m.some(E=>this.rules.other.anyLine.test(E.raw));i.loose=S}if(i.loose)for(let h=0;h<i.items.length;h++)i.items[h].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:r,title:i}}}table(e){var a;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const n=zf(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
64
|
+
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const l of r)this.rules.other.tableAlignRight.test(l)?o.align.push("right"):this.rules.other.tableAlignCenter.test(l)?o.align.push("center"):this.rules.other.tableAlignLeft.test(l)?o.align.push("left"):o.align.push(null);for(let l=0;l<n.length;l++)o.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:o.align[l]});for(const l of i)o.rows.push(zf(l,o.header.length).map((h,m)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:o.align[m]})));return o}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
|
|
65
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const o=Qr(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{const o=wg(t[2],"()");if(o===-2)return;if(o>-1){const l=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){const o=this.rules.other.pedanticHrefTitle.exec(r);o&&(r=o[1],i=o[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Hf(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){const o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return Hf(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const o=[...r[0]].length-1;let a,l,h=o,m=0;const S=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(S.lastIndex=0,t=t.slice(-1*e.length+o);(r=S.exec(t))!=null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(l=[...a].length,r[3]||r[4]){h+=l;continue}else if((r[5]||r[6])&&o%3&&!((o+l)%3)){m+=l;continue}if(h-=l,h>0)continue;l=Math.min(l,l+h+m);const E=[...r[0]][0].length,y=e.slice(0,o+r.index+E+l);if(Math.min(o,l)%2){const f=y.slice(1,-1);return{type:"em",raw:y,text:f,tokens:this.lexer.inlineTokens(f)}}const R=y.slice(2,-2);return{type:"strong",raw:y,text:R,tokens:this.lexer.inlineTokens(R)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let i,o;if(t[2]==="@")i=t[0],o="mailto:"+i;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);i=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:i,href:o,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Bt=class rl{constructor(t){fe(this,"tokens");fe(this,"options");fe(this,"state");fe(this,"tokenizer");fe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||bn,this.options.tokenizer=this.options.tokenizer||new go,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:We,block:po.normal,inline:Vr.normal};this.options.pedantic?(n.block=po.pedantic,n.inline=Vr.pedantic):this.options.gfm&&(n.block=po.gfm,this.options.breaks?n.inline=Vr.breaks:n.inline=Vr.gfm),this.tokenizer.rules=n}static get rules(){return{block:po,inline:Vr}}static lex(t,n){return new rl(n).lex(t)}static lexInline(t,n){return new rl(n).inlineTokens(t)}lex(t){t=t.replace(We.carriageReturn,`
|
|
66
|
+
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,o,a;for(this.options.pedantic&&(t=t.replace(We.tabCharGlobal," ").replace(We.spaceLine,""));t;){let l;if((o=(i=this.options.extensions)==null?void 0:i.block)!=null&&o.some(m=>(l=m.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);const m=n.at(-1);l.raw.length===1&&m!==void 0?m.raw+=`
|
|
67
|
+
`:n.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);const m=n.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
68
|
+
`+l.raw,m.text+=`
|
|
69
|
+
`+l.text,this.inlineQueue.at(-1).src=m.text):n.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);const m=n.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
70
|
+
`+l.raw,m.text+=`
|
|
71
|
+
`+l.raw,this.inlineQueue.at(-1).src=m.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title});continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),n.push(l);continue}let h=t;if((a=this.options.extensions)!=null&&a.startBlock){let m=1/0;const S=t.slice(1);let E;this.options.extensions.startBlock.forEach(y=>{E=y.call({lexer:this},S),typeof E=="number"&&E>=0&&(m=Math.min(m,E))}),m<1/0&&m>=0&&(h=t.substring(0,m+1))}if(this.state.top&&(l=this.tokenizer.paragraph(h))){const m=n.at(-1);r&&(m==null?void 0:m.type)==="paragraph"?(m.raw+=`
|
|
72
|
+
`+l.raw,m.text+=`
|
|
73
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):n.push(l),r=h.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);const m=n.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
74
|
+
`+l.raw,m.text+=`
|
|
75
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):n.push(l);continue}if(t){const m="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var l,h,m;let r=t,i=null;if(this.tokens.links){const S=Object.keys(this.tokens.links);if(S.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)S.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let o=!1,a="";for(;t;){o||(a=""),o=!1;let S;if((h=(l=this.options.extensions)==null?void 0:l.inline)!=null&&h.some(y=>(S=y.call({lexer:this},t,n))?(t=t.substring(S.raw.length),n.push(S),!0):!1))continue;if(S=this.tokenizer.escape(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.tag(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.link(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(S.raw.length);const y=n.at(-1);S.type==="text"&&(y==null?void 0:y.type)==="text"?(y.raw+=S.raw,y.text+=S.text):n.push(S);continue}if(S=this.tokenizer.emStrong(t,r,a)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.codespan(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.br(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.del(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.autolink(t)){t=t.substring(S.raw.length),n.push(S);continue}if(!this.state.inLink&&(S=this.tokenizer.url(t))){t=t.substring(S.raw.length),n.push(S);continue}let E=t;if((m=this.options.extensions)!=null&&m.startInline){let y=1/0;const R=t.slice(1);let f;this.options.extensions.startInline.forEach(b=>{f=b.call({lexer:this},R),typeof f=="number"&&f>=0&&(y=Math.min(y,f))}),y<1/0&&y>=0&&(E=t.substring(0,y+1))}if(S=this.tokenizer.inlineText(E)){t=t.substring(S.raw.length),S.raw.slice(-1)!=="_"&&(a=S.raw.slice(-1)),o=!0;const y=n.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=S.raw,y.text+=S.text):n.push(S);continue}if(t){const y="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return n}},mo=class{constructor(e){fe(this,"options");fe(this,"parser");this.options=e||bn}space(e){return""}code({text:e,lang:t,escaped:n}){var o;const r=(o=(t||"").match(We.notSpaceStart))==null?void 0:o[0],i=e.replace(We.endingNewline,"")+`
|
|
76
|
+
`;return r?'<pre><code class="language-'+Et(r)+'">'+(n?i:Et(i,!0))+`</code></pre>
|
|
77
|
+
`:"<pre><code>"+(n?i:Et(i,!0))+`</code></pre>
|
|
78
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
79
|
+
${this.parser.parse(e)}</blockquote>
|
|
80
|
+
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
81
|
+
`}hr(e){return`<hr>
|
|
82
|
+
`}list(e){const t=e.ordered,n=e.start;let r="";for(let a=0;a<e.items.length;a++){const l=e.items[a];r+=this.listitem(l)}const i=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+i+o+`>
|
|
83
|
+
`+r+"</"+i+`>
|
|
84
|
+
`}listitem(e){var n;let t="";if(e.task){const r=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+Et(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
85
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
86
|
+
`}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let r="";for(let i=0;i<e.rows.length;i++){const o=e.rows[i];n="";for(let a=0;a<o.length;a++)n+=this.tablecell(o[a]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
87
|
+
<thead>
|
|
88
|
+
`+t+`</thead>
|
|
89
|
+
`+r+`</table>
|
|
90
|
+
`}tablerow({text:e}){return`<tr>
|
|
91
|
+
${e}</tr>
|
|
92
|
+
`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
93
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Et(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const r=this.parser.parseInline(n),i=_f(e);if(i===null)return r;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+Et(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const i=_f(e);if(i===null)return Et(n);e=i;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${Et(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Et(e.text)}},Js=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},_t=class il{constructor(t){fe(this,"options");fe(this,"renderer");fe(this,"textRenderer");this.options=t||bn,this.options.renderer=this.options.renderer||new mo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Js}static parse(t,n){return new il(n).parse(t)}static parseInline(t,n){return new il(n).parseInline(t)}parse(t,n=!0){var i,o;let r="";for(let a=0;a<t.length;a++){const l=t[a];if((o=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&o[l.type]){const m=l,S=this.options.extensions.renderers[m.type].call({parser:this},m);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){r+=S||"";continue}}const h=l;switch(h.type){case"space":{r+=this.renderer.space(h);continue}case"hr":{r+=this.renderer.hr(h);continue}case"heading":{r+=this.renderer.heading(h);continue}case"code":{r+=this.renderer.code(h);continue}case"table":{r+=this.renderer.table(h);continue}case"blockquote":{r+=this.renderer.blockquote(h);continue}case"list":{r+=this.renderer.list(h);continue}case"html":{r+=this.renderer.html(h);continue}case"paragraph":{r+=this.renderer.paragraph(h);continue}case"text":{let m=h,S=this.renderer.text(m);for(;a+1<t.length&&t[a+1].type==="text";)m=t[++a],S+=`
|
|
94
|
+
`+this.renderer.text(m);n?r+=this.renderer.paragraph({type:"paragraph",raw:S,text:S,tokens:[{type:"text",raw:S,text:S,escaped:!0}]}):r+=S;continue}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return r}parseInline(t,n=this.renderer){var i,o;let r="";for(let a=0;a<t.length;a++){const l=t[a];if((o=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&o[l.type]){const m=this.options.extensions.renderers[l.type].call({parser:this},l);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=m||"";continue}}const h=l;switch(h.type){case"escape":{r+=n.text(h);break}case"html":{r+=n.html(h);break}case"link":{r+=n.link(h);break}case"image":{r+=n.image(h);break}case"strong":{r+=n.strong(h);break}case"em":{r+=n.em(h);break}case"codespan":{r+=n.codespan(h);break}case"br":{r+=n.br(h);break}case"del":{r+=n.del(h);break}case"text":{r+=n.text(h);break}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return r}},vo=(qs=class{constructor(e){fe(this,"options");fe(this,"block");this.options=e||bn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Bt.lex:Bt.lexInline}provideParser(){return this.block?_t.parse:_t.parseInline}},fe(qs,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),qs),Sg=class{constructor(...e){fe(this,"defaults",zs());fe(this,"options",this.setOptions);fe(this,"parse",this.parseMarkdown(!0));fe(this,"parseInline",this.parseMarkdown(!1));fe(this,"Parser",_t);fe(this,"Renderer",mo);fe(this,"TextRenderer",Js);fe(this,"Lexer",Bt);fe(this,"Tokenizer",go);fe(this,"Hooks",vo);this.use(...e)}walkTokens(e,t){var r,i;let n=[];for(const o of e)switch(n=n.concat(t.call(this,o)),o.type){case"table":{const a=o;for(const l of a.header)n=n.concat(this.walkTokens(l.tokens,t));for(const l of a.rows)for(const h of l)n=n.concat(this.walkTokens(h.tokens,t));break}case"list":{const a=o;n=n.concat(this.walkTokens(a.items,t));break}default:{const a=o;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{const h=a[l].flat(1/0);n=n.concat(this.walkTokens(h,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const r=me({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const o=t.renderers[i.name];o?t.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const o=t[i.level];o?o.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),n.renderer){const i=this.defaults.renderer||new mo(this.defaults);for(const o in n.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;const a=o,l=n.renderer[a],h=i[a];i[a]=(...m)=>{let S=l.apply(i,m);return S===!1&&(S=h.apply(i,m)),S||""}}r.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new go(this.defaults);for(const o in n.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;const a=o,l=n.tokenizer[a],h=i[a];i[a]=(...m)=>{let S=l.apply(i,m);return S===!1&&(S=h.apply(i,m)),S}}r.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new vo;for(const o in n.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;const a=o,l=n.hooks[a],h=i[a];vo.passThroughHooks.has(o)?i[a]=m=>{if(this.defaults.async)return Promise.resolve(l.call(i,m)).then(E=>h.call(i,E));const S=l.call(i,m);return h.call(i,S)}:i[a]=(...m)=>{let S=l.apply(i,m);return S===!1&&(S=h.apply(i,m)),S}}r.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,o=n.walkTokens;r.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults=me(me({},this.defaults),r)}),this}setOptions(e){return this.defaults=me(me({},this.defaults),e),this}lexer(e,t){return Bt.lex(e,t!=null?t:this.defaults)}parser(e,t){return _t.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(n,r)=>{const i=me({},r),o=me(me({},this.defaults),i),a=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&i.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n=="undefined"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=e);const l=o.hooks?o.hooks.provideLexer():e?Bt.lex:Bt.lexInline,h=o.hooks?o.hooks.provideParser():e?_t.parse:_t.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(n):n).then(m=>l(m,o)).then(m=>o.hooks?o.hooks.processAllTokens(m):m).then(m=>o.walkTokens?Promise.all(this.walkTokens(m,o.walkTokens)).then(()=>m):m).then(m=>h(m,o)).then(m=>o.hooks?o.hooks.postprocess(m):m).catch(a);try{o.hooks&&(n=o.hooks.preprocess(n));let m=l(n,o);o.hooks&&(m=o.hooks.processAllTokens(m)),o.walkTokens&&this.walkTokens(m,o.walkTokens);let S=h(m,o);return o.hooks&&(S=o.hooks.postprocess(S)),S}catch(m){return a(m)}}}onError(e,t){return n=>{if(n.message+=`
|
|
95
|
+
Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+Et(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},kn=new Sg;function se(e,t){return kn.parse(e,t)}se.options=se.setOptions=function(e){return kn.setOptions(e),se.defaults=kn.defaults,Ef(se.defaults),se},se.getDefaults=zs,se.defaults=bn,se.use=function(...e){return kn.use(...e),se.defaults=kn.defaults,Ef(se.defaults),se},se.walkTokens=function(e,t){return kn.walkTokens(e,t)},se.parseInline=kn.parseInline,se.Parser=_t,se.parser=_t.parse,se.Renderer=mo,se.TextRenderer=Js,se.Lexer=Bt,se.lexer=Bt.lex,se.Tokenizer=go,se.Hooks=vo,se.parse=se,se.options,se.setOptions,se.use,se.walkTokens,se.parseInline,_t.parse,Bt.lex;const Cg=e=>{if(e instanceof Date)return e;const t=e.endsWith("Z")?e:`${e}Z`;return new Date(t)};function Ff(e){if(!e)return"";const t=Cg(e),n=t.getDate().toString().padStart(2,"0"),r=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getFullYear(),o=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");return`${n}/${r}/${i} ${o}:${a}`}const yo=new se.Renderer;yo.link=({href:e,title:t,text:n})=>`<a href="${e}" title="${t||""}" target="_blank" class="nbc-text-blue-500 nbc-hover:underline">${n}</a>`,yo.heading=({depth:e,text:t})=>`<h${e} class="nbc-text-[${1.5-e*.2}rem] nbc-font-bold nbc-mb-2">${t}</h${e}>`;const bg=({message:e,avatar:t})=>e.sender==="user"?V.jsx("div",{className:"nbc-flex nbc-justify-end nbc-mb-4",children:V.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:[V.jsx("div",{className:"nbc-break-words",style:{overflowWrap:"anywhere",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:se(e.text,{renderer:yo})}}),V.jsx("div",{className:"nbc-text-xs nbc-mt-1 nbc-opacity-70 nbc-text-right",children:Ff(String(e.timestamp)).split(" ")[1].substring(0,5)})]})}):V.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:V.jsxs("div",{className:"nbc-flex nbc-items-start nbc-space-x-3",children:[V.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3 nbc-text-black",children:[t?V.jsx("img",{src:t,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}):V.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:[V.jsx("path",{d:"M12 6V2H8"}),V.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"}),V.jsx("path",{d:"M2 12h2"}),V.jsx("path",{d:"M9 11v2"}),V.jsx("path",{d:"M15 11v2"}),V.jsx("path",{d:"M20 12h2"})]}),V.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",children:Ff(String(e.timestamp)).split(" ")[1].substring(0,5)})]}),V.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:V.jsx("div",{className:"nbc-break-words",style:{overflowWrap:"anywhere",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:se(e.text,{renderer:yo})}})})]})}),kg=({avatar:e})=>V.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:V.jsxs("div",{className:"nbc-flex nbc-items-start nbc-space-x-3",children:[V.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[e&&V.jsx("img",{src:e,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}),V.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",children:" "})]}),V.jsx("div",{className:"nbc-bg-white nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-rounded-bl-md nbc-shadow-sm",children:V.jsxs("div",{className:"nbc-flex nbc-space-x-1",children:[V.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"0ms"}}),V.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"150ms"}}),V.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"300ms"}})]})})]})}),Gf=({messages:e,isTyping:t,avatar:n})=>{const r=ne.useRef(null),i=()=>{var o;(o=r.current)==null||o.scrollIntoView({behavior:"smooth"})};return ne.useEffect(()=>{i()},[e,t]),V.jsxs("div",{className:"nbc-flex-1 nbc-overflow-y-auto nbc-px-2 nbc-pt-4",style:{scrollbarWidth:"thin",scrollbarColor:"#d1d5db #f9fafb"},children:[V.jsx("style",{children:`
|
|
41
96
|
.nbc-flex-1::-webkit-scrollbar {
|
|
42
97
|
width: 6px;
|
|
43
98
|
}
|
|
@@ -59,14 +114,14 @@ Error generating stack: `+i.message+`
|
|
|
59
114
|
.nbc-flex-1::-webkit-scrollbar-button:vertical:end:increment {
|
|
60
115
|
display: none;
|
|
61
116
|
}
|
|
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)}},Zo=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=Zo(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:{}};/*!
|
|
117
|
+
`}),e.map(o=>V.jsx(bg,{message:o,avatar:n},o.id)),t&&V.jsx(kg,{avatar:n}),V.jsx("div",{ref:r})]})},Wf=({onSendMessage:e,placeholder:t="Escribe un mensaje...",disabled:n=!1})=>{const[r,i]=ne.useState(""),o=l=>{l.preventDefault(),r.trim()&&!n&&(e(r.trim()),i(""))},a=l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),r.trim()&&!n&&(e(r.trim()),i("")))};return V.jsx("form",{onSubmit:o,className:"nbc-bg-white nbc-border-t nbc-border-gray-100",children:V.jsxs("div",{className:"nbc-relative",children:[V.jsx("input",{type:"text",value:r,onChange:l=>i(l.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"}}),V.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:V.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:[V.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),V.jsx("path",{d:"M22 2 11 13"})]})})]})})},$f=({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 V.jsxs("div",{className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-space-y-4 nbc-p-4",children:[t.map((n,r)=>V.jsx("div",{className:`nbc-flex ${n.type==="user"?"nbc-justify-end":"nbc-justify-start"} nbc-mb-4`,children:n.type==="user"?V.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((i,o)=>V.jsx("div",{className:`nbc-h-4 nbc-bg-gray-100 nbc-rounded nbc-animate-pulse ${i}`},o))}):V.jsxs("div",{className:"nbc-w-full nbc-flex nbc-items-start nbc-space-x-3",children:[V.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[e?V.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"}):V.jsx("div",{className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-bg-gray-300 nbc-animate-pulse"}),V.jsx("div",{className:"nbc-w-10 nbc-h-3 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse nbc-mt-1"})]}),V.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((i,o)=>V.jsx("div",{className:`nbc-h-4 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse ${i}`},o))})]})},r)),V.jsx("div",{className:"nbc-text-center nbc-text-sm nbc-text-gray-500 nbc-animate-pulse",children:"Cargando conversación..."})]})},Rg=({isOpen:e,onClose:t,config:n,messages:r,onSendMessage:i,isLoading:o=!1,isAiTyping:a=!1,position:l,marginBottom:h,marginSide:m,isMobile:S=!1,apiKeyMissing:E=!1})=>{const[y,R]=ne.useState(!1),[f,b]=ne.useState(!1),T=c=>{i(c)};if(ne.useEffect(()=>{e?(b(!0),setTimeout(()=>R(!0),10)):(R(!1),setTimeout(()=>b(!1),300))},[e]),!f)return null;const x=()=>{const c=l||n.position||"bottom-right",u=h||n.marginBottom||16,s=m||n.marginSide||16,k={width:"400px",height:"580px",zIndex:2147483647,bottom:`${u+64+10}px`};return c==="bottom-left"?it(me({},k),{left:`${s}px`}):it(me({},k),{right:`${s}px`})},p=()=>`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 ${S?"nbc-inset-0 nbc-w-full nbc-h-full nbc-rounded-none":"nbc-w-auto nbc-h-auto nbc-rounded-lg nbc-inset-auto"} ${y?"nbc-opacity-100 nbc-scale-100 nbc-translate-y-0":"nbc-opacity-0 nbc-scale-95 nbc-translate-y-2"}`,g=()=>S?{zIndex:2147483647}:x(),d=`https://notchatbot.com?utm_source=${typeof window!="undefined"?encodeURIComponent(window.location.hostname):"unknown"}&utm_medium=widget&utm_campaign=WebChat`;return V.jsxs("div",{className:p(),style:g(),children:[V.jsx(_p,{title:n.title||"Chat",onClose:t,primaryColor:n.primaryColor,avatar:n.avatar,closeButtonIcon:n.closeButtonIcon,closeButtonText:n.closeButtonText,closeButtonCustomIcon:n.closeButtonCustomIcon}),E?V.jsx("div",{className:"nbc-flex-1 nbc-flex nbc-items-center nbc-justify-center nbc-min-h-[220px]",children:V.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:[V.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:[V.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"none"}),V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4m0 4h.01"})]}),"Falta la API Key"]})}):o?V.jsx($f,{avatar:n.avatar}):V.jsx(Gf,{messages:r,isTyping:a,avatar:n.avatar}),V.jsxs("div",{className:"nbc-mb-1 nbc-flex nbc-items-end nbc-justify-center nbc-text-xs nbc-text-black",children:[V.jsx("span",{children:"Powered by"})," ",V.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"nbc-font-bold nbc-text-black",children:"NotChatbot"})]}),V.jsx(Wf,{onSendMessage:T,placeholder:n.placeholder||"Escribe un mensaje...",disabled:a||E})]})};function wt(){const t=Date.now().toString(16).padStart(12,"0"),n=new Uint8Array(10);crypto.getRandomValues(n);const r=Array.from(n).map(o=>o.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 Vf(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 Xs(e,t,n={}){const{expires:r,maxAge:i,domain:o,path:a="/",secure:l=window.location.protocol==="https:",sameSite:h="lax"}=n;let m=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;r&&(m+=`; expires=${r.toUTCString()}`),i!==void 0&&(m+=`; max-age=${i}`),o&&(m+=`; domain=${o}`),m+=`; path=${a}`,l&&(m+="; secure"),m+=`; samesite=${h}`,document.cookie=m}function Qf(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 Eg(e,t={}){Xs(e,"",it(me({},t),{expires:new Date(0)}))}function Kf(){try{const e="__webchat_test__";Xs(e,"test");const t=Qf(e)==="test";return Eg(e),t}catch(e){return!1}}const Jf="notchatbot",Og=24;function Ys(){if(!Kf())return console.warn("WebChat: Cookies not supported, using session-only data"),{conversationId:wt(),conversationStarted:!1};const e=Qf(Jf);if(e)try{const n=JSON.parse(e);if(n&&typeof n=="object"&&typeof n.conversationId=="string"&&typeof n.conversationStarted=="boolean"&&Vf(n.conversationId))return n}catch(n){console.warn("WebChat: Invalid notchatbot cookie format, creating new one")}const t={conversationId:wt(),conversationStarted:!1};return Xf(t),t}function Xf(e){if(!Kf()){console.warn("WebChat: Cookies not supported, cannot save data");return}if(!e||!Vf(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=Og*60*60;Xs(Jf,JSON.stringify(e),{maxAge:t,secure:window.location.protocol==="https:",sameSite:"lax",path:"/"})}function Tg(e){const t=Ys(),n=it(me({},t),{conversationStarted:e});return Xf(n),n}function Yf(){return Ys().conversationId}function Zf(){return Ys().conversationStarted}const Ag=()=>{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},Zs=()=>Ag()?"mobile":"desktop",Ig=e=>{if(typeof window=="undefined")return()=>{};let t=Zs();const n=()=>{const r=Zs();r!==t&&(t=r,e(r))};return window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},wo=e=>{const t=Zs(),n=it(me({},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},Mg=e=>{const t=wo(e);return{position:t.position,marginBottom:t.marginBottom,marginSide:t.marginSide}},qf=()=>ot(this,null,function*(){const e=typeof window!="undefined"?sessionStorage.getItem("webchat-session-id"):null;if(e)return e;const t=`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;return typeof window!="undefined"&&sessionStorage.setItem("webchat-session-id",t),t});function Pg(){return typeof window=="undefined"?!1:window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")}function ed(){return Pg()?{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 Ng(){return ed().chatEndpoint}function td(){return ed().conversationEndpoint}const Lg=(e,t)=>ot(this,null,function*(){try{const n=td(),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}}),Dg=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,type:t.type}}),jg=(e,t)=>e.map(n=>({id:n.id,content:n.text,role:n.sender==="user"?"user":"assistant",type:n.type,createdAt:n.timestamp instanceof Date?n.timestamp.toISOString():n.timestamp,conversationId:t}));var nd={exports:{}};/*!
|
|
63
118
|
* @license Copyright 2015-2022 Ably Real-time Ltd (ably.com)
|
|
64
119
|
*
|
|
65
120
|
* Ably JavaScript Library v1.2.50
|
|
66
121
|
* https://github.com/ably/ably-js
|
|
67
122
|
*
|
|
68
123
|
* Released under the Apache Licence v2.0
|
|
69
|
-
*/(function(e,t){(function(r,
|
|
124
|
+
*/(function(e,t){(function(r,i){e.exports=i()})(window,function(){return function(n){var r={};function i(o){if(r[o])return r[o].exports;var a=r[o]={i:o,l:!1,exports:{}};return n[o].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return i.m=n,i.c=r,i.d=function(o,a,l){i.o(o,a)||Object.defineProperty(o,a,{enumerable:!0,get:l})},i.r=function(o){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},i.t=function(o,a){if(a&1&&(o=i(o)),a&8||a&4&&typeof o=="object"&&o&&o.__esModule)return o;var l=Object.create(null);if(i.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:o}),a&2&&typeof o!="string")for(var h in o)i.d(l,h,function(m){return o[m]}.bind(null,h));return l},i.n=function(o){var a=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(a,"a",a),a},i.o=function(o,a){return Object.prototype.hasOwnProperty.call(o,a)},i.p="",i(i.s=42)}([function(n,r,i){i.r(r),i.d(r,"__extends",function(){return a}),i.d(r,"__assign",function(){return l}),i.d(r,"__rest",function(){return h}),i.d(r,"__decorate",function(){return m}),i.d(r,"__param",function(){return S}),i.d(r,"__metadata",function(){return E}),i.d(r,"__awaiter",function(){return y}),i.d(r,"__generator",function(){return R}),i.d(r,"__createBinding",function(){return f}),i.d(r,"__exportStar",function(){return b}),i.d(r,"__values",function(){return T}),i.d(r,"__read",function(){return x}),i.d(r,"__spread",function(){return p}),i.d(r,"__spreadArrays",function(){return g}),i.d(r,"__spreadArray",function(){return C}),i.d(r,"__await",function(){return d}),i.d(r,"__asyncGenerator",function(){return c}),i.d(r,"__asyncDelegator",function(){return u}),i.d(r,"__asyncValues",function(){return s}),i.d(r,"__makeTemplateObject",function(){return w}),i.d(r,"__importStar",function(){return k}),i.d(r,"__importDefault",function(){return L}),i.d(r,"__classPrivateFieldGet",function(){return N}),i.d(r,"__classPrivateFieldSet",function(){return P});/*! *****************************************************************************
|
|
70
125
|
Copyright (c) Microsoft Corporation.
|
|
71
126
|
|
|
72
127
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -79,16 +134,16 @@ Error generating stack: `+i.message+`
|
|
|
79
134
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
80
135
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
81
136
|
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,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 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 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,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 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
|
-
`),
|
|
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
|
-
`+
|
|
137
|
+
***************************************************************************** */var o=function(I,M){return o=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])},o(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");o(I,M);function A(){this.constructor=I}I.prototype=M===null?Object.create(M):(A.prototype=M.prototype,new A)}var l=function(){return l=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},l.apply(this,arguments)};function h(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 m(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 S(I,M){return function(A,j){M(A,j,I)}}function E(I,M){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(I,M)}function y(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(D){try{O(j.next(D))}catch(B){W(B)}}function F(D){try{O(j.throw(D))}catch(B){W(B)}}function O(D){D.done?z(D.value):U(D.value).then(G,F)}O((j=j.apply(I,M||[])).next())})}function R(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(O){return function(D){return F([O,D])}}function F(O){if(j)throw new TypeError("Generator is already executing.");for(;A;)try{if(j=1,U&&(z=O[0]&2?U.return:O[0]?U.throw||((z=U.return)&&z.call(U),0):U.next)&&!(z=z.call(U,O[1])).done)return z;switch(U=0,z&&(O=[O[0]&2,z.value]),O[0]){case 0:case 1:z=O;break;case 4:return A.label++,{value:O[1],done:!1};case 5:A.label++,U=O[1],O=[0];continue;case 7:O=A.ops.pop(),A.trys.pop();continue;default:if(z=A.trys,!(z=z.length>0&&z[z.length-1])&&(O[0]===6||O[0]===2)){A=0;continue}if(O[0]===3&&(!z||O[1]>z[0]&&O[1]<z[3])){A.label=O[1];break}if(O[0]===6&&A.label<z[1]){A.label=z[1],z=O;break}if(z&&A.label<z[2]){A.label=z[2],A.ops.push(O);break}z[2]&&A.ops.pop(),A.trys.pop();continue}O=M.call(I,A)}catch(D){O=[6,D],U=0}finally{j=z=0}if(O[0]&5)throw O[1];return{value:O[0]?O[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 b(I,M){for(var A in I)A!=="default"&&!Object.prototype.hasOwnProperty.call(M,A)&&f(M,I,A)}function T(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 x(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 p(){for(var I=[],M=0;M<arguments.length;M++)I=I.concat(x(arguments[M]));return I}function g(){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 C(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 d(I){return this instanceof d?(this.v=I,this):new d(I)}function c(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($){return new Promise(function(X,Y){z.push([_,$,X,Y])>1||G(_,$)})})}function G(_,$){try{F(j[_]($))}catch(X){B(z[0][3],X)}}function F(_){_.value instanceof d?Promise.resolve(_.value.v).then(O,D):B(z[0][2],_)}function O(_){G("next",_)}function D(_){G("throw",_)}function B(_,$){_($),z.shift(),z.length&&G(z[0][0],z[0][1])}}function u(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:d(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 T=="function"?T(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(O){z({value:O,done:G})},W)}}function w(I,M){return Object.defineProperty?Object.defineProperty(I,"raw",{value:M}):I.raw=M,I}var v=Object.create?function(I,M){Object.defineProperty(I,"default",{enumerable:!0,value:M})}:function(I,M){I.default=M};function k(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 v(M,I),M}function L(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 P(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,i){(function(o){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=i(0),l=a.__importDefault(i(3)),h=a.__importStar(i(8)),m=a.__importDefault(i(4)),S=i(11),E=i(31);function y(H){return Math.floor(Math.random()*H.length)}function R(H){for(var Q=[],K=1;K<arguments.length;K++)Q[K-1]=arguments[K];for(var ee=0;ee<Q.length;ee++){var oe=Q[ee];if(!oe)break;var Ye=Object.prototype.hasOwnProperty;for(var Kr in oe)(!Ye||Ye.call(oe,Kr))&&(H[Kr]=oe[Kr])}return H}r.mixin=R;function f(H){return R({},H)}r.copy=f,r.isArray=Array.isArray||function(H){return Object.prototype.toString.call(H)=="[object Array]"};function b(H){return g(H)?[]:(0,r.isArray)(H)?H:[H]}r.ensureArray=b;function T(H){return Object.prototype.toString.call(H)=="[object Object]"}r.isObject=T;function x(H){for(var Q in H)return!1;return!0}r.isEmpty=x;function p(H,Q){for(var K in H)if(K!==Q)return!1;return!0}r.isOnlyPropIn=p;function g(H){return H==null}r.isEmptyArg=g;function C(H){var Q=new Object;for(var K in H)Q[K]=H[K];return Q}r.shallowClone=C;function d(H,Q){var K=function(){function oe(){}return oe}();K.prototype=H;var ee=new K;return Q&&R(ee,Q),ee}r.prototypicalClone=d;var c=function(H,Q){if(l.default.Config.inherits){l.default.Config.inherits(H,Q);return}H.super_=Q,H.prototype=d(Q.prototype,{constructor:H})};r.inherits=c;function u(H,Q){for(var K in H)if(H[K]==Q)return!0;return!1}r.containsValue=u;function s(H,Q){return(0,r.isArray)(Q)?w(H,Q):v(H,Q)}r.intersect=s;function w(H,Q){for(var K=[],ee=0;ee<H.length;ee++){var oe=H[ee];(0,r.arrIndexOf)(Q,oe)!=-1&&K.push(oe)}return K}r.arrIntersect=w;function v(H,Q){for(var K=[],ee=0;ee<H.length;ee++){var oe=H[ee];oe in Q&&K.push(oe)}return K}r.arrIntersectOb=v;function k(H,Q){for(var K=[],ee=0;ee<H.length;ee++){var oe=H[ee];(0,r.arrIndexOf)(Q,oe)==-1&&K.push(oe)}return K}r.arrSubtract=k,r.arrIndexOf=Array.prototype.indexOf?function(H,Q,K){return H.indexOf(Q,K)}:function(H,Q,K){K=K||0;for(var ee=H.length;K<ee;K++)if(H[K]===Q)return K;return-1};function L(H,Q){return(0,r.arrIndexOf)(H,Q)!==-1}r.arrIn=L;function N(H,Q){var K=(0,r.arrIndexOf)(H,Q),ee=K!=-1;return ee&&H.splice(K,1),ee}r.arrDeleteValue=N;function P(H,Q){var K=H.slice();return N(K,Q),K}r.arrWithoutValue=P;function I(H,Q){var K=[];for(var ee in H)Q&&!Object.prototype.hasOwnProperty.call(H,ee)||K.push(ee);return K}r.keysArray=I;function M(H,Q){var K=[];for(var ee in H)Q&&!Object.prototype.hasOwnProperty.call(H,ee)||K.push(H[ee]);return K}r.valuesArray=M;function A(H,Q){for(var K in H)Object.prototype.hasOwnProperty.call(H,K)&&H[K]&&Q(K)}r.forInOwnNonNullProperties=A,r.arrForEach=Array.prototype.forEach?function(H,Q){H.forEach(Q)}:function(H,Q){for(var K=H.length,ee=0;ee<K;ee++)Q(H[ee],ee,H)};function j(H,Q){return(0,r.arrForEach)(H.slice(),Q)}r.safeArrForEach=j,r.arrMap=Array.prototype.map?function(H,Q){return H.map(Q)}:function(H,Q){for(var K=[],ee=H.length,oe=0;oe<ee;oe++)K.push(Q(H[oe],oe,H));return K},r.arrFilter=Array.prototype.filter?function(H,Q){return H.filter(Q)}:function(H,Q){for(var K=[],ee=H.length,oe=0;oe<ee;oe++)Q(H[oe])&&K.push(H[oe]);return K},r.arrEvery=Array.prototype.every?function(H,Q){return H.every(Q)}:function(H,Q){for(var K=H.length,ee=0;ee<K;ee++)if(!Q(H[ee],ee,H))return!1;return!0};function U(H,Q){if(H.length===0)return!0;var K=H[0][Q];return(0,r.arrEvery)(H,function(ee){return ee[Q]===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,Q){var K=z[Q||ye.json];return{accept:K,"X-Ably-Version":h.default.protocolVersion.toString(),"Ably-Agent":(0,h.getAgentString)(H)}}r.defaultGetHeaders=W;function G(H,Q){var K,ee=K=z[Q||ye.json];return{accept:ee,"content-type":K,"X-Ably-Version":h.default.protocolVersion.toString(),"Ably-Agent":(0,h.getAgentString)(H)}}r.defaultPostHeaders=G;function F(H){return H.splice(y(H),1)[0]}r.arrPopRandomElement=F;function O(H){var Q=[];if(H)for(var K in H)Q.push(encodeURIComponent(K)+"="+encodeURIComponent(H[K]));return Q.length?"?"+Q.join("&"):""}r.toQueryString=O;function D(H){for(var Q,K=/([^?&=]+)=?([^&]*)/g,ee={};Q=K.exec(H);)ee[decodeURIComponent(Q[1])]=decodeURIComponent(Q[2]);return ee}r.parseQueryString=D,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 Q,K;return H instanceof Error||((Q=H==null?void 0:H.constructor)===null||Q===void 0?void 0:Q.name)==="ErrorInfo"||((K=H==null?void 0:H.constructor)===null||K===void 0?void 0:K.name)==="PartialErrorInfo"?H.toString():l.default.Config.inspect(H)}r.inspectError=_;function $(H){return l.default.BufferUtils.isBuffer(H)?H.toString():typeof H=="string"?H:l.default.Config.inspect(H)}r.inspectBody=$;function X(H){if(l.default.BufferUtils.isBuffer(H))return l.default.BufferUtils.byteLength(H);if(typeof H=="string")return l.default.Config.stringByteSize(H);throw new Error("Expected input of Utils.dataSizeBytes to be a buffer or string, but was: "+typeof H)}r.dataSizeBytes=X;function Y(){return String(Math.random()).substr(2)}r.cheapRandStr=Y;var te=function(H){if(l.default.Config.getRandomValues&&typeof Uint8Array!="undefined"){var Q=new Uint8Array(H);return l.default.Config.getRandomValues(Q),l.default.BufferUtils.base64Encode(Q)}for(var K=l.default.BufferUtils.base64CharSet,ee=Math.round(H*4/3),oe="",Ye=0;Ye<ee;Ye++)oe+=K[y(K)];return oe};r.randomString=te;var re=function(H){if(l.default.Config.getRandomValues&&typeof Uint8Array!="undefined"){var Q=new Uint8Array(H);return l.default.Config.getRandomValues(Q),l.default.BufferUtils.hexEncode(Q)}for(var K=l.default.BufferUtils.hexCharSet,ee=H*2,oe="",Ye=0;Ye<ee;Ye++)oe+=K[y(K)];return oe};r.randomHexString=re;function ce(H,Q){for(var K=Math.min(Q,H.length),ee=H.slice(),oe=[],Ye=0;Ye<K;Ye++)oe.push(F(ee));return oe}r.arrChooseN=ce,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,Q,K){return new Promise(function(ee,oe){H[Q].apply(H,a.__spreadArray(a.__spreadArray([],K,!1),[function(Ye,Kr){Ye?oe(Ye):ee(Kr)}],!1))})}r.promisify=Z;var ye;(function(H){H.msgpack="msgpack",H.json="json"})(ye=r.Format||(r.Format={}));function De(H,Q){return Q=="msgpack"?l.default.Config.msgpack.decode(H):JSON.parse(String(H))}r.decodeBody=De;function $e(H,Q){return Q=="msgpack"?l.default.Config.msgpack.encode(H,!0):JSON.stringify(H)}r.encodeBody=$e;function Ae(H){return H.map(function(Q){return Q&&Q.toLowerCase()})}r.allToLowerCase=Ae;function zt(H){return H.map(function(Q){return Q&&Q.toUpperCase()})}r.allToUpperCase=zt;function Co(H){return Math.min((H+2)/3,2)}r.getBackoffCoefficient=Co;function xt(){return 1-Math.random()*.2}r.getJitterCoefficient=xt;function bo(H,Q){return H*Co(Q)*xt()}r.getRetryTime=bo;function el(){return o||(typeof window!="undefined"?window:self)}r.getGlobalObject=el;function tl(H,Q){return Object.keys(H).every(function(K){return H[K]===Q[K]})&&Object.keys(Q).every(function(K){return Q[K]===H[K]})}r.shallowEquals=tl;function Qg(H){var Q=/^(\[([^?]*)(?:(.*))\])?(.+)$/,K=H.match(Q);if(!K||!K.length||K.length<5)throw new m.default("regex match failed",400,40010);if(K[2])throw new m.default("cannot use a derived option with a ".concat(K[2]," channel"),400,40010);return{qualifierParam:K[3]||"",channelName:K[4]}}r.matchDerivedChannel=Qg;function Kg(H){return l.default.Config.createHmac?Buffer.from(H,"ascii").toString("base64"):(0,S.stringify)((0,E.parse)(H))}r.toBase64=Kg;function Jg(H,Q){return H.length===Q.length&&(0,r.arrEvery)(H,function(K,ee){return K===Q[ee]})}r.arrEquals=Jg}).call(this,i(13))},function(n,r,i){(function(o){Object.defineProperty(r,"__esModule",{value:!0});var a=i(0),l=a.__importDefault(i(3)),h=o||(typeof window!="undefined"?window:self),m;(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"})(m||(m={}));function S(f,b){return"".concat(f).padStart(b?3:2,"0")}function E(f){return l.default.Config.logTimestamps?function(b){var T=new Date;f(S(T.getHours())+":"+S(T.getMinutes())+":"+S(T.getSeconds())+"."+S(T.getMilliseconds(),1)+" "+b)}:f}var y=function(){var f,b,T,x;return typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"||typeof((b=(f=h==null?void 0:h.console)===null||f===void 0?void 0:f.log)===null||b===void 0?void 0:b.apply)=="function"?(T=function(){for(var p=[],g=0;g<arguments.length;g++)p[g]=arguments[g];console.log.apply(console,p)},x=console.warn?function(){for(var p=[],g=0;g<arguments.length;g++)p[g]=arguments[g];console.warn.apply(console,p)}:T):h!=null&&h.console.log?T=x=function(){Function.prototype.apply.call(console.log,console,arguments)}:T=x=function(){},[T,x].map(E)},R=function(){function f(){f.logLevel=f.LOG_DEFAULT}return f.initLogHandlers=function(){var b=y(),T=b[0],x=b[1];this.logHandler=T,this.logErrorHandler=x},f.renamedClientOption=function(b,T){f.deprecationWarning("The `".concat(b,"` client option has been renamed to `").concat(T,"`. Please update your code to use `").concat(T,"` instead. `").concat(b,"` will be removed in a future version."))},f.renamedMethod=function(b,T,x){f.deprecationWarning("`".concat(b,"`’s `").concat(T,"` method has been renamed to `").concat(x,"`. Please update your code to use `").concat(x,"` instead. `").concat(T,"` will be removed in a future version."))},f.deprecationWarning=function(b){f.shouldLog(m.Error)&&f.logErrorHandler("Ably: Deprecation warning - ".concat(b))},f.logLevel=m.Error,f.LOG_NONE=m.None,f.LOG_ERROR=m.Error,f.LOG_MAJOR=m.Major,f.LOG_MINOR=m.Minor,f.LOG_MICRO=m.Micro,f.LOG_DEFAULT=m.Error,f.LOG_DEBUG=m.Micro,f.logAction=function(b,T,x){f.shouldLog(b)&&(b===m.Error?f.logErrorHandler:f.logHandler)("Ably: "+T+": "+x)},f.deprecated=function(b,T){f.deprecationWarning("".concat(b," is deprecated and will be removed in a future version. ").concat(T))},f.shouldLog=function(b){return b<=f.logLevel},f.setLog=function(b,T){b!==void 0&&(f.logLevel=b),T!==void 0&&(f.logHandler=f.logErrorHandler=T)},f}();r.default=R}).call(this,i(13))},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function a(){}return a}();r.default=o},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.PartialErrorInfo=void 0;var o=i(0),a=o.__importDefault(i(3)),l=o.__importStar(i(1));function h(E){var y="["+E.constructor.name;return E.message&&(y+=": "+E.message),E.statusCode&&(y+="; statusCode="+E.statusCode),E.code&&(y+="; code="+E.code),E.cause&&(y+="; cause="+l.inspectError(E.cause)),E.href&&!(E.message&&E.message.indexOf("help.ably.io")>-1)&&(y+="; see "+E.href+" "),y+="]",y}var m=function(E){o.__extends(y,E);function y(R,f,b,T){var x=E.call(this,R)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(x,y.prototype),x.code=f,x.statusCode=b,x.cause=T,x}return y.prototype.toString=function(){return h(this)},y.fromValues=function(R){var f=R,b=f.message,T=f.code,x=f.statusCode;if(typeof b!="string"||typeof T!="number"||typeof x!="number")throw new Error("ErrorInfo.fromValues(): invalid values: "+a.default.Config.inspect(R));var p=Object.assign(new y(b,T,x),R);return p.code&&!p.href&&(p.href="https://help.ably.io/error/"+p.code),p},y}(Error);r.default=m;var S=function(E){o.__extends(y,E);function y(R,f,b,T){var x=E.call(this,R)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(x,y.prototype),x.code=f,x.statusCode=b,x.cause=T,x}return y.prototype.toString=function(){return h(this)},y}(Error);r.PartialErrorInfo=S},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(){if(typeof ArrayBuffer=="function"){var a=o,l=a.lib,h=l.WordArray,m=h.init,S=h.init=function(E){if(E instanceof ArrayBuffer&&(E=new Uint8Array(E)),(E instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&E instanceof Uint8ClampedArray||E instanceof Int16Array||E instanceof Uint16Array||E instanceof Int32Array||E instanceof Uint32Array||E instanceof Float32Array||E instanceof Float64Array)&&(E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength)),E instanceof Uint8Array){for(var y=E.byteLength,R=[],f=0;f<y;f++)R[f>>>2]|=E[f]<<24-f%4*8;m.call(this,R,y)}else m.apply(this,arguments)};S.prototype=h}}(),o.lib.WordArray})},function(n,r,i){(function(o){(function(a,l){n.exports=l()})(this,function(){var a=a||function(l,h){var m;if(typeof window!="undefined"&&window.crypto&&(m=window.crypto),!m&&typeof window!="undefined"&&window.msCrypto&&(m=window.msCrypto),!m&&typeof o!="undefined"&&o.crypto&&(m=o.crypto),!m)try{m=i(44)}catch(c){}var S=function(){if(m){if(typeof m.getRandomValues=="function")try{return m.getRandomValues(new Uint32Array(1))[0]}catch(c){}if(typeof m.randomBytes=="function")try{return m.randomBytes(4).readInt32LE()}catch(c){}}throw new Error("Native crypto module could not be used to get secure random number.")},E=Object.create||function(){function c(){}return function(u){var s;return c.prototype=u,s=new c,c.prototype=null,s}}(),y={},R=y.lib={},f=R.Base=function(){return{extend:function(c){var u=E(this);return c&&u.mixIn(c),(!u.hasOwnProperty("init")||this.init===u.init)&&(u.init=function(){u.$super.init.apply(this,arguments)}),u.init.prototype=u,u.$super=this,u},create:function(){var c=this.extend();return c.init.apply(c,arguments),c},init:function(){},mixIn:function(c){for(var u in c)c.hasOwnProperty(u)&&(this[u]=c[u]);c.hasOwnProperty("toString")&&(this.toString=c.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),b=R.WordArray=f.extend({init:function(c,u){c=this.words=c||[],u!=h?this.sigBytes=u:this.sigBytes=c.length*4},toString:function(c){return(c||x).stringify(this)},concat:function(c){var u=this.words,s=c.words,w=this.sigBytes,v=c.sigBytes;if(this.clamp(),w%4)for(var k=0;k<v;k++){var L=s[k>>>2]>>>24-k%4*8&255;u[w+k>>>2]|=L<<24-(w+k)%4*8}else for(var k=0;k<v;k+=4)u[w+k>>>2]=s[k>>>2];return this.sigBytes+=v,this},clamp:function(){var c=this.words,u=this.sigBytes;c[u>>>2]&=4294967295<<32-u%4*8,c.length=l.ceil(u/4)},clone:function(){var c=f.clone.call(this);return c.words=this.words.slice(0),c},random:function(c){for(var u=[],s=0;s<c;s+=4)u.push(S());return new b.init(u,c)}}),T=y.enc={},x=T.Hex={stringify:function(c){for(var u=c.words,s=c.sigBytes,w=[],v=0;v<s;v++){var k=u[v>>>2]>>>24-v%4*8&255;w.push((k>>>4).toString(16)),w.push((k&15).toString(16))}return w.join("")},parse:function(c){for(var u=c.length,s=[],w=0;w<u;w+=2)s[w>>>3]|=parseInt(c.substr(w,2),16)<<24-w%8*4;return new b.init(s,u/2)}},p=T.Latin1={stringify:function(c){for(var u=c.words,s=c.sigBytes,w=[],v=0;v<s;v++){var k=u[v>>>2]>>>24-v%4*8&255;w.push(String.fromCharCode(k))}return w.join("")},parse:function(c){for(var u=c.length,s=[],w=0;w<u;w++)s[w>>>2]|=(c.charCodeAt(w)&255)<<24-w%4*8;return new b.init(s,u)}},g=T.Utf8={stringify:function(c){try{return decodeURIComponent(escape(p.stringify(c)))}catch(u){throw new Error("Malformed UTF-8 data")}},parse:function(c){return p.parse(unescape(encodeURIComponent(c)))}},C=R.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new b.init,this._nDataBytes=0},_append:function(c){typeof c=="string"&&(c=g.parse(c)),this._data.concat(c),this._nDataBytes+=c.sigBytes},_process:function(c){var u,s=this._data,w=s.words,v=s.sigBytes,k=this.blockSize,L=k*4,N=v/L;c?N=l.ceil(N):N=l.max((N|0)-this._minBufferSize,0);var P=N*k,I=l.min(P*4,v);if(P){for(var M=0;M<P;M+=k)this._doProcessBlock(w,M);u=w.splice(0,P),s.sigBytes-=I}return new b.init(u,I)},clone:function(){var c=f.clone.call(this);return c._data=this._data.clone(),c},_minBufferSize:0});R.Hasher=C.extend({cfg:f.extend(),init:function(c){this.cfg=this.cfg.extend(c),this.reset()},reset:function(){C.reset.call(this),this._doReset()},update:function(c){return this._append(c),this._process(),this},finalize:function(c){c&&this._append(c);var u=this._doFinalize();return u},blockSize:16,_createHelper:function(c){return function(u,s){return new c.init(s).finalize(u)}},_createHmacHelper:function(c){return function(u,s){return new d.HMAC.init(c,s).finalize(u)}}});var d=y.algo={};return y}(Math);return a})}).call(this,i(13))},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(2)),h=o.__importDefault(i(3));function m(y,R,f){try{R.apply(y,f)}catch(b){l.default.logAction(l.default.LOG_ERROR,"EventEmitter.emit()","Unexpected listener exception: "+b+"; stack = "+(b&&b.stack))}}function S(y,R,f){for(var b,T,x,p=0;p<y.length;p++)if(b=y[p],f&&(b=b[f]),a.isArray(b)){for(;(T=a.arrIndexOf(b,R))!==-1;)b.splice(T,1);f&&b.length===0&&delete y[p][f]}else if(a.isObject(b))for(x in b)Object.prototype.hasOwnProperty.call(b,x)&&a.isArray(b[x])&&S([b],R,x)}var E=function(){function y(){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null)}return y.prototype.on=function(){for(var R=this,f=[],b=0;b<arguments.length;b++)f[b]=arguments[b];if(f.length===1){var T=f[0];if(typeof T=="function")this.any.push(T);else throw new Error("EventListener.on(): Invalid arguments: "+h.default.Config.inspect(f))}if(f.length===2){var x=f[0],p=f[1];if(typeof p!="function")throw new Error("EventListener.on(): Invalid arguments: "+h.default.Config.inspect(f));if(a.isEmptyArg(x))this.any.push(p);else if(a.isArray(x))x.forEach(function(C){R.on(C,p)});else{if(typeof x!="string")throw new Error("EventListener.on(): Invalid arguments: "+h.default.Config.inspect(f));var g=this.events[x]||(this.events[x]=[]);g.push(p)}}},y.prototype.off=function(){for(var R,f=this,b=[],T=0;T<arguments.length;T++)b[T]=arguments[T];if(b.length==0||a.isEmptyArg(b[0])&&a.isEmptyArg(b[1])){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null);return}var x=b[0],p=b[1],g=null,C=null;if(b.length===1||!p)typeof x=="function"?g=x:C=x;else{if(typeof p!="function")throw new Error("EventEmitter.off(): invalid arguments:"+h.default.Config.inspect(b));R=[x,p],C=R[0],g=R[1]}if(g&&a.isEmptyArg(C)){S([this.any,this.events,this.anyOnce,this.eventsOnce],g);return}if(a.isArray(C)){C.forEach(function(d){f.off(d,g)});return}if(typeof C!="string")throw new Error("EventEmitter.off(): invalid arguments:"+h.default.Config.inspect(b));g?S([this.events,this.eventsOnce],g,C):(delete this.events[C],delete this.eventsOnce[C])},y.prototype.listeners=function(R){if(R){var f=this.events[R]||[];return this.eventsOnce[R]&&Array.prototype.push.apply(f,this.eventsOnce[R]),f.length?f:null}return this.any.length?this.any:null},y.prototype.emit=function(R){for(var f=[],b=1;b<arguments.length;b++)f[b-1]=arguments[b];var T={event:R},x=[];this.anyOnce.length&&(Array.prototype.push.apply(x,this.anyOnce),this.anyOnce=[]),this.any.length&&Array.prototype.push.apply(x,this.any);var p=this.eventsOnce[R];p&&(Array.prototype.push.apply(x,p),delete this.eventsOnce[R]);var g=this.events[R];g&&Array.prototype.push.apply(x,g),a.arrForEach(x,function(C){m(T,C,f)})},y.prototype.once=function(){for(var R=this,f=[],b=0;b<arguments.length;b++)f[b]=arguments[b];var T=f.length;if((T===0||T===1&&typeof f[0]!="function")&&h.default.Config.Promise){var x=f[0];return new h.default.Config.Promise(function(u){R.once(x,u)})}var p=f[0],g=f[1];if(f.length===1&&typeof p=="function")this.anyOnce.push(p);else if(a.isEmptyArg(p)){if(typeof g!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+h.default.Config.inspect(f));this.anyOnce.push(g)}else if(a.isArray(p)){var C=this,d=function(){var u=Array.prototype.slice.call(arguments);if(a.arrForEach(p,function(s){C.off(s,d)}),typeof g!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+h.default.Config.inspect(f));g.apply(this,u)};a.arrForEach(p,function(u){C.on(u,d)})}else{if(typeof p!="string")throw new Error("EventEmitter.once(): Invalid arguments:"+h.default.Config.inspect(f));var c=this.eventsOnce[p]||(this.eventsOnce[p]=[]);if(g){if(typeof g!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+h.default.Config.inspect(f));c.push(g)}}},y.prototype.whenState=function(R,f,b){for(var T=this,x=[],p=3;p<arguments.length;p++)x[p-3]=arguments[p];var g={event:R};if(typeof R!="string"||typeof f!="string")throw"whenState requires a valid event String argument";if(typeof b!="function"&&h.default.Config.Promise)return new h.default.Config.Promise(function(C){y.prototype.whenState.apply(T,[R,f,C].concat(x))});R===f?m(g,b,x):this.once(R,b)},y}();r.default=E},function(n,r,i){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 o=i(0),a=o.__importDefault(i(3)),l=o.__importStar(i(1)),h=o.__importDefault(i(2)),m=o.__importDefault(i(4)),S=i(43),E="ably-js/"+S.version,y={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:S.version,protocolVersion:2,agent:E,getHost:R,getPort:f,getHttpScheme:b,environmentFallbackHosts:T,getFallbackHosts:x,getHosts:p,checkHost:g,objectifyOptions:u,normaliseOptions:s};function R(v,k,L){return L?k=k==v.restHost&&v.realtimeHost||k||v.realtimeHost:k=k||v.restHost,k}r.getHost=R;function f(v,k){return k||v.tls?v.tlsPort:v.port}r.getPort=f;function b(v){return v.tls?"https://":"http://"}r.getHttpScheme=b;function T(v){return[v+"-a-fallback.ably-realtime.com",v+"-b-fallback.ably-realtime.com",v+"-c-fallback.ably-realtime.com",v+"-d-fallback.ably-realtime.com",v+"-e-fallback.ably-realtime.com"]}r.environmentFallbackHosts=T;function x(v){var k=v.fallbackHosts,L=typeof v.httpMaxRetryCount!="undefined"?v.httpMaxRetryCount:y.httpMaxRetryCount;return k?l.arrChooseN(k,L):[]}r.getFallbackHosts=x;function p(v){return[v.restHost].concat(x(v))}r.getHosts=p;function g(v){if(typeof v!="string")throw new m.default("host must be a string; was a "+typeof v,4e4,400);if(!v.length)throw new m.default("host must not be zero-length",4e4,400)}function C(v,k,L){return v.realtimeHost?v.realtimeHost:v.restHost?(h.default.logAction(h.default.LOG_MINOR,"Defaults.normaliseOptions",'restHost is set to "'+v.restHost+'" but realtimeHost is not set, so setting realtimeHost to "'+v.restHost+'" too. If this is not what you want, please set realtimeHost explicitly.'),v.restHost):k?y.REALTIME_HOST:L+"-"+y.REALTIME_HOST}function d(v){var k={};for(var L in y.TIMEOUTS)k[L]=v[L]||y.TIMEOUTS[L];return k}function c(v){var k=y.agent;if(v.agents)for(var L in v.agents)k+=" "+L+"/"+v.agents[L];return k}r.getAgentString=c;function u(v){return typeof v=="string"?v.indexOf(":")==-1?{token:v}:{key:v}:v}r.objectifyOptions=u;function s(v){if(v.host&&(h.default.renamedClientOption("host","restHost"),v.restHost=v.host),v.wsHost&&(h.default.renamedClientOption("wsHost","realtimeHost"),v.realtimeHost=v.wsHost),v.queueEvents&&(h.default.renamedClientOption("queueEvents","queueMessages"),v.queueMessages=v.queueEvents),v.headers&&h.default.deprecated("the `headers` client option",""),v.fallbackHostsUseDefault){if(v.fallbackHosts){var k="fallbackHosts and fallbackHostsUseDefault cannot both be set";throw h.default.logAction(h.default.LOG_ERROR,"Defaults.normaliseOptions",k),new m.default(k,4e4,400)}if(v.port||v.tlsPort){var k="fallbackHostsUseDefault cannot be set when port or tlsPort are set";throw h.default.logAction(h.default.LOG_ERROR,"Defaults.normaliseOptions",k),new m.default(k,4e4,400)}v.environment?h.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."):h.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)."),v.fallbackHosts=y.FALLBACK_HOSTS}v.recover===!0&&(h.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); } }`"),v.recover=function(F,O){O(!0)}),typeof v.recover=="function"&&v.closeOnUnload===!0&&(h.default.logAction(h.default.LOG_ERROR,"Defaults.normaliseOptions","closeOnUnload was true and a session recovery function was set - these are mutually exclusive, so unsetting the latter"),v.recover=void 0),"closeOnUnload"in v||(v.closeOnUnload=!v.recover),v.transports&&l.arrIn(v.transports,"xhr")&&(h.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.'),l.arrDeleteValue(v.transports,"xhr"),v.transports.push("xhr_streaming")),"queueMessages"in v||(v.queueMessages=!0);var L=v.environment&&String(v.environment).toLowerCase()||y.ENVIRONMENT,N=!L||L==="production";!v.fallbackHosts&&!v.restHost&&!v.realtimeHost&&!v.port&&!v.tlsPort&&(v.fallbackHosts=N?y.FALLBACK_HOSTS:T(L));var P=v.restHost||(N?y.REST_HOST:L+"-"+y.REST_HOST),I=C(v,N,L);l.arrForEach((v.fallbackHosts||[]).concat(P,I),g),v.port=v.port||y.PORT,v.tlsPort=v.tlsPort||y.TLS_PORT,"tls"in v||(v.tls=!0);var M=d(v);if("useBinaryProtocol"in v?v.useBinaryProtocol=a.default.Config.supportsBinary&&v.useBinaryProtocol:v.useBinaryProtocol=a.default.Config.preferBinary,v.clientId){var A=v.headers=v.headers||{};A["X-Ably-ClientId"]=a.default.BufferUtils.base64Encode(a.default.BufferUtils.utf8Encode(v.clientId))}"idempotentRestPublishing"in v||(v.idempotentRestPublishing=!0),v.promises&&!a.default.Config.Promise&&(h.default.logAction(h.default.LOG_ERROR,"Defaults.normaliseOptions","{promises: true} was specified, but no Promise constructor found; disabling promises"),v.promises=!1);var j=null,U=v.connectivityCheckUrl;if(v.connectivityCheckUrl){var z=v.connectivityCheckUrl.split("?"),W=z[0],G=z[1];j=G?l.parseQueryString(G):{},W.indexOf("://")===-1&&(W="https://"+W),U=W}return o.__assign(o.__assign({},v),{useBinaryProtocol:"useBinaryProtocol"in v?a.default.Config.supportsBinary&&v.useBinaryProtocol:a.default.Config.preferBinary,realtimeHost:I,restHost:P,maxMessageSize:v.maxMessageSize||y.maxMessageSize,timeouts:M,connectivityCheckParams:j,connectivityCheckUrl:U})}r.normaliseOptions=s,r.default=y;function w(v){return Object.assign(y,v)}r.getDefaults=w},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(3)),l=o.__importDefault(i(2)),h=o.__importDefault(i(4)),m=o.__importStar(i(1));function S(f){return!f||!f.channelOptions?{channelOptions:f,plugins:{},baseEncodedPreviousPayload:void 0}:f}function E(f){if(f&&f.cipher){if(!a.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var b=a.default.Crypto.getCipher(f.cipher);return{cipher:b.cipherParams,channelCipher:b.cipher}}return f!=null?f:{}}function y(f){var b=0;return f.name&&(b+=f.name.length),f.clientId&&(b+=f.clientId.length),f.extras&&(b+=JSON.stringify(f.extras).length),f.data&&(b+=m.dataSizeBytes(f.data)),b}var R=function(){function f(){}return f.prototype.toJSON=function(){var b=this.encoding,T=this.data;return T&&a.default.BufferUtils.isBuffer(T)&&(arguments.length>0?(b=b?b+"/base64":"base64",T=a.default.BufferUtils.base64Encode(T)):T=a.default.BufferUtils.toBuffer(T)),{name:this.name,id:this.id,clientId:this.clientId,connectionId:this.connectionId,connectionKey:this.connectionKey,extras:this.extras,encoding:b,data:T}},f.prototype.toString=function(){var b="[Message";return this.name&&(b+="; name="+this.name),this.id&&(b+="; id="+this.id),this.timestamp&&(b+="; timestamp="+this.timestamp),this.clientId&&(b+="; clientId="+this.clientId),this.connectionId&&(b+="; connectionId="+this.connectionId),this.encoding&&(b+="; encoding="+this.encoding),this.extras&&(b+="; extras ="+JSON.stringify(this.extras)),this.data&&(typeof this.data=="string"?b+="; data="+this.data:a.default.BufferUtils.isBuffer(this.data)?b+="; data (buffer)="+a.default.BufferUtils.base64Encode(this.data):b+="; data (json)="+JSON.stringify(this.data)),this.extras&&(b+="; extras="+JSON.stringify(this.extras)),b+="]",b},f.encrypt=function(b,T,x){var p=b.data,g=b.encoding,C=T.channelCipher;g=g?g+"/":"",a.default.BufferUtils.isBuffer(p)||(p=a.default.BufferUtils.utf8Encode(String(p)),g=g+"utf-8/"),C.encrypt(p,function(d,c){if(d){x(d);return}b.data=c,b.encoding=g+"cipher+"+C.algorithm,x(null,b)})},f.encode=function(b,T,x){var p=b.data,g=typeof p=="string"||a.default.BufferUtils.isBuffer(p)||p===null||p===void 0;if(!g)if(m.isObject(p)||m.isArray(p))b.data=JSON.stringify(p),b.encoding=b.encoding?b.encoding+"/json":"json";else throw new h.default("Data type is unsupported",40013,400);T!=null&&T.cipher?f.encrypt(b,T,x):x(null,b)},f.encodeArray=function(b,T,x){for(var p=0,g=0;g<b.length;g++)f.encode(b[g],T,function(C){if(C){x(C);return}p++,p==b.length&&x(null,b)})},f.decode=function(b,T){var x=S(T),p=b.data,g=b.encoding;if(g){var C=g.split("/"),d=void 0,c=C.length,u=b.data,s="";try{for(;(d=c)>0;){var w=C[--c].match(/([-\w]+)(\+([\w-]+))?/);if(!w)break;switch(s=w[1],s){case"base64":u=a.default.BufferUtils.base64Decode(String(u)),d==C.length&&(p=u);continue;case"utf-8":u=a.default.BufferUtils.utf8Decode(u);continue;case"json":u=JSON.parse(u);continue;case"cipher":if(x.channelOptions!=null&&x.channelOptions.cipher&&x.channelOptions.channelCipher){var v=w[3],k=x.channelOptions.channelCipher;if(v!=k.algorithm)throw new Error("Unable to decrypt message with given cipher; incompatible cipher params");u=k.decrypt(u);continue}else throw new Error("Unable to decrypt message; not an encrypted channel");case"vcdiff":if(!x.plugins||!x.plugins.vcdiff)throw new h.default("Missing Vcdiff decoder (https://github.com/ably-forks/vcdiff-decoder)",40019,400);if(typeof Uint8Array=="undefined")throw new h.default("Delta decoding not supported on this browser (need ArrayBuffer & Uint8Array)",40020,400);try{var L=x.baseEncodedPreviousPayload;typeof L=="string"&&(L=a.default.BufferUtils.utf8Encode(L)),L=a.default.BufferUtils.toBuffer(L),u=a.default.BufferUtils.toBuffer(u),u=a.default.BufferUtils.typedArrayToBuffer(x.plugins.vcdiff.decode(u,L)),p=u}catch(P){throw new h.default("Vcdiff delta decode failed with "+P,40018,400)}continue;default:throw new Error("Unknown encoding")}}}catch(P){var N=P;throw new h.default("Error processing the "+s+" encoding, decoder returned ‘"+N.message+"’",N.code||40013,400)}finally{b.encoding=d<=0?null:C.slice(0,d).join("/"),b.data=u}}x.baseEncodedPreviousPayload=p},f.fromResponseBody=function(b,T,x){x&&(b=m.decodeBody(b,x));for(var p=0;p<b.length;p++){var g=b[p]=f.fromValues(b[p]);try{f.decode(g,T)}catch(C){l.default.logAction(l.default.LOG_ERROR,"Message.fromResponseBody()",C.toString())}}return b},f.fromValues=function(b){return Object.assign(new f,b)},f.fromValuesArray=function(b){for(var T=b.length,x=new Array(T),p=0;p<T;p++)x[p]=f.fromValues(b[p]);return x},f.fromEncoded=function(b,T){var x=f.fromValues(b),p=E(T!=null?T:null);try{f.decode(x,p)}catch(g){l.default.logAction(l.default.LOG_ERROR,"Message.fromEncoded()",g.toString())}return x},f.fromEncodedArray=function(b,T){return b.map(function(x){return f.fromEncoded(x,T)})},f.getMessagesSize=function(b){for(var T,x=0,p=0;p<b.length;p++)T=b[p],x+=T.size||(T.size=y(T));return x},f.serialize=m.encodeBody,f}();r.default=R},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(4)),h=o.__importDefault(i(9)),m=o.__importDefault(i(16)),S={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},E=[];Object.keys(S).forEach(function(x){E[S[x]]=x});var y={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},R=Object.keys(y);y.MODE_ALL=y.PRESENCE|y.PUBLISH|y.SUBSCRIBE|y.PRESENCE_SUBSCRIBE;function f(x){var p=[];if(x)for(var g=0;g<x.length;g++)p.push(x[g].toString());return"[ "+p.join(", ")+" ]"}var b="id channel channelSerial connectionId count msgSerial timestamp".split(" "),T=function(){function x(){var p=this;this.hasFlag=function(g){return(p.flags&y[g])>0}}return x.prototype.setFlag=function(p){return this.flags=this.flags|y[p]},x.prototype.getMode=function(){return this.flags&&this.flags&y.MODE_ALL},x.prototype.encodeModesToFlags=function(p){var g=this;p.forEach(function(C){return g.setFlag(C)})},x.prototype.decodeModesFromFlags=function(){var p=this,g=[];return x.channelModes.forEach(function(C){p.hasFlag(C)&&g.push(C)}),g.length>0?g:void 0},x.fromValues=function(p){return Object.assign(new x,p)},x.Action=S,x.channelModes=["PRESENCE","PUBLISH","SUBSCRIBE","PRESENCE_SUBSCRIBE"],x.ActionName=E,x.serialize=a.encodeBody,x.deserialize=function(p,g){var C=a.decodeBody(p,g);return x.fromDeserialized(C)},x.fromDeserialized=function(p){var g=p.error;g&&(p.error=l.default.fromValues(g));var C=p.messages;if(C)for(var d=0;d<C.length;d++)C[d]=h.default.fromValues(C[d]);var c=p.presence;if(c)for(var d=0;d<c.length;d++)c[d]=m.default.fromValues(c[d],!0);return Object.assign(new x,p)},x.stringify=function(p){var g="[ProtocolMessage";p.action!==void 0&&(g+="; action="+x.ActionName[p.action]||!1);for(var C,d=0;d<b.length;d++)C=b[d],p[C]!==void 0&&(g+="; "+C+"="+p[C]);if(p.messages&&(g+="; messages="+f(h.default.fromValuesArray(p.messages))),p.presence&&(g+="; presence="+f(m.default.fromValuesArray(p.presence))),p.error&&(g+="; error="+l.default.fromValues(p.error).toString()),p.auth&&p.auth.accessToken&&(g+="; token="+p.auth.accessToken),p.flags&&(g+="; flags="+R.filter(p.hasFlag).join(",")),p.params){var c="";a.forInOwnNonNullProperties(p.params,function(u){c.length>0&&(c+="; "),c+=u+"="+p.params[u]}),c.length>0&&(g+="; params=["+c+"]")}return g+="]",g},x}();r.default=T},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(){var a=o,l=a.lib,h=l.WordArray,m=a.enc;m.Base64={stringify:function(E){var y=E.words,R=E.sigBytes,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";E.clamp();for(var b=[],T=0;T<R;T+=3)for(var x=y[T>>>2]>>>24-T%4*8&255,p=y[T+1>>>2]>>>24-(T+1)%4*8&255,g=y[T+2>>>2]>>>24-(T+2)%4*8&255,C=x<<16|p<<8|g,d=0;d<4&&T+d*.75<R;d++)b.push(f.charAt(C>>>6*(3-d)&63));var c=f.charAt(64);if(c)for(;b.length%4;)b.push(c);return b.join("")},parse:function(E){var y=E.length,R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var b=0;b<R.length;b++)f[R.charCodeAt(b)]=b}var T=R.charAt(64);if(T){var x=E.indexOf(T);x!==-1&&(y=x)}return S(E,y,f)}};function S(E,y,R){for(var f=[],b=0,T=0;T<y;T++)if(T%4){var x=R[E.charCodeAt(T-1)]<<T%4*2,p=R[E.charCodeAt(T)]>>>6-T%4*2,g=x|p;f[b>>>2]|=g<<24-b%4*8,b++}return h.create(f,b)}}(),o.enc.Base64})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(10)),h=o.__importDefault(i(26)),m=o.__importDefault(i(2)),S=o.__importDefault(i(8)),E=o.__importDefault(i(21)),y=o.__importDefault(i(18)),R=o.__importDefault(i(4)),f=o.__importDefault(i(22)),b=o.__importDefault(i(3));function T(g){var C=[80015,80017,80030];return g.code?y.default.isTokenErr(g)?!1:a.arrIn(C,g.code)?!0:g.code>=4e4&&g.code<5e4:!1}function x(g){return T(g)?[l.default.fromValues({action:l.default.Action.ERROR,error:g})]:[l.default.fromValues({action:l.default.Action.DISCONNECTED,error:g})]}var p=function(g){o.__extends(C,g);function C(d,c,u){var s=g.call(this,d,c,u,!0)||this;return s.onAuthUpdated=function(w){s.authParams={access_token:w.token}},s.stream="stream"in u?u.stream:!0,s.sendRequest=null,s.recvRequest=null,s.pendingCallback=null,s.pendingItems=null,s}return C.prototype.connect=function(){var d=this;m.default.logAction(m.default.LOG_MINOR,"CometTransport.connect()","starting"),h.default.prototype.connect.call(this);var c=this.params,u=c.options,s=S.default.getHost(u,c.host),w=S.default.getPort(u),v=u.tls?"https://":"http://";this.baseUri=v+s+":"+w+"/comet/";var k=this.baseUri+"connect";m.default.logAction(m.default.LOG_MINOR,"CometTransport.connect()","uri: "+k),this.auth.getAuthParams(function(L,N){if(L){d.disconnect(L);return}if(!d.isDisposed){d.authParams=N;var P=d.params.getConnectParams(N);"stream"in P&&(d.stream=P.stream),m.default.logAction(m.default.LOG_MINOR,"CometTransport.connect()","connectParams:"+a.toQueryString(P));var I=!1,M=d.recvRequest=d.createRequest(k,null,P,null,d.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV);M.on("data",function(A){d.recvRequest&&(I||(I=!0,d.emit("preconnect")),d.onData(A))}),M.on("complete",function(A){if(d.recvRequest||(A=A||new R.default("Request cancelled",80003,400)),d.recvRequest=null,!I&&!A&&(I=!0,d.emit("preconnect")),d.onActivity(),A){A.code?d.onData(x(A)):d.disconnect(A);return}b.default.Config.nextTick(function(){d.recv()})}),M.exec()}})},C.prototype.requestClose=function(){m.default.logAction(m.default.LOG_MINOR,"CometTransport.requestClose()"),this._requestCloseOrDisconnect(!0)},C.prototype.requestDisconnect=function(){m.default.logAction(m.default.LOG_MINOR,"CometTransport.requestDisconnect()"),this._requestCloseOrDisconnect(!1)},C.prototype._requestCloseOrDisconnect=function(d){var c=this,u=d?this.closeUri:this.disconnectUri;if(u){var s=this.createRequest(u,null,this.authParams,null,f.default.REQ_SEND);s.on("complete",function(w){w&&(m.default.logAction(m.default.LOG_ERROR,"CometTransport.request"+(d?"Close()":"Disconnect()"),"request returned err = "+a.inspectError(w)),c.finish("disconnected",w))}),s.exec()}},C.prototype.dispose=function(){var d=this;m.default.logAction(m.default.LOG_MINOR,"CometTransport.dispose()",""),this.isDisposed||(this.isDisposed=!0,this.recvRequest&&(m.default.logAction(m.default.LOG_MINOR,"CometTransport.dispose()","aborting recv request"),this.recvRequest.abort(),this.recvRequest=null),this.finish("disconnected",E.default.disconnected()),b.default.Config.nextTick(function(){d.emit("disposed")}))},C.prototype.onConnect=function(d){var c;if(!this.isDisposed){var u=(c=d.connectionDetails)===null||c===void 0?void 0:c.connectionKey;h.default.prototype.onConnect.call(this,d);var s=this.baseUri+u;m.default.logAction(m.default.LOG_MICRO,"CometTransport.onConnect()","baseUri = "+s),this.sendUri=s+"/send",this.recvUri=s+"/recv",this.closeUri=s+"/close",this.disconnectUri=s+"/disconnect"}},C.prototype.send=function(d){if(this.sendRequest){this.pendingItems=this.pendingItems||[],this.pendingItems.push(d);return}var c=this.pendingItems||[];c.push(d),this.pendingItems=null,this.sendItems(c)},C.prototype.sendAnyPending=function(){var d=this.pendingItems;d&&(this.pendingItems=null,this.sendItems(d))},C.prototype.sendItems=function(d){var c=this,u=this.sendRequest=this.createRequest(this.sendUri,null,this.authParams,this.encodeRequest(d),f.default.REQ_SEND);u.on("complete",function(s,w){if(s&&m.default.logAction(m.default.LOG_ERROR,"CometTransport.sendItems()","on complete: err = "+a.inspectError(s)),c.sendRequest=null,s){s.code?c.onData(x(s)):c.disconnect(s);return}w&&c.onData(w),c.pendingItems&&b.default.Config.nextTick(function(){c.sendRequest||c.sendAnyPending()})}),u.exec()},C.prototype.recv=function(){var d=this;if(!this.recvRequest&&this.isConnected){var c=this.recvRequest=this.createRequest(this.recvUri,null,this.authParams,null,this.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV_POLL);c.on("data",function(u){d.onData(u)}),c.on("complete",function(u){if(d.recvRequest=null,d.onActivity(),u){u.code?d.onData(x(u)):d.disconnect(u);return}b.default.Config.nextTick(function(){d.recv()})}),c.exec()}},C.prototype.onData=function(d){try{var c=this.decodeResponse(d);if(c&&c.length)for(var u=0;u<c.length;u++)this.onProtocolMessage(l.default.fromDeserialized(c[u]))}catch(s){m.default.logAction(m.default.LOG_ERROR,"CometTransport.onData()","Unexpected exception handing channel event: "+s.stack)}},C.prototype.encodeRequest=function(d){return JSON.stringify(d)},C.prototype.decodeResponse=function(d){return typeof d=="string"?JSON.parse(d):d},C}(h.default);r.default=p},function(n,r){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(o){typeof window=="object"&&(i=window)}n.exports=i},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.isSuccessCode=void 0;var o;(function(l){l[l.Success=200]="Success",l[l.NoContent=204]="NoContent",l[l.BadRequest=400]="BadRequest",l[l.Unauthorized=401]="Unauthorized",l[l.Forbidden=403]="Forbidden",l[l.RequestTimeout=408]="RequestTimeout",l[l.InternalServerError=500]="InternalServerError"})(o||(o={}));function a(l){return l>=o.Success&&l<o.BadRequest}r.isSuccessCode=a,r.default=o},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(3)),l=o.__importStar(i(1)),h=o.__importDefault(i(2)),m=o.__importDefault(i(18)),S=o.__importDefault(i(19)),E=i(4),y=o.__importDefault(i(14));function R(g,C,d,c,u){g.http.supportsAuthHeaders?g.auth.getAuthHeaders(function(s,w){s?c(s):u(l.mixin(w,C),d)}):g.auth.getAuthParams(function(s,w){s?c(s):u(C,l.mixin(w,d))})}function f(g,C){return function(d,c,u,s,w){if(d&&!c){g(d);return}if(w===y.default.NoContent){g(d,[],u,!0,w);return}if(!s)try{c=l.decodeBody(c,C)}catch(I){l.isErrorInfoOrPartialErrorInfo(I)?g(I):g(new E.PartialErrorInfo(l.inspectError(I),null));return}if(!c){g(new E.PartialErrorInfo("unenvelope(): Response body is missing",null));return}var v=c,k=v.statusCode,L=v.response,N=v.headers;if(k===void 0){g(d,c,u,!0,w);return}if(k<200||k>=300){var P=L&&L.error||d;P||(P=new Error("Error in unenveloping "+c),P.statusCode=k),g(P,L,N,!0,k);return}g(d,L,N,!0,k)}}function b(g){var C=[];if(g)for(var d in g)C.push(d+"="+g[d]);return C.join("&")}function T(g,C){return g+(C?"?":"")+b(C)}function x(g,C,d,c){return function(u,s,w,v,k){u?h.default.logAction(h.default.LOG_MICRO,"Resource."+C+"()","Received Error; "+T(d,c)+"; Error: "+l.inspectError(u)):h.default.logAction(h.default.LOG_MICRO,"Resource."+C+"()","Received; "+T(d,c)+"; Headers: "+b(w)+"; StatusCode: "+k+"; Body: "+(a.default.BufferUtils.isBuffer(s)?s.toString():s)),g&&g(u,s,w,v,k)}}var p=function(){function g(){}return g.get=function(C,d,c,u,s,w){g.do(S.default.Get,C,d,null,c,u,s,w)},g.delete=function(C,d,c,u,s,w){g.do(S.default.Delete,C,d,null,c,u,s,w)},g.post=function(C,d,c,u,s,w,v){g.do(S.default.Post,C,d,c,u,s,w,v)},g.patch=function(C,d,c,u,s,w,v){g.do(S.default.Patch,C,d,c,u,s,w,v)},g.put=function(C,d,c,u,s,w,v){g.do(S.default.Put,C,d,c,u,s,w,v)},g.do=function(C,d,c,u,s,w,v,k){h.default.shouldLog(h.default.LOG_MICRO)&&(k=x(k,C,c,w)),v&&(k=k&&f(k,v),(w=w||{}).envelope=v);function L(N,P){var I;if(h.default.shouldLog(h.default.LOG_MICRO)&&h.default.logAction(h.default.LOG_MICRO,"Resource."+C+"()","Sending; "+T(c,P)),h.default.shouldLog(h.default.LOG_MICRO)){var M=u;if(((I=N["content-type"])===null||I===void 0?void 0:I.indexOf("msgpack"))>0)try{M=a.default.Config.msgpack.decode(u)}catch(A){h.default.logAction(h.default.LOG_MICRO,"Resource."+C+"()","Sending MsgPack Decoding Error: "+l.inspectError(A))}h.default.logAction(h.default.LOG_MICRO,"Resource."+C+"()","Sending; "+T(c,P)+"; Body: "+M)}d.http.do(C,d,c,N,u,P,function(A,j,U,z,W){if(A&&m.default.isTokenErr(A)){d.auth.authorize(null,null,function(G){if(G){k(G);return}R(d,N,P,k,L)});return}k(A,j,U,z,W)})}R(d,s,w,k,L)},g}();r.default=p},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(2)),l=o.__importDefault(i(3)),h=o.__importDefault(i(9)),m=o.__importStar(i(1));function S(y){return E.Actions.indexOf(y)}var E=function(){function y(){}return y.prototype.isSynthesized=function(){return!this.id||!this.connectionId?!0:this.id.substring(this.connectionId.length,0)!==this.connectionId},y.prototype.parseId=function(){if(!this.id)throw new Error("parseId(): Presence message does not contain an id");var R=this.id.split(":");return{connectionId:R[0],msgSerial:parseInt(R[1],10),index:parseInt(R[2],10)}},y.prototype.toJSON=function(){var R=this.data,f=this.encoding;return R&&l.default.BufferUtils.isBuffer(R)&&(arguments.length>0?(f=f?f+"/base64":"base64",R=l.default.BufferUtils.base64Encode(R)):R=l.default.BufferUtils.toBuffer(R)),{id:this.id,clientId:this.clientId,action:S(this.action),data:R,encoding:f,extras:this.extras}},y.prototype.toString=function(){var R="[PresenceMessage";return R+="; action="+this.action,this.id&&(R+="; id="+this.id),this.timestamp&&(R+="; timestamp="+this.timestamp),this.clientId&&(R+="; clientId="+this.clientId),this.connectionId&&(R+="; connectionId="+this.connectionId),this.encoding&&(R+="; encoding="+this.encoding),this.data&&(typeof this.data=="string"?R+="; data="+this.data:l.default.BufferUtils.isBuffer(this.data)?R+="; data (buffer)="+l.default.BufferUtils.base64Encode(this.data):R+="; data (json)="+JSON.stringify(this.data)),this.extras&&(R+="; extras="+JSON.stringify(this.extras)),R+="]",R},y.fromResponseBody=function(R,f,b){var T=[];b&&(R=m.decodeBody(R,b));for(var x=0;x<R.length;x++){var p=T[x]=y.fromValues(R[x],!0);try{y.decode(p,f)}catch(g){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromResponseBody()",g.toString())}}return T},y.fromValues=function(R,f){return f&&(R.action=y.Actions[R.action]),Object.assign(new y,R)},y.fromValuesArray=function(R){for(var f=R.length,b=new Array(f),T=0;T<f;T++)b[T]=y.fromValues(R[T]);return b},y.fromEncoded=function(R,f){var b=y.fromValues(R,!0);try{y.decode(b,f!=null?f:{})}catch(T){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromEncoded()",T.toString())}return b},y.fromEncodedArray=function(R,f){return R.map(function(b){return y.fromEncoded(b,f)})},y.fromData=function(R){return R instanceof y?R:y.fromValues({data:R})},y.Actions=["absent","present","enter","leave","update"],y.encode=h.default.encode,y.decode=h.default.decode,y.getMessagesSize=h.default.getMessagesSize,y}();r.default=E},function(n,r,i){(function(o){Object.defineProperty(r,"__esModule",{value:!0});var a=i(0),l=a.__importStar(i(1)),h=a.__importDefault(i(7)),m=a.__importStar(i(4)),S=a.__importDefault(i(2)),E=a.__importDefault(i(8)),y=a.__importDefault(i(22)),R=a.__importDefault(i(3));function f(v,k){return l.arrIn(l.allToLowerCase(l.keysArray(k)),"x-ably-errorcode")}function b(v,k){if(f(v,k))return v.error&&m.default.fromValues(v.error)}var T=function(){},x=0,p={},g=typeof o!="undefined"&&o.XDomainRequest;function C(){var v=navigator.userAgent.toString().match(/MSIE\s([\d.]+)/);return v&&Number(v[1])}function d(){var v;return g&&(v=C())&&v===10}function c(v,k){return v.getResponseHeader&&v.getResponseHeader(k)}function u(v){return v.getResponseHeader&&(v.getResponseHeader("transfer-encoding")||!v.getResponseHeader("content-length"))}function s(v){for(var k=l.trim(v.getAllResponseHeaders()).split(`\r
|
|
138
|
+
`),L={},N=0;N<k.length;N++){var P=k[N].split(":").map(l.trim);L[P[0].toLowerCase()]=P[1]}return L}var w=function(v){a.__extends(k,v);function k(L,N,P,I,M,A,j){var U=v.call(this)||this;return P=P||{},P.rnd=l.cheapRandStr(),d()&&!P.envelope&&(P.envelope="json"),U.uri=L+l.toQueryString(P),U.headers=N||{},U.body=I,U.method=j?j.toUpperCase():l.isEmptyArg(I)?"GET":"POST",U.requestMode=M,U.timeouts=A,U.timedOut=!1,U.requestComplete=!1,U.id=String(++x),p[U.id]=U,U}return k.createRequest=function(L,N,P,I,M,A,j){var U=A||E.default.TIMEOUTS;return new k(L,N,l.copy(P),I,M,U,j)},k.prototype.complete=function(L,N,P,I,M){this.requestComplete||(this.requestComplete=!0,!L&&N&&this.emit("data",N),this.emit("complete",L,N,P,I,M),this.dispose())},k.prototype.abort=function(){this.dispose()},k.prototype.exec=function(){var L=this,N=this.headers,P=this.requestMode==y.default.REQ_SEND?this.timeouts.httpRequestTimeout:this.timeouts.recvTimeout,I=this.timer=setTimeout(function(){L.timedOut=!0,A.abort()},P),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,ye,De,$e){var Ae,zt=ye+" (event type: "+Z.type+")";!((Ae=L==null?void 0:L.xhr)===null||Ae===void 0)&&Ae.statusText&&(zt+=", current statusText is "+L.xhr.statusText),S.default.logAction(S.default.LOG_ERROR,"Request.on"+Z.type+"()",zt),L.complete(new m.PartialErrorInfo(zt,De,$e))};A.onerror=function(Z){F(Z,"XHR error occurred",null,400)},A.onabort=function(Z){L.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 O,D,B,_=0,$=!1,X=function(){if(clearTimeout(I),B=D<400,D==204){L.complete(null,null,null,null,D);return}O=L.requestMode==y.default.REQ_RECV_STREAM&&B&&u(A)},Y=function(){var Z;try{var ye=c(A,"content-type"),De=ye?ye.indexOf("application/json")>=0:A.responseType=="text";if(De){var $e=A.responseType==="arraybuffer"?R.default.BufferUtils.utf8Decode(A.response):String(A.responseText);$e.length?Z=JSON.parse($e):Z=$e,$=!0}else Z=A.response;Z.response!==void 0?(D=Z.statusCode,B=D<400,N=Z.headers,Z=Z.response):N=s(A)}catch(zt){L.complete(new m.PartialErrorInfo("Malformed response body from server: "+zt.message,null,400));return}if(B||l.isArray(Z)){L.complete(null,Z,N,$,D);return}var Ae=b(Z,N);Ae||(Ae=new m.PartialErrorInfo("Error response received from server: "+D+" body was: "+R.default.Config.inspect(Z),null,D)),L.complete(Ae,Z,N,$,D)};function te(){for(var Z=A.responseText,ye=Z.length-1,De,$e;_<ye&&(De=Z.indexOf(`
|
|
139
|
+
`,_))>-1;)$e=Z.slice(_,De),_=De+1,re($e)}var re=function(Z){try{Z=JSON.parse(Z)}catch(ye){L.complete(new m.PartialErrorInfo("Malformed response body from server: "+ye.message,null,400));return}L.emit("data",Z)},ce=function(){te(),L.streamComplete=!0,R.default.Config.nextTick(function(){L.complete()})};A.onreadystatechange=function(){var Z=A.readyState;Z<3||A.status!==0&&(D===void 0&&(D=A.status,D===1223&&(D=204),X()),Z==3&&O?te():Z==4&&(O?ce():Y()))},A.send(U)},k.prototype.dispose=function(){var L=this.xhr;if(L){L.onreadystatechange=L.onerror=L.onabort=L.ontimeout=T,this.xhr=null;var N=this.timer;N&&(clearTimeout(N),this.timer=null),this.requestComplete||L.abort()}delete p[this.id]},k}(h.default);r.default=w}).call(this,i(13))},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(2)),l=o.__importStar(i(1)),h=o.__importDefault(i(24)),m=o.__importDefault(i(4)),S=o.__importDefault(i(45)),E=i(11),y=o.__importDefault(i(19)),R=o.__importDefault(i(14)),f=o.__importDefault(i(3)),b=o.__importDefault(i(15)),T=Math.pow(2,17);function x(){}function p(){return("000000"+Math.floor(Math.random()*1e16)).slice(-16)}function g(P){return!!P.connection}function C(P){return l.isErrorInfoOrPartialErrorInfo(P)?(P.code||(P.statusCode===403?P.code=40300:(P.code=40170,P.statusCode=401)),P):new m.default(l.inspectError(P),P.code||40170,P.statusCode||401)}var d=function(P,I){if(f.default.Config.createHmac){var M=f.default.Config.createHmac("SHA256",I);return M.update(P),M.digest("base64")}return(0,E.stringify)((0,S.default)(P,I))};function c(P){if(!P)return"";typeof P=="string"&&(P=JSON.parse(P));var I=Object.create(null),M=l.keysArray(P,!0);if(!M)return"";M.sort();for(var A=0;A<M.length;A++)I[M[A]]=P[M[A]].sort();return JSON.stringify(I)}function u(P){if(P.authCallback)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with authCallback");else if(P.authUrl)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with authUrl");else if(P.key)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with client-side signing");else if(P.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(P){return"useTokenAuth"in P&&!P.useTokenAuth}function w(P){return P.useTokenAuth||!s(P)&&(P.authCallback||P.authUrl||P.token||P.tokenDetails)}function v(P){return!P.key&&!P.authCallback&&!P.authUrl}var k=0;function L(){return k++}var N=function(){function P(I,M){if(this.authOptions={},this.client=I,this.tokenParams=M.defaultTokenParams||{},this.currentTokenRequestId=null,this.waitingForTokenRequest=null,w(M)){if(M.key&&!d){var A="client-side token request signing not supported";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",A),new Error(A)}v(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),u(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 m.default(A,40160,401)}a.default.logAction(a.default.LOG_MINOR,"Auth()","anonymous, using basic auth"),this._saveBasicOptions(M)}}return P.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 l.promisify(this,"authorize",arguments);if(U&&U.key&&this.authOptions.key!==U.key)throw new m.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."),l.isOnlyPropIn(U,"force")&&(U=null)),this._forceNewToken(I,U,function(z,W){if(z){j.client.connection&&z.statusCode===R.default.Forbidden&&j.client.connection.connectionManager.actOnErrorFromAuthorize(z),A==null||A(z);return}g(j.client)?j.client.connection.connectionManager.onAuthUpdated(W,A||x):A==null||A(null,W)})},P.prototype.authorise=function(I,M,A){a.default.renamedMethod("Auth","authorise","authorize"),this.authorize(I,M,A)},P.prototype._forceNewToken=function(I,M,A){var j=this;this.tokenDetails=null,this._saveTokenOptions(I,M),u(this.authOptions),this._ensureValidAuthCredentials(!0,function(U,z){delete j.tokenParams.timestamp,delete j.authOptions.queryTime,A(U,z)})},P.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 l.promisify(this,"requestToken",arguments);M=M||this.authOptions,I=I||l.copy(this.tokenParams);var U=A||x,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(_,$){var X=l.mixin({accept:"application/json, text/plain"},M.authHeaders),Y=M.authMethod&&M.authMethod.toLowerCase()==="post",te,re=M.authUrl.indexOf("?");re>-1&&(te=l.parseQueryString(M.authUrl.slice(re)),M.authUrl=M.authUrl.slice(0,re),Y||(M.authParams=l.mixin(te,M.authParams)));var ce=l.mixin({},M.authParams||{},_),Z=function($e,Ae,zt,Co){var xt;if($e?a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Received Error: "+l.inspectError($e)):(xt=zt["content-type"],a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Received; content-type: "+xt+"; body: "+l.inspectBody(Ae))),$e||Co)return $($e,Ae);if(f.default.BufferUtils.isBuffer(Ae)&&(Ae=Ae.toString()),!xt){$(new m.default("authUrl response is missing a content-type header",40170,401));return}var bo=xt.indexOf("application/json")>-1,el=xt.indexOf("text/plain")>-1||xt.indexOf("application/jwt")>-1;if(!bo&&!el){$(new m.default("authUrl responded with unacceptable content-type "+xt+", should be either text/plain, application/jwt or application/json",40170,401));return}if(bo){if(Ae.length>T){$(new m.default("authUrl response exceeded max permitted length",40170,401));return}try{Ae=JSON.parse(Ae)}catch(tl){$(new m.default("Unexpected error processing authURL response; err = "+tl.message,40170,401));return}}$(null,Ae,xt)};if(a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Requesting token from "+M.authUrl+"; Params: "+JSON.stringify(ce)+"; method: "+(Y?"POST":"GET")),Y){var ye=X||{};ye["content-type"]="application/x-www-form-urlencoded";var De=l.toQueryString(ce).slice(1);j.client.http.doUri(y.default.Post,W,M.authUrl,ye,De,te,Z)}else j.client.http.doUri(y.default.Get,W,M.authUrl,X||{},null,ce,Z)};else if(M.key)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with client-side signing"),z=function(_,$){j.createTokenRequest(_,M,$)};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 m.default(G,40171,403));return}"capability"in I&&(I.capability=c(I.capability));var F=function(_,$){var X=_.keyName,Y="/keys/"+X+"/requestToken",te=function(ce){return W.baseUri(ce)+Y},re=l.defaultPostHeaders(j.client.options);M.requestHeaders&&l.mixin(re,M.requestHeaders),a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().requestToken","Sending POST to "+Y+"; Token params: "+JSON.stringify(_)),j.client.http.do(y.default.Post,W,te,re,JSON.stringify(_),null,$)},O=!1,D=this.client.options.timeouts.realtimeRequestTimeout,B=setTimeout(function(){O=!0;var _="Token request callback timed out after "+D/1e3+" seconds";a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",_),U(new m.default(_,40170,401))},D);z(I,function(_,$,X){if(!O){if(clearTimeout(B),_){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request signing call returned error; err = "+l.inspectError(_)),U(C(_));return}if(typeof $=="string"){$.length===0?U(new m.default("Token string is empty",40170,401)):$.length>T?U(new m.default("Token string exceeded max permitted length (was "+$.length+" bytes)",40170,401)):$==="undefined"||$==="null"?U(new m.default("Token string was literal null/undefined",40170,401)):$[0]==="{"&&!(X&&X.indexOf("application/jwt")>-1)?U(new m.default("Token was double-encoded; make sure you're not JSON-encoding an already encoded token request or details",40170,401)):U(null,{token:$});return}if(typeof $!="object"){var Y="Expected token request callback to call back with a token string or token request/details object, but got a "+typeof $;a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",Y),U(new m.default(Y,40170,401));return}var te=JSON.stringify($).length;if(te>T&&!M.suppressMaxLengthCheck){U(new m.default("Token request/details object exceeded max permitted stringified size (was "+te+" bytes)",40170,401));return}if("issued"in $){U(null,$);return}if(!("keyName"in $)){var Y="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()",Y),U(new m.default(Y,40170,401));return}F($,function(re,ce,Z,ye){if(re){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request API call returned error; err = "+l.inspectError(re)),U(C(re));return}ye||(ce=JSON.parse(ce)),a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","token received"),U(null,ce)})}})},P.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 l.promisify(this,"createTokenRequest",arguments);M=M||this.authOptions,I=I||l.copy(this.tokenParams);var U=M.key;if(!U){A(new m.default("No key specified",40101,403));return}var z=U.split(":"),W=z[0],G=z[1];if(!G){A(new m.default("Invalid key specified",40101,403));return}if(I.clientId===""){A(new m.default("clientId can’t be an empty string",40012,400));return}"capability"in I&&(I.capability=c(I.capability));var F=l.mixin({keyName:W},I),O=I.clientId||"",D=I.ttl||"",B=I.capability||"";(function(_){if(F.timestamp){_();return}j.getTimestamp(M&&M.queryTime,function($,X){if($){A($);return}F.timestamp=X,_()})})(function(){var _=F.nonce||(F.nonce=p()),$=F.timestamp,X=F.keyName+`
|
|
140
|
+
`+D+`
|
|
86
141
|
`+B+`
|
|
87
|
-
`+
|
|
88
|
-
|
|
142
|
+
`+O+`
|
|
143
|
+
`+$+`
|
|
89
144
|
`+_+`
|
|
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?
|
|
145
|
+
`;F.mac=F.mac||d(X,G),a.default.logAction(a.default.LOG_MINOR,"Auth.getTokenRequest()","generated signed request"),A(null,F)})},P.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})})},P.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 "+l.toBase64(A.token)})})},P.prototype.getTimestamp=function(I,M){!this.isTimeOffsetSet()&&(I||this.authOptions.queryTime)?this.client.time(M):M(null,this.getTimestampUsingOffset())},P.prototype.getTimestampUsingOffset=function(){return l.now()+(this.client.serverTimeOffset||0)},P.prototype.isTimeOffsetSet=function(){return this.client.serverTimeOffset!==null},P.prototype._saveBasicOptions=function(I){this.method="basic",this.key=I.key,this.basicKey=l.toBase64(I.key),this.authOptions=I||{},"clientId"in I&&this._userSetClientId(I.clientId)},P.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)},P.prototype._ensureValidAuthCredentials=function(I,M){var A=this,j=this.tokenDetails;if(j){if(this._tokenClientIdMismatch(j.clientId)){M(new m.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=h.default.create())).push(M),!(this.currentTokenRequestId!==null&&!I)){var U=this.currentTokenRequestId=L();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||x;if(A.waitingForTokenRequest=null,z){G(z);return}G(null,A.tokenDetails=W)})}},P.prototype._userSetClientId=function(I){if(typeof I=="string"||I===null){if(I==="*")throw new m.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 m.default("clientId must be either a string or null",40012,400)},P.prototype._uncheckedSetClientId=function(I){if(this._tokenClientIdMismatch(I)){var M="Unexpected clientId mismatch: client has "+this.clientId+", requested "+I,A=new m.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},P.prototype._tokenClientIdMismatch=function(I){return!!(this.clientId&&this.clientId!=="*"&&I&&I!=="*"&&this.clientId!==I)},P.isTokenErr=function(I){return I.code&&I.code>=40140&&I.code<40150},P.prototype.revokeTokens=function(I,M,A){if(w(this.client.options))throw new m.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 l.promisify(this,"revokeTokens",[I,U]);A=x}var z=A,W=o.__assign({targets:I.map(function(D){return"".concat(D.type,":").concat(D.value)})},U),G=this.client.options.useBinaryProtocol?l.Format.msgpack:l.Format.json,F=l.defaultPostHeaders(this.client.options,G);this.client.options.headers&&l.mixin(F,this.client.options.headers);var O=l.encodeBody(W,G);b.default.post(this.client,"/keys/".concat(j,"/revokeTokens"),O,F,{newBatchResponse:"true"},null,function(D,B,_,$){if(D){z(D);return}var X=$?B:l.decodeBody(B,G);z(null,X)})},P}();r.default=N},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o;(function(a){a.Get="get",a.Delete="delete",a.Post="post",a.Put="put",a.Patch="patch"})(o||(o={})),r.default=o},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.HttpPaginatedResponse=r.PaginatedResult=void 0;var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(2)),h=o.__importDefault(i(15)),m=o.__importDefault(i(14));function S(T){var x=T.match(/^\.\/(\w+)\?(.*)$/);return x&&x[2]&&a.parseQueryString(x[2])}function E(T){typeof T=="string"&&(T=T.split(","));for(var x={},p=0;p<T.length;p++){var g=T[p].match(/^\s*<(.+)>;\s*rel="(\w+)"$/);if(g){var C=S(g[1]);C&&(x[g[2]]=C)}}return x}function y(T,x,p){return!(p&&(x||typeof T.code=="number"))}var R=function(){function T(x,p,g,C,d,c){this.rest=x,this.path=p,this.headers=g,this.envelope=C!=null?C:null,this.bodyHandler=d,this.useHttpPaginatedResponse=c||!1}return T.prototype.get=function(x,p){var g=this;h.default.get(this.rest,this.path,this.headers,x,this.envelope,function(C,d,c,u,s){g.handlePage(C,d,c,u,s,p)})},T.prototype.delete=function(x,p){var g=this;h.default.delete(this.rest,this.path,this.headers,x,this.envelope,function(C,d,c,u,s){g.handlePage(C,d,c,u,s,p)})},T.prototype.post=function(x,p,g){var C=this;h.default.post(this.rest,this.path,p,this.headers,x,this.envelope,function(d,c,u,s,w){g&&C.handlePage(d,c,u,s,w,g)})},T.prototype.put=function(x,p,g){var C=this;h.default.put(this.rest,this.path,p,this.headers,x,this.envelope,function(d,c,u,s,w){g&&C.handlePage(d,c,u,s,w,g)})},T.prototype.patch=function(x,p,g){var C=this;h.default.patch(this.rest,this.path,p,this.headers,x,this.envelope,function(d,c,u,s,w){g&&C.handlePage(d,c,u,s,w,g)})},T.prototype.handlePage=function(x,p,g,C,d,c){if(x&&y(x,p,this.useHttpPaginatedResponse)){l.default.logAction(l.default.LOG_ERROR,"PaginatedResource.handlePage()","Unexpected error getting resource: err = "+a.inspectError(x)),c==null||c(x);return}var u,s,w;try{u=d==m.default.NoContent?[]:this.bodyHandler(p,g||{},C)}catch(v){c==null||c(x||v);return}g&&(s=g.Link||g.link)&&(w=E(s)),this.useHttpPaginatedResponse?c(null,new b(this,u,g||{},d,w,x)):c(null,new f(this,u,w))},T}(),f=function(){function T(x,p,g){var C=this;this.resource=x,this.items=p;var d=this;g&&("first"in g&&(this.first=function(c){if(!c&&d.resource.rest.options.promises)return a.promisify(d,"first",[]);d.get(g.first,c)}),"current"in g&&(this.current=function(c){if(!c&&d.resource.rest.options.promises)return a.promisify(d,"current",[]);d.get(g.current,c)}),this.next=function(c){if(!c&&d.resource.rest.options.promises)return a.promisify(d,"next",[]);"next"in g?d.get(g.next,c):c(null,null)},this.hasNext=function(){return"next"in g},this.isLast=function(){var c;return!(!((c=C.hasNext)===null||c===void 0)&&c.call(C))})}return T.prototype.get=function(x,p){var g=this.resource;h.default.get(g.rest,g.path,g.headers,x,g.envelope,function(C,d,c,u,s){g.handlePage(C,d,c,u,s,p)})},T}();r.PaginatedResult=f;var b=function(T){o.__extends(x,T);function x(p,g,C,d,c,u){var s=T.call(this,p,g,c)||this;return s.statusCode=d,s.success=d<300&&d>=200,s.headers=C,s.errorCode=u&&u.code,s.errorMessage=u&&u.message,s}return x.prototype.toJSON=function(){return{items:this.items,statusCode:this.statusCode,success:this.success,headers:this.headers,errorCode:this.errorCode,errorMessage:this.errorMessage}},x}(f);r.HttpPaginatedResponse=b,r.default=R},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.isRetriable=void 0;var o=i(0),a=o.__importDefault(i(4)),l={DISCONNECTED:80003,SUSPENDED:80002,FAILED:8e4,CLOSING:80017,CLOSED:80017,UNKNOWN_CONNECTION_ERR:50002,UNKNOWN_CHANNEL_ERR:50001},h={disconnected:function(){return a.default.fromValues({statusCode:400,code:l.DISCONNECTED,message:"Connection to server temporarily unavailable"})},suspended:function(){return a.default.fromValues({statusCode:400,code:l.SUSPENDED,message:"Connection to server unavailable"})},failed:function(){return a.default.fromValues({statusCode:400,code:l.FAILED,message:"Connection failed or disconnected by server"})},closing:function(){return a.default.fromValues({statusCode:400,code:l.CLOSING,message:"Connection closing"})},closed:function(){return a.default.fromValues({statusCode:400,code:l.CLOSED,message:"Connection closed"})},unknownConnectionErr:function(){return a.default.fromValues({statusCode:500,code:l.UNKNOWN_CONNECTION_ERR,message:"Internal connection error"})},unknownChannelErr:function(){return a.default.fromValues({statusCode:500,code:l.UNKNOWN_CONNECTION_ERR,message:"Internal channel error"})}};function m(S){return!S.statusCode||!S.code||S.statusCode>=500?!0:Object.values(l).includes(S.code)}r.isRetriable=m,r.default=h},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o;(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"})(o||(o={})),r.default=o},function(n,r,i){(function(o,a){n.exports=a(i(6),i(5),i(58),i(11),i(40),i(32),i(25),i(27),i(28),i(59),i(60))})(this,function(o){return o})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(2)),l=function(){function h(m){this.members=m||[]}return h.prototype.call=function(){for(var m=[],S=0;S<arguments.length;S++)m[S]=arguments[S];for(var E=0,y=this.members;E<y.length;E++){var R=y[E];if(R)try{R.apply(void 0,m)}catch(f){a.default.logAction(a.default.LOG_ERROR,"Multicaster multiple callback handler","Unexpected exception: "+f+"; stack = "+f.stack)}}},h.prototype.push=function(){for(var m,S=[],E=0;E<arguments.length;E++)S[E]=arguments[E];(m=this.members).push.apply(m,S)},h.create=function(m){var S=new h(m);return Object.assign(function(){for(var E=[],y=0;y<arguments.length;y++)E[y]=arguments[y];return S.call.apply(S,E)},{push:function(E){return S.push(E)}})},h}();r.default=l},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){(function(){var a=o,l=a.lib,h=l.Base,m=a.enc,S=m.Utf8,E=a.algo;E.HMAC=h.extend({init:function(y,R){y=this._hasher=new y.init,typeof R=="string"&&(R=S.parse(R));var f=y.blockSize,b=f*4;R.sigBytes>b&&(R=y.finalize(R)),R.clamp();for(var T=this._oKey=R.clone(),x=this._iKey=R.clone(),p=T.words,g=x.words,C=0;C<f;C++)p[C]^=1549556828,g[C]^=909522486;T.sigBytes=x.sigBytes=b,this.reset()},reset:function(){var y=this._hasher;y.reset(),y.update(this._iKey)},update:function(y){return this._hasher.update(y),this},finalize:function(y){var R=this._hasher,f=R.finalize(y);R.reset();var b=R.finalize(this._oKey.clone().concat(f));return b}})})()})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(10)),l=o.__importStar(i(1)),h=o.__importDefault(i(7)),m=o.__importDefault(i(2)),S=o.__importDefault(i(21)),E=o.__importDefault(i(4)),y=o.__importDefault(i(3)),R=a.default.Action,f=a.default.fromValues({action:R.CLOSE}),b=a.default.fromValues({action:R.DISCONNECT}),T=function(x){o.__extends(p,x);function p(g,C,d,c){var u=x.call(this)||this;return c&&(d.format=void 0,d.heartbeats=!0),u.connectionManager=g,g.registerProposedTransport(u),u.auth=C,u.params=d,u.timeouts=d.options.timeouts,u.format=d.format,u.isConnected=!1,u.isFinished=!1,u.isDisposed=!1,u.maxIdleInterval=null,u.idleTimer=null,u.lastActivity=null,u}return p.prototype.connect=function(){},p.prototype.close=function(){this.isConnected&&this.requestClose(),this.finish("closed",S.default.closed())},p.prototype.disconnect=function(g){this.isConnected&&this.requestDisconnect(),this.finish("disconnected",g||S.default.disconnected())},p.prototype.fail=function(g){this.isConnected&&this.requestDisconnect(),this.finish("failed",g||S.default.failed())},p.prototype.finish=function(g,C){var d;this.isFinished||(this.isFinished=!0,this.isConnected=!1,this.maxIdleInterval=null,clearTimeout((d=this.idleTimer)!==null&&d!==void 0?d:void 0),this.idleTimer=null,this.emit(g,C),this.dispose())},p.prototype.onProtocolMessage=function(g){switch(m.default.shouldLog(m.default.LOG_MICRO)&&m.default.logAction(m.default.LOG_MICRO,"Transport.onProtocolMessage()","received on "+this.shortName+": "+a.default.stringify(g)+"; connectionId = "+this.connectionManager.connectionId),this.onActivity(),g.action){case R.HEARTBEAT:m.default.logAction(m.default.LOG_MICRO,"Transport.onProtocolMessage()",this.shortName+" heartbeat; connectionId = "+this.connectionManager.connectionId),this.emit("heartbeat",g.id);break;case R.CONNECTED:this.onConnect(g),this.emit("connected",g.error,g.connectionId,g.connectionDetails,g);break;case R.CLOSED:this.onClose(g);break;case R.DISCONNECTED:this.onDisconnect(g);break;case R.ACK:this.emit("ack",g.msgSerial,g.count);break;case R.NACK:this.emit("nack",g.msgSerial,g.count,g.error);break;case R.SYNC:this.connectionManager.onChannelMessage(g,this);break;case R.ACTIVATE:break;case R.AUTH:this.auth.authorize(function(C){C&&m.default.logAction(m.default.LOG_ERROR,"Transport.onProtocolMessage()","Ably requested re-authentication, but unable to obtain a new token: "+l.inspectError(C))});break;case R.ERROR:if(m.default.logAction(m.default.LOG_MINOR,"Transport.onProtocolMessage()","received error action; connectionId = "+this.connectionManager.connectionId+"; err = "+y.default.Config.inspect(g.error)+(g.channel?", channel: "+g.channel:"")),g.channel===void 0){this.onFatalError(g);break}this.connectionManager.onChannelMessage(g,this);break;default:this.connectionManager.onChannelMessage(g,this)}},p.prototype.onConnect=function(g){if(this.isConnected=!0,!g.connectionDetails)throw new Error("Transport.onConnect(): Connect message recieved without connectionDetails");var C=g.connectionDetails.maxIdleInterval;C&&(this.maxIdleInterval=C+this.timeouts.realtimeRequestTimeout,this.onActivity())},p.prototype.onDisconnect=function(g){var C=g&&g.error;m.default.logAction(m.default.LOG_MINOR,"Transport.onDisconnect()","err = "+l.inspectError(C)),this.finish("disconnected",C)},p.prototype.onFatalError=function(g){var C=g&&g.error;m.default.logAction(m.default.LOG_MINOR,"Transport.onFatalError()","err = "+l.inspectError(C)),this.finish("failed",C)},p.prototype.onClose=function(g){var C=g&&g.error;m.default.logAction(m.default.LOG_MINOR,"Transport.onClose()","err = "+l.inspectError(C)),this.finish("closed",C)},p.prototype.requestClose=function(){m.default.logAction(m.default.LOG_MINOR,"Transport.requestClose()",""),this.send(f)},p.prototype.requestDisconnect=function(){m.default.logAction(m.default.LOG_MINOR,"Transport.requestDisconnect()",""),this.send(b)},p.prototype.ping=function(g){var C={action:a.default.Action.HEARTBEAT};g&&(C.id=g),this.send(a.default.fromValues(C))},p.prototype.dispose=function(){m.default.logAction(m.default.LOG_MINOR,"Transport.dispose()",""),this.isDisposed=!0,this.off()},p.prototype.onActivity=function(){this.maxIdleInterval&&(this.lastActivity=this.connectionManager.lastActivity=l.now(),this.setIdleTimer(this.maxIdleInterval+100))},p.prototype.setIdleTimer=function(g){var C=this;this.idleTimer||(this.idleTimer=setTimeout(function(){C.onIdleTimerExpire()},g))},p.prototype.onIdleTimerExpire=function(){if(!this.lastActivity||!this.maxIdleInterval)throw new Error("Transport.onIdleTimerExpire(): lastActivity/maxIdleInterval not set");this.idleTimer=null;var g=l.now()-this.lastActivity,C=this.maxIdleInterval-g;if(C<=0){var d="No activity seen from realtime in "+g+"ms; assuming connection has dropped";m.default.logAction(m.default.LOG_ERROR,"Transport.onIdleTimerExpire()",d),this.disconnect(new E.default(d,80003,408))}else this.setIdleTimer(C+100)},p.tryConnect=function(g,C,d,c,u){var s=new g(C,d,c),w,v=function(L){clearTimeout(w),u({event:this.event,error:L})},k=C.options.timeouts.realtimeRequestTimeout;w=setTimeout(function(){s.off(["preconnect","disconnected","failed"]),s.dispose(),v.call({event:"disconnected"},new E.default("Timeout waiting for transport to indicate itself viable",5e4,500))},k),s.on(["failed","disconnected"],v),s.on("preconnect",function(){m.default.logAction(m.default.LOG_MINOR,"Transport.tryConnect()","viable transport "+s),clearTimeout(w),s.off(["failed","disconnected"],v),u(null,s)}),s.connect()},p}(h.default);r.default=T},function(n,r,i){(function(o,a){n.exports=a(i(6),i(40),i(25))})(this,function(o){return function(){var a=o,l=a.lib,h=l.Base,m=l.WordArray,S=a.algo,E=S.MD5,y=S.EvpKDF=h.extend({cfg:h.extend({keySize:128/32,hasher:E,iterations:1}),init:function(R){this.cfg=this.cfg.extend(R)},compute:function(R,f){for(var b,T=this.cfg,x=T.hasher.create(),p=m.create(),g=p.words,C=T.keySize,d=T.iterations;g.length<C;){b&&x.update(b),b=x.update(R).finalize(f),x.reset();for(var c=1;c<d;c++)b=x.finalize(b),x.reset();p.concat(b)}return p.sigBytes=C*4,p}});a.EvpKDF=function(R,f,b){return y.create(b).compute(R,f)}}(),o.EvpKDF})},function(n,r,i){(function(o,a){n.exports=a(i(6),i(27))})(this,function(o){o.lib.Cipher||function(a){var l=o,h=l.lib,m=h.Base,S=h.WordArray,E=h.BufferedBlockAlgorithm,y=l.enc;y.Utf8;var R=y.Base64,f=l.algo,b=f.EvpKDF,T=h.Cipher=E.extend({cfg:m.extend(),createEncryptor:function(N,P){return this.create(this._ENC_XFORM_MODE,N,P)},createDecryptor:function(N,P){return this.create(this._DEC_XFORM_MODE,N,P)},init:function(N,P,I){this.cfg=this.cfg.extend(I),this._xformMode=N,this._key=P,this.reset()},reset:function(){E.reset.call(this),this._doReset()},process:function(N){return this._append(N),this._process()},finalize:function(N){N&&this._append(N);var P=this._doFinalize();return P},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(P){return typeof P=="string"?L:w}return function(P){return{encrypt:function(I,M,A){return N(M).encrypt(P,I,M,A)},decrypt:function(I,M,A){return N(M).decrypt(P,I,M,A)}}}}()});h.StreamCipher=T.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1});var x=l.mode={},p=h.BlockCipherMode=m.extend({createEncryptor:function(N,P){return this.Encryptor.create(N,P)},createDecryptor:function(N,P){return this.Decryptor.create(N,P)},init:function(N,P){this._cipher=N,this._iv=P}}),g=x.CBC=function(){var N=p.extend();N.Encryptor=N.extend({processBlock:function(I,M){var A=this._cipher,j=A.blockSize;P.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),P.call(this,I,M,j),this._prevBlock=U}});function P(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}(),C=l.pad={},d=C.Pkcs7={pad:function(N,P){for(var I=P*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=S.create(j,M);N.concat(z)},unpad:function(N){var P=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=P}};h.BlockCipher=T.extend({cfg:T.cfg.extend({mode:g,padding:d}),reset:function(){var N;T.reset.call(this);var P=this.cfg,I=P.iv,M=P.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,P){this._mode.processBlock(N,P)},_doFinalize:function(){var N,P=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(P.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),P.unpad(N)),N},blockSize:128/32});var c=h.CipherParams=m.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),u=l.format={},s=u.OpenSSL={stringify:function(N){var P,I=N.ciphertext,M=N.salt;return M?P=S.create([1398893684,1701076831]).concat(M).concat(I):P=I,P.toString(R)},parse:function(N){var P,I=R.parse(N),M=I.words;return M[0]==1398893684&&M[1]==1701076831&&(P=S.create(M.slice(2,4)),M.splice(0,4),I.sigBytes-=16),c.create({ciphertext:I,salt:P})}},w=h.SerializableCipher=m.extend({cfg:m.extend({format:s}),encrypt:function(N,P,I,M){M=this.cfg.extend(M);var A=N.createEncryptor(I,M),j=A.finalize(P),U=A.cfg;return c.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,P,I,M){M=this.cfg.extend(M),P=this._parse(P,M.format);var A=N.createDecryptor(I,M).finalize(P.ciphertext);return A},_parse:function(N,P){return typeof N=="string"?P.parse(N,this):N}}),v=l.kdf={},k=v.OpenSSL={execute:function(N,P,I,M){M||(M=S.random(64/8));var A=b.create({keySize:P+I}).compute(N,M),j=S.create(A.words.slice(P),I*4);return A.sigBytes=P*4,c.create({key:A,iv:j,salt:M})}},L=h.PasswordBasedCipher=w.extend({cfg:w.cfg.extend({kdf:k}),encrypt:function(N,P,I,M){M=this.cfg.extend(M);var A=M.kdf.execute(I,N.keySize,N.ivSize);M.iv=A.iv;var j=w.encrypt.call(this,N,P,A.key,M);return j.mixIn(A),j},decrypt:function(N,P,I,M){M=this.cfg.extend(M),P=this._parse(P,M.format);var A=M.kdf.execute(I,N.keySize,N.ivSize,P.salt);M.iv=A.iv;var j=w.decrypt.call(this,N,P,A.key,M);return j}})}()})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.Request=r.createRequest=void 0;var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(12)),h=o.__importDefault(i(3)),m=o.__importDefault(i(7)),S=i(4),E=o.__importDefault(i(8)),y=o.__importDefault(i(2)),R=o.__importDefault(i(22)),f=a.getGlobalObject(),b=function(){},T=f._ablyjs_jsonp={};T._=function(u){return T["_"+u]||b};var x=1,p="jsonp";function g(u,s,w,v,k,L,N){return L=L||E.default.TIMEOUTS,new d(void 0,u,s,a.copy(w),v,k,L,N)}r.createRequest=g;var C=function(u){o.__extends(s,u);function s(w,v,k){var L=u.call(this,w,v,k)||this;return L.shortName=p,k.stream=!1,L}return s.isAvailable=function(){return h.default.Config.jsonpSupported&&h.default.Config.allowComet},s.prototype.toString=function(){return"JSONPTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},s.prototype.createRequest=function(w,v,k,L,N,P,I){return P=(this===null||this===void 0?void 0:this.timeouts)||P||E.default.TIMEOUTS,g(w,v,k,L,N,P,I)},s}(l.default),d=function(u){o.__extends(s,u);function s(w,v,k,L,N,P,I,M){var A=u.call(this)||this;return w===void 0&&(w=x++),A.id=w,A.uri=v,A.params=L||{},A.params.rnd=a.cheapRandStr(),k&&(k["X-Ably-Version"]&&(A.params.v=k["X-Ably-Version"]),k["X-Ably-Lib"]&&(A.params.lib=k["X-Ably-Lib"])),A.body=N,A.method=M,A.requestMode=P,A.timeouts=I,A.requestComplete=!1,A}return s.prototype.exec=function(){var w=this,v=this.id,k=this.body,L=this.method,N=this.uri,P=this.params;P.callback="_ablyjs_jsonp._("+v+")",P.envelope="jsonp",k&&(P.body=k),L&&L!=="get"&&(P.method=L);var I=this.script=document.createElement("script"),M=N+a.toQueryString(P);I.src=M,I.src.split("/").slice(-1)[0]!==M.split("/").slice(-1)[0]&&y.default.logAction(y.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){w.complete(new S.PartialErrorInfo("JSONP script error (event: "+h.default.Config.inspect(U)+")",null,400))},T["_"+v]=function(U){if(U.statusCode){var z=U.response;if(U.statusCode==204)w.complete(null,null,null,U.statusCode);else if(!z)w.complete(new S.PartialErrorInfo("Invalid server response: no envelope detected",null,500));else if(U.statusCode<400||a.isArray(z))w.complete(null,z,U.headers,U.statusCode);else{var W=z.error||new S.PartialErrorInfo("Error response received from server",null,U.statusCode);w.complete(W)}}else w.complete(null,U)};var A=this.requestMode==R.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(w,v,k,L){if(k=k||{},!this.requestComplete){this.requestComplete=!0;var N=void 0;v&&(N=typeof v=="string"?"text/plain":"application/json",k["content-type"]=N,this.emit("data",v)),this.emit("complete",w,v,k,!0,L),this.dispose()}},s.prototype.abort=function(){this.dispose()},s.prototype.dispose=function(){var w=this.timer;w&&(clearTimeout(w),this.timer=null);var v=this.script;v.parentNode&&v.parentNode.removeChild(v),delete T[this.id],this.emit("disposed")},s}(m.default);r.Request=d;function c(u){return f.JSONPTransport=C,C.isAvailable()&&(u.supportedTransports[p]=C),C}r.default=c},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(2)),h=o.__importDefault(i(8)),m=o.__importDefault(i(18)),S=o.__importDefault(i(46)),E=o.__importDefault(i(20)),y=o.__importDefault(i(33)),R=o.__importDefault(i(4)),f=o.__importDefault(i(49)),b=o.__importDefault(i(19)),T=o.__importDefault(i(3)),x=o.__importDefault(i(9)),p=o.__importDefault(i(16)),g=o.__importDefault(i(15)),C=function(){},d=function(){function u(s){if(!s){var w="no options provided";throw l.default.logAction(l.default.LOG_ERROR,"Rest()",w),new Error(w)}var v=h.default.objectifyOptions(s);v.log?(l.default.setLog(v.log.level,v.log.handler),l.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 }`.")):l.default.setLog(v.logLevel,v.logHandler),l.default.logAction(l.default.LOG_MICRO,"Rest()","initialized with clientOptions "+T.default.Config.inspect(s));var k=this.options=h.default.normaliseOptions(v);if(k.key){var L=k.key.match(/^([^:\s]+):([^:.\s]+)$/);if(!L){var w="invalid key parameter";throw l.default.logAction(l.default.LOG_ERROR,"Rest()",w),new R.default(w,40400,404)}k.keyName=L[1],k.keySecret=L[2]}if("clientId"in k)if(typeof k.clientId=="string"||k.clientId===null){if(k.clientId==="*")throw new R.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 R.default("clientId must be either a string or null",40012,400);l.default.logAction(l.default.LOG_MINOR,"Rest()","started; version = "+h.default.version),this.baseUri=this.authority=function(N){return h.default.getHttpScheme(k)+N+":"+h.default.getPort(k,!1)},this._currentFallback=null,this.serverTimeOffset=null,this.http=new T.default.Http(k),this.auth=new m.default(this,k),this.channels=new c(this),this.push=new S.default(this)}return u.prototype.stats=function(s,w){if(w===void 0)if(typeof s=="function")w=s,s=null;else{if(this.options.promises)return a.promisify(this,"stats",[s]);w=C}var v=a.defaultGetHeaders(this.options),k=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,L=this.http.supportsLinkHeaders?void 0:k;this.options.headers&&a.mixin(v,this.options.headers),new E.default(this,"/stats",v,L,function(N,P,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,w)},u.prototype.time=function(s,w){var v=this;if(w===void 0){if(typeof s=="function")w=s,s=null;else if(this.options.promises)return a.promisify(this,"time",[s])}var k=w||C,L=a.defaultGetHeaders(this.options);this.options.headers&&a.mixin(L,this.options.headers);var N=function(P){return v.authority(P)+"/time"};this.http.do(b.default.Get,this,N,L,null,s,function(P,I,M,A){if(P){k(P);return}A||(I=JSON.parse(I));var j=I[0];if(!j){k(new R.default("Internal error (unexpected result type from GET /time)",5e4,500));return}v.serverTimeOffset=j-a.now(),k(null,j)})},u.prototype.request=function(s,w,v,k,L,N){var P=this.options.useBinaryProtocol,I=P?T.default.Config.msgpack.encode:JSON.stringify,M=P?T.default.Config.msgpack.decode:JSON.parse,A=P?a.Format.msgpack:a.Format.json,j=this.http.supportsLinkHeaders?void 0:A;v=v||{};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,w,v,k,L]);N=C}typeof k!="string"&&(k=I(k)),this.options.headers&&a.mixin(z,this.options.headers),L&&a.mixin(z,L);var W=new E.default(this,w,z,j,function(G,F,O){return a.ensureArray(O?G:M(G))},!0);if(!a.arrIn(T.default.Http.methods,U))throw new R.default("Unsupported method "+U,40500,405);a.arrIn(T.default.Http.methodsWithBody,U)?W[U](v,k,N):W[U](v,N)},u.prototype.batchPublish=function(s,w){if(w===void 0){if(this.options.promises)return a.promisify(this,"batchPublish",[s]);w=C}var v=w,k,L;a.isArray(s)?(k=s,L=!1):(k=[s],L=!0);var N=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,P=a.defaultPostHeaders(this.options,N);this.options.headers&&a.mixin(P,this.options.headers);var I=a.encodeBody(k,N);g.default.post(this,"/messages",I,P,{newBatchResponse:"true"},null,function(M,A,j,U){if(M){v(M);return}var z=U?A:a.decodeBody(A,N);L?v(null,z[0]):v(null,z)})},u.prototype.batchPresence=function(s,w){if(w===void 0){if(this.options.promises)return a.promisify(this,"batchPresence",[s]);w=C}var v=w,k=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,L=a.defaultPostHeaders(this.options,k);this.options.headers&&a.mixin(L,this.options.headers);var N=s.join(",");g.default.get(this,"/presence",L,{newBatchResponse:"true",channels:N},null,function(P,I,M,A){if(P){v(P);return}var j=A?I:a.decodeBody(I,k);v(null,j)})},u.prototype.setLog=function(s){l.default.setLog(s.level,s.handler)},u.Promise=function(s){return s=h.default.objectifyOptions(s),s.promises=!0,new u(s)},u.Callbacks=u,u.Platform=T.default,u.Message=x.default,u.PresenceMessage=p.default,u}(),c=function(){function u(s){this.rest=s,this.all=Object.create(null)}return u.prototype.get=function(s,w){s=String(s);var v=this.all[s];return v?w&&v.setOptions(w):this.all[s]=v=new y.default(this.rest,s,w),v},u.prototype.release=function(s){delete this.all[String(s)]},u}();r.default=d},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return o.enc.Utf8})},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(a){var l=o,h=l.lib,m=h.WordArray,S=h.Hasher,E=l.algo,y=[],R=[];(function(){function T(C){for(var d=a.sqrt(C),c=2;c<=d;c++)if(!(C%c))return!1;return!0}function x(C){return(C-(C|0))*4294967296|0}for(var p=2,g=0;g<64;)T(p)&&(g<8&&(y[g]=x(a.pow(p,1/2))),R[g]=x(a.pow(p,1/3)),g++),p++})();var f=[],b=E.SHA256=S.extend({_doReset:function(){this._hash=new m.init(y.slice(0))},_doProcessBlock:function(T,x){for(var p=this._hash.words,g=p[0],C=p[1],d=p[2],c=p[3],u=p[4],s=p[5],w=p[6],v=p[7],k=0;k<64;k++){if(k<16)f[k]=T[x+k]|0;else{var L=f[k-15],N=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,P=f[k-2],I=(P<<15|P>>>17)^(P<<13|P>>>19)^P>>>10;f[k]=N+f[k-7]+I+f[k-16]}var M=u&s^~u&w,A=g&C^g&d^C&d,j=(g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22),U=(u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25),z=v+U+M+R[k]+f[k],W=j+A;v=w,w=s,s=u,u=c+z|0,c=d,d=C,C=g,g=z+W|0}p[0]=p[0]+g|0,p[1]=p[1]+C|0,p[2]=p[2]+d|0,p[3]=p[3]+c|0,p[4]=p[4]+u|0,p[5]=p[5]+s|0,p[6]=p[6]+w|0,p[7]=p[7]+v|0},_doFinalize:function(){var T=this._data,x=T.words,p=this._nDataBytes*8,g=T.sigBytes*8;return x[g>>>5]|=128<<24-g%32,x[(g+64>>>9<<4)+14]=a.floor(p/4294967296),x[(g+64>>>9<<4)+15]=p,T.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var T=S.clone.call(this);return T._hash=this._hash.clone(),T}});l.SHA256=S._createHelper(b),l.HmacSHA256=S._createHmacHelper(b)}(Math),o.SHA256})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(7)),h=o.__importDefault(i(2)),m=o.__importDefault(i(34)),S=o.__importDefault(i(9)),E=o.__importDefault(i(4)),y=o.__importDefault(i(20)),R=o.__importDefault(i(15)),f=o.__importDefault(i(3));function b(){}var T=9;function x(C){return a.arrEvery(C,function(d){return!d.id})}function p(C){var d=C||{};if(d.cipher){if(!f.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var c=f.default.Crypto.getCipher(d.cipher);d.cipher=c.cipherParams,d.channelCipher=c.cipher}else"cipher"in d&&(d.cipher=void 0,d.channelCipher=null);return d}var g=function(C){o.__extends(d,C);function d(c,u,s){var w=C.call(this)||this;return h.default.logAction(h.default.LOG_MINOR,"Channel()","started; name = "+u),w.rest=c,w.name=u,w.basePath="/channels/"+encodeURIComponent(u),w.presence=new m.default(w),w.channelOptions=p(s),w}return d.prototype.setOptions=function(c){this.channelOptions=p(c)},d.prototype.history=function(c,u){if(h.default.logAction(h.default.LOG_MICRO,"Channel.history()","channel = "+this.name),u===void 0)if(typeof c=="function")u=c,c=null;else{if(this.rest.options.promises)return a.promisify(this,"history",arguments);u=b}this._history(c,u)},d.prototype._history=function(c,u){var s=this.rest,w=s.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,v=this.rest.http.supportsLinkHeaders?void 0:w,k=a.defaultGetHeaders(s.options,w);s.options.headers&&a.mixin(k,s.options.headers);var L=this.channelOptions;new y.default(s,this.basePath+"/messages",k,v,function(N,P,I){return S.default.fromResponseBody(N,L,I?void 0:w)}).get(c,u)},d.prototype.publish=function(){var c=this,u=arguments.length,s=arguments[0],w=arguments[1],v=arguments[u-1],k,L;if(typeof v!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);v=b}if(typeof s=="string"||s===null)k=[S.default.fromValues({name:s,data:w})],L=arguments[2];else if(a.isObject(s))k=[S.default.fromValues(s)],L=arguments[1];else if(a.isArray(s))k=S.default.fromValuesArray(s),L=arguments[1];else throw new E.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);(typeof L!="object"||!L)&&(L={});var N=this.rest,P=N.options,I=P.useBinaryProtocol?a.Format.msgpack:a.Format.json,M=N.options.idempotentRestPublishing,A=a.defaultPostHeaders(N.options,I);if(P.headers&&a.mixin(A,P.headers),M&&x(k)){var j=a.randomString(T);a.arrForEach(k,function(U,z){U.id=j+":"+z.toString()})}S.default.encodeArray(k,this.channelOptions,function(U){if(U){v(U);return}var z=S.default.getMessagesSize(k),W=P.maxMessageSize;if(z>W){v(new E.default("Maximum size of messages that can be published at once exceeded ( was "+z+" bytes; limit is "+W+" bytes)",40009,400));return}c._publish(S.default.serialize(k,I),A,L,v)})},d.prototype._publish=function(c,u,s,w){R.default.post(this.rest,this.basePath+"/messages",c,u,s,null,w)},d.prototype.status=function(c){if(typeof c!="function"&&this.rest.options.promises)return a.promisify(this,"status",[]);var u=this.rest.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,s=a.defaultPostHeaders(this.rest.options,u);R.default.get(this.rest,this.basePath,s,{},u,c||b)},d}(l.default);r.default=g},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(7)),h=o.__importDefault(i(2)),m=o.__importDefault(i(20)),S=o.__importDefault(i(16));function E(){}var y=function(R){o.__extends(f,R);function f(b){var T=R.call(this)||this;return T.channel=b,T.basePath=b.basePath+"/presence",T}return f.prototype.get=function(b,T){if(h.default.logAction(h.default.LOG_MICRO,"Presence.get()","channel = "+this.channel.name),T===void 0)if(typeof b=="function")T=b,b=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"get",arguments);T=E}var x=this.channel.rest,p=x.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,g=this.channel.rest.http.supportsLinkHeaders?void 0:p,C=a.defaultGetHeaders(x.options,p);x.options.headers&&a.mixin(C,x.options.headers);var d=this.channel.channelOptions;new m.default(x,this.basePath,C,g,function(c,u,s){return S.default.fromResponseBody(c,d,s?void 0:p)}).get(b,T)},f.prototype.history=function(b,T){return h.default.logAction(h.default.LOG_MICRO,"Presence.history()","channel = "+this.channel.name),this._history(b,T)},f.prototype._history=function(b,T){if(T===void 0)if(typeof b=="function")T=b,b=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"_history",[b]);T=E}var x=this.channel.rest,p=x.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,g=this.channel.rest.http.supportsLinkHeaders?void 0:p,C=a.defaultGetHeaders(x.options,p);x.options.headers&&a.mixin(C,x.options.headers);var d=this.channel.channelOptions;new m.default(x,this.basePath+"/history",C,g,function(c,u,s){return S.default.fromResponseBody(c,d,s?void 0:p)}).get(b,T)},f}(l.default);r.default=y},function(n,r,i){(function(o){Object.defineProperty(r,"__esModule",{value:!0}),r.TransportParams=void 0;var a=i(0),l=a.__importDefault(i(10)),h=a.__importStar(i(1)),m=a.__importStar(i(52)),S=a.__importStar(i(8)),E=a.__importDefault(i(3)),y=a.__importDefault(i(7)),R=a.__importDefault(i(36)),f=a.__importDefault(i(2)),b=a.__importDefault(i(37)),T=a.__importStar(i(21)),x=a.__importStar(i(4)),p=a.__importDefault(i(18)),g=a.__importDefault(i(9)),C=a.__importDefault(i(24)),d=a.__importDefault(i(53)),c=a.__importDefault(i(26)),u=a.__importDefault(i(14)),s=function(){var G;return typeof E.default.WebStorage!="undefined"&&((G=E.default.WebStorage)===null||G===void 0?void 0:G.localSupported)},w=function(){var G;return typeof E.default.WebStorage!="undefined"&&((G=E.default.WebStorage)===null||G===void 0?void 0:G.sessionSupported)},v=l.default.Action,k=function(){},L="ably-transport-preference",N="ably-connection-recovery";function P(){var G,F;return w()&&((F=(G=E.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,O;return w()&&((O=(F=E.default.WebStorage)===null||F===void 0?void 0:F.setSession)===null||O===void 0?void 0:O.call(F,N,G))}function M(){var G,F;return w()&&((F=(G=E.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 h.arrIndexOf(E.default.Defaults.transportPreferenceOrder,G.shortName)>h.arrIndexOf(E.default.Defaults.transportPreferenceOrder,F.shortName)}function j(G,F,O){var D;if(G.channel!==F.channel||(D=G.action)!==v.PRESENCE&&D!==v.MESSAGE||D!==F.action)return!1;var B=D===v.PRESENCE?"presence":"messages",_=G[B].concat(F[B]),$=g.default.getMessagesSize(_);return $>O||!h.allSame(_,"clientId")||!h.arrEvery(_,function(X){return!X.id})?!1:(G[B]=_,!0)}function U(G){try{return JSON.parse(G)}catch(F){return null}}var z=function(){function G(F,O,D,B){this.options=F,this.host=O,this.mode=D,this.connectionKey=B,this.format=F.useBinaryProtocol?h.Format.msgpack:h.Format.json}return G.prototype.getConnectParams=function(F){var O=F?h.copy(F):{},D=this.options;switch(this.mode){case"upgrade":O.upgrade=this.connectionKey;break;case"resume":O.resume=this.connectionKey;break;case"recover":{var B=U(D.recover);B&&(O.recover=B.connectionKey);break}}return D.clientId!==void 0&&(O.clientId=D.clientId),D.echoMessages===!1&&(O.echo="false"),this.format!==void 0&&(O.format=this.format),this.stream!==void 0&&(O.stream=this.stream),this.heartbeats!==void 0&&(O.heartbeats=this.heartbeats),O.v=S.default.protocolVersion,O.agent=(0,S.getAgentString)(this.options),D.transportParams!==void 0&&h.mixin(O,D.transportParams),O},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(O,D){var B=G.call(this)||this;B.disconnectedRetryCount=0,F.initTransports(),B.realtime=O,B.options=D;var _=D.timeouts,$=_.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:$,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 R.default,B.msgSerial=0,B.connectionDetails=void 0,B.connectionId=void 0,B.connectionKey=void 0,B.connectionStateTtl=_.connectionStateTtl,B.maxIdleInterval=null,B.transports=h.intersect(D.transports||S.default.defaultTransports,F.supportedTransports),B.baseTransport=h.intersect(S.default.baseTransportOrder,B.transports)[0],B.upgradeTransports=h.intersect(B.transports,S.default.upgradeTransports),B.transportPreference=null,B.httpHosts=S.default.getHosts(D),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 = ["+(D.transports||S.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 X="no requested transports available";throw f.default.logAction(f.default.LOG_ERROR,"realtime.ConnectionManager()",X),new Error(X)}var Y=E.default.Config.addEventListener;return Y&&(w()&&typeof D.recover=="function"&&Y("beforeunload",B.persistConnection.bind(B)),D.closeOnUnload===!0&&Y("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"})}),Y("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())}),Y("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,d.default)(F),h.arrForEach(E.default.Transports,function(O){O(F)})},F.prototype.createTransportParams=function(O,D){return new z(this.options,O,D,this.connectionKey)},F.prototype.getTransportParams=function(O){var D=this,B=function(_){if(D.connectionKey){_("resume");return}if(typeof D.options.recover=="string"){_("recover");return}var $=D.options.recover,X=P();if(X&&typeof $=="function"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Calling clientOptions-provided recover function with last session data"),$(X,function(Y){Y?(D.options.recover=X.recoveryKey,_("recover")):_("clean")});return}_("clean")};B(function(_){var $=D.createTransportParams(null,_);if(_==="recover"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport recovery mode = recover; recoveryKey = "+D.options.recover);var X=U(D.options.recover);X&&(D.msgSerial=X.msgSerial)}else f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport params = "+$.toString());O($)})},F.prototype.tryATransport=function(O,D,B){var _=this;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","trying "+D),c.default.tryConnect(F.supportedTransports[D],this,this.realtime.auth,O,function($,X){var Y=_.state;if(Y==_.states.closing||Y==_.states.closed||Y==_.states.failed){X&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","connection "+Y.state+" while we were attempting the transport; closing "+X),X.close()),B(!0);return}if($){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","transport "+D+" "+$.event+", err: "+$.error.toString()),p.default.isTokenErr($.error)&&!(_.errorReason&&p.default.isTokenErr(_.errorReason))?(_.errorReason=$.error,_.realtime.auth._forceNewToken(null,null,function(te){if(te){_.actOnErrorFromAuthorize(te);return}_.tryATransport(O,D,B)})):$.event==="failed"?(_.notifyState({state:"failed",error:$.error}),B(!0)):$.event==="disconnected"&&((0,T.isRetriable)($.error)?B(!1):(_.notifyState({state:_.states.connecting.failState,error:$.error}),B(!0)));return}f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","viable transport "+D+"; setting pending"),_.setTransportPending(X,O),B(null,X)})},F.prototype.setTransportPending=function(O,D){var B=this,_=D.mode;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setTransportPending()","transport = "+O+"; mode = "+_),h.arrDeleteValue(this.proposedTransports,O),this.pendingTransports.push(O);var $=E.default.Defaults.transportPreferenceOrder[E.default.Defaults.transportPreferenceOrder.length-1];O.once("connected",function(Y,te,re){_=="upgrade"&&B.activeProtocol?O.shortName!==$&&h.arrIn(B.getUpgradePossibilities(),$)&&B.activeProtocol?setTimeout(function(){B.scheduleTransportActivation(Y,O,te,re)},B.options.timeouts.parallelUpgradeDelay):B.scheduleTransportActivation(Y,O,te,re):(B.activateTransport(Y,O,te,re),E.default.Config.nextTick(function(){B.connectImpl(D)})),_==="recover"&&B.options.recover&&(B.options.recover=null,B.unpersistConnection())});var X=this;O.on(["disconnected","closed","failed"],function(Y){X.deactivateTransport(O,this.event,Y)}),this.emit("transport.pending",O)},F.prototype.scheduleTransportActivation=function(O,D,B,_){var $=this,X=this.activeProtocol&&this.activeProtocol.getTransport(),Y=function(){D.disconnect(),h.arrDeleteValue($.pendingTransports,D)};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 "+D.shortName),Y();return}if(X&&!A(D,X)){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+D.shortName+" is no better than current active transport "+X.shortName+" - abandoning upgrade"),Y();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Scheduling transport upgrade; transport = "+D);var te=null;if(!D.isConnected){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+D.shortName+"is no longer connected; abandoning upgrade"),Y();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 "+D.shortName),Y();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Syncing transport; transport = "+D);var re=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Activating transport; transport = "+D),D.send(l.default.fromValues({action:v.ACTIVATE})),$.activateTransport(O,D,B,_),$.state===$.states.synchronizing?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, sending queued messages on upgraded transport; transport = "+D),$.state=$.states.connected):f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, but state is now "+$.state.state+", so leaving unchanged"),$.state.sendEvents&&$.sendQueuedMessages()};te?te.onceIdle(re):re()},F.prototype.activateTransport=function(O,D,B,_){var $=this;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","transport = "+D),O&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","error = "+O),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(D);var X=this.state,Y=this.states.connected.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","current state = "+X.state),X.state==this.states.closing.state||X.state==this.states.closed.state||X.state==this.states.failed.state)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Disconnecting transport and abandoning"),D.disconnect(),!1;if(h.arrDeleteValue(this.pendingTransports,D),!D.isConnected)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Declining to activate transport "+D+" since it appears to no longer be connected"),!1;var te=this.activeProtocol;this.activeProtocol=new m.default(D),this.host=D.params.host;var re=_.connectionKey;if(re&&this.connectionKey!=re&&this.setConnection(B,_,!!O),this.onConnectionDetailsUpdate(_,D),E.default.Config.nextTick(function(){D.on("connected",function(Z,ye,De){$.onConnectionDetailsUpdate(De,D),$.emit("update",new b.default(Y,Y,null,Z))})}),X.state===this.states.connected.state?O&&(this.errorReason=this.realtime.connection.errorReason=O,this.emit("update",new b.default(Y,Y,null,O))):(this.notifyState({state:"connected",error:O}),this.errorReason=this.realtime.connection.errorReason=O||null),this.emit("transport.active",D),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 "+D.shortName+") finishing with "+te.messageQueue.count()+" messages still pending"),te.transport===D){var ce="Assumption violated: activating a transport that was also the transport for the previous active protocol; transport = "+D.shortName+"; stack = "+new Error().stack;f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()",ce)}else te.finish();return h.safeArrForEach(this.pendingTransports,function(Z){if(Z===D){var ye="Assumption violated: activating a transport that is still marked as a pending transport; transport = "+D.shortName+"; stack = "+new Error().stack;f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()",ye),h.arrDeleteValue($.pendingTransports,D)}else Z.disconnect()}),h.safeArrForEach(this.proposedTransports,function(Z){Z===D?(f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Assumption violated: activating a transport that is still marked as a proposed transport; transport = "+D.shortName+"; stack = "+new Error().stack),h.arrDeleteValue($.proposedTransports,D)):Z.dispose()}),!0},F.prototype.deactivateTransport=function(O,D,B){var _=this.activeProtocol,$=_&&_.getTransport()===O,X=h.arrDeleteValue(this.pendingTransports,O),Y=h.arrDeleteValue(this.proposedTransports,O),te=this.noTransportsScheduledForActivation();if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.deactivateTransport()","transport = "+O),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.deactivateTransport()","state = "+D+($?"; was active":X?"; was pending":Y?"; was proposed":"")+(te?"":"; another transport is scheduled for activation")),B&&B.message&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","reason = "+B.message),$&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","Getting, clearing, and requeuing "+this.activeProtocol.messageQueue.count()+" pending messages"),this.queuePendingMessages(_.getPendingMessages()),E.default.Config.nextTick(function(){_.clearPendingMessages()}),this.activeProtocol=this.host=null),this.emit("transport.inactive",O),$&&te||$&&D==="failed"||D==="closed"||_===null&&X&&this.pendingTransports.length===0){if(D==="disconnected"&&B&&B.statusCode>500&&this.httpHosts.length>1){this.unpersistTransportPreference(),this.forceFallbackHost=!0,this.notifyState({state:D,error:B,retryImmediately:!0});return}var re=D==="failed"&&p.default.isTokenErr(B)?"disconnected":D;this.notifyState({state:re,error:B});return}$&&D==="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 h.isEmpty(this.pendingTransports)||this.pendingTransports.every(function(O){return!O.isConnected})},F.prototype.setConnection=function(O,D,B){var _=this.connectionId,$=_&&_!==O,X=!_&&B;($||X)&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setConnection()","Resetting msgSerial"),this.msgSerial=0,this.queuedMessages.resetSendAttempted()),this.connectionId!==O&&f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setConnection()","New connectionId; reattaching any attached channels"),this.realtime.connection.id=this.connectionId=O,this.realtime.connection.key=this.connectionKey=D.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 O=h.now()-this.lastActivity;O>this.connectionStateTtl+this.maxIdleInterval&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.checkConnectionStateFreshness()","Last known activity from realtime was "+O+"ms ago; discarding connection state"),this.clearConnection(),this.states.connecting.failState="suspended")}},F.prototype.persistConnection=function(){if(w()){var O=this.createRecoveryKey();O&&I({recoveryKey:O,disconnectedAt:h.now(),location:o.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 O,D;return(D=(O=T.default)[this.state.state])===null||D===void 0?void 0:D.call(O)},F.prototype.activeState=function(){return this.state.queueEvents||this.state.sendEvents},F.prototype.enactStateChange=function(O){var D=O.current==="failed"?f.default.LOG_ERROR:f.default.LOG_MAJOR;f.default.logAction(D,"Connection state",O.current+(O.reason?"; reason: "+O.reason:"")),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.enactStateChange","setting new state: "+O.current+"; reason = "+(O.reason&&O.reason.message));var B=this.state=this.states[O.current];O.reason&&(this.errorReason=O.reason,this.realtime.connection.errorReason=O.reason),(B.terminal||B.state==="suspended")&&this.clearConnection(),this.emit("connectionstate",O)},F.prototype.startTransitionTimer=function(O){var D=this;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startTransitionTimer()","transitionState: "+O.state),this.transitionTimer&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startTransitionTimer()","clearing already-running timer"),clearTimeout(this.transitionTimer)),this.transitionTimer=setTimeout(function(){D.transitionTimer&&(D.transitionTimer=null,f.default.logAction(f.default.LOG_MINOR,"ConnectionManager "+O.state+" timer expired","requesting new state: "+O.failState),D.notifyState({state:O.failState}))},O.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 O=this;this.suspendTimer||(this.suspendTimer=setTimeout(function(){O.suspendTimer&&(O.suspendTimer=null,f.default.logAction(f.default.LOG_MINOR,"ConnectionManager suspend timer expired","requesting new state: suspended"),O.states.connecting.failState="suspended",O.notifyState({state:"suspended"}))},this.connectionStateTtl))},F.prototype.checkSuspendTimer=function(O){O!=="disconnected"&&O!=="suspended"&&O!=="connecting"&&this.cancelSuspendTimer()},F.prototype.cancelSuspendTimer=function(){this.states.connecting.failState="disconnected",this.suspendTimer&&(clearTimeout(this.suspendTimer),this.suspendTimer=null)},F.prototype.startRetryTimer=function(O){var D=this;this.retryTimer=setTimeout(function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager retry timer expired","retrying"),D.retryTimer=null,D.requestState({state:"connecting"})},O)},F.prototype.cancelRetryTimer=function(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)},F.prototype.notifyState=function(O){var D=this,B,_,$=O.state,X=$==="disconnected"&&(this.state===this.states.connected||this.state===this.states.synchronizing||O.retryImmediately||this.state===this.states.connecting&&O.error&&p.default.isTokenErr(O.error)&&!(this.errorReason&&p.default.isTokenErr(this.errorReason)));if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.notifyState()","new state: "+$+(X?"; will retry connection immediately":"")),$!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(O.state),($==="suspended"||$==="connected")&&(this.disconnectedRetryCount=0),!this.state.terminal)){var Y=this.states[O.state],te=Y.retryDelay;Y.state==="disconnected"&&(this.disconnectedRetryCount++,te=h.getRetryTime(Y.retryDelay,this.disconnectedRetryCount));var re=new b.default(this.state.state,Y.state,te,O.error||((_=(B=T.default)[Y.state])===null||_===void 0?void 0:_.call(B)));if(X){var ce=function(){D.state===D.states.disconnected&&(D.lastAutoReconnectAttempt=h.now(),D.requestState({state:"connecting"}))},Z=this.lastAutoReconnectAttempt&&h.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(ce,1e3-Z)):E.default.Config.nextTick(ce)}else($==="disconnected"||$==="suspended")&&this.startRetryTimer(te);($==="disconnected"&&!X||$==="suspended"||Y.terminal)&&E.default.Config.nextTick(function(){D.disconnectAllTransports()}),$=="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($,re.reason),this.failQueuedMessages(re.reason))}},F.prototype.requestState=function(O){var D=this,B,_,$=O.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.requestState()","requested state: "+$+"; current state: "+this.state.state),$!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer($),!($=="connecting"&&this.state.state=="connected")&&!($=="closing"&&this.state.state=="closed"))){var X=this.states[$],Y=new b.default(this.state.state,X.state,null,O.error||((_=(B=T.default)[X.state])===null||_===void 0?void 0:_.call(B)));this.enactStateChange(Y),$=="connecting"&&E.default.Config.nextTick(function(){D.startConnect()}),$=="closing"&&this.closeImpl()}},F.prototype.startConnect=function(){var O=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 D=this.realtime.auth,B=++this.connectCounter,_=function(){O.checkConnectionStateFreshness(),O.getTransportParams(function(X){if(X.mode==="recover"&&X.options.recover){var Y=U(X.options.recover);Y&&O.realtime.channels.recoverChannels(Y.channelSerials)}B===O.connectCounter&&O.connectImpl(X,B)})};if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startConnect()","starting connection"),this.startSuspendTimer(),this.startTransitionTimer(this.states.connecting),D.method==="basic")_();else{var $=function(X){B===O.connectCounter&&(X?O.actOnErrorFromAuthorize(X):_())};this.errorReason&&p.default.isTokenErr(this.errorReason)?D._forceNewToken(null,null,$):D._ensureValidAuthCredentials(!1,$)}},F.prototype.connectImpl=function(O,D){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(O):this.transports.length>1&&this.getTransportPreference()?this.connectPreference(O,D):this.connectBase(O,D)},F.prototype.connectPreference=function(O,D){var B=this,_=this.getTransportPreference(),$=!1;h.arrIn(this.transports,_)||(this.unpersistTransportPreference(),this.connectImpl(O,D)),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectPreference()","Trying to connect with stored transport preference "+_);var X=setTimeout(function(){$=!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(O,D)},this.options.timeouts.preferenceConnectTimeout);O.host=this.httpHosts[0],this.tryATransport(O,_,function(Y,te){clearTimeout(X),$&&te?(te.off(),te.disconnect(),h.arrDeleteValue(B.pendingTransports,te)):!te&&!Y&&(B.unpersistTransportPreference(),B.connectImpl(O,D))})},F.prototype.connectBase=function(O,D){var B=this,_=function(re){B.notifyState({state:B.states.connecting.failState,error:re})},$=this.httpHosts.slice(),X=function(re,ce){D===B.connectCounter&&!ce&&!re&&te()};f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectBase()","Trying to connect with base transport "+this.baseTransport);var Y=$.shift();if(!Y){_(new x.default("Unable to connect (no available host)",80003,404));return}O.host=Y;var te=function(){if(!$.length){_(new x.default("Unable to connect (and no more fallback hosts to try)",80003,404));return}if(!B.realtime.http.checkConnectivity){_(new x.PartialErrorInfo("Internal error: Http.checkConnectivity not set",null,500));return}B.realtime.http.checkConnectivity(function(re,ce){if(D===B.connectCounter){if(re){_(re);return}if(!ce){_(new x.default("Unable to connect (network unreachable)",80003,404));return}O.host=h.arrPopRandomElement($),B.tryATransport(O,B.baseTransport,X)}})};if(this.forceFallbackHost&&$.length){this.forceFallbackHost=!1,te();return}this.tryATransport(O,this.baseTransport,X)},F.prototype.getUpgradePossibilities=function(){var O=this.activeProtocol.getTransport().shortName,D=h.arrIndexOf(this.upgradeTransports,O);return this.upgradeTransports.slice(D+1)},F.prototype.upgradeIfNeeded=function(O){var D=this,B=this.getUpgradePossibilities();f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.upgradeIfNeeded()","upgrade possibilities: "+E.default.Config.inspect(B)),B.length&&h.arrForEach(B,function(_){var $=D.createTransportParams(O.host,"upgrade");D.tryATransport($,_,k)})},F.prototype.closeImpl=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.closeImpl()","closing connection"),this.cancelSuspendTimer(),this.startTransitionTimer(this.states.closing),h.safeArrForEach(this.pendingTransports,function(O){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Closing pending transport: "+O),O&&O.close()}),h.safeArrForEach(this.proposedTransports,function(O){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Disposing of proposed transport: "+O),O&&O.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(O,D){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 $=this.activeProtocol.getTransport().params;E.default.Config.nextTick(function(){B.state.state==="connected"&&B.upgradeIfNeeded($)})}var X=(_=this.activeProtocol)===null||_===void 0?void 0:_.getTransport();X&&X.onAuthUpdated&&X.onAuthUpdated(O);var Y=l.default.fromValues({action:v.AUTH,auth:{accessToken:O.token}});this.send(Y);var te=function(){B.off(re),D(null,O)},re=function(Z){Z.current==="failed"&&(B.off(te),B.off(re),D(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 ce=function(Z){switch(Z.current){case"connected":B.off(ce),D(null,O);break;case"failed":case"closed":case"suspended":B.off(ce),D(Z.reason||B.getStateError());break}};this.on("connectionstate",ce),this.state.state==="connecting"?this.startConnect():this.requestState({state:"connecting"})}}},F.prototype.disconnectAllTransports=function(O){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.disconnectAllTransports()","Disconnecting all transports"+(O?" except the active transport":"")),this.connectCounter++,h.safeArrForEach(this.pendingTransports,function(D){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting pending transport: "+D),D&&D.disconnect()}),this.pendingTransports=[],h.safeArrForEach(this.proposedTransports,function(D){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disposing of proposed transport: "+D),D&&D.dispose()}),this.proposedTransports=[],this.activeProtocol&&!O&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting active transport: "+this.activeProtocol.getTransport()),this.activeProtocol.getTransport().disconnect())},F.prototype.send=function(O,D,B){B=B||k;var _=this.state;if(_.sendEvents){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","sending event"),this.sendImpl(new m.PendingMessage(O,B));return}var $=D&&_.queueEvents||_.forceQueueEvents;if(!$){var X="rejecting event, queueEvent was "+D+", state was "+_.state;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()",X),B(this.errorReason||new x.default(X,9e4,400));return}f.default.shouldLog(f.default.LOG_MICRO)&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","queueing msg; "+l.default.stringify(O)),this.queue(O,B)},F.prototype.sendImpl=function(O){var D=O.message;O.ackRequired&&!O.sendAttempted&&(D.msgSerial=this.msgSerial++);try{this.activeProtocol.send(O)}catch(B){f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.sendImpl()","Unexpected exception in transport.send(): "+B.stack)}},F.prototype.queue=function(O,D){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,O,_)?(B.merged||(B.callback=C.default.create([B.callback]),B.merged=!0),B.callback.push(D)):this.queuedMessages.push(new m.PendingMessage(O,D))},F.prototype.sendQueuedMessages=function(){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.sendQueuedMessages()","sending "+this.queuedMessages.count()+" queued messages");for(var O;O=this.queuedMessages.shift();)this.sendImpl(O)},F.prototype.queuePendingMessages=function(O){O&&O.length&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.queuePendingMessages()","queueing "+O.length+" pending messages"),this.queuedMessages.prepend(O))},F.prototype.failQueuedMessages=function(O){var D=this.queuedMessages.count();D>0&&(f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.failQueuedMessages()","failing "+D+" queued messages, err = "+h.inspectError(O)),this.queuedMessages.completeAllMessages(O))},F.prototype.onChannelMessage=function(O,D){var B=this.activeProtocol&&D===this.activeProtocol.getTransport(),_=h.arrIn(this.pendingTransports,D)&&this.state==this.states.synchronizing;B||_?this.realtime.channels.onChannelMessage(O):h.arrIndexOf([v.ACK,v.NACK,v.ERROR],O.action)>-1?this.realtime.channels.onChannelMessage(O):f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onChannelMessage()","received message "+JSON.stringify(O)+"on defunct transport; discarding")},F.prototype.ping=function(O,D){var B=this;if(O){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.ping()","transport = "+O);var _=function(){O.off("heartbeat",Y),D(new x.default("Timeout waiting for heartbeat response",5e4,500))},$=h.now(),X=h.cheapRandStr(),Y=function(ye){if(ye===X){O.off("heartbeat",Y),clearTimeout(te);var De=h.now()-$;D(null,De)}},te=setTimeout(_,this.options.timeouts.realtimeRequestTimeout);O.on("heartbeat",Y),O.ping(X);return}if(this.state.state!=="connected"){D(new x.default("Unable to ping service; not connected",4e4,400));return}var re=!1,ce=function(ye,De){B.off("transport.active",Z),re||(re=!0,D(ye,De))},Z=function(){re||(re=!0,E.default.Config.nextTick(function(){B.ping(null,D)}))};this.on("transport.active",Z),this.ping(this.activeProtocol.getTransport(),ce)},F.prototype.abort=function(O){this.activeProtocol.getTransport().fail(O)},F.prototype.registerProposedTransport=function(O){this.proposedTransports.push(O)},F.prototype.getTransportPreference=function(){var O,D;return this.transportPreference||s()&&((D=(O=E.default.WebStorage)===null||O===void 0?void 0:O.get)===null||D===void 0?void 0:D.call(O,L))},F.prototype.persistTransportPreference=function(O){var D,B;h.arrIn(S.default.upgradeTransports,O.shortName)&&(this.transportPreference=O.shortName,s()&&((B=(D=E.default.WebStorage)===null||D===void 0?void 0:D.set)===null||B===void 0||B.call(D,L,O.shortName)))},F.prototype.unpersistTransportPreference=function(){var O,D;this.transportPreference=null,s()&&((D=(O=E.default.WebStorage)===null||O===void 0?void 0:O.remove)===null||D===void 0||D.call(O,L))},F.prototype.actOnErrorFromAuthorize=function(O){if(O.code===40171)this.notifyState({state:"failed",error:O});else if(O.code===40102)this.notifyState({state:"failed",error:O});else if(O.statusCode===u.default.Forbidden){var D="Client configured authentication provider returned 403; failing the connection";f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.actOnErrorFromAuthorize()",D),this.notifyState({state:"failed",error:new x.default(D,80019,403,O)})}else{var D="Client configured authentication provider request failed";f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.actOnErrorFromAuthorize",D),this.notifyState({state:this.state.failState,error:new x.default(D,80019,401,O)})}},F.prototype.onConnectionDetailsUpdate=function(O,D){if(O){this.connectionDetails=O,O.maxMessageSize&&(this.options.maxMessageSize=O.maxMessageSize);var B=O.clientId;if(B){var _=this.realtime.auth._uncheckedSetClientId(B);if(_){f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.onConnectionDetailsUpdate()",_.message),D.fail(_);return}}var $=O.connectionStateTtl;$&&(this.connectionStateTtl=$),this.maxIdleInterval=O.maxIdleInterval,this.emit("connectiondetails",O)}},F.supportedTransports={},F}(y.default);r.default=W}).call(this,i(13))},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(7)),l=o.__importDefault(i(2)),h=function(m){o.__extends(S,m);function S(){var E=m.call(this)||this;return E.messages=[],E}return S.prototype.count=function(){return this.messages.length},S.prototype.push=function(E){this.messages.push(E)},S.prototype.shift=function(){return this.messages.shift()},S.prototype.last=function(){return this.messages[this.messages.length-1]},S.prototype.copyAll=function(){return this.messages.slice()},S.prototype.append=function(E){this.messages.push.apply(this.messages,E)},S.prototype.prepend=function(E){this.messages.unshift.apply(this.messages,E)},S.prototype.completeMessages=function(E,y,R){l.default.logAction(l.default.LOG_MICRO,"MessageQueue.completeMessages()","serial = "+E+"; count = "+y),R=R||null;var f=this.messages;if(f.length===0)throw new Error("MessageQueue.completeMessages(): completeMessages called on any empty MessageQueue");var b=f[0];if(b){var T=b.message.msgSerial,x=E+y;if(x>T)for(var p=f.splice(0,x-T),g=0,C=p;g<C.length;g++){var d=C[g];d.callback(R)}f.length==0&&this.emit("idle")}},S.prototype.completeAllMessages=function(E){this.completeMessages(0,Number.MAX_SAFE_INTEGER||Number.MAX_VALUE,E)},S.prototype.resetSendAttempted=function(){for(var E=0,y=this.messages;E<y.length;E++){var R=y[E];R.sendAttempted=!1}},S.prototype.clear=function(){l.default.logAction(l.default.LOG_MICRO,"MessageQueue.clear()","clearing "+this.messages.length+" messages"),this.messages=[],this.emit("idle")},S}(a.default);r.default=h},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function a(l,h,m,S){this.previous=l,this.current=h,m&&(this.retryIn=m),S&&(this.reason=S)}return a}();r.default=o},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(10)),l=o.__importDefault(i(7)),h=o.__importStar(i(1)),m=o.__importDefault(i(33)),S=o.__importDefault(i(2)),E=o.__importDefault(i(54)),y=o.__importDefault(i(9)),R=o.__importDefault(i(39)),f=o.__importStar(i(4)),b=o.__importDefault(i(16)),T=o.__importDefault(i(21)),x=a.default.Action,p=function(){};function g(c){if(c&&"params"in c&&!h.isObject(c.params))return new f.default("options.params must be an object",4e4,400);if(c&&"modes"in c){if(!h.isArray(c.modes))return new f.default("options.modes must be an array",4e4,400);for(var u=0;u<c.modes.length;u++){var s=c.modes[u];if(!s||typeof s!="string"||!h.arrIn(a.default.channelModes,String.prototype.toUpperCase.call(s)))return new f.default("Invalid channel mode: "+s,4e4,400)}}}var C=function(c){o.__extends(u,c);function u(s,w,v){var k=c.call(this,s,w,v)||this;return k.retryCount=0,k.history=function(L,N){if(S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.history()","channel = "+this.name),N===void 0)if(typeof L=="function")N=L,L=null;else{if(this.rest.options.promises)return h.promisify(this,"history",arguments);N=p}if(L&&L.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 L.untilAttach,L.from_serial=this.properties.attachSerial}m.default.prototype._history.call(this,L,N)},k.whenState=function(L,N){return l.default.prototype.whenState.call(k,L,k.state,N)},S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel()","started; name = "+w),k.realtime=s,k.presence=new E.default(k),k.connectionManager=s.connection.connectionManager,k.state="initialized",k.subscriptions=new l.default,k.syncChannelSerial=void 0,k.properties={attachSerial:void 0,channelSerial:void 0},k.setOptions(v),k.errorReason=null,k._requestedFlags=null,k._mode=null,k._attachResume=!1,k._decodingContext={channelOptions:k.channelOptions,plugins:s.options.plugins||{},baseEncodedPreviousPayload:void 0},k._lastPayload={messageId:null,protocolMessageChannelSerial:null,decodeFailureRecoveryInProgress:null},k._allChannelChanges=new l.default,k}return u.prototype.invalidStateError=function(){return new f.default("Channel operation failed as channel state is "+this.state,90001,400,this.errorReason||void 0)},u.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},u.prototype.setOptions=function(s,w){var v=this.channelOptions;if(!w&&this.rest.options.promises)return h.promisify(this,"setOptions",arguments);var k=w||function(N){N&&S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.setOptions()","Set options failed: "+N.toString())},L=g(s);if(L){k(L);return}m.default.prototype.setOptions.call(this,s),this._decodingContext&&(this._decodingContext.channelOptions=this.channelOptions),this._shouldReattachToSetOptions(s,v)?(this.attachImpl(),this._allChannelChanges.once(["attached","update","detached","failed"],function(N){switch(this.event){case"update":case"attached":k==null||k(null);return;default:k==null||k(N.reason);return}})):k()},u.prototype._shouldReattachToSetOptions=function(s,w){if(!(this.state==="attached"||this.state==="attaching"))return!1;if(s!=null&&s.params){var v=d(s.params),k=d(w.params);if(Object.keys(v).length!==Object.keys(k).length||!h.shallowEquals(k,v))return!0}return!!(s!=null&&s.modes&&(!w.modes||!h.arrEquals(s.modes,w.modes)))},u.prototype.publish=function(){for(var s=this,w=[],v=0;v<arguments.length;v++)w[v]=arguments[v];var k=w[0],L=w.length,N=w[L-1];if(typeof N!="function"){if(this.realtime.options.promises)return h.promisify(this,"publish",arguments);N=p,++L}if(!this.connectionManager.activeState()){N(this.connectionManager.getError());return}if(L==2)if(h.isObject(k))k=[y.default.fromValues(k)];else if(h.isArray(k))k=y.default.fromValuesArray(k);else throw new f.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);else k=[y.default.fromValues({name:w[0],data:w[1]})];var P=this.realtime.options.maxMessageSize;y.default.encodeArray(k,this.channelOptions,function(I){if(I){N(I);return}var M=y.default.getMessagesSize(k);if(M>P){N(new f.default("Maximum size of messages that can be published at once exceeded ( was "+M+" bytes; limit is "+P+" bytes)",40009,400));return}s.__publish(k,N)})},u.prototype.__publish=function(s,w){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.publish()","message count = "+s.length);var v=this.state;switch(v){case"failed":case"suspended":w(f.default.fromValues(this.invalidStateError()));break;default:{S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.publish()","sending message; channel state is "+v);var k=new a.default;k.action=x.MESSAGE,k.channel=this.name,k.messages=s,this.sendMessage(k,w);break}}},u.prototype.onEvent=function(s){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.onEvent()","received message");for(var w=this.subscriptions,v=0;v<s.length;v++){var k=s[v];w.emit(k.name,k)}},u.prototype.attach=function(s,w){var v;if(typeof s=="function"?(w=s,v=null):v=s,!w){if(this.realtime.options.promises)return h.promisify(this,"attach",arguments);w=function(k){k&&S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.attach()","Channel attach failed: "+k.toString())}}if(v)S.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=v;else if(this.state==="attached"){w(null,null);return}this._attach(!1,null,w)},u.prototype._attach=function(s,w,v){v||(v=function(L){L&&S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel._attach()","Channel attach failed: "+L.toString())});var k=this.connectionManager;if(!k.activeState()){v(k.getError());return}(this.state!=="attaching"||s)&&this.requestState("attaching",w),this.once(function(L){switch(this.event){case"attached":v==null||v(null,L);break;case"detached":case"suspended":case"failed":v==null||v(L.reason||k.getError()||new f.default("Unable to attach; reason unknown; state = "+this.event,9e4,500));break;case"detaching":v==null||v(new f.default("Attach request superseded by a subsequent detach request",9e4,409));break}})},u.prototype.attachImpl=function(){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.attachImpl()","sending ATTACH message");var s=a.default.fromValues({action:x.ATTACH,channel:this.name,params:this.channelOptions.params,channelSerial:this.properties.channelSerial});this._requestedFlags?s.encodeModesToFlags(this._requestedFlags):this.channelOptions.modes&&s.encodeModesToFlags(h.allToUpperCase(this.channelOptions.modes)),this._attachResume&&s.setFlag("ATTACH_RESUME"),this._lastPayload.decodeFailureRecoveryInProgress&&(s.channelSerial=this._lastPayload.protocolMessageChannelSerial),this.sendMessage(s,p)},u.prototype.detach=function(s){if(!s){if(this.realtime.options.promises)return h.promisify(this,"detach",arguments);s=p}var w=this.connectionManager;if(!w.activeState()){s(w.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(v){switch(this.event){case"detached":s();break;case"attached":case"suspended":case"failed":s(v.reason||w.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}})}},u.prototype.detachImpl=function(s){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.detach()","sending DETACH message");var w=a.default.fromValues({action:x.DETACH,channel:this.name});this.sendMessage(w,s||p)},u.prototype.subscribe=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];var v=u.processListenerArgs(s),k=v[0],L=v[1],N=v[2];if(!N&&this.realtime.options.promises)return h.promisify(this,"subscribe",[k,L]);if(this.state==="failed"){N==null||N(f.default.fromValues(this.invalidStateError()));return}return k&&typeof k=="object"&&!Array.isArray(k)?this._subscribeFilter(k,L):this.subscriptions.on(k,L),this.attach(N||p)},u.prototype._subscribeFilter=function(s,w){var v=function(k){var L,N,P,I,M,A,j={name:k.name,refTimeserial:(N=(L=k.extras)===null||L===void 0?void 0:L.ref)===null||N===void 0?void 0:N.timeserial,refType:(I=(P=k.extras)===null||P===void 0?void 0:P.ref)===null||I===void 0?void 0:I.type,isRef:!!(!((A=(M=k.extras)===null||M===void 0?void 0:M.ref)===null||A===void 0)&&A.timeserial),clientId:k.clientId};Object.entries(s).find(function(U){var z=U[0],W=U[1];return W!==void 0?j[z]!==W:!1})||w(k)};this._addFilteredSubscription(s,w,v),this.subscriptions.on(v)},u.prototype._addFilteredSubscription=function(s,w,v){var k;if(this.filteredSubscriptions||(this.filteredSubscriptions=new Map),this.filteredSubscriptions.has(w)){var L=this.filteredSubscriptions.get(w);L.set(s,((k=L==null?void 0:L.get(s))===null||k===void 0?void 0:k.concat(v))||[v])}else this.filteredSubscriptions.set(w,new Map([[s,[v]]]))},u.prototype._getAndDeleteFilteredSubscriptions=function(s,w){var v=this;if(!this.filteredSubscriptions)return[];if(!w&&s)return Array.from(this.filteredSubscriptions.entries()).map(function(P){var I,M=P[0],A=P[1],j=A.get(s);return A.delete(s),A.size===0&&((I=v.filteredSubscriptions)===null||I===void 0||I.delete(M)),j}).reduce(function(P,I){var M;return I?(M=P).concat.apply(M,I):P},[]);if(!w||!this.filteredSubscriptions.has(w))return[];var k=this.filteredSubscriptions.get(w);if(!s){var L=Array.from(k.values()).reduce(function(P,I){return P.concat.apply(P,I)},[]);return this.filteredSubscriptions.delete(w),L}var N=k.get(s);return k.delete(s),N||[]},u.prototype.unsubscribe=function(){for(var s=this,w,v=[],k=0;k<arguments.length;k++)v[k]=arguments[k];var L=u.processListenerArgs(v),N=L[0],P=L[1];if(typeof N=="object"&&!P||!((w=this.filteredSubscriptions)===null||w===void 0)&&w.has(P)){this._getAndDeleteFilteredSubscriptions(N,P).forEach(function(I){return s.subscriptions.off(I)});return}this.subscriptions.off(N,P)},u.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 w=a.default.fromValues({action:x.SYNC,channel:this.name});this.syncChannelSerial&&(w.channelSerial=this.syncChannelSerial),s.send(w)},u.prototype.sendMessage=function(s,w){this.connectionManager.send(s,this.realtime.options.queueMessages,w)},u.prototype.sendPresence=function(s,w){var v=a.default.fromValues({action:x.PRESENCE,channel:this.name,presence:h.isArray(s)?b.default.fromValuesArray(s):[b.default.fromValues(s)]});this.sendMessage(v,w)},u.prototype.onMessage=function(s){(s.action===x.ATTACHED||s.action===x.MESSAGE||s.action===x.PRESENCE)&&this.setChannelSerial(s.channelSerial);var w,v=!1;switch(s.action){case x.ATTACHED:{this.properties.attachSerial=s.channelSerial,this._mode=s.getMode(),this.params=s.params||{};var k=s.decodeModesFromFlags();this.modes=k&&h.allToLowerCase(k)||void 0;var L=s.hasFlag("RESUMED"),N=s.hasFlag("HAS_PRESENCE"),P=s.hasFlag("HAS_BACKLOG");if(this.state==="attached"){L||this.presence.onAttached(N);var I=new R.default(this.state,this.state,L,P,s.error);this._allChannelChanges.emit("update",I),(!L||this.channelOptions.updateOnAttached)&&this.emit("update",I)}else this.state==="detaching"?this.checkPendingState():this.notifyState("attached",s.error,L,N,P);break}case x.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 x.SYNC:if(v=!0,w=this.syncChannelSerial=s.channelSerial,!s.presence)break;case x.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],b.default.decode(G,W),G.connectionId||(G.connectionId=U),G.timestamp||(G.timestamp=z),G.id||(G.id=j+":"+F)}catch(X){S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()",X.toString())}this.presence.setPresence(A,v,w);break}case x.MESSAGE:{if(this.state!=="attached"){S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.onMessage()",'Message "'+s.id+'" skipped as this channel "'+this.name+'" state is not "attached" (state is "'+this.state+'").');return}var O=s.messages,D=O[0],B=O[O.length-1],j=s.id,U=s.connectionId,z=s.timestamp;if(D.extras&&D.extras.delta&&D.extras.delta.from!==this._lastPayload.messageId){var _='Delta message decode failure - previous message not available for message "'+s.id+'" on this channel "'+this.name+'".';S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()",_),this._startDecodeFailureRecovery(new f.default(_,40018,400));break}for(var F=0;F<O.length;F++){var _=O[F];try{y.default.decode(_,this._decodingContext)}catch(Z){switch(S.default.logAction(S.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(O);break}case x.ERROR:{var $=s.error;$&&$.code==80016?this.checkPendingState():this.notifyState("failed",f.default.fromValues($));break}default:S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()","Fatal protocol error: unrecognised action ("+s.action+")"),this.connectionManager.abort(T.default.unknownChannelErr())}},u.prototype._startDecodeFailureRecovery=function(s){var w=this;this._lastPayload.decodeFailureRecoveryInProgress||(S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.onMessage()","Starting decode failure recovery process."),this._lastPayload.decodeFailureRecoveryInProgress=!0,this._attach(!0,s,function(){w._lastPayload.decodeFailureRecoveryInProgress=!1}))},u.prototype.onAttached=function(){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.onAttached","activating channel; name = "+this.name)},u.prototype.notifyState=function(s,w,v,k,L){if(S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.notifyState","name = "+this.name+", current state = "+this.state+", notifying state "+s),this.clearStateTimer(),h.arrIn(["detached","suspended","failed"],s)&&(this.properties.channelSerial=null),s!==this.state){this.presence.actOnChannelState(s,k,w),s==="suspended"&&this.connectionManager.state.sendEvents?this.startRetryTimer():this.cancelRetryTimer(),w&&(this.errorReason=w);var N=new R.default(this.state,s,v,L,w),P=s==="failed"?S.default.LOG_ERROR:S.default.LOG_MAJOR;S.default.logAction(P,'Channel state for channel "'+this.name+'"',s+(w?"; reason: "+w:"")),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)}},u.prototype.requestState=function(s,w){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.requestState","name = "+this.name+", state = "+s),this.notifyState(s,w),this.checkPendingState()},u.prototype.checkPendingState=function(){var s=this.connectionManager.state;if(!(s.sendEvents||s.forceQueueEvents)){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.checkPendingState","sendEvents is false; state is "+this.connectionManager.state.state);return}switch(S.default.logAction(S.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}},u.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}},u.prototype.startStateTimerIfNotRunning=function(){var s=this;this.stateTimer||(this.stateTimer=setTimeout(function(){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.startStateTimerIfNotRunning","timer expired"),s.stateTimer=null,s.timeoutPendingState()},this.realtime.options.timeouts.realtimeRequestTimeout))},u.prototype.clearStateTimer=function(){var s=this.stateTimer;s&&(clearTimeout(s),this.stateTimer=null)},u.prototype.startRetryTimer=function(){var s=this;if(!this.retryTimer){this.retryCount++;var w=h.getRetryTime(this.realtime.options.timeouts.channelRetryTimeout,this.retryCount);this.retryTimer=setTimeout(function(){s.state==="suspended"&&s.connectionManager.state.sendEvents&&(s.retryTimer=null,S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel retry timer expired","attempting a new attach"),s.requestState("attaching"))},w)}},u.prototype.cancelRetryTimer=function(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)},u.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)},u.prototype.setChannelSerial=function(s){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.setChannelSerial()","Updating channel serial; serial = "+s+"; previous = "+this.properties.channelSerial),s&&(this.properties.channelSerial=s)},u}(m.default);function d(c){var u=c||{};u.agent;var s=o.__rest(u,["agent"]);return s}r.default=C},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function a(l,h,m,S,E){this.previous=l,this.current=h,h==="attached"&&(this.resumed=m,this.hasBacklog=S),E&&(this.reason=E)}return a}();r.default=o},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(){var a=o,l=a.lib,h=l.WordArray,m=l.Hasher,S=a.algo,E=[],y=S.SHA1=m.extend({_doReset:function(){this._hash=new h.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(R,f){for(var b=this._hash.words,T=b[0],x=b[1],p=b[2],g=b[3],C=b[4],d=0;d<80;d++){if(d<16)E[d]=R[f+d]|0;else{var c=E[d-3]^E[d-8]^E[d-14]^E[d-16];E[d]=c<<1|c>>>31}var u=(T<<5|T>>>27)+C+E[d];d<20?u+=(x&p|~x&g)+1518500249:d<40?u+=(x^p^g)+1859775393:d<60?u+=(x&p|x&g|p&g)-1894007588:u+=(x^p^g)-899497514,C=g,g=p,p=x<<30|x>>>2,x=T,T=u}b[0]=b[0]+T|0,b[1]=b[1]+x|0,b[2]=b[2]+p|0,b[3]=b[3]+g|0,b[4]=b[4]+C|0},_doFinalize:function(){var R=this._data,f=R.words,b=this._nDataBytes*8,T=R.sigBytes*8;return f[T>>>5]|=128<<24-T%32,f[(T+64>>>9<<4)+14]=Math.floor(b/4294967296),f[(T+64>>>9<<4)+15]=b,R.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var R=m.clone.call(this);return R._hash=this._hash.clone(),R}});a.SHA1=m._createHelper(y),a.HmacSHA1=m._createHmacHelper(y)}(),o.SHA1})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});function o(d){if(d===void 0)return"undefined";var c,u;if(d instanceof ArrayBuffer?(u="ArrayBuffer",c=new DataView(d)):d instanceof DataView&&(u="DataView",c=d),!c)return JSON.stringify(d);for(var s=[],w=0;w<d.byteLength;w++){if(w>20){s.push("...");break}var v=c.getUint8(w).toString(16);v.length===1&&(v="0"+v),s.push(v)}return"<"+u+" "+s.join(" ")+">"}function a(d,c,u){for(var s=0,w=u.length;s<w;s++){var v=u.charCodeAt(s);if(v<128){d.setUint8(c++,v>>>0&127|0);continue}if(v<2048){d.setUint8(c++,v>>>6&31|192),d.setUint8(c++,v>>>0&63|128);continue}if(v<65536){d.setUint8(c++,v>>>12&15|224),d.setUint8(c++,v>>>6&63|128),d.setUint8(c++,v>>>0&63|128);continue}if(v<1114112){d.setUint8(c++,v>>>18&7|240),d.setUint8(c++,v>>>12&63|128),d.setUint8(c++,v>>>6&63|128),d.setUint8(c++,v>>>0&63|128);continue}throw new Error("bad codepoint "+v)}}function l(d,c,u){for(var s="",w=c,v=c+u;w<v;w++){var k=d.getUint8(w);if(!(k&128)){s+=String.fromCharCode(k);continue}if((k&224)===192){s+=String.fromCharCode((k&15)<<6|d.getUint8(++w)&63);continue}if((k&240)===224){s+=String.fromCharCode((k&15)<<12|(d.getUint8(++w)&63)<<6|(d.getUint8(++w)&63)<<0);continue}if((k&248)===240){s+=String.fromCharCode((k&7)<<18|(d.getUint8(++w)&63)<<12|(d.getUint8(++w)&63)<<6|(d.getUint8(++w)&63)<<0);continue}throw new Error("Invalid byte "+k.toString(16))}return s}function h(d){for(var c=0,u=0,s=d.length;u<s;u++){var w=d.charCodeAt(u);if(w<128){c+=1;continue}if(w<2048){c+=2;continue}if(w<65536){c+=3;continue}if(w<1114112){c+=4;continue}throw new Error("bad codepoint "+w)}return c}function m(d,c){var u=C(d,c);if(u!==0){var s=new ArrayBuffer(u),w=new DataView(s);return g(d,w,0,c),s}}var S=65536*65536,E=1/S;function y(d,c){return c=c||0,d.getInt32(c)*S+d.getUint32(c+4)}function R(d,c){return c=c||0,d.getUint32(c)*S+d.getUint32(c+4)}function f(d,c,u){u<9223372036854776e3?(d.setInt32(c,Math.floor(u*E)),d.setInt32(c+4,u&-1)):(d.setUint32(c,2147483647),d.setUint32(c+4,2147483647))}function b(d,c,u){u<18446744073709552e3?(d.setUint32(c,Math.floor(u*E)),d.setInt32(c+4,u&-1)):(d.setUint32(c,4294967295),d.setUint32(c+4,4294967295))}var T=function(){function d(c,u){var s=this;this.map=function(w){for(var v={},k=0;k<w;k++){var L=s.parse();v[L]=s.parse()}return v},this.bin=function(w){var v=new ArrayBuffer(w);return new Uint8Array(v).set(new Uint8Array(s.view.buffer,s.offset,w),0),s.offset+=w,v},this.buf=this.bin,this.str=function(w){var v=l(s.view,s.offset,w);return s.offset+=w,v},this.array=function(w){for(var v=new Array(w),k=0;k<w;k++)v[k]=s.parse();return v},this.ext=function(w){return s.offset+=w,{type:s.view.getInt8(s.offset),data:s.buf(w)}},this.parse=function(){var w=s.view.getUint8(s.offset),v,k;if(!(w&128))return s.offset++,w;if((w&240)===128)return k=w&15,s.offset++,s.map(k);if((w&240)===144)return k=w&15,s.offset++,s.array(k);if((w&224)===160)return k=w&31,s.offset++,s.str(k);if((w&224)===224)return v=s.view.getInt8(s.offset),s.offset++,v;switch(w){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 k=s.view.getUint8(s.offset+1),s.offset+=2,s.bin(k);case 197:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.bin(k);case 198:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.bin(k);case 199:return k=s.view.getUint8(s.offset+1),s.offset+=2,s.ext(k);case 200:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.ext(k);case 201:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.ext(k);case 202:return v=s.view.getFloat32(s.offset+1),s.offset+=5,v;case 203:return v=s.view.getFloat64(s.offset+1),s.offset+=9,v;case 204:return v=s.view.getUint8(s.offset+1),s.offset+=2,v;case 205:return v=s.view.getUint16(s.offset+1),s.offset+=3,v;case 206:return v=s.view.getUint32(s.offset+1),s.offset+=5,v;case 207:return v=R(s.view,s.offset+1),s.offset+=9,v;case 208:return v=s.view.getInt8(s.offset+1),s.offset+=2,v;case 209:return v=s.view.getInt16(s.offset+1),s.offset+=3,v;case 210:return v=s.view.getInt32(s.offset+1),s.offset+=5,v;case 211:return v=y(s.view,s.offset+1),s.offset+=9,v;case 212:return k=1,s.offset++,s.ext(k);case 213:return k=2,s.offset++,s.ext(k);case 214:return k=4,s.offset++,s.ext(k);case 215:return k=8,s.offset++,s.ext(k);case 216:return k=16,s.offset++,s.ext(k);case 217:return k=s.view.getUint8(s.offset+1),s.offset+=2,s.str(k);case 218:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.str(k);case 219:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.str(k);case 220:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.array(k);case 221:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.array(k);case 222:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.map(k);case 223:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.map(k)}throw new Error("Unknown type 0x"+w.toString(16))},this.offset=u||0,this.view=c}return d}();function x(d){var c=new DataView(d),u=new T(c),s=u.parse();if(u.offset!==d.byteLength)throw new Error(d.byteLength-u.offset+" trailing bytes");return s}function p(d,c){return Object.keys(d).filter(function(u){var s=d[u],w=typeof s;return(!c||s!=null)&&(w!=="function"||!!s.toJSON)})}function g(d,c,u,s){var w=typeof d;if(typeof d=="string"){var v=h(d);if(v<32)return c.setUint8(u,v|160),a(c,u+1,d),1+v;if(v<256)return c.setUint8(u,217),c.setUint8(u+1,v),a(c,u+2,d),2+v;if(v<65536)return c.setUint8(u,218),c.setUint16(u+1,v),a(c,u+3,d),3+v;if(v<4294967296)return c.setUint8(u,219),c.setUint32(u+1,v),a(c,u+5,d),5+v}if(ArrayBuffer.isView&&ArrayBuffer.isView(d)&&(d=d.buffer),d instanceof ArrayBuffer){var k=d.byteLength;if(k<256)return c.setUint8(u,196),c.setUint8(u+1,k),new Uint8Array(c.buffer).set(new Uint8Array(d),u+2),2+k;if(k<65536)return c.setUint8(u,197),c.setUint16(u+1,k),new Uint8Array(c.buffer).set(new Uint8Array(d),u+3),3+k;if(k<4294967296)return c.setUint8(u,198),c.setUint32(u+1,k),new Uint8Array(c.buffer).set(new Uint8Array(d),u+5),5+k}if(typeof d=="number"){if(Math.floor(d)!==d)return c.setUint8(u,203),c.setFloat64(u+1,d),9;if(d>=0){if(d<128)return c.setUint8(u,d),1;if(d<256)return c.setUint8(u,204),c.setUint8(u+1,d),2;if(d<65536)return c.setUint8(u,205),c.setUint16(u+1,d),3;if(d<4294967296)return c.setUint8(u,206),c.setUint32(u+1,d),5;if(d<18446744073709552e3)return c.setUint8(u,207),b(c,u+1,d),9;throw new Error("Number too big 0x"+d.toString(16))}if(d>=-32)return c.setInt8(u,d),1;if(d>=-128)return c.setUint8(u,208),c.setInt8(u+1,d),2;if(d>=-32768)return c.setUint8(u,209),c.setInt16(u+1,d),3;if(d>=-2147483648)return c.setUint8(u,210),c.setInt32(u+1,d),5;if(d>=-9223372036854776e3)return c.setUint8(u,211),f(c,u+1,d),9;throw new Error("Number too small -0x"+(-d).toString(16).substr(1))}if(w==="undefined")return s?0:(c.setUint8(u,212),c.setUint8(u+1,0),c.setUint8(u+2,0),3);if(d===null)return s?0:(c.setUint8(u,192),1);if(w==="boolean")return c.setUint8(u,d?195:194),1;if(typeof d.toJSON=="function")return g(d.toJSON(),c,u,s);if(w==="object"){var L,N=0,P=void 0,I=Array.isArray(d);if(I?L=d.length:(P=p(d,s),L=P.length),L<16?(c.setUint8(u,L|(I?144:128)),N=1):L<65536?(c.setUint8(u,I?220:222),c.setUint16(u+1,L),N=3):L<4294967296&&(c.setUint8(u,I?221:223),c.setUint32(u+1,L),N=5),I)for(var M=0;M<L;M++)N+=g(d[M],c,u+N,s);else if(P)for(var M=0;M<L;M++){var A=P[M];N+=g(A,c,u+N),N+=g(d[A],c,u+N,s)}return N}if(w==="function")return 0;throw new Error("Unknown type "+w)}function C(d,c){var u=typeof d;if(u==="string"){var s=h(d);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(d)&&(d=d.buffer),d instanceof ArrayBuffer){var w=d.byteLength;if(w<256)return 2+w;if(w<65536)return 3+w;if(w<4294967296)return 5+w}if(typeof d=="number"){if(Math.floor(d)!==d)return 9;if(d>=0){if(d<128)return 1;if(d<256)return 2;if(d<65536)return 3;if(d<4294967296)return 5;if(d<18446744073709552e3)return 9;throw new Error("Number too big 0x"+d.toString(16))}if(d>=-32)return 1;if(d>=-128)return 2;if(d>=-32768)return 3;if(d>=-2147483648)return 5;if(d>=-9223372036854776e3)return 9;throw new Error("Number too small -0x"+d.toString(16).substr(1))}if(u==="boolean")return 1;if(d===null)return c?0:1;if(d===void 0)return c?0:3;if(typeof d.toJSON=="function")return C(d.toJSON(),c);if(u==="object"){var v,k=0;if(Array.isArray(d)){v=d.length;for(var L=0;L<v;L++)k+=C(d[L],c)}else{var N=p(d,c);v=N.length;for(var L=0;L<v;L++){var P=N[L];k+=C(P)+C(d[P],c)}}if(v<16)return 1+k;if(v<65536)return 3+k;if(v<4294967296)return 5+k;throw new Error("Array or object too long 0x"+v.toString(16))}if(u==="function")return 0;throw new Error("Unknown type "+u)}r.default={encode:m,decode:x,inspect:o,utf8Write:a,utf8Read:l,utf8ByteCount:h}},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(30)),l=o.__importDefault(i(50)),h=o.__importDefault(i(3)),m=o.__importDefault(i(4)),S=o.__importDefault(i(55)),E=o.__importDefault(i(57)),y=o.__importDefault(i(62)),R=o.__importDefault(i(64)),f=o.__importDefault(i(68)),b=o.__importDefault(i(2)),T=i(8),x=o.__importDefault(i(65)),p=o.__importDefault(i(66)),g=o.__importDefault(i(41)),C=(0,E.default)(R.default,S.default);h.default.Crypto=C,h.default.BufferUtils=S.default,h.default.Http=y.default,h.default.Config=R.default,h.default.Transports=f.default,h.default.WebStorage=x.default,a.default.Crypto=C,l.default.Crypto=C,b.default.initLogHandlers(),h.default.Defaults=(0,T.getDefaults)(p.default),h.default.Config.agent&&(h.default.Defaults.agent+=" "+h.default.Config.agent),h.default.Config.noUpgrade&&(h.default.Defaults.upgradeTransports=[]),r.default={ErrorInfo:m.default,Rest:a.default,Realtime:l.default,msgpack:g.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,i){(function(o,a){n.exports=a(i(6),i(32),i(25))})(this,function(o){return o.HmacSHA256})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(47)),h=o.__importDefault(i(15)),m=o.__importDefault(i(20)),S=o.__importDefault(i(4)),E=o.__importDefault(i(48)),y=function(){},R=function(){function x(p){this.rest=p,this.admin=new f(p)}return x}(),f=function(){function x(p){this.rest=p,this.deviceRegistrations=new b(p),this.channelSubscriptions=new T(p)}return x.prototype.publish=function(p,g,C){var d=this.rest,c=d.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(d.options,c),s={},w=a.mixin({recipient:p},g);if(typeof C!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);C=y}d.options.headers&&a.mixin(u,d.options.headers),d.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var v=a.encodeBody(w,c);h.default.post(d,"/push/publish",v,u,s,null,function(k){return C(k)})},x}(),b=function(){function x(p){this.rest=p}return x.prototype.save=function(p,g){var C=this.rest,d=l.default.fromValues(p),c=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(C.options,c),s={};if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),C.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var w=a.encodeBody(d,c);h.default.put(C,"/push/deviceRegistrations/"+encodeURIComponent(p.id),w,u,s,null,function(v,k,L,N){g(v,v?void 0:l.default.fromResponseBody(k,N?void 0:c))})},x.prototype.get=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,d),u=p.id||p;if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"get",arguments);g=y}if(typeof u!="string"||!u.length){g(new S.default("First argument to DeviceRegistrations#get must be a deviceId string or DeviceDetails",4e4,400));return}C.options.headers&&a.mixin(c,C.options.headers),h.default.get(C,"/push/deviceRegistrations/"+encodeURIComponent(u),c,{},null,function(s,w,v,k){g(s,s?void 0:l.default.fromResponseBody(w,k?void 0:d))})},x.prototype.list=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:d,u=a.defaultGetHeaders(C.options,d);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),new m.default(C,"/push/deviceRegistrations",u,c,function(s,w,v){return l.default.fromResponseBody(s,v?void 0:d)}).get(p,g)},x.prototype.remove=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,d),u={},s=p.id||p;if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"remove",arguments);g=y}if(typeof s!="string"||!s.length){g(new S.default("First argument to DeviceRegistrations#remove must be a deviceId string or DeviceDetails",4e4,400));return}C.options.headers&&a.mixin(c,C.options.headers),C.options.pushFullWait&&a.mixin(u,{fullWait:"true"}),h.default.delete(C,"/push/deviceRegistrations/"+encodeURIComponent(s),c,u,null,function(w){return g(w)})},x.prototype.removeWhere=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,d);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);g=y}C.options.headers&&a.mixin(c,C.options.headers),C.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),h.default.delete(C,"/push/deviceRegistrations",c,p,null,function(u){return g(u)})},x}(),T=function(){function x(p){this.remove=x.prototype.removeWhere,this.rest=p}return x.prototype.save=function(p,g){var C=this.rest,d=E.default.fromValues(p),c=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(C.options,c),s={};if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),C.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var w=a.encodeBody(d,c);h.default.post(C,"/push/channelSubscriptions",w,u,s,null,function(v,k,L,N){g(v,!v&&E.default.fromResponseBody(k,N?void 0:c))})},x.prototype.list=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:d,u=a.defaultGetHeaders(C.options,d);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),new m.default(C,"/push/channelSubscriptions",u,c,function(s,w,v){return E.default.fromResponseBody(s,v?void 0:d)}).get(p,g)},x.prototype.removeWhere=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,d);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);g=y}C.options.headers&&a.mixin(c,C.options.headers),C.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),h.default.delete(C,"/push/channelSubscriptions",c,p,null,function(u){return g(u)})},x.prototype.listChannels=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:d,u=a.defaultGetHeaders(C.options,d);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"listChannels",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),C.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),new m.default(C,"/push/channels",u,c,function(s,w,v){for(var k=!v&&d?a.decodeBody(s,d):s,L=0;L<k.length;L++)k[L]=String(k[L]);return k}).get(p,g)},x}();r.default=R},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(4)),h;(function(E){E.Phone="phone",E.Tablet="tablet",E.Desktop="desktop",E.TV="tv",E.Watch="watch",E.Car="car",E.Embedded="embedded",E.Other="other"})(h||(h={}));var m;(function(E){E.Android="android",E.IOS="ios",E.Browser="browser"})(m||(m={}));var S=function(){function E(){}return E.prototype.toJSON=function(){var y,R,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:(y=this.push)===null||y===void 0?void 0:y.recipient,state:(R=this.push)===null||R===void 0?void 0:R.state,error:(f=this.push)===null||f===void 0?void 0:f.error}}},E.prototype.toString=function(){var y,R,f,b,T="[DeviceDetails";return this.id&&(T+="; id="+this.id),this.platform&&(T+="; platform="+this.platform),this.formFactor&&(T+="; formFactor="+this.formFactor),this.clientId&&(T+="; clientId="+this.clientId),this.metadata&&(T+="; metadata="+this.metadata),this.deviceIdentityToken&&(T+="; deviceIdentityToken="+JSON.stringify(this.deviceIdentityToken)),!((y=this.push)===null||y===void 0)&&y.recipient&&(T+="; push.recipient="+JSON.stringify(this.push.recipient)),!((R=this.push)===null||R===void 0)&&R.state&&(T+="; push.state="+this.push.state),!((f=this.push)===null||f===void 0)&&f.error&&(T+="; push.error="+JSON.stringify(this.push.error)),!((b=this.push)===null||b===void 0)&&b.metadata&&(T+="; push.metadata="+this.push.metadata),T+="]",T},E.fromResponseBody=function(y,R){return R&&(y=a.decodeBody(y,R)),a.isArray(y)?E.fromValuesArray(y):E.fromValues(y)},E.fromValues=function(y){return y.error=y.error&&l.default.fromValues(y.error),Object.assign(new E,y)},E.fromValuesArray=function(y){for(var R=y.length,f=new Array(R),b=0;b<R;b++)f[b]=E.fromValues(y[b]);return f},E.toRequestBody=a.encodeBody,E}();r.default=S},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=function(){function h(){}return h.prototype.toJSON=function(){return{channel:this.channel,deviceId:this.deviceId,clientId:this.clientId}},h.prototype.toString=function(){var m="[PushChannelSubscription";return this.channel&&(m+="; channel="+this.channel),this.deviceId&&(m+="; deviceId="+this.deviceId),this.clientId&&(m+="; clientId="+this.clientId),m+="]",m},h.fromResponseBody=function(m,S){return S&&(m=a.decodeBody(m,S)),a.isArray(m)?h.fromValuesArray(m):h.fromValues(m)},h.fromValues=function(m){return Object.assign(new h,m)},h.fromValuesArray=function(m){for(var S=m.length,E=new Array(S),y=0;y<S;y++)E[y]=h.fromValues(m[y]);return E},h.toRequestBody=a.encodeBody,h}();r.default=l},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=function(){function C(d){this.count=d&&d.count||0,this.data=d&&d.data||0,this.uncompressedData=d&&d.uncompressedData||0,this.failed=d&&d.failed||0,this.refused=d&&d.refused||0}return C}(),h=function(C){o.__extends(d,C);function d(c){var u=C.call(this,c)||this;return c&&c.category&&(u.category={},a.forInOwnNonNullProperties(c.category,function(s){u.category[s]=new l(c.category[s])})),u}return d}(l),m=function(){function C(d){this.peak=d&&d.peak||0,this.min=d&&d.min||0,this.mean=d&&d.mean||0,this.opened=d&&d.opened||0,this.refused=d&&d.refused||0}return C}(),S=function(){function C(d){this.succeeded=d&&d.succeeded||0,this.failed=d&&d.failed||0,this.refused=d&&d.refused||0}return C}(),E=function(){function C(d){this.plain=new m(d&&d.plain),this.tls=new m(d&&d.tls),this.all=new m(d&&d.all)}return C}(),y=function(){function C(d){this.messages=new h(d&&d.messages),this.presence=new h(d&&d.presence),this.all=new h(d&&d.all)}return C}(),R=function(){function C(d){this.realtime=new y(d&&d.realtime),this.rest=new y(d&&d.rest),this.webhook=new y(d&&d.webhook),this.sharedQueue=new y(d&&d.sharedQueue),this.externalQueue=new y(d&&d.externalQueue),this.httpEvent=new y(d&&d.httpEvent),this.push=new y(d&&d.push),this.all=new y(d&&d.all)}return C}(),f=function(){function C(d){this.all=new y(d&&d.all),this.inbound=new R(d&&d.inbound),this.outbound=new R(d&&d.outbound)}return C}(),b=function(){function C(d){this.all=new y(d&&d.all),this.producerPaid=new f(d&&d.producerPaid),this.consumerPaid=new f(d&&d.consumerPaid)}return C}(),T=function(){function C(d){this.messages=d&&d.messages||0;var c=d&&d.notifications;this.notifications={invalid:c&&c.invalid||0,attempted:c&&c.attempted||0,successful:c&&c.successful||0,failed:c&&c.failed||0},this.directPublishes=d&&d.directPublishes||0}return C}(),x=function(){function C(d){this.succeeded=d&&d.succeeded||0,this.skipped=d&&d.skipped||0,this.failed=d&&d.failed||0}return C}(),p=function(){function C(d){var c=this;this.delta=void 0,d&&d.delta&&(this.delta={},a.forInOwnNonNullProperties(d.delta,function(u){c.delta[u]=new x(d.delta[u])}))}return C}(),g=function(C){o.__extends(d,C);function d(c){var u=C.call(this,c)||this;return u.persisted=new y(c&&c.persisted),u.connections=new E(c&&c.connections),u.channels=new m(c&&c.channels),u.apiRequests=new S(c&&c.apiRequests),u.tokenRequests=new S(c&&c.tokenRequests),u.xchgProducer=new b(c&&c.xchgProducer),u.xchgConsumer=new b(c&&c.xchgConsumer),u.push=new T(c&&c.pushStats),u.processed=new p(c&&c.processed),u.inProgress=c&&c.inProgress||void 0,u.unit=c&&c.unit||void 0,u.intervalId=c&&c.intervalId||void 0,u}return d.fromValues=function(c){return new d(c)},d}(f);r.default=g},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(30)),h=o.__importDefault(i(7)),m=o.__importDefault(i(2)),S=o.__importDefault(i(51)),E=o.__importDefault(i(38)),y=o.__importDefault(i(8)),R=o.__importDefault(i(4)),f=o.__importDefault(i(10)),b=o.__importDefault(i(35)),T=o.__importDefault(i(3)),x=o.__importDefault(i(9)),p=function(C){o.__extends(d,C);function d(c){var u=C.call(this,c)||this;return m.default.logAction(m.default.LOG_MINOR,"Realtime()",""),u.connection=new S.default(u,u.options),u.channels=new g(u),c.autoConnect!==!1&&u.connect(),u}return d.prototype.connect=function(){m.default.logAction(m.default.LOG_MINOR,"Realtime.connect()",""),this.connection.connect()},d.prototype.close=function(){m.default.logAction(m.default.LOG_MINOR,"Realtime.close()",""),this.connection.close()},d.Promise=function(c){return c=y.default.objectifyOptions(c),c.promises=!0,new d(c)},d.Callbacks=d,d.Utils=a,d.ConnectionManager=b.default,d.Platform=T.default,d.ProtocolMessage=f.default,d.Message=x.default,d}(l.default),g=function(C){o.__extends(d,C);function d(c){var u=C.call(this)||this;return u.realtime=c,u.all=Object.create(null),c.connection.connectionManager.on("transport.active",function(){u.onTransportActive()}),u}return d.prototype.channelSerials=function(){for(var c={},u=0,s=a.keysArray(this.all,!0);u<s.length;u++){var w=s[u],v=this.all[w];v.properties.channelSerial&&(c[w]=v.properties.channelSerial)}return c},d.prototype.recoverChannels=function(c){for(var u=0,s=a.keysArray(c,!0);u<s.length;u++){var w=s[u],v=this.get(w);v.properties.channelSerial=c[w]}},d.prototype.onChannelMessage=function(c){var u=c.channel;if(u===void 0){m.default.logAction(m.default.LOG_ERROR,"Channels.onChannelMessage()","received event unspecified channel, action = "+c.action);return}var s=this.all[u];if(!s){m.default.logAction(m.default.LOG_ERROR,"Channels.onChannelMessage()","received event for non-existent channel: "+u);return}s.onMessage(c)},d.prototype.onTransportActive=function(){for(var c in this.all){var u=this.all[c];u.state==="attaching"||u.state==="detaching"?u.checkPendingState():u.state==="suspended"?u._attach(!1,null):u.state==="attached"&&u.requestState("attaching")}},d.prototype.propogateConnectionInterruption=function(c,u){var s={closing:"detached",closed:"detached",failed:"failed",suspended:"suspended"},w=["attaching","attached","detaching","suspended"],v=s[c];for(var k in this.all){var L=this.all[k];a.arrIn(w,L.state)&&L.notifyState(v,u)}},d.prototype.get=function(c,u){c=String(c);var s=this.all[c];if(!s)s=this.all[c]=new E.default(this.realtime,c,u);else if(u){if(s._shouldReattachToSetOptions(u,s.channelOptions))throw new R.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(u)}return s},d.prototype.getDerived=function(c,u,s){if(u.filter){var w=a.toBase64(u.filter),v=a.matchDerivedChannel(c);c="[filter=".concat(w).concat(v.qualifierParam,"]").concat(v.channelName)}return this.get(c,s)},d.prototype.release=function(c){c=String(c);var u=this.all[c];if(u){var s=u.getReleaseErr();if(s)throw s;delete this.all[c]}},d}(h.default);r.default=p},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(7)),h=o.__importDefault(i(35)),m=o.__importDefault(i(2)),S=o.__importDefault(i(37)),E=o.__importDefault(i(3));function y(){}var R=function(f){o.__extends(b,f);function b(T,x){var p=f.call(this)||this;return p.whenState=function(g,C){return l.default.prototype.whenState.call(p,g,p.state,C,new S.default(void 0,g))},p.ably=T,p.connectionManager=new h.default(T,x),p.state=p.connectionManager.state.state,p.key=void 0,p.id=void 0,p.errorReason=null,p.connectionManager.on("connectionstate",function(g){var C=p.state=g.current;E.default.Config.nextTick(function(){p.emit(C,g)})}),p.connectionManager.on("update",function(g){E.default.Config.nextTick(function(){p.emit("update",g)})}),p}return b.prototype.connect=function(){m.default.logAction(m.default.LOG_MINOR,"Connection.connect()",""),this.connectionManager.requestState({state:"connecting"})},b.prototype.ping=function(T){if(m.default.logAction(m.default.LOG_MINOR,"Connection.ping()",""),!T){if(this.ably.options.promises)return a.promisify(this,"ping",arguments);T=y}this.connectionManager.ping(null,T)},b.prototype.close=function(){m.default.logAction(m.default.LOG_MINOR,"Connection.close()","connectionKey = "+this.key),this.connectionManager.requestState({state:"closing"})},Object.defineProperty(b.prototype,"recoveryKey",{get:function(){return this.createRecoveryKey()},enumerable:!1,configurable:!0}),b.prototype.createRecoveryKey=function(){return this.connectionManager.createRecoveryKey()},b}(l.default);r.default=R},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.PendingMessage=void 0;var o=i(0),a=o.__importDefault(i(10)),l=o.__importStar(i(1)),h=o.__importDefault(i(7)),m=o.__importDefault(i(2)),S=o.__importDefault(i(36)),E=o.__importDefault(i(4)),y=a.default.Action,R=function(){function b(T,x){this.message=T,this.callback=x,this.merged=!1;var p=T.action;this.sendAttempted=!1,this.ackRequired=p==y.MESSAGE||p==y.PRESENCE}return b}();r.PendingMessage=R;var f=function(b){o.__extends(T,b);function T(x){var p=b.call(this)||this;return p.transport=x,p.messageQueue=new S.default,x.on("ack",function(g,C){p.onAck(g,C)}),x.on("nack",function(g,C,d){p.onNack(g,C,d)}),p}return T.prototype.onAck=function(x,p){m.default.logAction(m.default.LOG_MICRO,"Protocol.onAck()","serial = "+x+"; count = "+p),this.messageQueue.completeMessages(x,p)},T.prototype.onNack=function(x,p,g){m.default.logAction(m.default.LOG_ERROR,"Protocol.onNack()","serial = "+x+"; count = "+p+"; err = "+l.inspectError(g)),g||(g=new E.default("Unable to send message; channel not responding",50001,500)),this.messageQueue.completeMessages(x,p,g)},T.prototype.onceIdle=function(x){var p=this.messageQueue;if(p.count()===0){x();return}p.once("idle",x)},T.prototype.send=function(x){x.ackRequired&&this.messageQueue.push(x),m.default.shouldLog(m.default.LOG_MICRO)&&m.default.logAction(m.default.LOG_MICRO,"Protocol.send()","sending msg; "+a.default.stringify(x.message)),x.sendAttempted=!0,this.transport.send(x.message)},T.prototype.getTransport=function(){return this.transport},T.prototype.getPendingMessages=function(){return this.messageQueue.copyAll()},T.prototype.clearPendingMessages=function(){return this.messageQueue.clear()},T.prototype.finish=function(){var x=this.transport;this.onceIdle(function(){x.disconnect()})},T}(h.default);r.default=f},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(3)),l=o.__importStar(i(1)),h=o.__importDefault(i(26)),m=o.__importDefault(i(8)),S=o.__importDefault(i(2)),E=o.__importDefault(i(10)),y=o.__importDefault(i(4)),R="web_socket";function f(x){return!!x.on}var b=function(x){o.__extends(p,x);function p(g,C,d){var c=x.call(this,g,C,d)||this;return c.shortName=R,d.heartbeats=a.default.Config.useProtocolHeartbeats,c.wsHost=m.default.getHost(d.options,d.host,!0),c}return p.isAvailable=function(){return!!a.default.Config.WebSocket},p.prototype.createWebSocket=function(g,C){return this.uri=g+l.toQueryString(C),new a.default.Config.WebSocket(this.uri)},p.prototype.toString=function(){return"WebSocketTransport; uri="+this.uri},p.prototype.connect=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","starting"),h.default.prototype.connect.call(this);var g=this,C=this.params,d=C.options,c=d.tls?"wss://":"ws://",u=c+this.wsHost+":"+m.default.getPort(d)+"/";S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","uri: "+u),this.auth.getAuthParams(function(s,w){if(!g.isDisposed){var v="";for(var k in w)v+=" "+k+": "+w[k]+";";if(S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","authParams:"+v+" err: "+s),s){g.disconnect(s);return}var L=C.getConnectParams(w);try{var N=g.wsConnection=g.createWebSocket(u,L);N.binaryType=a.default.Config.binaryType,N.onopen=function(){g.onWsOpen()},N.onclose=function(P){g.onWsClose(P)},N.onmessage=function(P){g.onWsData(P.data)},N.onerror=function(P){g.onWsError(P)},f(N)&&N.on("ping",function(){g.onActivity()})}catch(P){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.connect()","Unexpected exception creating websocket: err = "+(P.stack||P.message)),g.disconnect(P)}}})},p.prototype.send=function(g){var C=this.wsConnection;if(!C){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.send()","No socket connection");return}try{C.send(E.default.serialize(g,this.params.format))}catch(c){var d="Exception from ws connection when trying to send: "+l.inspectError(c);S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.send()",d),this.finish("disconnected",new y.default(d,5e4,500))}},p.prototype.onWsData=function(g){S.default.logAction(S.default.LOG_MICRO,"WebSocketTransport.onWsData()","data received; length = "+g.length+"; type = "+typeof g);try{this.onProtocolMessage(E.default.deserialize(g,this.format))}catch(C){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.onWsData()","Unexpected exception handing channel message: "+C.stack)}},p.prototype.onWsOpen=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsOpen()","opened WebSocket"),this.emit("preconnect")},p.prototype.onWsClose=function(g){var C,d;if(typeof g=="object"?(d=g.code,C=g.wasClean||d===1e3):(d=g,C=d==1e3),delete this.wsConnection,C){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsClose()","Cleanly closed WebSocket");var c=new y.default("Websocket closed",80003,400);this.finish("disconnected",c)}else{var u="Unclean disconnection of WebSocket ; code = "+d,c=new y.default(u,80003,400);S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsClose()",u),this.finish("disconnected",c)}this.emit("disposed")},p.prototype.onWsError=function(g){var C=this;S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onError()","Error from WebSocket: "+g.message),a.default.Config.nextTick(function(){C.disconnect(Error(g.message))})},p.prototype.dispose=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.dispose()",""),this.isDisposed=!0;var g=this.wsConnection;g&&(g.onmessage=function(){},delete this.wsConnection,a.default.Config.nextTick(function(){if(S.default.logAction(S.default.LOG_MICRO,"WebSocketTransport.dispose()","closing websocket"),!g)throw new Error("WebSocketTransport.dispose(): wsConnection is not defined");g.close()}))},p}(h.default);function T(x){return b.isAvailable()&&(x.supportedTransports[R]=b),b}r.default=T},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(34)),h=o.__importDefault(i(7)),m=o.__importDefault(i(2)),S=o.__importDefault(i(16)),E=o.__importStar(i(4)),y=o.__importDefault(i(38)),R=o.__importDefault(i(24)),f=o.__importDefault(i(39)),b=function(){};function T(c){return c.channel.realtime.auth.clientId}function x(c){var u=c.channel.realtime,s=u.auth.clientId;return(!s||s==="*")&&u.connection.state==="connected"}function p(c,u,s){switch(c.state){case"attached":case"suspended":s();break;case"initialized":case"detached":case"detaching":case"attaching":c.attach(function(w){w?u(w):s()});break;default:u(E.default.fromValues(c.invalidStateError()))}}function g(c,u){if(c.isSynthesized()||u.isSynthesized())return c.timestamp>=u.timestamp;var s=c.parseId(),w=u.parseId();return s.msgSerial===w.msgSerial?s.index>w.index:s.msgSerial>w.msgSerial}var C=function(c){o.__extends(u,c);function u(s){var w=c.call(this,s)||this;return w.channel=s,w.syncComplete=!1,w.members=new d(w,function(v){return v.clientId+":"+v.connectionId}),w._myMembers=new d(w,function(v){return v.clientId}),w.subscriptions=new h.default,w.pendingPresence=[],w}return u.prototype.enter=function(s,w){if(x(this))throw new E.default("clientId must be specified to enter a presence channel",40012,400);return this._enterOrUpdateClient(void 0,void 0,s,"enter",w)},u.prototype.update=function(s,w){if(x(this))throw new E.default("clientId must be specified to update presence data",40012,400);return this._enterOrUpdateClient(void 0,void 0,s,"update",w)},u.prototype.enterClient=function(s,w,v){return this._enterOrUpdateClient(void 0,s,w,"enter",v)},u.prototype.updateClient=function(s,w,v){return this._enterOrUpdateClient(void 0,s,w,"update",v)},u.prototype._enterOrUpdateClient=function(s,w,v,k,L){var N=this;if(!L)if(typeof v=="function")L=v,v=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"_enterOrUpdateClient",[s,w,v,k]);L=b}var P=this.channel;if(!P.connectionManager.activeState()){L(P.connectionManager.getError());return}m.default.logAction(m.default.LOG_MICRO,"RealtimePresence."+k+"Client()","channel = "+P.name+", id = "+s+", client = "+(w||"(implicit) "+T(this)));var I=S.default.fromData(v);I.action=k,s&&(I.id=s),w&&(I.clientId=w),S.default.encode(I,P.channelOptions,function(M){if(M){L(M);return}switch(P.state){case"attached":P.sendPresence(I,L);break;case"initialized":case"detached":P.attach();case"attaching":N.pendingPresence.push({presence:I,callback:L});break;default:M=new E.PartialErrorInfo("Unable to "+k+" presence channel while in "+P.state+" state",90001),M.code=90001,L(M)}})},u.prototype.leave=function(s,w){if(x(this))throw new E.default("clientId must have been specified to enter or leave a presence channel",40012,400);return this.leaveClient(void 0,s,w)},u.prototype.leaveClient=function(s,w,v){if(!v)if(typeof w=="function")v=w,w=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"leaveClient",[s,w]);v=b}var k=this.channel;if(!k.connectionManager.activeState()){v==null||v(k.connectionManager.getError());return}m.default.logAction(m.default.LOG_MICRO,"RealtimePresence.leaveClient()","leaving; channel = "+this.channel.name+", client = "+s);var L=S.default.fromData(w);switch(L.action="leave",s&&(L.clientId=s),k.state){case"attached":k.sendPresence(L,v);break;case"attaching":this.pendingPresence.push({presence:L,callback:v});break;case"initialized":case"failed":{var N=new E.PartialErrorInfo("Unable to leave presence channel (incompatible state)",90001);v==null||v(N);break}default:v==null||v(k.invalidStateError())}},u.prototype.get=function(s,w){var v=this,k=Array.prototype.slice.call(arguments);k.length==1&&typeof k[0]=="function"&&k.unshift(null),s=k[0],w=k[1];var L=!s||("waitForSync"in s?s.waitForSync:!0);if(!w){if(this.channel.realtime.options.promises)return a.promisify(this,"get",k);w=b}function N(P){w(null,s?P.list(s):P.values())}if(this.channel.state==="suspended"){L?w(E.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}p(this.channel,w,function(){var P=v.members;L?P.waitSync(function(){N(P)}):N(P)})},u.prototype.history=function(s,w){if(m.default.logAction(m.default.LOG_MICRO,"RealtimePresence.history()","channel = "+this.name),w===void 0)if(typeof s=="function")w=s,s=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"history",arguments);w=b}s&&s.untilAttach&&(this.channel.state==="attached"?(delete s.untilAttach,s.from_serial=this.channel.properties.attachSerial):w(new E.default("option untilAttach requires the channel to be attached, was: "+this.channel.state,4e4,400))),l.default.prototype._history.call(this,s,w)},u.prototype.setPresence=function(s,w,v){m.default.logAction(m.default.LOG_MICRO,"RealtimePresence.setPresence()","received presence for "+s.length+" participants; syncChannelSerial = "+v);var k,L,N=this.members,P=this._myMembers,I=[],M=this.channel.connectionManager.connectionId;w&&(this.members.startSync(),v&&(L=v.match(/^[\w-]+:(.*)$/))&&(k=L[1]));for(var A=0;A<s.length;A++){var j=S.default.fromValues(s[A]);switch(j.action){case"leave":N.remove(j)&&I.push(j),j.connectionId===M&&!j.isSynthesized()&&P.remove(j);break;case"enter":case"present":case"update":N.put(j)&&I.push(j),j.connectionId===M&&P.put(j);break}}w&&!k&&(N.endSync(),this.channel.syncChannelSerial=null);for(var A=0;A<I.length;A++){var j=I[A];this.subscriptions.emit(j.action,j)}},u.prototype.onAttached=function(s){m.default.logAction(m.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 w=this.pendingPresence,v=w.length;if(v){this.pendingPresence=[];var k=[],L=R.default.create();m.default.logAction(m.default.LOG_MICRO,"RealtimePresence.onAttached","sending "+v+" queued presence messages");for(var N=0;N<v;N++){var P=w[N];k.push(P.presence),L.push(P.callback)}this.channel.sendPresence(k,L)}},u.prototype.actOnChannelState=function(s,w,v){switch(s){case"attached":this.onAttached(w);break;case"detached":case"failed":this._clearMyMembers(),this.members.clear();case"suspended":this.failPendingPresence(v);break}},u.prototype.failPendingPresence=function(s){if(this.pendingPresence.length){m.default.logAction(m.default.LOG_MINOR,"RealtimeChannel.failPendingPresence","channel; name = "+this.channel.name+", err = "+a.inspectError(s));for(var w=0;w<this.pendingPresence.length;w++)try{this.pendingPresence[w].callback(s)}catch(v){}this.pendingPresence=[]}},u.prototype._clearMyMembers=function(){this._myMembers.clear()},u.prototype._ensureMyMembersPresent=function(){var s=this,w=this._myMembers,v=function(N){if(N){var P="Presence auto-re-enter failed: "+N.toString(),I=new E.default(P,91004,400);m.default.logAction(m.default.LOG_ERROR,"RealtimePresence._ensureMyMembersPresent()",P);var M=new f.default(s.channel.state,s.channel.state,!0,!1,I);s.channel.emit("update",M)}};for(var k in w.map){var L=w.map[k];m.default.logAction(m.default.LOG_MICRO,"RealtimePresence._ensureMyMembersPresent()",'Auto-reentering clientId "'+L.clientId+'" into the presence set'),this._enterOrUpdateClient(L.id,L.clientId,L.data,"enter",v)}},u.prototype._synthesizeLeaves=function(s){var w=this.subscriptions;a.arrForEach(s,function(v){var k=S.default.fromValues({action:"leave",connectionId:v.connectionId,clientId:v.clientId,data:v.data,encoding:v.encoding,timestamp:a.now()});w.emit("leave",k)})},u.prototype.on=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];m.default.renamedMethod("RealtimePresence","on","subscribe"),this.subscribe.apply(this,s)},u.prototype.off=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];m.default.renamedMethod("RealtimePresence","off","unsubscribe"),this.unsubscribe.apply(this,s)},u.prototype.subscribe=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];var v=y.default.processListenerArgs(s),k=v[0],L=v[1],N=v[2],P=this.channel;if(!N){if(this.channel.realtime.options.promises)return a.promisify(this,"subscribe",[k,L]);N=b}if(P.state==="failed"){N(E.default.fromValues(P.invalidStateError()));return}this.subscriptions.on(k,L),P.attach(N)},u.prototype.unsubscribe=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];var v=y.default.processListenerArgs(s),k=v[0],L=v[1];this.subscriptions.off(k,L)},u}(l.default),d=function(c){o.__extends(u,c);function u(s,w){var v=c.call(this)||this;return v.presence=s,v.map=Object.create(null),v.syncInProgress=!1,v.residualMembers=null,v.memberKey=w,v}return u.prototype.get=function(s){return this.map[s]},u.prototype.getClient=function(s){var w=this.map,v=[];for(var k in w){var L=w[k];L.clientId==s&&L.action!="absent"&&v.push(L)}return v},u.prototype.list=function(s){var w=this.map,v=s&&s.clientId,k=s&&s.connectionId,L=[];for(var N in w){var P=w[N];P.action!=="absent"&&(v&&v!=P.clientId||k&&k!=P.connectionId||L.push(P))}return L},u.prototype.put=function(s){(s.action==="enter"||s.action==="update")&&(s=S.default.fromValues(s),s.action="present");var w=this.map,v=this.memberKey(s);this.residualMembers&&delete this.residualMembers[v];var k=w[v];return k&&!g(s,k)?!1:(w[v]=s,!0)},u.prototype.values=function(){var s=this.map,w=[];for(var v in s){var k=s[v];k.action!="absent"&&w.push(k)}return w},u.prototype.remove=function(s){var w=this.map,v=this.memberKey(s),k=w[v];return k&&!g(s,k)?!1:(this.syncInProgress?(s=S.default.fromValues(s),s.action="absent",w[v]=s):delete w[v],!0)},u.prototype.startSync=function(){var s=this.map,w=this.syncInProgress;m.default.logAction(m.default.LOG_MINOR,"PresenceMap.startSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),this.syncInProgress||(this.residualMembers=a.copy(s),this.setInProgress(!0))},u.prototype.endSync=function(){var s=this.map,w=this.syncInProgress;if(m.default.logAction(m.default.LOG_MINOR,"PresenceMap.endSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),w){for(var v in s){var k=s[v];k.action==="absent"&&delete s[v]}this.presence._synthesizeLeaves(a.valuesArray(this.residualMembers));for(var v in this.residualMembers)delete s[v];this.residualMembers=null,this.setInProgress(!1)}this.emit("sync")},u.prototype.waitSync=function(s){var w=this.syncInProgress;if(m.default.logAction(m.default.LOG_MINOR,"PresenceMap.waitSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),!w){s();return}this.once("sync",s)},u.prototype.clear=function(){this.map={},this.setInProgress(!1),this.residualMembers=null},u.prototype.setInProgress=function(s){m.default.logAction(m.default.LOG_MICRO,"PresenceMap.setInProgress()","inProgress = "+s),this.syncInProgress=s,this.presence.syncComplete=!s},u}(h.default);r.default=C},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=i(56),l=i(31),h=i(11),m=o.__importDefault(i(5)),S=o.__importDefault(i(3)),E=function(){function y(){this.base64CharSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",this.hexCharSet="0123456789abcdef"}return y.prototype.isWordArray=function(R){return R!=null&&R.sigBytes!==void 0},y.prototype.isArrayBuffer=function(R){return R!=null&&R.constructor===ArrayBuffer},y.prototype.isTypedArray=function(R){return!!ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(R)},y.prototype.uint8ViewToBase64=function(R){for(var f="",b=this.base64CharSet,T=R.byteLength,x=T%3,p=T-x,g,C,d,c,u,s=0;s<p;s=s+3)u=R[s]<<16|R[s+1]<<8|R[s+2],g=(u&16515072)>>18,C=(u&258048)>>12,d=(u&4032)>>6,c=u&63,f+=b[g]+b[C]+b[d]+b[c];return x==1?(u=R[p],g=(u&252)>>2,C=(u&3)<<4,f+=b[g]+b[C]+"=="):x==2&&(u=R[p]<<8|R[p+1],g=(u&64512)>>10,C=(u&1008)>>4,d=(u&15)<<2,f+=b[g]+b[C]+b[d]+"="),f},y.prototype.base64ToArrayBuffer=function(R){for(var f=atob==null?void 0:atob(R),b=f.length,T=new Uint8Array(b),x=0;x<b;x++){var p=f.charCodeAt(x);T[x]=p}return T.buffer},y.prototype.isBuffer=function(R){return this.isArrayBuffer(R)||this.isWordArray(R)||this.isTypedArray(R)},y.prototype.toBuffer=function(R){if(!ArrayBuffer)throw new Error("Can't convert to Buffer: browser does not support the necessary types");if(this.isArrayBuffer(R))return new Uint8Array(R);if(this.isTypedArray(R))return new Uint8Array(R.buffer);if(this.isWordArray(R)){for(var f=new ArrayBuffer(R.sigBytes),b=new Uint8Array(f),T=0;T<R.sigBytes;T++)b[T]=R.words[T>>>2]>>>24-T%4*8&255;return b}throw new Error("BufferUtils.toBuffer expected an arraybuffer, typed array, or CryptoJS wordarray")},y.prototype.toArrayBuffer=function(R){return this.isArrayBuffer(R)?R:this.toBuffer(R).buffer},y.prototype.toWordArray=function(R){return this.isTypedArray(R)&&(R=R.buffer),this.isWordArray(R)?R:m.default.create(R)},y.prototype.base64Encode=function(R){return this.isWordArray(R)?(0,h.stringify)(R):this.uint8ViewToBase64(this.toBuffer(R))},y.prototype.base64Decode=function(R){return ArrayBuffer&&S.default.Config.atob?this.base64ToArrayBuffer(R):(0,h.parse)(R)},y.prototype.hexEncode=function(R){return(0,a.stringify)(this.toWordArray(R))},y.prototype.hexDecode=function(R){var f=(0,a.parse)(R);return ArrayBuffer?this.toArrayBuffer(f):f},y.prototype.utf8Encode=function(R){return S.default.Config.TextEncoder?new S.default.Config.TextEncoder().encode(R).buffer:(0,l.parse)(R)},y.prototype.utf8Decode=function(R){if(!this.isBuffer(R))throw new Error("Expected input of utf8decode to be an arraybuffer, typed array, or CryptoJS wordarray");return TextDecoder&&!this.isWordArray(R)?new TextDecoder().decode(R):(R=this.toWordArray(R),(0,l.stringify)(R))},y.prototype.bufferCompare=function(R,f){if(!R)return-1;if(!f)return 1;var b=this.toWordArray(R),T=this.toWordArray(f);b.clamp(),T.clamp();var x=b.sigBytes-T.sigBytes;if(x!=0)return x;for(var p=b.words,g=T.words,C=0;C<p.length;C++)if(x=p[C]-g[C],x!=0)return x;return 0},y.prototype.byteLength=function(R){return this.isArrayBuffer(R)||this.isTypedArray(R)?R.byteLength:this.isWordArray(R)?R.sigBytes:-1},y.prototype.typedArrayToBuffer=function(R){return R.buffer},y}();r.default=new E},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return o.enc.Hex})},function(n,r,i){i.r(r);var o=i(5),a=i.n(o),l=i(11),h=i(23),m=i.n(h),S=i(2),E=i.n(S),y=i(4),R=i.n(y),f=function(b,T){var x="aes",p=256,g="cbc",C=16,d=4,c=4294967296,u=2147483648,s;if(b.getRandomWordArray)s=b.getRandomWordArray;else if(typeof Uint32Array!="undefined"&&b.getRandomValues){var w=new Uint32Array(d);s=function(A,j){var U=A/4,z=U==d?w:new Uint32Array(U);b.getRandomValues(z,function(W){typeof j!="undefined"&&j(W,T.toWordArray(z))})}}else s=function(A,j){E.a.logAction(E.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()*c)-u;j(null,a.a.create(z))};function v(A){return A+C&-16}function k(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 L(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 P(){}function I(){this.algorithm=null,this.keyLength=null,this.mode=null,this.key=null}P.CipherParams=I,P.getDefaultParams=function(A){var j;if(typeof A=="function"||typeof A=="string"){if(E.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")E.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)."),P.generateRandomKey(function(z){A(null,P.getDefaultParams({key:z}))});else if(typeof arguments[1]=="function")E.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,P.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(l.parse)(L(A.key)):j=T.toWordArray(A.key);var U=new I;if(U.key=j,U.algorithm=A.algorithm||x,U.keyLength=j.words.length*(4*8),U.mode=A.mode||g,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 k(U),U},P.generateRandomKey=function(A,j){arguments.length==1&&typeof A=="function"&&(j=A,A=void 0),s((A||p)/8,function(U,z){j!==void 0&&j(U?R.a.fromValues(U):null,z)})},P.getCipher=function(A){var j=A instanceof I?A:P.getDefaultParams(A);return{cipherParams:j,cipher:new M(j,d,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=T.toWordArray(A.key),U&&(this.iv=T.toWordArray(U).clone()),this.blockLengthWords=j}return M.prototype.encrypt=function(A,j){E.a.logAction(E.a.LOG_MICRO,"CBCCipher.encrypt()",""),A=T.toWordArray(A);var U=A.sigBytes,z=v(U),W=this,G=function(){W.getIv(function(F,O){if(F){j(F);return}var D=W.encryptCipher.process(A.concat(N[z-U])),B=O.concat(D);j(null,B)})};this.encryptCipher?G():this.iv?(this.encryptCipher=m.a.algo[this.cjsAlgorithm].createEncryptor(this.key,{iv:this.iv}),G()):s(C,function(F,O){if(F){j(F);return}W.encryptCipher=m.a.algo[W.cjsAlgorithm].createEncryptor(W.key,{iv:O}),W.iv=O,G()})},M.prototype.decrypt=function(A){E.a.logAction(E.a.LOG_MICRO,"CBCCipher.decrypt()",""),A=T.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=m.a.algo[this.cjsAlgorithm].createDecryptor(this.key,{iv:z}),F=G.process(W),O=G.finalize();return G.reset(),O&&O.sigBytes&&F.concat(O),F},M.prototype.getIv=function(A){if(this.iv){var j=this.iv;this.iv=null,A(null,j);return}var U=this;s(C,function(z,W){if(z){A(z);return}A(null,U.encryptCipher.process(W))})},P};r.default=f},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(){var a=o,l=a.lib,h=l.WordArray,m=a.enc;m.Utf16=m.Utf16BE={stringify:function(E){for(var y=E.words,R=E.sigBytes,f=[],b=0;b<R;b+=2){var T=y[b>>>2]>>>16-b%4*8&65535;f.push(String.fromCharCode(T))}return f.join("")},parse:function(E){for(var y=E.length,R=[],f=0;f<y;f++)R[f>>>1]|=E.charCodeAt(f)<<16-f%2*16;return h.create(R,y*2)}},m.Utf16LE={stringify:function(E){for(var y=E.words,R=E.sigBytes,f=[],b=0;b<R;b+=2){var T=S(y[b>>>2]>>>16-b%4*8&65535);f.push(String.fromCharCode(T))}return f.join("")},parse:function(E){for(var y=E.length,R=[],f=0;f<y;f++)R[f>>>1]|=S(E.charCodeAt(f)<<16-f%2*16);return h.create(R,y*2)}};function S(E){return E<<8&4278255360|E>>>8&16711935}}(),o.enc.Utf16})},function(n,r,i){(function(o,a){n.exports=a(i(6),i(28))})(this,function(o){return function(a){var l=o,h=l.lib,m=h.CipherParams,S=l.enc,E=S.Hex,y=l.format;y.Hex={stringify:function(R){return R.ciphertext.toString(E)},parse:function(R){var f=E.parse(R);return m.create({ciphertext:f})}}}(),o.format.Hex})},function(n,r,i){(function(o,a){n.exports=a(i(6),i(11),i(61),i(27),i(28))})(this,function(o){return function(){var a=o,l=a.lib,h=l.BlockCipher,m=a.algo,S=[],E=[],y=[],R=[],f=[],b=[],T=[],x=[],p=[],g=[];(function(){for(var c=[],u=0;u<256;u++)u<128?c[u]=u<<1:c[u]=u<<1^283;for(var s=0,w=0,u=0;u<256;u++){var v=w^w<<1^w<<2^w<<3^w<<4;v=v>>>8^v&255^99,S[s]=v,E[v]=s;var k=c[s],L=c[k],N=c[L],P=c[v]*257^v*16843008;y[s]=P<<24|P>>>8,R[s]=P<<16|P>>>16,f[s]=P<<8|P>>>24,b[s]=P;var P=N*16843009^L*65537^k*257^s*16843008;T[v]=P<<24|P>>>8,x[v]=P<<16|P>>>16,p[v]=P<<8|P>>>24,g[v]=P,s?(s=k^c[c[c[N^k]]],w^=c[c[w]]):s=w=1}})();var C=[0,1,2,4,8,16,32,64,128,27,54],d=m.AES=h.extend({_doReset:function(){var c;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var u=this._keyPriorReset=this._key,s=u.words,w=u.sigBytes/4,v=this._nRounds=w+6,k=(v+1)*4,L=this._keySchedule=[],N=0;N<k;N++)N<w?L[N]=s[N]:(c=L[N-1],N%w?w>6&&N%w==4&&(c=S[c>>>24]<<24|S[c>>>16&255]<<16|S[c>>>8&255]<<8|S[c&255]):(c=c<<8|c>>>24,c=S[c>>>24]<<24|S[c>>>16&255]<<16|S[c>>>8&255]<<8|S[c&255],c^=C[N/w|0]<<24),L[N]=L[N-w]^c);for(var P=this._invKeySchedule=[],I=0;I<k;I++){var N=k-I;if(I%4)var c=L[N];else var c=L[N-4];I<4||N<=4?P[I]=c:P[I]=T[S[c>>>24]]^x[S[c>>>16&255]]^p[S[c>>>8&255]]^g[S[c&255]]}}},encryptBlock:function(c,u){this._doCryptBlock(c,u,this._keySchedule,y,R,f,b,S)},decryptBlock:function(c,u){var s=c[u+1];c[u+1]=c[u+3],c[u+3]=s,this._doCryptBlock(c,u,this._invKeySchedule,T,x,p,g,E);var s=c[u+1];c[u+1]=c[u+3],c[u+3]=s},_doCryptBlock:function(c,u,s,w,v,k,L,N){for(var P=this._nRounds,I=c[u]^s[0],M=c[u+1]^s[1],A=c[u+2]^s[2],j=c[u+3]^s[3],U=4,z=1;z<P;z++){var W=w[I>>>24]^v[M>>>16&255]^k[A>>>8&255]^L[j&255]^s[U++],G=w[M>>>24]^v[A>>>16&255]^k[j>>>8&255]^L[I&255]^s[U++],F=w[A>>>24]^v[j>>>16&255]^k[I>>>8&255]^L[M&255]^s[U++],O=w[j>>>24]^v[I>>>16&255]^k[M>>>8&255]^L[A&255]^s[U++];I=W,M=G,A=F,j=O}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++],O=(N[j>>>24]<<24|N[I>>>16&255]<<16|N[M>>>8&255]<<8|N[A&255])^s[U++];c[u]=W,c[u+1]=G,c[u+2]=F,c[u+3]=O},keySize:256/32});a.AES=h._createHelper(d)}(),o.AES})},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(a){var l=o,h=l.lib,m=h.WordArray,S=h.Hasher,E=l.algo,y=[];(function(){for(var p=0;p<64;p++)y[p]=a.abs(a.sin(p+1))*4294967296|0})();var R=E.MD5=S.extend({_doReset:function(){this._hash=new m.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,g){for(var C=0;C<16;C++){var d=g+C,c=p[d];p[d]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360}var u=this._hash.words,s=p[g+0],w=p[g+1],v=p[g+2],k=p[g+3],L=p[g+4],N=p[g+5],P=p[g+6],I=p[g+7],M=p[g+8],A=p[g+9],j=p[g+10],U=p[g+11],z=p[g+12],W=p[g+13],G=p[g+14],F=p[g+15],O=u[0],D=u[1],B=u[2],_=u[3];O=f(O,D,B,_,s,7,y[0]),_=f(_,O,D,B,w,12,y[1]),B=f(B,_,O,D,v,17,y[2]),D=f(D,B,_,O,k,22,y[3]),O=f(O,D,B,_,L,7,y[4]),_=f(_,O,D,B,N,12,y[5]),B=f(B,_,O,D,P,17,y[6]),D=f(D,B,_,O,I,22,y[7]),O=f(O,D,B,_,M,7,y[8]),_=f(_,O,D,B,A,12,y[9]),B=f(B,_,O,D,j,17,y[10]),D=f(D,B,_,O,U,22,y[11]),O=f(O,D,B,_,z,7,y[12]),_=f(_,O,D,B,W,12,y[13]),B=f(B,_,O,D,G,17,y[14]),D=f(D,B,_,O,F,22,y[15]),O=b(O,D,B,_,w,5,y[16]),_=b(_,O,D,B,P,9,y[17]),B=b(B,_,O,D,U,14,y[18]),D=b(D,B,_,O,s,20,y[19]),O=b(O,D,B,_,N,5,y[20]),_=b(_,O,D,B,j,9,y[21]),B=b(B,_,O,D,F,14,y[22]),D=b(D,B,_,O,L,20,y[23]),O=b(O,D,B,_,A,5,y[24]),_=b(_,O,D,B,G,9,y[25]),B=b(B,_,O,D,k,14,y[26]),D=b(D,B,_,O,M,20,y[27]),O=b(O,D,B,_,W,5,y[28]),_=b(_,O,D,B,v,9,y[29]),B=b(B,_,O,D,I,14,y[30]),D=b(D,B,_,O,z,20,y[31]),O=T(O,D,B,_,N,4,y[32]),_=T(_,O,D,B,M,11,y[33]),B=T(B,_,O,D,U,16,y[34]),D=T(D,B,_,O,G,23,y[35]),O=T(O,D,B,_,w,4,y[36]),_=T(_,O,D,B,L,11,y[37]),B=T(B,_,O,D,I,16,y[38]),D=T(D,B,_,O,j,23,y[39]),O=T(O,D,B,_,W,4,y[40]),_=T(_,O,D,B,s,11,y[41]),B=T(B,_,O,D,k,16,y[42]),D=T(D,B,_,O,P,23,y[43]),O=T(O,D,B,_,A,4,y[44]),_=T(_,O,D,B,z,11,y[45]),B=T(B,_,O,D,F,16,y[46]),D=T(D,B,_,O,v,23,y[47]),O=x(O,D,B,_,s,6,y[48]),_=x(_,O,D,B,I,10,y[49]),B=x(B,_,O,D,G,15,y[50]),D=x(D,B,_,O,N,21,y[51]),O=x(O,D,B,_,z,6,y[52]),_=x(_,O,D,B,k,10,y[53]),B=x(B,_,O,D,j,15,y[54]),D=x(D,B,_,O,w,21,y[55]),O=x(O,D,B,_,M,6,y[56]),_=x(_,O,D,B,F,10,y[57]),B=x(B,_,O,D,P,15,y[58]),D=x(D,B,_,O,W,21,y[59]),O=x(O,D,B,_,L,6,y[60]),_=x(_,O,D,B,U,10,y[61]),B=x(B,_,O,D,v,15,y[62]),D=x(D,B,_,O,A,21,y[63]),u[0]=u[0]+O|0,u[1]=u[1]+D|0,u[2]=u[2]+B|0,u[3]=u[3]+_|0},_doFinalize:function(){var p=this._data,g=p.words,C=this._nDataBytes*8,d=p.sigBytes*8;g[d>>>5]|=128<<24-d%32;var c=a.floor(C/4294967296),u=C;g[(d+64>>>9<<4)+15]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,g[(d+64>>>9<<4)+14]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360,p.sigBytes=(g.length+1)*4,this._process();for(var s=this._hash,w=s.words,v=0;v<4;v++){var k=w[v];w[v]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}return s},clone:function(){var p=S.clone.call(this);return p._hash=this._hash.clone(),p}});function f(p,g,C,d,c,u,s){var w=p+(g&C|~g&d)+c+s;return(w<<u|w>>>32-u)+g}function b(p,g,C,d,c,u,s){var w=p+(g&d|C&~d)+c+s;return(w<<u|w>>>32-u)+g}function T(p,g,C,d,c,u,s){var w=p+(g^C^d)+c+s;return(w<<u|w>>>32-u)+g}function x(p,g,C,d,c,u,s){var w=p+(C^(g|~d))+c+s;return(w<<u|w>>>32-u)+g}l.MD5=S._createHelper(R),l.HmacMD5=S._createHmacHelper(R)}(Math),o.MD5})},function(n,r,i){var o;Object.defineProperty(r,"__esModule",{value:!0});var a=i(0),l=a.__importDefault(i(3)),h=a.__importStar(i(1)),m=a.__importDefault(i(8)),S=i(4),E=a.__importDefault(i(19)),y=a.__importDefault(i(17)),R=a.__importDefault(i(22)),f=a.__importDefault(i(2)),b=i(29),T=a.__importDefault(i(63)),x=i(14);function p(d){var c=d.statusCode;return c===408&&!d.code||c===400&&!d.code||c>=500&&c<=504}function g(d){var c=d.connection,u=c&&c.connectionManager.host;return u?[u].concat(m.default.getFallbackHosts(d.options)):m.default.getHosts(d.options)}var C=(o=function(){function d(c){this.checksInProgress=null,this.checkConnectivity=void 0,this.supportsAuthHeaders=!1,this.supportsLinkHeaders=!1,this._getHosts=g,this.options=c||{};var u=this.options.connectivityCheckUrl||m.default.connectivityCheckUrl,s=this.options.connectivityCheckParams,w=!this.options.connectivityCheckUrl;l.default.Config.xhrSupported?(this.supportsAuthHeaders=!0,this.Request=function(v,k,L,N,P,I,M){var A=y.default.createRequest(L,N,P,I,R.default.REQ_SEND,k&&k.options.timeouts,v);return A.once("complete",M),A.exec(),A},this.options.disableConnectivityCheck?this.checkConnectivity=function(v){v(null,!0)}:this.checkConnectivity=function(v){f.default.logAction(f.default.LOG_MICRO,"(XHRRequest)Http.checkConnectivity()","Sending; "+u),this.doUri(E.default.Get,null,u,null,null,s,function(k,L,N,P,I){var M=!1;w?M=!k&&(L==null?void 0:L.replace(/\n/,""))=="yes":M=!k&&(0,x.isSuccessCode)(I),f.default.logAction(f.default.LOG_MICRO,"(XHRRequest)Http.checkConnectivity()","Result: "+M),v(null,M)})}):l.default.Config.jsonpSupported?(this.Request=function(v,k,L,N,P,I,M){var A=(0,b.createRequest)(L,N,P,I,R.default.REQ_SEND,k&&k.options.timeouts,v);return A.once("complete",M),l.default.Config.nextTick(function(){A.exec()}),A},this.options.disableConnectivityCheck?this.checkConnectivity=function(v){v(null,!0)}:this.checkConnectivity=function(v){var k=this,L=m.default.jsonpInternetUpUrl;if(this.checksInProgress){this.checksInProgress.push(v);return}this.checksInProgress=[v],f.default.logAction(f.default.LOG_MICRO,"(JSONP)Http.checkConnectivity()","Sending; "+L);var N=new b.Request("isTheInternetUp",L,null,null,null,R.default.REQ_SEND,m.default.TIMEOUTS);N.once("complete",function(P,I){var M=!P&&I;f.default.logAction(f.default.LOG_MICRO,"(JSONP)Http.checkConnectivity()","Result: "+M);for(var A=0;A<k.checksInProgress.length;A++)k.checksInProgress[A](null,M);k.checksInProgress=null}),l.default.Config.nextTick(function(){N.exec()})}):l.default.Config.fetchSupported?(this.supportsAuthHeaders=!0,this.Request=T.default,this.checkConnectivity=function(v){f.default.logAction(f.default.LOG_MICRO,"(Fetch)Http.checkConnectivity()","Sending; "+u),this.doUri(E.default.Get,null,u,null,null,null,function(k,L){var N=!k&&(L==null?void 0:L.replace(/\n/,""))=="yes";f.default.logAction(f.default.LOG_MICRO,"(Fetch)Http.checkConnectivity()","Result: "+N),v(null,N)})}):this.Request=function(v,k,L,N,P,I,M){M(new S.PartialErrorInfo("no supported HTTP transports available",null,400),null)}}return d.prototype.do=function(c,u,s,w,v,k,L){var N=this,P=typeof s=="function"?s:function(j){return u.baseUri(j)+s},I=u._currentFallback;if(I)if(I.validUntil>h.now()){if(!this.Request){L==null||L(new S.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(c,u,P(I.host),w,k,v,function(j){for(var U=[],z=1;z<arguments.length;z++)U[z-1]=arguments[z];if(j&&p(j)){u._currentFallback=null,N.do(c,u,s,w,v,k,L);return}L==null||L.apply(void 0,a.__spreadArray([j],U,!1))});return}else u._currentFallback=null;var M=g(u);if(M.length===1){this.doUri(c,u,P(M[0]),w,v,k,L);return}var A=function(j,U){var z=j.shift();N.doUri(c,u,P(z),w,v,k,function(W){for(var G=[],F=1;F<arguments.length;F++)G[F-1]=arguments[F];if(W&&p(W)&&j.length){A(j,!0);return}U&&(u._currentFallback={host:z,validUntil:h.now()+u.options.timeouts.fallbackRetryTimeout}),L==null||L.apply(void 0,a.__spreadArray([W],G,!1))})};A(M)},d.prototype.doUri=function(c,u,s,w,v,k,L){if(!this.Request){L(new S.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(c,u,s,w,k,v,L)},d}(),o.methods=[E.default.Get,E.default.Delete,E.default.Post,E.default.Put,E.default.Patch],o.methodsWithoutBody=[E.default.Get,E.default.Delete],o.methodsWithBody=[E.default.Post,E.default.Put,E.default.Patch],o);r.default=C},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(4)),l=o.__importDefault(i(3)),h=o.__importDefault(i(8)),m=o.__importStar(i(1)),S=i(1);function E(f,b){return!!b.get("x-ably-errorcode")}function y(f,b){if(E(f,b))return f.error&&a.default.fromValues(f.error)}function R(f,b,T,x,p,g,C){var d=new Headers(x||{}),c=f?f.toUpperCase():m.isEmptyArg(g)?"GET":"POST",u=new AbortController,s=setTimeout(function(){u.abort(),C(new a.PartialErrorInfo("Request timed out",null,408))},b?b.options.timeouts.httpRequestTimeout:h.default.TIMEOUTS.httpRequestTimeout),w={method:c,headers:d,body:g};l.default.Config.isWebworker||(w.credentials=d.has("authorization")?"include":"same-origin"),(0,S.getGlobalObject)().fetch(T+"?"+new URLSearchParams(p||{}),w).then(function(v){clearTimeout(s);var k=v.headers.get("Content-Type"),L;k&&k.indexOf("application/x-msgpack")>-1?L=v.arrayBuffer():k&&k.indexOf("application/json")>-1?L=v.json():L=v.text(),L.then(function(N){var P=!!k&&k.indexOf("application/x-msgpack")===-1;if(v.ok)C(null,N,v.headers,P,v.status);else{var I=y(N,v.headers)||new a.PartialErrorInfo("Error response received from server: "+v.status+" body was: "+l.default.Config.inspect(N),null,v.status);C(I,N,v.headers,P,v.status)}})}).catch(function(v){clearTimeout(s),C(v)})}r.default=R},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(41)),l=o.__importStar(i(1)),h=l.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 m(){var R=h.location;return!h.WebSocket||!R||!R.origin||R.origin.indexOf("http")>-1}var S=h.navigator&&h.navigator.userAgent.toString(),E=h.location&&h.location.href,y={agent:"browser",logTimestamps:!0,userAgent:S,currentUrl:E,noUpgrade:S&&!!S.match(/MSIE\s8\.0/),binaryType:"arraybuffer",WebSocket:h.WebSocket,fetchSupported:!!h.fetch,xhrSupported:h.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,jsonpSupported:typeof document!="undefined",allowComet:m(),streamingSupported:!0,useProtocolHeartbeats:!0,createHmac:null,msgpack:a.default,supportsBinary:!!h.TextDecoder,preferBinary:!1,ArrayBuffer:h.ArrayBuffer,atob:h.atob,nextTick:typeof h.setImmediate!="undefined"?h.setImmediate.bind(h):function(R){setTimeout(R,0)},addEventListener:h.addEventListener,inspect:JSON.stringify,stringByteSize:function(R){return h.TextDecoder&&new h.TextEncoder().encode(R).length||R.length},TextEncoder:h.TextEncoder,TextDecoder:h.TextDecoder,Promise:h.Promise,getRandomValues:function(R){if(R!==void 0)return function(f,b){R.getRandomValues(f),b&&b(null)}}(h.crypto||msCrypto)};r.default=y},function(n,r,i){(function(o){Object.defineProperty(r,"__esModule",{value:!0});var a=i(0),l=a.__importStar(i(1)),h="ablyjs-storage-test",m=function(){function S(){try{o.sessionStorage.setItem(h,h),o.sessionStorage.removeItem(h),this.sessionSupported=!0}catch(E){this.sessionSupported=!1}try{o.localStorage.setItem(h,h),o.localStorage.removeItem(h),this.localSupported=!0}catch(E){this.localSupported=!1}}return S.prototype.get=function(E){return this._get(E,!1)},S.prototype.getSession=function(E){return this._get(E,!0)},S.prototype.remove=function(E){return this._remove(E,!1)},S.prototype.removeSession=function(E){return this._remove(E,!0)},S.prototype.set=function(E,y,R){return this._set(E,y,R,!1)},S.prototype.setSession=function(E,y,R){return this._set(E,y,R,!0)},S.prototype._set=function(E,y,R,f){var b={value:y};return R&&(b.expires=l.now()+R),this.storageInterface(f).setItem(E,JSON.stringify(b))},S.prototype._get=function(E,y){if(y&&!this.sessionSupported)throw new Error("Session Storage not supported");if(!y&&!this.localSupported)throw new Error("Local Storage not supported");var R=this.storageInterface(y).getItem(E);if(!R)return null;var f=JSON.parse(R);return f.expires&&f.expires<l.now()?(this.storageInterface(y).removeItem(E),null):f.value},S.prototype._remove=function(E,y){return this.storageInterface(y).removeItem(E)},S.prototype.storageInterface=function(E){return E?o.sessionStorage:o.localStorage},S}();r.default=new m}).call(this,i(13))},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(67)),l={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=l},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o;(function(a){a.WebSocket="web_socket",a.Comet="comet",a.XhrStreaming="xhr_streaming",a.XhrPolling="xhr_polling",a.JsonP="jsonp"})(o||(o={})),r.default=o},function(n,r,i){i.r(r);var o=i(29),a=i.n(o),l=i(1),h=i(3),m=i.n(h),S=i(12),E=i.n(S),y=i(17),R=i.n(y),f=function(p){var g="xhr_polling";function C(d,c,u){u.stream=!1,E.a.call(this,d,c,u),this.shortName=g}return l.inherits(C,E.a),C.isAvailable=function(){return m.a.Config.xhrSupported&&m.a.Config.allowComet},C.prototype.toString=function(){return"XHRPollingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},C.prototype.createRequest=function(d,c,u,s,w){return R.a.createRequest(d,c,u,s,w,this.timeouts)},typeof p!="undefined"&&C.isAvailable()&&(p.supportedTransports[g]=C),C},b=f,T=function(p){var g="xhr_streaming";function C(d,c,u){E.a.call(this,d,c,u),this.shortName=g}return l.inherits(C,E.a),C.isAvailable=function(){return m.a.Config.xhrSupported&&m.a.Config.streamingSupported&&m.a.Config.allowComet},C.prototype.toString=function(){return"XHRStreamingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},C.prototype.createRequest=function(d,c,u,s,w){return R.a.createRequest(d,c,u,s,w,this.timeouts)},typeof p!="undefined"&&C.isAvailable()&&(p.supportedTransports[g]=C),C},x=T;r.default=[a.a,b,x]}]).default})})(nd);var Ug=nd.exports;const Bg=he(Ug),xo=(e,t,n,r,i)=>ot(this,null,function*(){try{const o=new Bg.Realtime({token:e.token,clientId:e.clientId});o.connection.on("connected",()=>{i==null||i("connected")}),o.connection.on("failed",h=>{console.error("[❌ ABLY CONNECTION FAILED]",h),i==null||i("failed")}),o.connection.on("disconnected",()=>{i==null||i("disconnected")});const a=`room:${t}:${n}`,l=o.channels.get(a);return l.subscribe("messages",h=>{var m;try{const S=(m=h.data)==null?void 0:m.message;if(S&&S.role==="employee"){const E={id:S.id||wt(),text:S.content||"",sender:"bot",timestamp:S.createdAt?new Date(S.createdAt):new Date,type:S.type};r(E)}}catch(S){console.error("[❌ MESSAGE PARSING ERROR]",S)}}),{client:o,channel:l}}catch(o){throw console.error("[❌ ABLY INITIALIZATION ERROR]",o),o}}),_g=(e,t)=>ot(this,null,function*(){try{const n=td(),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}}),rd=e=>{e&&e.close()},id=()=>({id:wt(),text:"Lo siento, hubo un problema con la conexión. Esta es una respuesta de demostración.",sender:"bot",timestamp:new Date().toISOString(),type:"text"}),od=(e,t,n,r)=>{const i=jg(t,e),o={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:i};return{conversationId:e,conversation:o,chatbotUid:n.apiKey}},ad=e=>ot(this,null,function*(){try{const t=Ng(),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}}),sd=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||wt(),text:e.content,sender:"bot",timestamp:t,type:e.type}}return null},zg=e=>`¡Hola! Soy ${e||"tu asistente"}, ¿En qué te puedo ayudar?
|
|
91
146
|
|
|
92
147
|
Aunque no lo creas, soy una inteligencia artificial! Puedo resolver todas tus dudas 😊
|
|
93
148
|
|
|
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(()=>Zo(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(Zo(e))}),[e]),oe.useEffect(()=>{n(Zo(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:""};let nf=!1,qo=null;const rf=e=>{try{e&&(nf=!0),qo&&(qo.destroy(),qo=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;let r;n.shadowRoot?(r=n.shadowRoot,r.innerHTML=""):r=n.attachShadow({mode:"open"});const o=document.createElement("style");o.textContent=ap,r.appendChild(o);const i=document.createElement("div");r.appendChild(i);const a=_c(i);return a.render(gf.createElement(ip,{config:t})),{root:a,destroy:()=>{a.unmount(),qo=null},getConversationId:()=>Jc()}}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});
|
|
149
|
+
También puedes pedir hablar con nuestro equipo de los sueños!`,ld=e=>({id:wt(),text:zg(e),sender:"bot",timestamp:new Date().toISOString(),type:"text"}),ud=()=>typeof window!="undefined"&&window.innerWidth<640,Hg=({config:e})=>{if(!e.apiKey)return console.warn("WebChat: apiKey is required but not provided in config"),null;const[t,n]=ne.useState(()=>wo(e)),[r,i]=ne.useState(!1),[o,a]=ne.useState(()=>ud()),[l,h]=ne.useState(""),[m,S]=ne.useState(!1),[E,y]=ne.useState(!1),[R,f]=ne.useState(!1),[b,T]=ne.useState(""),[,x]=ne.useState(null),p=ne.useRef(null),[g,C]=ne.useState(!1),[d,c]=ne.useState(!1),[u,s]=ne.useState(""),[w,v]=ne.useState([e.initialMessage?{id:wt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString(),type:"text"}:ld(e.title)]),k=ne.useCallback((U,z="bot")=>{v(W=>[...W,U]),!r&&(U.sender==="bot"||z==="bot")&&U.id!==u&&C(!0)},[r,u]);ne.useEffect(()=>{const U=()=>{const z=ud();a(z)};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),ne.useEffect(()=>Ig(()=>{n(wo(e))}),[e]),ne.useEffect(()=>{n(wo(e))},[e]),ne.useEffect(()=>{ot(this,null,function*(){const z=Yf();h(z);const W=yield qf();T(W)})},[]),ne.useEffect(()=>{if(w.length>0){const U=w[w.length-1];U.sender==="bot"&&s(U.id)}},[]);const L=ne.useCallback(U=>{k(U,"ably")},[k]),N=ne.useCallback(U=>ot(this,null,function*(){if(!(d||p.current))try{if(U.tokenDetails){const z=yield xo(U.tokenDetails,e.apiKey||"",l,L);x(z),p.current=z.client,c(!0)}}catch(z){console.error("[❌ ABLY SETUP ERROR from history]",z)}}),[d,l,L]),P=ne.useCallback(()=>ot(this,null,function*(){if(!(d||p.current))try{const U=yield _g(l,e.apiKey||"");if(U!=null&&U.tokenDetails){const z=yield xo(U.tokenDetails,e.apiKey||"",l,L);x(z),p.current=z.client,c(!0)}}catch(U){console.error("[❌ ABLY SETUP ERROR from endpoint]",U)}}),[d,l,e.apiKey,L]),I=ne.useCallback(()=>ot(this,null,function*(){var z,W;const U=r;if(i(G=>!G),!U){C(!1);const G=w.filter(F=>F.sender==="bot").slice(-1)[0];G&&s(G.id)}if(!U&&!m&&l&&Zf()&&!d){y(!0);const G=yield Lg(l,e.apiKey||"");if(((W=(z=G==null?void 0:G.conversation)==null?void 0:z.messages)==null?void 0:W.length)>0){const F=Dg(G.conversation.messages);v(F);const O=F.filter(D=>D.sender==="bot").slice(-1)[0];O&&s(O.id),yield N(G)}else console.warn("WebChat: No conversation history found, showing initial message");y(!1),S(!0)}else!U&&Zf()&&!d?yield P():U||console.warn("WebChat: Chat opened - no existing conversation to fetch")}),[r,l,m,d,e.apiKey,N,P,w]),M=ne.useCallback(()=>{i(!1)},[]),A=ne.useCallback(U=>ot(this,null,function*(){const z=new Date().toISOString(),W={id:wt(),text:U,sender:"user",timestamp:z,type:"text"};v(F=>[...F,W]),f(!0);const G=[...w,W];try{const F=od(l,G,{apiKey:e.apiKey||""},b),O=yield ad(F);if(O){if(O.response.tokenDetails&&!p.current){const B=yield xo(O.response.tokenDetails,e.apiKey||"",l,L);x(B),p.current=B.client,c(!0)}const D=sd(O.response.message);D&&k(D,"bot")}else{setTimeout(()=>{const D=id();k(D,"bot"),f(!1)},1e3);return}}catch(F){console.error("WebChat: Error in message handling:",F),setTimeout(()=>{const O=id();k(O,"bot"),f(!1)},1e3);return}f(!1),Tg(!0)}),[l,w,e.apiKey,b,L,k]),j=Mg(e);return ne.useEffect(()=>()=>{rd(p.current),p.current=null},[]),V.jsxs("div",{className:"nbc-font-sans",style:{zIndex:2147483647},children:[V.jsx(Bp,{isOpen:r,onClick:I,primaryColor:t.primaryColor,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,hasNewMessages:g,isMobile:o}),V.jsx(Rg,{isOpen:r,onClose:M,config:t,messages:w,onSendMessage:A,isLoading:E,isAiTyping:R,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,isMobile:o,apiKeyMissing:!e.apiKey})]})},cd='*,: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-2{margin-bottom:.5rem}.nbc-mb-4{margin-bottom:1rem}.nbc-ml-2{margin-left:.5rem}.nbc-mr-3{margin-right:.75rem}.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-0{min-height:0px}.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-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-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / 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-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / 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-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / 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-no-underline{text-decoration-line:none}.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}',Fg={apiKey:"",primaryColor:"#111111",avatar:"",title:"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:""},Gg=({title:e,primaryColor:t="#3b82f6",avatar:n})=>{const r={backgroundColor:t};return V.jsxs("div",{style:r,className:"nbc-flex nbc-items-center nbc-p-4",children:[V.jsx("div",{className:"nbc-flex nbc-items-center nbc-mr-3 nbc-text-black",children:n?V.jsx("img",{src:n,alt:"Avatar",className:"nbc-w-8 nbc-h-8 nbc-rounded-full nbc-object-cover"}):V.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:[V.jsx("path",{d:"M12 6V2H8"}),V.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"}),V.jsx("path",{d:"M2 12h2"}),V.jsx("path",{d:"M9 11v2"}),V.jsx("path",{d:"M15 11v2"}),V.jsx("path",{d:"M20 12h2"})]})}),V.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]})},Wg=({footerText:e,primaryColor:t="#3b82f6"})=>{if(!e)return null;const n=r=>{const i=/(https?:\/\/[^\s]+)/g;return r.split(i).map((a,l)=>i.test(a)?V.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"nbc-font-medium nbc-no-underline",style:{color:t},children:a},l):a)};return V.jsx("div",{className:"nbc-py-3 nbc-px-4 nbc-bg-gray-50 nbc-border-t nbc-border-gray-200 nbc-text-xs nbc-text-gray-500 nbc-text-center nbc-leading-relaxed",children:n(e)})},$g=({config:e,messages:t,onSendMessage:n,isLoading:r,isAiTyping:i})=>{const o=(l,h="auto")=>l===void 0?h:typeof l=="number"?`${l}px`:l,a={width:o(e.width,"100%"),height:o(e.height,"400px"),maxWidth:o(e.maxWidth,"100%"),maxHeight:o(e.maxHeight,"100vh"),minWidth:o(e.minWidth,"280px"),minHeight:o(e.minHeight,"300px"),display:"flex",flexDirection:"column",backgroundColor:"#ffffff",borderRadius:o(e.borderRadius,"12px"),border:e.border||"1px solid #e5e7eb",boxShadow:e.boxShadow||"0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'};return V.jsxs("div",{style:a,children:[e.showHeader!==!1&&V.jsx(Gg,{title:e.title||"Chat",primaryColor:e.primaryColor,avatar:e.avatar}),V.jsxs("div",{className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-min-h-0",children:[r?V.jsx("div",{className:"nbc-flex-1 nbc-p-4",children:V.jsx($f,{})}):V.jsx("div",{className:"nbc-flex-1 nbc-overflow-y-auto",children:V.jsx(Gf,{messages:t,isTyping:i||!1,avatar:e.avatar})}),V.jsx("div",{className:"nbc-p-4 nbc-border-t nbc-border-gray-200 nbc-bg-gray-50",children:V.jsx(Wf,{onSendMessage:n,placeholder:e.placeholder||"Escribe un mensaje...",primaryColor:e.primaryColor,disabled:r})})]}),e.showFooter!==!1&&e.footerText&&V.jsx(Wg,{footerText:e.footerText,primaryColor:e.primaryColor})]})},fd=({config:e})=>{if(!e.apiKey)return console.warn("EmbedChat: apiKey is required but not provided in config"),null;const[t,n]=ne.useState(""),[r,i]=ne.useState(!1),[o,a]=ne.useState(""),[,l]=ne.useState(null),h=ne.useRef(null),[,m]=ne.useState(!1),[S,E]=ne.useState([e.initialMessage?{id:wt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString(),type:"text"}:ld(e.title)]),y=ne.useCallback(b=>{E(T=>[...T,b])},[]);ne.useEffect(()=>{ot(this,null,function*(){const T=yield qf();a(T)})},[]);const R=ne.useCallback(b=>{y(b)},[y]),f=ne.useCallback(b=>ot(this,null,function*(){if(!b.trim())return;let T=t;T||(T=wt(),n(T));const x={id:wt(),text:b,sender:"user",timestamp:new Date().toISOString(),conversationId:T,type:"text"};y(x),i(!0);const p=[...S,x];try{const g=od(T,p,{apiKey:e.apiKey||""},o),C=yield ad(g);if(C){if(C.response.tokenDetails&&!h.current){const c=yield xo(C.response.tokenDetails,e.apiKey||"",T,R);l(c),h.current=c.client,m(!0)}const d=sd(C.response.message);d&&y(d)}i(!1)}catch(g){console.error("EmbedChat: Error sending message:",g),i(!1)}}),[t,o,e.apiKey,y,R,S]);return ne.useEffect(()=>()=>{h.current&&rd(h.current)},[]),V.jsx($g,{config:e,messages:S,onSendMessage:f,isLoading:!1,isAiTyping:r})};let dd=!1,So=null;const hd=e=>{try{e&&(dd=!0),So&&(So.destroy(),So=null);const t=me(me({elementId:"webchat-notchatbot"},Fg),e),n=document.getElementById(t.elementId);if(!n)return console.error(`WebChat: Element with id "${t.elementId}" not found`),null;let r;n.shadowRoot?(r=n.shadowRoot,r.innerHTML=""):r=n.attachShadow({mode:"open"});const i=document.createElement("style");i.textContent=cd,r.appendChild(i);const o=document.createElement("div");r.appendChild(o);const a=_s(o);return a.render(Mo.createElement(Hg,{config:t})),{root:a,destroy:()=>{a.unmount(),So=null},getConversationId:()=>Yf()}}catch(t){return console.error("WebChat: Failed to initialize",t),null}},Vg=e=>{try{if(!e.elementId)return console.error("EmbedChat: elementId is required"),null;const t=document.getElementById(e.elementId);if(!t)return console.error(`EmbedChat: Element with id "${e.elementId}" not found`),null;let n;t.shadowRoot?(n=t.shadowRoot,n.innerHTML=""):n=t.attachShadow({mode:"open"});const r=document.createElement("style");r.textContent=cd,n.appendChild(r);const i=document.createElement("div");n.appendChild(i);const o=_s(i);return o.render(Mo.createElement(fd,{config:e})),{destroy:()=>{o.unmount()},updateConfig:a=>{const l=me(me({},e),a);o.render(Mo.createElement(fd,{config:l}))}}}catch(t){return console.error("EmbedChat: Failed to initialize",t),null}},pd={initialize:hd},gd={initialize:Vg};if(typeof window!="undefined"){window.WebChat=pd,window.EmbedChat=gd;const e=()=>{if(!dd){let n=document.getElementById("webchat-notchatbot");n||(n=document.createElement("div"),n.id="webchat-notchatbot",document.body.appendChild(n)),hd()}const t=new CustomEvent("WebChatReady");document.dispatchEvent(t)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e,0)}be.EmbedChatAPI=gd,be.WebChat=pd,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})});
|