voxnix 1.0.14 → 1.0.16

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.
@@ -15,7 +15,7 @@ var OmnixWidget=function(zy){"use strict";var Ut=typeof globalThis<"u"?globalThi
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */Wh.exports;var PS;function LT(){return PS||(PS=1,function(o,r){process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var i="18.3.1",l=Symbol.for("react.element"),f=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),w=Symbol.for("react.provider"),C=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),j=Symbol.for("react.offscreen"),z=Symbol.iterator,O="@@iterator";function B(D){if(D===null||typeof D!="object")return null;var V=z&&D[z]||D[O];return typeof V=="function"?V:null}var U={current:null},q={transition:null},K={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},Z={current:null},ee={},A=null;function Ce(D){A=D}ee.setExtraStackFrame=function(D){A=D},ee.getCurrentStack=null,ee.getStackAddendum=function(){var D="";A&&(D+=A);var V=ee.getCurrentStack;return V&&(D+=V()||""),D};var X=!1,F=!1,L=!1,M=!1,_e=!1,be={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:q,ReactCurrentOwner:Z};be.ReactDebugCurrentFrame=ee,be.ReactCurrentActQueue=K;function $e(D){{for(var V=arguments.length,ce=new Array(V>1?V-1:0),ve=1;ve<V;ve++)ce[ve-1]=arguments[ve];Ee("warn",D,ce)}}function ge(D){{for(var V=arguments.length,ce=new Array(V>1?V-1:0),ve=1;ve<V;ve++)ce[ve-1]=arguments[ve];Ee("error",D,ce)}}function Ee(D,V,ce){{var ve=be.ReactDebugCurrentFrame,Ie=ve.getStackAddendum();Ie!==""&&(V+="%s",ce=ce.concat([Ie]));var pt=ce.map(function(Ue){return String(Ue)});pt.unshift("Warning: "+V),Function.prototype.apply.call(console[D],console,pt)}}var He={};function De(D,V){{var ce=D.constructor,ve=ce&&(ce.displayName||ce.name)||"ReactClass",Ie=ve+"."+V;if(He[Ie])return;ge("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",V,ve),He[Ie]=!0}}var $={isMounted:function(D){return!1},enqueueForceUpdate:function(D,V,ce){De(D,"forceUpdate")},enqueueReplaceState:function(D,V,ce,ve){De(D,"replaceState")},enqueueSetState:function(D,V,ce,ve){De(D,"setState")}},G=Object.assign,he={};Object.freeze(he);function le(D,V,ce){this.props=D,this.context=V,this.refs=he,this.updater=ce||$}le.prototype.isReactComponent={},le.prototype.setState=function(D,V){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,V,"setState")},le.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};{var Je={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},Ge=function(D,V){Object.defineProperty(le.prototype,D,{get:function(){$e("%s(...) is deprecated in plain JavaScript React classes. %s",V[0],V[1])}})};for(var ut in Je)Je.hasOwnProperty(ut)&&Ge(ut,Je[ut])}function Se(){}Se.prototype=le.prototype;function Te(D,V,ce){this.props=D,this.context=V,this.refs=he,this.updater=ce||$}var mt=Te.prototype=new Se;mt.constructor=Te,G(mt,le.prototype),mt.isPureReactComponent=!0;function dr(){var D={current:null};return Object.seal(D),D}var zr=Array.isArray;function Yt(D){return zr(D)}function Xt(D){{var V=typeof Symbol=="function"&&Symbol.toStringTag,ce=V&&D[Symbol.toStringTag]||D.constructor.name||"Object";return ce}}function Fr(D){try{return br(D),!1}catch{return!0}}function br(D){return""+D}function nn(D){if(Fr(D))return ge("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Xt(D)),br(D)}function Tn(D,V,ce){var ve=D.displayName;if(ve)return ve;var Ie=V.displayName||V.name||"";return Ie!==""?ce+"("+Ie+")":ce}function vn(D){return D.displayName||"Context"}function qr(D){if(D==null)return null;if(typeof D.tag=="number"&&ge("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof D=="function")return D.displayName||D.name||null;if(typeof D=="string")return D;switch(D){case p:return"Fragment";case f:return"Portal";case S:return"Profiler";case v:return"StrictMode";case R:return"Suspense";case T:return"SuspenseList"}if(typeof D=="object")switch(D.$$typeof){case C:var V=D;return vn(V)+".Consumer";case w:var ce=D;return vn(ce._context)+".Provider";case b:return Tn(D,D.render,"ForwardRef");case H:var ve=D.displayName||null;return ve!==null?ve:qr(D.type)||"Memo";case P:{var Ie=D,pt=Ie._payload,Ue=Ie._init;try{return qr(Ue(pt))}catch{return null}}}return null}var tr=Object.prototype.hasOwnProperty,ar={key:!0,ref:!0,__self:!0,__source:!0},Pr,ui,Kr;Kr={};function Qr(D){if(tr.call(D,"ref")){var V=Object.getOwnPropertyDescriptor(D,"ref").get;if(V&&V.isReactWarning)return!1}return D.ref!==void 0}function Rn(D){if(tr.call(D,"key")){var V=Object.getOwnPropertyDescriptor(D,"key").get;if(V&&V.isReactWarning)return!1}return D.key!==void 0}function ta(D,V){var ce=function(){Pr||(Pr=!0,ge("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",V))};ce.isReactWarning=!0,Object.defineProperty(D,"key",{get:ce,configurable:!0})}function ra(D,V){var ce=function(){ui||(ui=!0,ge("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",V))};ce.isReactWarning=!0,Object.defineProperty(D,"ref",{get:ce,configurable:!0})}function Pe(D){if(typeof D.ref=="string"&&Z.current&&D.__self&&Z.current.stateNode!==D.__self){var V=qr(Z.current.type);Kr[V]||(ge('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',V,D.ref),Kr[V]=!0)}}var rt=function(D,V,ce,ve,Ie,pt,Ue){var xt={$$typeof:l,type:D,key:V,ref:ce,props:Ue,_owner:pt};return xt._store={},Object.defineProperty(xt._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(xt,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ve}),Object.defineProperty(xt,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ie}),Object.freeze&&(Object.freeze(xt.props),Object.freeze(xt)),xt};function _t(D,V,ce){var ve,Ie={},pt=null,Ue=null,xt=null,Lt=null;if(V!=null){Qr(V)&&(Ue=V.ref,Pe(V)),Rn(V)&&(nn(V.key),pt=""+V.key),xt=V.__self===void 0?null:V.__self,Lt=V.__source===void 0?null:V.__source;for(ve in V)tr.call(V,ve)&&!ar.hasOwnProperty(ve)&&(Ie[ve]=V[ve])}var Jt=arguments.length-2;if(Jt===1)Ie.children=ce;else if(Jt>1){for(var Ir=Array(Jt),Dr=0;Dr<Jt;Dr++)Ir[Dr]=arguments[Dr+2];Object.freeze&&Object.freeze(Ir),Ie.children=Ir}if(D&&D.defaultProps){var Mt=D.defaultProps;for(ve in Mt)Ie[ve]===void 0&&(Ie[ve]=Mt[ve])}if(pt||Ue){var Tr=typeof D=="function"?D.displayName||D.name||"Unknown":D;pt&&ta(Ie,Tr),Ue&&ra(Ie,Tr)}return rt(D,pt,Ue,xt,Lt,Z.current,Ie)}function rr(D,V){var ce=rt(D.type,V,D.ref,D._self,D._source,D._owner,D.props);return ce}function Sr(D,V,ce){if(D==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var ve,Ie=G({},D.props),pt=D.key,Ue=D.ref,xt=D._self,Lt=D._source,Jt=D._owner;if(V!=null){Qr(V)&&(Ue=V.ref,Jt=Z.current),Rn(V)&&(nn(V.key),pt=""+V.key);var Ir;D.type&&D.type.defaultProps&&(Ir=D.type.defaultProps);for(ve in V)tr.call(V,ve)&&!ar.hasOwnProperty(ve)&&(V[ve]===void 0&&Ir!==void 0?Ie[ve]=Ir[ve]:Ie[ve]=V[ve])}var Dr=arguments.length-2;if(Dr===1)Ie.children=ce;else if(Dr>1){for(var Mt=Array(Dr),Tr=0;Tr<Dr;Tr++)Mt[Tr]=arguments[Tr+2];Ie.children=Mt}return rt(D.type,pt,Ue,xt,Lt,Jt,Ie)}function Mr(D){return typeof D=="object"&&D!==null&&D.$$typeof===l}var Or=".",gn=":";function wr(D){var V=/[=:]/g,ce={"=":"=0",":":"=2"},ve=D.replace(V,function(Ie){return ce[Ie]});return"$"+ve}var yr=!1,hr=/\/+/g;function vi(D){return D.replace(hr,"$&/")}function An(D,V){return typeof D=="object"&&D!==null&&D.key!=null?(nn(D.key),wr(""+D.key)):V.toString(36)}function Hi(D,V,ce,ve,Ie){var pt=typeof D;(pt==="undefined"||pt==="boolean")&&(D=null);var Ue=!1;if(D===null)Ue=!0;else switch(pt){case"string":case"number":Ue=!0;break;case"object":switch(D.$$typeof){case l:case f:Ue=!0}}if(Ue){var xt=D,Lt=Ie(xt),Jt=ve===""?Or+An(xt,0):ve;if(Yt(Lt)){var Ir="";Jt!=null&&(Ir=vi(Jt)+"/"),Hi(Lt,V,Ir,"",function(m0){return m0})}else Lt!=null&&(Mr(Lt)&&(Lt.key&&(!xt||xt.key!==Lt.key)&&nn(Lt.key),Lt=rr(Lt,ce+(Lt.key&&(!xt||xt.key!==Lt.key)?vi(""+Lt.key)+"/":"")+Jt)),V.push(Lt));return 1}var Dr,Mt,Tr=0,Xr=ve===""?Or:ve+gn;if(Yt(D))for(var Mo=0;Mo<D.length;Mo++)Dr=D[Mo],Mt=Xr+An(Dr,Mo),Tr+=Hi(Dr,V,ce,Mt,Ie);else{var Hc=B(D);if(typeof Hc=="function"){var Ws=D;Hc===Ws.entries&&(yr||$e("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),yr=!0);for(var Ic=Hc.call(Ws),Al,g0=0;!(Al=Ic.next()).done;)Dr=Al.value,Mt=Xr+An(Dr,g0++),Tr+=Hi(Dr,V,ce,Mt,Ie)}else if(pt==="object"){var cd=String(D);throw new Error("Objects are not valid as a React child (found: "+(cd==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":cd)+"). If you meant to render a collection of children, use an array instead.")}}return Tr}function ja(D,V,ce){if(D==null)return D;var ve=[],Ie=0;return Hi(D,ve,"","",function(pt){return V.call(ce,pt,Ie++)}),ve}function qs(D){var V=0;return ja(D,function(){V++}),V}function cs(D,V,ce){ja(D,function(){V.apply(this,arguments)},ce)}function fs(D){return ja(D,function(V){return V})||[]}function ds(D){if(!Mr(D))throw new Error("React.Children.only expected to receive a single React element child.");return D}function hs(D){var V={$$typeof:C,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};V.Provider={$$typeof:w,_context:V};var ce=!1,ve=!1,Ie=!1;{var pt={$$typeof:C,_context:V};Object.defineProperties(pt,{Provider:{get:function(){return ve||(ve=!0,ge("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),V.Provider},set:function(Ue){V.Provider=Ue}},_currentValue:{get:function(){return V._currentValue},set:function(Ue){V._currentValue=Ue}},_currentValue2:{get:function(){return V._currentValue2},set:function(Ue){V._currentValue2=Ue}},_threadCount:{get:function(){return V._threadCount},set:function(Ue){V._threadCount=Ue}},Consumer:{get:function(){return ce||(ce=!0,ge("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),V.Consumer}},displayName:{get:function(){return V.displayName},set:function(Ue){Ie||($e("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",Ue),Ie=!0)}}}),V.Consumer=pt}return V._currentRenderer=null,V._currentRenderer2=null,V}var Yn=-1,In=0,pr=1,kn=2;function Ii(D){if(D._status===Yn){var V=D._result,ce=V();if(ce.then(function(pt){if(D._status===In||D._status===Yn){var Ue=D;Ue._status=pr,Ue._result=pt}},function(pt){if(D._status===In||D._status===Yn){var Ue=D;Ue._status=kn,Ue._result=pt}}),D._status===Yn){var ve=D;ve._status=In,ve._result=ce}}if(D._status===pr){var Ie=D._result;return Ie===void 0&&ge(`lazy: Expected the result of a dynamic import() call. Instead received: %s
18
+ */Wh.exports;var PS;function LT(){return PS||(PS=1,function(o,r){process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var i="18.3.1",l=Symbol.for("react.element"),f=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),w=Symbol.for("react.provider"),C=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),j=Symbol.for("react.offscreen"),z=Symbol.iterator,O="@@iterator";function B(D){if(D===null||typeof D!="object")return null;var V=z&&D[z]||D[O];return typeof V=="function"?V:null}var U={current:null},q={transition:null},K={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},Z={current:null},ee={},A=null;function Ce(D){A=D}ee.setExtraStackFrame=function(D){A=D},ee.getCurrentStack=null,ee.getStackAddendum=function(){var D="";A&&(D+=A);var V=ee.getCurrentStack;return V&&(D+=V()||""),D};var X=!1,F=!1,L=!1,M=!1,_e=!1,be={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:q,ReactCurrentOwner:Z};be.ReactDebugCurrentFrame=ee,be.ReactCurrentActQueue=K;function $e(D){{for(var V=arguments.length,ce=new Array(V>1?V-1:0),ve=1;ve<V;ve++)ce[ve-1]=arguments[ve];Ee("warn",D,ce)}}function ge(D){{for(var V=arguments.length,ce=new Array(V>1?V-1:0),ve=1;ve<V;ve++)ce[ve-1]=arguments[ve];Ee("error",D,ce)}}function Ee(D,V,ce){{var ve=be.ReactDebugCurrentFrame,Ie=ve.getStackAddendum();Ie!==""&&(V+="%s",ce=ce.concat([Ie]));var pt=ce.map(function(Ue){return String(Ue)});pt.unshift("Warning: "+V),Function.prototype.apply.call(console[D],console,pt)}}var He={};function De(D,V){{var ce=D.constructor,ve=ce&&(ce.displayName||ce.name)||"ReactClass",Ie=ve+"."+V;if(He[Ie])return;ge("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",V,ve),He[Ie]=!0}}var $={isMounted:function(D){return!1},enqueueForceUpdate:function(D,V,ce){De(D,"forceUpdate")},enqueueReplaceState:function(D,V,ce,ve){De(D,"replaceState")},enqueueSetState:function(D,V,ce,ve){De(D,"setState")}},G=Object.assign,he={};Object.freeze(he);function le(D,V,ce){this.props=D,this.context=V,this.refs=he,this.updater=ce||$}le.prototype.isReactComponent={},le.prototype.setState=function(D,V){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,V,"setState")},le.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};{var Je={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},Ge=function(D,V){Object.defineProperty(le.prototype,D,{get:function(){$e("%s(...) is deprecated in plain JavaScript React classes. %s",V[0],V[1])}})};for(var ut in Je)Je.hasOwnProperty(ut)&&Ge(ut,Je[ut])}function Se(){}Se.prototype=le.prototype;function Te(D,V,ce){this.props=D,this.context=V,this.refs=he,this.updater=ce||$}var mt=Te.prototype=new Se;mt.constructor=Te,G(mt,le.prototype),mt.isPureReactComponent=!0;function dr(){var D={current:null};return Object.seal(D),D}var zr=Array.isArray;function Yt(D){return zr(D)}function Xt(D){{var V=typeof Symbol=="function"&&Symbol.toStringTag,ce=V&&D[Symbol.toStringTag]||D.constructor.name||"Object";return ce}}function Fr(D){try{return br(D),!1}catch{return!0}}function br(D){return""+D}function nn(D){if(Fr(D))return ge("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Xt(D)),br(D)}function Tn(D,V,ce){var ve=D.displayName;if(ve)return ve;var Ie=V.displayName||V.name||"";return Ie!==""?ce+"("+Ie+")":ce}function vn(D){return D.displayName||"Context"}function qr(D){if(D==null)return null;if(typeof D.tag=="number"&&ge("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof D=="function")return D.displayName||D.name||null;if(typeof D=="string")return D;switch(D){case p:return"Fragment";case f:return"Portal";case S:return"Profiler";case v:return"StrictMode";case R:return"Suspense";case T:return"SuspenseList"}if(typeof D=="object")switch(D.$$typeof){case C:var V=D;return vn(V)+".Consumer";case w:var ce=D;return vn(ce._context)+".Provider";case b:return Tn(D,D.render,"ForwardRef");case H:var ve=D.displayName||null;return ve!==null?ve:qr(D.type)||"Memo";case P:{var Ie=D,pt=Ie._payload,Ue=Ie._init;try{return qr(Ue(pt))}catch{return null}}}return null}var tr=Object.prototype.hasOwnProperty,ar={key:!0,ref:!0,__self:!0,__source:!0},Pr,ui,Kr;Kr={};function Qr(D){if(tr.call(D,"ref")){var V=Object.getOwnPropertyDescriptor(D,"ref").get;if(V&&V.isReactWarning)return!1}return D.ref!==void 0}function Rn(D){if(tr.call(D,"key")){var V=Object.getOwnPropertyDescriptor(D,"key").get;if(V&&V.isReactWarning)return!1}return D.key!==void 0}function ta(D,V){var ce=function(){Pr||(Pr=!0,ge("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",V))};ce.isReactWarning=!0,Object.defineProperty(D,"key",{get:ce,configurable:!0})}function ra(D,V){var ce=function(){ui||(ui=!0,ge("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",V))};ce.isReactWarning=!0,Object.defineProperty(D,"ref",{get:ce,configurable:!0})}function Pe(D){if(typeof D.ref=="string"&&Z.current&&D.__self&&Z.current.stateNode!==D.__self){var V=qr(Z.current.type);Kr[V]||(ge('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',V,D.ref),Kr[V]=!0)}}var nt=function(D,V,ce,ve,Ie,pt,Ue){var xt={$$typeof:l,type:D,key:V,ref:ce,props:Ue,_owner:pt};return xt._store={},Object.defineProperty(xt._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(xt,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ve}),Object.defineProperty(xt,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ie}),Object.freeze&&(Object.freeze(xt.props),Object.freeze(xt)),xt};function _t(D,V,ce){var ve,Ie={},pt=null,Ue=null,xt=null,Lt=null;if(V!=null){Qr(V)&&(Ue=V.ref,Pe(V)),Rn(V)&&(nn(V.key),pt=""+V.key),xt=V.__self===void 0?null:V.__self,Lt=V.__source===void 0?null:V.__source;for(ve in V)tr.call(V,ve)&&!ar.hasOwnProperty(ve)&&(Ie[ve]=V[ve])}var Jt=arguments.length-2;if(Jt===1)Ie.children=ce;else if(Jt>1){for(var Ir=Array(Jt),Dr=0;Dr<Jt;Dr++)Ir[Dr]=arguments[Dr+2];Object.freeze&&Object.freeze(Ir),Ie.children=Ir}if(D&&D.defaultProps){var Mt=D.defaultProps;for(ve in Mt)Ie[ve]===void 0&&(Ie[ve]=Mt[ve])}if(pt||Ue){var Tr=typeof D=="function"?D.displayName||D.name||"Unknown":D;pt&&ta(Ie,Tr),Ue&&ra(Ie,Tr)}return nt(D,pt,Ue,xt,Lt,Z.current,Ie)}function rr(D,V){var ce=nt(D.type,V,D.ref,D._self,D._source,D._owner,D.props);return ce}function Sr(D,V,ce){if(D==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var ve,Ie=G({},D.props),pt=D.key,Ue=D.ref,xt=D._self,Lt=D._source,Jt=D._owner;if(V!=null){Qr(V)&&(Ue=V.ref,Jt=Z.current),Rn(V)&&(nn(V.key),pt=""+V.key);var Ir;D.type&&D.type.defaultProps&&(Ir=D.type.defaultProps);for(ve in V)tr.call(V,ve)&&!ar.hasOwnProperty(ve)&&(V[ve]===void 0&&Ir!==void 0?Ie[ve]=Ir[ve]:Ie[ve]=V[ve])}var Dr=arguments.length-2;if(Dr===1)Ie.children=ce;else if(Dr>1){for(var Mt=Array(Dr),Tr=0;Tr<Dr;Tr++)Mt[Tr]=arguments[Tr+2];Ie.children=Mt}return nt(D.type,pt,Ue,xt,Lt,Jt,Ie)}function Mr(D){return typeof D=="object"&&D!==null&&D.$$typeof===l}var Or=".",gn=":";function wr(D){var V=/[=:]/g,ce={"=":"=0",":":"=2"},ve=D.replace(V,function(Ie){return ce[Ie]});return"$"+ve}var yr=!1,hr=/\/+/g;function vi(D){return D.replace(hr,"$&/")}function An(D,V){return typeof D=="object"&&D!==null&&D.key!=null?(nn(D.key),wr(""+D.key)):V.toString(36)}function Hi(D,V,ce,ve,Ie){var pt=typeof D;(pt==="undefined"||pt==="boolean")&&(D=null);var Ue=!1;if(D===null)Ue=!0;else switch(pt){case"string":case"number":Ue=!0;break;case"object":switch(D.$$typeof){case l:case f:Ue=!0}}if(Ue){var xt=D,Lt=Ie(xt),Jt=ve===""?Or+An(xt,0):ve;if(Yt(Lt)){var Ir="";Jt!=null&&(Ir=vi(Jt)+"/"),Hi(Lt,V,Ir,"",function(m0){return m0})}else Lt!=null&&(Mr(Lt)&&(Lt.key&&(!xt||xt.key!==Lt.key)&&nn(Lt.key),Lt=rr(Lt,ce+(Lt.key&&(!xt||xt.key!==Lt.key)?vi(""+Lt.key)+"/":"")+Jt)),V.push(Lt));return 1}var Dr,Mt,Tr=0,Xr=ve===""?Or:ve+gn;if(Yt(D))for(var Mo=0;Mo<D.length;Mo++)Dr=D[Mo],Mt=Xr+An(Dr,Mo),Tr+=Hi(Dr,V,ce,Mt,Ie);else{var Hc=B(D);if(typeof Hc=="function"){var Ws=D;Hc===Ws.entries&&(yr||$e("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),yr=!0);for(var Ic=Hc.call(Ws),Al,g0=0;!(Al=Ic.next()).done;)Dr=Al.value,Mt=Xr+An(Dr,g0++),Tr+=Hi(Dr,V,ce,Mt,Ie)}else if(pt==="object"){var cd=String(D);throw new Error("Objects are not valid as a React child (found: "+(cd==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":cd)+"). If you meant to render a collection of children, use an array instead.")}}return Tr}function ja(D,V,ce){if(D==null)return D;var ve=[],Ie=0;return Hi(D,ve,"","",function(pt){return V.call(ce,pt,Ie++)}),ve}function qs(D){var V=0;return ja(D,function(){V++}),V}function cs(D,V,ce){ja(D,function(){V.apply(this,arguments)},ce)}function fs(D){return ja(D,function(V){return V})||[]}function ds(D){if(!Mr(D))throw new Error("React.Children.only expected to receive a single React element child.");return D}function hs(D){var V={$$typeof:C,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};V.Provider={$$typeof:w,_context:V};var ce=!1,ve=!1,Ie=!1;{var pt={$$typeof:C,_context:V};Object.defineProperties(pt,{Provider:{get:function(){return ve||(ve=!0,ge("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),V.Provider},set:function(Ue){V.Provider=Ue}},_currentValue:{get:function(){return V._currentValue},set:function(Ue){V._currentValue=Ue}},_currentValue2:{get:function(){return V._currentValue2},set:function(Ue){V._currentValue2=Ue}},_threadCount:{get:function(){return V._threadCount},set:function(Ue){V._threadCount=Ue}},Consumer:{get:function(){return ce||(ce=!0,ge("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),V.Consumer}},displayName:{get:function(){return V.displayName},set:function(Ue){Ie||($e("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",Ue),Ie=!0)}}}),V.Consumer=pt}return V._currentRenderer=null,V._currentRenderer2=null,V}var Yn=-1,In=0,pr=1,kn=2;function Ii(D){if(D._status===Yn){var V=D._result,ce=V();if(ce.then(function(pt){if(D._status===In||D._status===Yn){var Ue=D;Ue._status=pr,Ue._result=pt}},function(pt){if(D._status===In||D._status===Yn){var Ue=D;Ue._status=kn,Ue._result=pt}}),D._status===Yn){var ve=D;ve._status=In,ve._result=ce}}if(D._status===pr){var Ie=D._result;return Ie===void 0&&ge(`lazy: Expected the result of a dynamic import() call. Instead received: %s
19
19
 
20
20
  Your code should look like:
21
21
  const MyComponent = lazy(() => import('./MyComponent'))
@@ -53,7 +53,7 @@ Check the top-level render call using <`+ce+">.")}return V}function Ur(D,V){if(!
53
53
  *
54
54
  * This source code is licensed under the MIT license found in the
55
55
  * LICENSE file in the root directory of this source tree.
56
- */var US;function zT(){return US||(US=1,function(o){process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var r=!1,i=5;function l(Pe,rt){var _t=Pe.length;Pe.push(rt),v(Pe,rt,_t)}function f(Pe){return Pe.length===0?null:Pe[0]}function p(Pe){if(Pe.length===0)return null;var rt=Pe[0],_t=Pe.pop();return _t!==rt&&(Pe[0]=_t,S(Pe,_t,0)),rt}function v(Pe,rt,_t){for(var rr=_t;rr>0;){var Sr=rr-1>>>1,Mr=Pe[Sr];if(w(Mr,rt)>0)Pe[Sr]=rt,Pe[rr]=Mr,rr=Sr;else return}}function S(Pe,rt,_t){for(var rr=_t,Sr=Pe.length,Mr=Sr>>>1;rr<Mr;){var Or=(rr+1)*2-1,gn=Pe[Or],wr=Or+1,yr=Pe[wr];if(w(gn,rt)<0)wr<Sr&&w(yr,gn)<0?(Pe[rr]=yr,Pe[wr]=rt,rr=wr):(Pe[rr]=gn,Pe[Or]=rt,rr=Or);else if(wr<Sr&&w(yr,rt)<0)Pe[rr]=yr,Pe[wr]=rt,rr=wr;else return}}function w(Pe,rt){var _t=Pe.sortIndex-rt.sortIndex;return _t!==0?_t:Pe.id-rt.id}var C=1,b=2,R=3,T=4,H=5;function P(Pe,rt){}var j=typeof performance=="object"&&typeof performance.now=="function";if(j){var z=performance;o.unstable_now=function(){return z.now()}}else{var O=Date,B=O.now();o.unstable_now=function(){return O.now()-B}}var U=1073741823,q=-1,K=250,Z=5e3,ee=1e4,A=U,Ce=[],X=[],F=1,L=null,M=R,_e=!1,be=!1,$e=!1,ge=typeof setTimeout=="function"?setTimeout:null,Ee=typeof clearTimeout=="function"?clearTimeout:null,He=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function De(Pe){for(var rt=f(X);rt!==null;){if(rt.callback===null)p(X);else if(rt.startTime<=Pe)p(X),rt.sortIndex=rt.expirationTime,l(Ce,rt);else return;rt=f(X)}}function $(Pe){if($e=!1,De(Pe),!be)if(f(Ce)!==null)be=!0,Kr(G);else{var rt=f(X);rt!==null&&Qr($,rt.startTime-Pe)}}function G(Pe,rt){be=!1,$e&&($e=!1,Rn()),_e=!0;var _t=M;try{var rr;if(!r)return he(Pe,rt)}finally{L=null,M=_t,_e=!1}}function he(Pe,rt){var _t=rt;for(De(_t),L=f(Ce);L!==null&&!(L.expirationTime>_t&&(!Pe||Tn()));){var rr=L.callback;if(typeof rr=="function"){L.callback=null,M=L.priorityLevel;var Sr=L.expirationTime<=_t,Mr=rr(Sr);_t=o.unstable_now(),typeof Mr=="function"?L.callback=Mr:L===f(Ce)&&p(Ce),De(_t)}else p(Ce);L=f(Ce)}if(L!==null)return!0;var Or=f(X);return Or!==null&&Qr($,Or.startTime-_t),!1}function le(Pe,rt){switch(Pe){case C:case b:case R:case T:case H:break;default:Pe=R}var _t=M;M=Pe;try{return rt()}finally{M=_t}}function Je(Pe){var rt;switch(M){case C:case b:case R:rt=R;break;default:rt=M;break}var _t=M;M=rt;try{return Pe()}finally{M=_t}}function Ge(Pe){var rt=M;return function(){var _t=M;M=rt;try{return Pe.apply(this,arguments)}finally{M=_t}}}function ut(Pe,rt,_t){var rr=o.unstable_now(),Sr;if(typeof _t=="object"&&_t!==null){var Mr=_t.delay;typeof Mr=="number"&&Mr>0?Sr=rr+Mr:Sr=rr}else Sr=rr;var Or;switch(Pe){case C:Or=q;break;case b:Or=K;break;case H:Or=A;break;case T:Or=ee;break;case R:default:Or=Z;break}var gn=Sr+Or,wr={id:F++,callback:rt,priorityLevel:Pe,startTime:Sr,expirationTime:gn,sortIndex:-1};return Sr>rr?(wr.sortIndex=Sr,l(X,wr),f(Ce)===null&&wr===f(X)&&($e?Rn():$e=!0,Qr($,Sr-rr))):(wr.sortIndex=gn,l(Ce,wr),!be&&!_e&&(be=!0,Kr(G))),wr}function Se(){}function Te(){!be&&!_e&&(be=!0,Kr(G))}function mt(){return f(Ce)}function dr(Pe){Pe.callback=null}function zr(){return M}var Yt=!1,Xt=null,Fr=-1,br=i,nn=-1;function Tn(){var Pe=o.unstable_now()-nn;return!(Pe<br)}function vn(){}function qr(Pe){if(Pe<0||Pe>125){console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported");return}Pe>0?br=Math.floor(1e3/Pe):br=i}var tr=function(){if(Xt!==null){var Pe=o.unstable_now();nn=Pe;var rt=!0,_t=!0;try{_t=Xt(rt,Pe)}finally{_t?ar():(Yt=!1,Xt=null)}}else Yt=!1},ar;if(typeof He=="function")ar=function(){He(tr)};else if(typeof MessageChannel<"u"){var Pr=new MessageChannel,ui=Pr.port2;Pr.port1.onmessage=tr,ar=function(){ui.postMessage(null)}}else ar=function(){ge(tr,0)};function Kr(Pe){Xt=Pe,Yt||(Yt=!0,ar())}function Qr(Pe,rt){Fr=ge(function(){Pe(o.unstable_now())},rt)}function Rn(){Ee(Fr),Fr=-1}var ta=vn,ra=null;o.unstable_IdlePriority=H,o.unstable_ImmediatePriority=C,o.unstable_LowPriority=T,o.unstable_NormalPriority=R,o.unstable_Profiling=ra,o.unstable_UserBlockingPriority=b,o.unstable_cancelCallback=dr,o.unstable_continueExecution=Te,o.unstable_forceFrameRate=qr,o.unstable_getCurrentPriorityLevel=zr,o.unstable_getFirstCallbackNode=mt,o.unstable_next=Je,o.unstable_pauseExecution=Se,o.unstable_requestPaint=ta,o.unstable_runWithPriority=le,o.unstable_scheduleCallback=ut,o.unstable_shouldYield=Tn,o.unstable_wrapCallback=Ge,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(Wy)),Wy}var jS;function zS(){return jS||(jS=1,process.env.NODE_ENV==="production"?xv.exports=jT():xv.exports=zT()),xv.exports}/**
56
+ */var US;function zT(){return US||(US=1,function(o){process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var r=!1,i=5;function l(Pe,nt){var _t=Pe.length;Pe.push(nt),v(Pe,nt,_t)}function f(Pe){return Pe.length===0?null:Pe[0]}function p(Pe){if(Pe.length===0)return null;var nt=Pe[0],_t=Pe.pop();return _t!==nt&&(Pe[0]=_t,S(Pe,_t,0)),nt}function v(Pe,nt,_t){for(var rr=_t;rr>0;){var Sr=rr-1>>>1,Mr=Pe[Sr];if(w(Mr,nt)>0)Pe[Sr]=nt,Pe[rr]=Mr,rr=Sr;else return}}function S(Pe,nt,_t){for(var rr=_t,Sr=Pe.length,Mr=Sr>>>1;rr<Mr;){var Or=(rr+1)*2-1,gn=Pe[Or],wr=Or+1,yr=Pe[wr];if(w(gn,nt)<0)wr<Sr&&w(yr,gn)<0?(Pe[rr]=yr,Pe[wr]=nt,rr=wr):(Pe[rr]=gn,Pe[Or]=nt,rr=Or);else if(wr<Sr&&w(yr,nt)<0)Pe[rr]=yr,Pe[wr]=nt,rr=wr;else return}}function w(Pe,nt){var _t=Pe.sortIndex-nt.sortIndex;return _t!==0?_t:Pe.id-nt.id}var C=1,b=2,R=3,T=4,H=5;function P(Pe,nt){}var j=typeof performance=="object"&&typeof performance.now=="function";if(j){var z=performance;o.unstable_now=function(){return z.now()}}else{var O=Date,B=O.now();o.unstable_now=function(){return O.now()-B}}var U=1073741823,q=-1,K=250,Z=5e3,ee=1e4,A=U,Ce=[],X=[],F=1,L=null,M=R,_e=!1,be=!1,$e=!1,ge=typeof setTimeout=="function"?setTimeout:null,Ee=typeof clearTimeout=="function"?clearTimeout:null,He=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function De(Pe){for(var nt=f(X);nt!==null;){if(nt.callback===null)p(X);else if(nt.startTime<=Pe)p(X),nt.sortIndex=nt.expirationTime,l(Ce,nt);else return;nt=f(X)}}function $(Pe){if($e=!1,De(Pe),!be)if(f(Ce)!==null)be=!0,Kr(G);else{var nt=f(X);nt!==null&&Qr($,nt.startTime-Pe)}}function G(Pe,nt){be=!1,$e&&($e=!1,Rn()),_e=!0;var _t=M;try{var rr;if(!r)return he(Pe,nt)}finally{L=null,M=_t,_e=!1}}function he(Pe,nt){var _t=nt;for(De(_t),L=f(Ce);L!==null&&!(L.expirationTime>_t&&(!Pe||Tn()));){var rr=L.callback;if(typeof rr=="function"){L.callback=null,M=L.priorityLevel;var Sr=L.expirationTime<=_t,Mr=rr(Sr);_t=o.unstable_now(),typeof Mr=="function"?L.callback=Mr:L===f(Ce)&&p(Ce),De(_t)}else p(Ce);L=f(Ce)}if(L!==null)return!0;var Or=f(X);return Or!==null&&Qr($,Or.startTime-_t),!1}function le(Pe,nt){switch(Pe){case C:case b:case R:case T:case H:break;default:Pe=R}var _t=M;M=Pe;try{return nt()}finally{M=_t}}function Je(Pe){var nt;switch(M){case C:case b:case R:nt=R;break;default:nt=M;break}var _t=M;M=nt;try{return Pe()}finally{M=_t}}function Ge(Pe){var nt=M;return function(){var _t=M;M=nt;try{return Pe.apply(this,arguments)}finally{M=_t}}}function ut(Pe,nt,_t){var rr=o.unstable_now(),Sr;if(typeof _t=="object"&&_t!==null){var Mr=_t.delay;typeof Mr=="number"&&Mr>0?Sr=rr+Mr:Sr=rr}else Sr=rr;var Or;switch(Pe){case C:Or=q;break;case b:Or=K;break;case H:Or=A;break;case T:Or=ee;break;case R:default:Or=Z;break}var gn=Sr+Or,wr={id:F++,callback:nt,priorityLevel:Pe,startTime:Sr,expirationTime:gn,sortIndex:-1};return Sr>rr?(wr.sortIndex=Sr,l(X,wr),f(Ce)===null&&wr===f(X)&&($e?Rn():$e=!0,Qr($,Sr-rr))):(wr.sortIndex=gn,l(Ce,wr),!be&&!_e&&(be=!0,Kr(G))),wr}function Se(){}function Te(){!be&&!_e&&(be=!0,Kr(G))}function mt(){return f(Ce)}function dr(Pe){Pe.callback=null}function zr(){return M}var Yt=!1,Xt=null,Fr=-1,br=i,nn=-1;function Tn(){var Pe=o.unstable_now()-nn;return!(Pe<br)}function vn(){}function qr(Pe){if(Pe<0||Pe>125){console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported");return}Pe>0?br=Math.floor(1e3/Pe):br=i}var tr=function(){if(Xt!==null){var Pe=o.unstable_now();nn=Pe;var nt=!0,_t=!0;try{_t=Xt(nt,Pe)}finally{_t?ar():(Yt=!1,Xt=null)}}else Yt=!1},ar;if(typeof He=="function")ar=function(){He(tr)};else if(typeof MessageChannel<"u"){var Pr=new MessageChannel,ui=Pr.port2;Pr.port1.onmessage=tr,ar=function(){ui.postMessage(null)}}else ar=function(){ge(tr,0)};function Kr(Pe){Xt=Pe,Yt||(Yt=!0,ar())}function Qr(Pe,nt){Fr=ge(function(){Pe(o.unstable_now())},nt)}function Rn(){Ee(Fr),Fr=-1}var ta=vn,ra=null;o.unstable_IdlePriority=H,o.unstable_ImmediatePriority=C,o.unstable_LowPriority=T,o.unstable_NormalPriority=R,o.unstable_Profiling=ra,o.unstable_UserBlockingPriority=b,o.unstable_cancelCallback=dr,o.unstable_continueExecution=Te,o.unstable_forceFrameRate=qr,o.unstable_getCurrentPriorityLevel=zr,o.unstable_getFirstCallbackNode=mt,o.unstable_next=Je,o.unstable_pauseExecution=Se,o.unstable_requestPaint=ta,o.unstable_runWithPriority=le,o.unstable_scheduleCallback=ut,o.unstable_shouldYield=Tn,o.unstable_wrapCallback=Ge,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(Wy)),Wy}var jS;function zS(){return jS||(jS=1,process.env.NODE_ENV==="production"?xv.exports=jT():xv.exports=zT()),xv.exports}/**
57
57
  * @license React
58
58
  * react-dom.production.min.js
59
59
  *
@@ -65,7 +65,7 @@ Check the top-level render call using <`+ce+">.")}return V}function Ur(D,V){if(!
65
65
  `+$+n}var he=!1;function le(n,a){if(!n||he)return"";he=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(fe){var h=fe}Reflect.construct(n,[],a)}else{try{a.call()}catch(fe){h=fe}n.call(a.prototype)}else{try{throw Error()}catch(fe){h=fe}n()}}catch(fe){if(fe&&h&&typeof fe.stack=="string"){for(var m=fe.stack.split(`
66
66
  `),x=h.stack.split(`
67
67
  `),k=m.length-1,Y=x.length-1;1<=k&&0<=Y&&m[k]!==x[Y];)Y--;for(;1<=k&&0<=Y;k--,Y--)if(m[k]!==x[Y]){if(k!==1||Y!==1)do if(k--,Y--,0>Y||m[k]!==x[Y]){var Q=`
68
- `+m[k].replace(" at new "," at ");return n.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",n.displayName)),Q}while(1<=k&&0<=Y);break}}}finally{he=!1,Error.prepareStackTrace=c}return(n=n?n.displayName||n.name:"")?G(n):""}function Je(n){switch(n.tag){case 5:return G(n.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return n=le(n.type,!1),n;case 11:return n=le(n.type.render,!1),n;case 1:return n=le(n.type,!0),n;default:return""}}function Ge(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case ee:return"Fragment";case Z:return"Portal";case Ce:return"Profiler";case A:return"StrictMode";case M:return"Suspense";case _e:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case F:return(n.displayName||"Context")+".Consumer";case X:return(n._context.displayName||"Context")+".Provider";case L:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case be:return a=n.displayName||null,a!==null?a:Ge(n.type)||"Memo";case $e:a=n._payload,n=n._init;try{return Ge(n(a))}catch{}}return null}function ut(n){var a=n.type;switch(n.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=a.render,n=n.displayName||n.name||"",a.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ge(a);case 8:return a===A?"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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Se(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Te(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function mt(n){var a=Te(n)?"checked":"value",c=Object.getOwnPropertyDescriptor(n.constructor.prototype,a),h=""+n[a];if(!n.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var m=c.get,x=c.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return m.call(this)},set:function(k){h=""+k,x.call(this,k)}}),Object.defineProperty(n,a,{enumerable:c.enumerable}),{getValue:function(){return h},setValue:function(k){h=""+k},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function dr(n){n._valueTracker||(n._valueTracker=mt(n))}function zr(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var c=a.getValue(),h="";return n&&(h=Te(n)?n.checked?"true":"false":n.value),n=h,n!==c?(a.setValue(n),!0):!1}function Yt(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Xt(n,a){var c=a.checked;return De({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??n._wrapperState.initialChecked})}function Fr(n,a){var c=a.defaultValue==null?"":a.defaultValue,h=a.checked!=null?a.checked:a.defaultChecked;c=Se(a.value!=null?a.value:c),n._wrapperState={initialChecked:h,initialValue:c,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function br(n,a){a=a.checked,a!=null&&U(n,"checked",a,!1)}function nn(n,a){br(n,a);var c=Se(a.value),h=a.type;if(c!=null)h==="number"?(c===0&&n.value===""||n.value!=c)&&(n.value=""+c):n.value!==""+c&&(n.value=""+c);else if(h==="submit"||h==="reset"){n.removeAttribute("value");return}a.hasOwnProperty("value")?vn(n,a.type,c):a.hasOwnProperty("defaultValue")&&vn(n,a.type,Se(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(n.defaultChecked=!!a.defaultChecked)}function Tn(n,a,c){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var h=a.type;if(!(h!=="submit"&&h!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+n._wrapperState.initialValue,c||a===n.value||(n.value=a),n.defaultValue=a}c=n.name,c!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,c!==""&&(n.name=c)}function vn(n,a,c){(a!=="number"||Yt(n.ownerDocument)!==n)&&(c==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+c&&(n.defaultValue=""+c))}var qr=Array.isArray;function tr(n,a,c,h){if(n=n.options,a){a={};for(var m=0;m<c.length;m++)a["$"+c[m]]=!0;for(c=0;c<n.length;c++)m=a.hasOwnProperty("$"+n[c].value),n[c].selected!==m&&(n[c].selected=m),m&&h&&(n[c].defaultSelected=!0)}else{for(c=""+Se(c),a=null,m=0;m<n.length;m++){if(n[m].value===c){n[m].selected=!0,h&&(n[m].defaultSelected=!0);return}a!==null||n[m].disabled||(a=n[m])}a!==null&&(a.selected=!0)}}function ar(n,a){if(a.dangerouslySetInnerHTML!=null)throw Error(i(91));return De({},a,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Pr(n,a){var c=a.value;if(c==null){if(c=a.children,a=a.defaultValue,c!=null){if(a!=null)throw Error(i(92));if(qr(c)){if(1<c.length)throw Error(i(93));c=c[0]}a=c}a==null&&(a=""),c=a}n._wrapperState={initialValue:Se(c)}}function ui(n,a){var c=Se(a.value),h=Se(a.defaultValue);c!=null&&(c=""+c,c!==n.value&&(n.value=c),a.defaultValue==null&&n.defaultValue!==c&&(n.defaultValue=c)),h!=null&&(n.defaultValue=""+h)}function Kr(n){var a=n.textContent;a===n._wrapperState.initialValue&&a!==""&&a!==null&&(n.value=a)}function Qr(n){switch(n){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 Rn(n,a){return n==null||n==="http://www.w3.org/1999/xhtml"?Qr(a):n==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var ta,ra=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,c,h,m){MSApp.execUnsafeLocalFunction(function(){return n(a,c,h,m)})}:n}(function(n,a){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=a;else{for(ta=ta||document.createElement("div"),ta.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=ta.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;a.firstChild;)n.appendChild(a.firstChild)}});function Pe(n,a){if(a){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=a;return}}n.textContent=a}var rt={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},_t=["Webkit","ms","Moz","O"];Object.keys(rt).forEach(function(n){_t.forEach(function(a){a=a+n.charAt(0).toUpperCase()+n.substring(1),rt[a]=rt[n]})});function rr(n,a,c){return a==null||typeof a=="boolean"||a===""?"":c||typeof a!="number"||a===0||rt.hasOwnProperty(n)&&rt[n]?(""+a).trim():a+"px"}function Sr(n,a){n=n.style;for(var c in a)if(a.hasOwnProperty(c)){var h=c.indexOf("--")===0,m=rr(c,a[c],h);c==="float"&&(c="cssFloat"),h?n.setProperty(c,m):n[c]=m}}var Mr=De({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 Or(n,a){if(a){if(Mr[n]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(i(137,n));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(i(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(i(61))}if(a.style!=null&&typeof a.style!="object")throw Error(i(62))}}function gn(n,a){if(n.indexOf("-")===-1)return typeof a.is=="string";switch(n){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 wr=null;function yr(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var hr=null,vi=null,An=null;function Hi(n){if(n=dt(n)){if(typeof hr!="function")throw Error(i(280));var a=n.stateNode;a&&(a=Zr(a),hr(n.stateNode,n.type,a))}}function ja(n){vi?An?An.push(n):An=[n]:vi=n}function qs(){if(vi){var n=vi,a=An;if(An=vi=null,Hi(n),a)for(n=0;n<a.length;n++)Hi(a[n])}}function cs(n,a){return n(a)}function fs(){}var ds=!1;function hs(n,a,c){if(ds)return n(a,c);ds=!0;try{return cs(n,a,c)}finally{ds=!1,(vi!==null||An!==null)&&(fs(),qs())}}function Yn(n,a){var c=n.stateNode;if(c===null)return null;var h=Zr(c);if(h===null)return null;c=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(n=n.type,h=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!h;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(i(231,a,typeof c));return c}var In=!1;if(S)try{var pr={};Object.defineProperty(pr,"passive",{get:function(){In=!0}}),window.addEventListener("test",pr,pr),window.removeEventListener("test",pr,pr)}catch{In=!1}function kn(n,a,c,h,m,x,k,Y,Q){var fe=Array.prototype.slice.call(arguments,3);try{a.apply(c,fe)}catch(Fe){this.onError(Fe)}}var Ii=!1,Ea=null,ps=!1,W=null,Re={onError:function(n){Ii=!0,Ea=n}};function je(n,a,c,h,m,x,k,Y,Q){Ii=!1,Ea=null,kn.apply(Re,arguments)}function et(n,a,c,h,m,x,k,Y,Q){if(je.apply(this,arguments),Ii){if(Ii){var fe=Ea;Ii=!1,Ea=null}else throw Error(i(198));ps||(ps=!0,W=fe)}}function Ft(n){var a=n,c=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,a.flags&4098&&(c=a.return),n=a.return;while(n)}return a.tag===3?c:null}function Tt(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function Pt(n){if(Ft(n)!==n)throw Error(i(188))}function Ht(n){var a=n.alternate;if(!a){if(a=Ft(n),a===null)throw Error(i(188));return a!==n?null:n}for(var c=n,h=a;;){var m=c.return;if(m===null)break;var x=m.alternate;if(x===null){if(h=m.return,h!==null){c=h;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===c)return Pt(m),n;if(x===h)return Pt(m),a;x=x.sibling}throw Error(i(188))}if(c.return!==h.return)c=m,h=x;else{for(var k=!1,Y=m.child;Y;){if(Y===c){k=!0,c=m,h=x;break}if(Y===h){k=!0,h=m,c=x;break}Y=Y.sibling}if(!k){for(Y=x.child;Y;){if(Y===c){k=!0,c=x,h=m;break}if(Y===h){k=!0,h=x,c=m;break}Y=Y.sibling}if(!k)throw Error(i(189))}}if(c.alternate!==h)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?n:a}function ln(n){return n=Ht(n),n!==null?Hr(n):null}function Hr(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var a=Hr(n);if(a!==null)return a;n=n.sibling}return null}var Lr=r.unstable_scheduleCallback,Vn=r.unstable_cancelCallback,za=r.unstable_shouldYield,qa=r.unstable_requestPaint,Ot=r.unstable_now,Bt=r.unstable_getCurrentPriorityLevel,Ya=r.unstable_ImmediatePriority,wl=r.unstable_UserBlockingPriority,bl=r.unstable_NormalPriority,Ro=r.unstable_LowPriority,bu=r.unstable_IdlePriority,Ao=null,$i=null;function Oc(n){if($i&&typeof $i.onCommitFiberRoot=="function")try{$i.onCommitFiberRoot(Ao,n,void 0,(n.current.flags&128)===128)}catch{}}var gi=Math.clz32?Math.clz32:_u,ld=Math.log,ud=Math.LN2;function _u(n){return n>>>=0,n===0?32:31-(ld(n)/ud|0)|0}var ko=64,na=4194304;function Va(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Wa(n,a){var c=n.pendingLanes;if(c===0)return 0;var h=0,m=n.suspendedLanes,x=n.pingedLanes,k=c&268435455;if(k!==0){var Y=k&~m;Y!==0?h=Va(Y):(x&=k,x!==0&&(h=Va(x)))}else k=c&~m,k!==0?h=Va(k):x!==0&&(h=Va(x));if(h===0)return 0;if(a!==0&&a!==h&&!(a&m)&&(m=h&-h,x=a&-a,m>=x||m===16&&(x&4194240)!==0))return a;if(h&4&&(h|=c&16),a=n.entangledLanes,a!==0)for(n=n.entanglements,a&=h;0<a;)c=31-gi(a),m=1<<c,h|=n[c],a&=~m;return h}function Du(n,a){switch(n){case 1:case 2:case 4:return a+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 a+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 _l(n,a){for(var c=n.suspendedLanes,h=n.pingedLanes,m=n.expirationTimes,x=n.pendingLanes;0<x;){var k=31-gi(x),Y=1<<k,Q=m[k];Q===-1?(!(Y&c)||Y&h)&&(m[k]=Du(Y,a)):Q<=a&&(n.expiredLanes|=Y),x&=~Y}}function Fo(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function Tu(){var n=ko;return ko<<=1,!(ko&4194240)&&(ko=64),n}function Ru(n){for(var a=[],c=0;31>c;c++)a.push(n);return a}function Ys(n,a,c){n.pendingLanes|=a,a!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,a=31-gi(a),n[a]=c}function p0(n,a){var c=n.pendingLanes&~a;n.pendingLanes=a,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=a,n.mutableReadLanes&=a,n.entangledLanes&=a,a=n.entanglements;var h=n.eventTimes;for(n=n.expirationTimes;0<c;){var m=31-gi(c),x=1<<m;a[m]=0,h[m]=-1,n[m]=-1,c&=~x}}function Vs(n,a){var c=n.entangledLanes|=a;for(n=n.entanglements;c;){var h=31-gi(c),m=1<<h;m&a|n[h]&a&&(n[h]|=a),c&=~m}}var sr=0;function Au(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var Zt,Nc,vs,Dt,ku,Wn=!1,gs=[],mi=null,ms=null,Ur=null,_r=new Map,Oo=new Map,Fn=[],yi="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 Ca(n,a){switch(n){case"focusin":case"focusout":mi=null;break;case"dragenter":case"dragleave":ms=null;break;case"mouseover":case"mouseout":Ur=null;break;case"pointerover":case"pointerout":_r.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(a.pointerId)}}function Dl(n,a,c,h,m,x){return n===null||n.nativeEvent!==x?(n={blockedOn:a,domEventName:c,eventSystemFlags:h,nativeEvent:x,targetContainers:[m]},a!==null&&(a=dt(a),a!==null&&Nc(a)),n):(n.eventSystemFlags|=h,a=n.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),n)}function Bc(n,a,c,h,m){switch(a){case"focusin":return mi=Dl(mi,n,a,c,h,m),!0;case"dragenter":return ms=Dl(ms,n,a,c,h,m),!0;case"mouseover":return Ur=Dl(Ur,n,a,c,h,m),!0;case"pointerover":var x=m.pointerId;return _r.set(x,Dl(_r.get(x)||null,n,a,c,h,m)),!0;case"gotpointercapture":return x=m.pointerId,Oo.set(x,Dl(Oo.get(x)||null,n,a,c,h,m)),!0}return!1}function Mc(n){var a=Ml(n.target);if(a!==null){var c=Ft(a);if(c!==null){if(a=c.tag,a===13){if(a=Tt(c),a!==null){n.blockedOn=a,ku(n.priority,function(){vs(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function No(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var c=Nu(n.domEventName,n.eventSystemFlags,a[0],n.nativeEvent);if(c===null){c=n.nativeEvent;var h=new c.constructor(c.type,c);wr=h,c.target.dispatchEvent(h),wr=null}else return a=dt(c),a!==null&&Nc(a),n.blockedOn=c,!1;a.shift()}return!0}function Tl(n,a,c){No(n)&&c.delete(a)}function v0(){Wn=!1,mi!==null&&No(mi)&&(mi=null),ms!==null&&No(ms)&&(ms=null),Ur!==null&&No(Ur)&&(Ur=null),_r.forEach(Tl),Oo.forEach(Tl)}function Sa(n,a){n.blockedOn===a&&(n.blockedOn=null,Wn||(Wn=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,v0)))}function Ga(n){function a(m){return Sa(m,n)}if(0<gs.length){Sa(gs[0],n);for(var c=1;c<gs.length;c++){var h=gs[c];h.blockedOn===n&&(h.blockedOn=null)}}for(mi!==null&&Sa(mi,n),ms!==null&&Sa(ms,n),Ur!==null&&Sa(Ur,n),_r.forEach(a),Oo.forEach(a),c=0;c<Fn.length;c++)h=Fn[c],h.blockedOn===n&&(h.blockedOn=null);for(;0<Fn.length&&(c=Fn[0],c.blockedOn===null);)Mc(c),c.blockedOn===null&&Fn.shift()}var ys=q.ReactCurrentBatchConfig,wa=!0;function Fu(n,a,c,h){var m=sr,x=ys.transition;ys.transition=null;try{sr=1,Bo(n,a,c,h)}finally{sr=m,ys.transition=x}}function Ou(n,a,c,h){var m=sr,x=ys.transition;ys.transition=null;try{sr=4,Bo(n,a,c,h)}finally{sr=m,ys.transition=x}}function Bo(n,a,c,h){if(wa){var m=Nu(n,a,c,h);if(m===null)Cd(n,a,h,Rl,c),Ca(n,h);else if(Bc(m,n,a,c,h))h.stopPropagation();else if(Ca(n,h),a&4&&-1<yi.indexOf(n)){for(;m!==null;){var x=dt(m);if(x!==null&&Zt(x),x=Nu(n,a,c,h),x===null&&Cd(n,a,h,Rl,c),x===m)break;m=x}m!==null&&h.stopPropagation()}else Cd(n,a,h,null,c)}}var Rl=null;function Nu(n,a,c,h){if(Rl=null,n=yr(h),n=Ml(n),n!==null)if(a=Ft(n),a===null)n=null;else if(c=a.tag,c===13){if(n=Tt(a),n!==null)return n;n=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null);return Rl=n,null}function Bu(n){switch(n){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(Bt()){case Ya:return 1;case wl:return 4;case bl:case Ro:return 16;case bu:return 536870912;default:return 16}default:return 16}}var Ka=null,D=null,V=null;function ce(){if(V)return V;var n,a=D,c=a.length,h,m="value"in Ka?Ka.value:Ka.textContent,x=m.length;for(n=0;n<c&&a[n]===m[n];n++);var k=c-n;for(h=1;h<=k&&a[c-h]===m[x-h];h++);return V=m.slice(n,1<h?1-h:void 0)}function ve(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function Ie(){return!0}function pt(){return!1}function Ue(n){function a(c,h,m,x,k){this._reactName=c,this._targetInst=m,this.type=h,this.nativeEvent=x,this.target=k,this.currentTarget=null;for(var Y in n)n.hasOwnProperty(Y)&&(c=n[Y],this[Y]=c?c(x):x[Y]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ie:pt,this.isPropagationStopped=pt,this}return De(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ie)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ie)},persist:function(){},isPersistent:Ie}),a}var xt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Lt=Ue(xt),Jt=De({},xt,{view:0,detail:0}),Ir=Ue(Jt),Dr,Mt,Tr,Xr=De({},Jt,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:E0,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Tr&&(Tr&&n.type==="mousemove"?(Dr=n.screenX-Tr.screenX,Mt=n.screenY-Tr.screenY):Mt=Dr=0,Tr=n),Dr)},movementY:function(n){return"movementY"in n?n.movementY:Mt}}),Mo=Ue(Xr),Hc=De({},Xr,{dataTransfer:0}),Ws=Ue(Hc),Ic=De({},Jt,{relatedTarget:0}),Al=Ue(Ic),g0=De({},xt,{animationName:0,elapsedTime:0,pseudoElement:0}),cd=Ue(g0),m0=De({},xt,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Zv=Ue(m0),y0=De({},xt,{data:0}),x0=Ue(y0),Jv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eg={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"},C1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gs(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=C1[n])?!!a[n]:!1}function E0(){return Gs}var C0=De({},Jt,{key:function(n){if(n.key){var a=Jv[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=ve(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?eg[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:E0,charCode:function(n){return n.type==="keypress"?ve(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?ve(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),S0=Ue(C0),w0=De({},Xr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tg=Ue(w0),fd=De({},Jt,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:E0}),rg=Ue(fd),Pi=De({},xt,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ks=Ue(Pi),mn=De({},Xr,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Qs=Ue(mn),b0=[9,13,27,32],Mu=S&&"CompositionEvent"in window,$c=null;S&&"documentMode"in document&&($c=document.documentMode);var Pc=S&&"TextEvent"in window&&!$c,ng=S&&(!Mu||$c&&8<$c&&11>=$c),ig=" ",dd=!1;function ag(n,a){switch(n){case"keyup":return b0.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Hu=!1;function og(n,a){switch(n){case"compositionend":return sg(a);case"keypress":return a.which!==32?null:(dd=!0,ig);case"textInput":return n=a.data,n===ig&&dd?null:n;default:return null}}function S1(n,a){if(Hu)return n==="compositionend"||!Mu&&ag(n,a)?(n=ce(),V=D=Ka=null,Hu=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return ng&&a.locale!=="ko"?null:a.data;default:return null}}var w1={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 lg(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!w1[n.type]:a==="textarea"}function _0(n,a,c,h){ja(h),a=Yc(a,"onChange"),0<a.length&&(c=new Lt("onChange","change",null,c,h),n.push({event:c,listeners:a}))}var xs=null,kl=null;function ug(n){Nl(n,0)}function Lc(n){var a=Xa(n);if(zr(a))return n}function b1(n,a){if(n==="change")return a}var cg=!1;if(S){var D0;if(S){var T0="oninput"in document;if(!T0){var fg=document.createElement("div");fg.setAttribute("oninput","return;"),T0=typeof fg.oninput=="function"}D0=T0}else D0=!1;cg=D0&&(!document.documentMode||9<document.documentMode)}function dg(){xs&&(xs.detachEvent("onpropertychange",hg),kl=xs=null)}function hg(n){if(n.propertyName==="value"&&Lc(kl)){var a=[];_0(a,kl,n,yr(n)),hs(ug,a)}}function _1(n,a,c){n==="focusin"?(dg(),xs=a,kl=c,xs.attachEvent("onpropertychange",hg)):n==="focusout"&&dg()}function pg(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Lc(kl)}function D1(n,a){if(n==="click")return Lc(a)}function vg(n,a){if(n==="input"||n==="change")return Lc(a)}function T1(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var Qa=typeof Object.is=="function"?Object.is:T1;function Uc(n,a){if(Qa(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var c=Object.keys(n),h=Object.keys(a);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var m=c[h];if(!w.call(a,m)||!Qa(n[m],a[m]))return!1}return!0}function gg(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function hd(n,a){var c=gg(n);n=0;for(var h;c;){if(c.nodeType===3){if(h=n+c.textContent.length,n<=a&&h>=a)return{node:c,offset:a-n};n=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=gg(c)}}function Ho(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Ho(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function jc(){for(var n=window,a=Yt();a instanceof n.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)n=a.contentWindow;else break;a=Yt(n.document)}return a}function pd(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}function Iu(n){var a=jc(),c=n.focusedElem,h=n.selectionRange;if(a!==c&&c&&c.ownerDocument&&Ho(c.ownerDocument.documentElement,c)){if(h!==null&&pd(c)){if(a=h.start,n=h.end,n===void 0&&(n=a),"selectionStart"in c)c.selectionStart=a,c.selectionEnd=Math.min(n,c.value.length);else if(n=(a=c.ownerDocument||document)&&a.defaultView||window,n.getSelection){n=n.getSelection();var m=c.textContent.length,x=Math.min(h.start,m);h=h.end===void 0?x:Math.min(h.end,m),!n.extend&&x>h&&(m=h,h=x,x=m),m=hd(c,x);var k=hd(c,h);m&&k&&(n.rangeCount!==1||n.anchorNode!==m.node||n.anchorOffset!==m.offset||n.focusNode!==k.node||n.focusOffset!==k.offset)&&(a=a.createRange(),a.setStart(m.node,m.offset),n.removeAllRanges(),x>h?(n.addRange(a),n.extend(k.node,k.offset)):(a.setEnd(k.node,k.offset),n.addRange(a)))}}for(a=[],n=c;n=n.parentNode;)n.nodeType===1&&a.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<a.length;c++)n=a[c],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var R1=S&&"documentMode"in document&&11>=document.documentMode,$u=null,R0=null,zc=null,A0=!1;function k0(n,a,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;A0||$u==null||$u!==Yt(h)||(h=$u,"selectionStart"in h&&pd(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),zc&&Uc(zc,h)||(zc=h,h=Yc(R0,"onSelect"),0<h.length&&(a=new Lt("onSelect","select",null,a,c),n.push({event:a,listeners:h}),a.target=$u)))}function vd(n,a){var c={};return c[n.toLowerCase()]=a.toLowerCase(),c["Webkit"+n]="webkit"+a,c["Moz"+n]="moz"+a,c}var Fl={animationend:vd("Animation","AnimationEnd"),animationiteration:vd("Animation","AnimationIteration"),animationstart:vd("Animation","AnimationStart"),transitionend:vd("Transition","TransitionEnd")},Gn={},F0={};S&&(F0=document.createElement("div").style,"AnimationEvent"in window||(delete Fl.animationend.animation,delete Fl.animationiteration.animation,delete Fl.animationstart.animation),"TransitionEvent"in window||delete Fl.transitionend.transition);function gd(n){if(Gn[n])return Gn[n];if(!Fl[n])return n;var a=Fl[n],c;for(c in a)if(a.hasOwnProperty(c)&&c in F0)return Gn[n]=a[c];return n}var mg=gd("animationend"),yg=gd("animationiteration"),xg=gd("animationstart"),Eg=gd("transitionend"),O0=new Map,md="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 ba(n,a){O0.set(n,a),p(a,[n])}for(var N0=0;N0<md.length;N0++){var Ol=md[N0],A1=Ol.toLowerCase(),k1=Ol[0].toUpperCase()+Ol.slice(1);ba(A1,"on"+k1)}ba(mg,"onAnimationEnd"),ba(yg,"onAnimationIteration"),ba(xg,"onAnimationStart"),ba("dblclick","onDoubleClick"),ba("focusin","onFocus"),ba("focusout","onBlur"),ba(Eg,"onTransitionEnd"),v("onMouseEnter",["mouseout","mouseover"]),v("onMouseLeave",["mouseout","mouseover"]),v("onPointerEnter",["pointerout","pointerover"]),v("onPointerLeave",["pointerout","pointerover"]),p("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),p("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),p("onBeforeInput",["compositionend","keypress","textInput","paste"]),p("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),p("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),p("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qc="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(" "),B0=new Set("cancel close invalid load scroll toggle".split(" ").concat(qc));function yd(n,a,c){var h=n.type||"unknown-event";n.currentTarget=c,et(h,a,void 0,n),n.currentTarget=null}function Nl(n,a){a=(a&4)!==0;for(var c=0;c<n.length;c++){var h=n[c],m=h.event;h=h.listeners;e:{var x=void 0;if(a)for(var k=h.length-1;0<=k;k--){var Y=h[k],Q=Y.instance,fe=Y.currentTarget;if(Y=Y.listener,Q!==x&&m.isPropagationStopped())break e;yd(m,Y,fe),x=Q}else for(k=0;k<h.length;k++){if(Y=h[k],Q=Y.instance,fe=Y.currentTarget,Y=Y.listener,Q!==x&&m.isPropagationStopped())break e;yd(m,Y,fe),x=Q}}}if(ps)throw n=W,ps=!1,W=null,n}function xr(n,a){var c=a[Gc];c===void 0&&(c=a[Gc]=new Set);var h=n+"__bubble";c.has(h)||(Cg(a,n,2,!1),c.add(h))}function xd(n,a,c){var h=0;a&&(h|=4),Cg(c,n,h,a)}var Ed="_reactListening"+Math.random().toString(36).slice(2);function Pu(n){if(!n[Ed]){n[Ed]=!0,l.forEach(function(c){c!=="selectionchange"&&(B0.has(c)||xd(c,!1,n),xd(c,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Ed]||(a[Ed]=!0,xd("selectionchange",!1,a))}}function Cg(n,a,c,h){switch(Bu(a)){case 1:var m=Fu;break;case 4:m=Ou;break;default:m=Bo}c=m.bind(null,a,c,n),m=void 0,!In||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(m=!0),h?m!==void 0?n.addEventListener(a,c,{capture:!0,passive:m}):n.addEventListener(a,c,!0):m!==void 0?n.addEventListener(a,c,{passive:m}):n.addEventListener(a,c,!1)}function Cd(n,a,c,h,m){var x=h;if(!(a&1)&&!(a&2)&&h!==null)e:for(;;){if(h===null)return;var k=h.tag;if(k===3||k===4){var Y=h.stateNode.containerInfo;if(Y===m||Y.nodeType===8&&Y.parentNode===m)break;if(k===4)for(k=h.return;k!==null;){var Q=k.tag;if((Q===3||Q===4)&&(Q=k.stateNode.containerInfo,Q===m||Q.nodeType===8&&Q.parentNode===m))return;k=k.return}for(;Y!==null;){if(k=Ml(Y),k===null)return;if(Q=k.tag,Q===5||Q===6){h=x=k;continue e}Y=Y.parentNode}}h=h.return}hs(function(){var fe=x,Fe=yr(c),Ne=[];e:{var ke=O0.get(n);if(ke!==void 0){var Ke=Lt,at=n;switch(n){case"keypress":if(ve(c)===0)break e;case"keydown":case"keyup":Ke=S0;break;case"focusin":at="focus",Ke=Al;break;case"focusout":at="blur",Ke=Al;break;case"beforeblur":case"afterblur":Ke=Al;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ke=Mo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ke=Ws;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ke=rg;break;case mg:case yg:case xg:Ke=cd;break;case Eg:Ke=Ks;break;case"scroll":Ke=Ir;break;case"wheel":Ke=Qs;break;case"copy":case"cut":case"paste":Ke=Zv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ke=tg}var lt=(a&4)!==0,hn=!lt&&n==="scroll",ne=lt?ke!==null?ke+"Capture":null:ke;lt=[];for(var te=fe,oe;te!==null;){oe=te;var Oe=oe.stateNode;if(oe.tag===5&&Oe!==null&&(oe=Oe,ne!==null&&(Oe=Yn(te,ne),Oe!=null&&lt.push(Lu(te,Oe,oe)))),hn)break;te=te.return}0<lt.length&&(ke=new Ke(ke,at,null,c,Fe),Ne.push({event:ke,listeners:lt}))}}if(!(a&7)){e:{if(ke=n==="mouseover"||n==="pointerover",Ke=n==="mouseout"||n==="pointerout",ke&&c!==wr&&(at=c.relatedTarget||c.fromElement)&&(Ml(at)||at[Xs]))break e;if((Ke||ke)&&(ke=Fe.window===Fe?Fe:(ke=Fe.ownerDocument)?ke.defaultView||ke.parentWindow:window,Ke?(at=c.relatedTarget||c.toElement,Ke=fe,at=at?Ml(at):null,at!==null&&(hn=Ft(at),at!==hn||at.tag!==5&&at.tag!==6)&&(at=null)):(Ke=null,at=fe),Ke!==at)){if(lt=Mo,Oe="onMouseLeave",ne="onMouseEnter",te="mouse",(n==="pointerout"||n==="pointerover")&&(lt=tg,Oe="onPointerLeave",ne="onPointerEnter",te="pointer"),hn=Ke==null?ke:Xa(Ke),oe=at==null?ke:Xa(at),ke=new lt(Oe,te+"leave",Ke,c,Fe),ke.target=hn,ke.relatedTarget=oe,Oe=null,Ml(Fe)===fe&&(lt=new lt(ne,te+"enter",at,c,Fe),lt.target=oe,lt.relatedTarget=hn,Oe=lt),hn=Oe,Ke&&at)t:{for(lt=Ke,ne=at,te=0,oe=lt;oe;oe=Io(oe))te++;for(oe=0,Oe=ne;Oe;Oe=Io(Oe))oe++;for(;0<te-oe;)lt=Io(lt),te--;for(;0<oe-te;)ne=Io(ne),oe--;for(;te--;){if(lt===ne||ne!==null&&lt===ne.alternate)break t;lt=Io(lt),ne=Io(ne)}lt=null}else lt=null;Ke!==null&&Sg(Ne,ke,Ke,lt,!1),at!==null&&hn!==null&&Sg(Ne,hn,at,lt,!0)}}e:{if(ke=fe?Xa(fe):window,Ke=ke.nodeName&&ke.nodeName.toLowerCase(),Ke==="select"||Ke==="input"&&ke.type==="file")var st=b1;else if(lg(ke))if(cg)st=vg;else{st=pg;var yt=_1}else(Ke=ke.nodeName)&&Ke.toLowerCase()==="input"&&(ke.type==="checkbox"||ke.type==="radio")&&(st=D1);if(st&&(st=st(n,fe))){_0(Ne,st,c,Fe);break e}yt&&yt(n,ke,fe),n==="focusout"&&(yt=ke._wrapperState)&&yt.controlled&&ke.type==="number"&&vn(ke,"number",ke.value)}switch(yt=fe?Xa(fe):window,n){case"focusin":(lg(yt)||yt.contentEditable==="true")&&($u=yt,R0=fe,zc=null);break;case"focusout":zc=R0=$u=null;break;case"mousedown":A0=!0;break;case"contextmenu":case"mouseup":case"dragend":A0=!1,k0(Ne,c,Fe);break;case"selectionchange":if(R1)break;case"keydown":case"keyup":k0(Ne,c,Fe)}var Et;if(Mu)e:{switch(n){case"compositionstart":var bt="onCompositionStart";break e;case"compositionend":bt="onCompositionEnd";break e;case"compositionupdate":bt="onCompositionUpdate";break e}bt=void 0}else Hu?ag(n,c)&&(bt="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(bt="onCompositionStart");bt&&(ng&&c.locale!=="ko"&&(Hu||bt!=="onCompositionStart"?bt==="onCompositionEnd"&&Hu&&(Et=ce()):(Ka=Fe,D="value"in Ka?Ka.value:Ka.textContent,Hu=!0)),yt=Yc(fe,bt),0<yt.length&&(bt=new x0(bt,n,null,c,Fe),Ne.push({event:bt,listeners:yt}),Et?bt.data=Et:(Et=sg(c),Et!==null&&(bt.data=Et)))),(Et=Pc?og(n,c):S1(n,c))&&(fe=Yc(fe,"onBeforeInput"),0<fe.length&&(Fe=new x0("onBeforeInput","beforeinput",null,c,Fe),Ne.push({event:Fe,listeners:fe}),Fe.data=Et))}Nl(Ne,a)})}function Lu(n,a,c){return{instance:n,listener:a,currentTarget:c}}function Yc(n,a){for(var c=a+"Capture",h=[];n!==null;){var m=n,x=m.stateNode;m.tag===5&&x!==null&&(m=x,x=Yn(n,c),x!=null&&h.unshift(Lu(n,x,m)),x=Yn(n,a),x!=null&&h.push(Lu(n,x,m))),n=n.return}return h}function Io(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function Sg(n,a,c,h,m){for(var x=a._reactName,k=[];c!==null&&c!==h;){var Y=c,Q=Y.alternate,fe=Y.stateNode;if(Q!==null&&Q===h)break;Y.tag===5&&fe!==null&&(Y=fe,m?(Q=Yn(c,x),Q!=null&&k.unshift(Lu(c,Q,Y))):m||(Q=Yn(c,x),Q!=null&&k.push(Lu(c,Q,Y)))),c=c.return}k.length!==0&&n.push({event:a,listeners:k})}var wg=/\r\n?/g,F1=/\u0000|\uFFFD/g;function bg(n){return(typeof n=="string"?n:""+n).replace(wg,`
68
+ `+m[k].replace(" at new "," at ");return n.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",n.displayName)),Q}while(1<=k&&0<=Y);break}}}finally{he=!1,Error.prepareStackTrace=c}return(n=n?n.displayName||n.name:"")?G(n):""}function Je(n){switch(n.tag){case 5:return G(n.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return n=le(n.type,!1),n;case 11:return n=le(n.type.render,!1),n;case 1:return n=le(n.type,!0),n;default:return""}}function Ge(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case ee:return"Fragment";case Z:return"Portal";case Ce:return"Profiler";case A:return"StrictMode";case M:return"Suspense";case _e:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case F:return(n.displayName||"Context")+".Consumer";case X:return(n._context.displayName||"Context")+".Provider";case L:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case be:return a=n.displayName||null,a!==null?a:Ge(n.type)||"Memo";case $e:a=n._payload,n=n._init;try{return Ge(n(a))}catch{}}return null}function ut(n){var a=n.type;switch(n.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=a.render,n=n.displayName||n.name||"",a.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ge(a);case 8:return a===A?"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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Se(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Te(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function mt(n){var a=Te(n)?"checked":"value",c=Object.getOwnPropertyDescriptor(n.constructor.prototype,a),h=""+n[a];if(!n.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var m=c.get,x=c.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return m.call(this)},set:function(k){h=""+k,x.call(this,k)}}),Object.defineProperty(n,a,{enumerable:c.enumerable}),{getValue:function(){return h},setValue:function(k){h=""+k},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function dr(n){n._valueTracker||(n._valueTracker=mt(n))}function zr(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var c=a.getValue(),h="";return n&&(h=Te(n)?n.checked?"true":"false":n.value),n=h,n!==c?(a.setValue(n),!0):!1}function Yt(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Xt(n,a){var c=a.checked;return De({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??n._wrapperState.initialChecked})}function Fr(n,a){var c=a.defaultValue==null?"":a.defaultValue,h=a.checked!=null?a.checked:a.defaultChecked;c=Se(a.value!=null?a.value:c),n._wrapperState={initialChecked:h,initialValue:c,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function br(n,a){a=a.checked,a!=null&&U(n,"checked",a,!1)}function nn(n,a){br(n,a);var c=Se(a.value),h=a.type;if(c!=null)h==="number"?(c===0&&n.value===""||n.value!=c)&&(n.value=""+c):n.value!==""+c&&(n.value=""+c);else if(h==="submit"||h==="reset"){n.removeAttribute("value");return}a.hasOwnProperty("value")?vn(n,a.type,c):a.hasOwnProperty("defaultValue")&&vn(n,a.type,Se(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(n.defaultChecked=!!a.defaultChecked)}function Tn(n,a,c){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var h=a.type;if(!(h!=="submit"&&h!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+n._wrapperState.initialValue,c||a===n.value||(n.value=a),n.defaultValue=a}c=n.name,c!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,c!==""&&(n.name=c)}function vn(n,a,c){(a!=="number"||Yt(n.ownerDocument)!==n)&&(c==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+c&&(n.defaultValue=""+c))}var qr=Array.isArray;function tr(n,a,c,h){if(n=n.options,a){a={};for(var m=0;m<c.length;m++)a["$"+c[m]]=!0;for(c=0;c<n.length;c++)m=a.hasOwnProperty("$"+n[c].value),n[c].selected!==m&&(n[c].selected=m),m&&h&&(n[c].defaultSelected=!0)}else{for(c=""+Se(c),a=null,m=0;m<n.length;m++){if(n[m].value===c){n[m].selected=!0,h&&(n[m].defaultSelected=!0);return}a!==null||n[m].disabled||(a=n[m])}a!==null&&(a.selected=!0)}}function ar(n,a){if(a.dangerouslySetInnerHTML!=null)throw Error(i(91));return De({},a,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Pr(n,a){var c=a.value;if(c==null){if(c=a.children,a=a.defaultValue,c!=null){if(a!=null)throw Error(i(92));if(qr(c)){if(1<c.length)throw Error(i(93));c=c[0]}a=c}a==null&&(a=""),c=a}n._wrapperState={initialValue:Se(c)}}function ui(n,a){var c=Se(a.value),h=Se(a.defaultValue);c!=null&&(c=""+c,c!==n.value&&(n.value=c),a.defaultValue==null&&n.defaultValue!==c&&(n.defaultValue=c)),h!=null&&(n.defaultValue=""+h)}function Kr(n){var a=n.textContent;a===n._wrapperState.initialValue&&a!==""&&a!==null&&(n.value=a)}function Qr(n){switch(n){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 Rn(n,a){return n==null||n==="http://www.w3.org/1999/xhtml"?Qr(a):n==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var ta,ra=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,c,h,m){MSApp.execUnsafeLocalFunction(function(){return n(a,c,h,m)})}:n}(function(n,a){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=a;else{for(ta=ta||document.createElement("div"),ta.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=ta.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;a.firstChild;)n.appendChild(a.firstChild)}});function Pe(n,a){if(a){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=a;return}}n.textContent=a}var nt={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},_t=["Webkit","ms","Moz","O"];Object.keys(nt).forEach(function(n){_t.forEach(function(a){a=a+n.charAt(0).toUpperCase()+n.substring(1),nt[a]=nt[n]})});function rr(n,a,c){return a==null||typeof a=="boolean"||a===""?"":c||typeof a!="number"||a===0||nt.hasOwnProperty(n)&&nt[n]?(""+a).trim():a+"px"}function Sr(n,a){n=n.style;for(var c in a)if(a.hasOwnProperty(c)){var h=c.indexOf("--")===0,m=rr(c,a[c],h);c==="float"&&(c="cssFloat"),h?n.setProperty(c,m):n[c]=m}}var Mr=De({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 Or(n,a){if(a){if(Mr[n]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(i(137,n));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(i(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(i(61))}if(a.style!=null&&typeof a.style!="object")throw Error(i(62))}}function gn(n,a){if(n.indexOf("-")===-1)return typeof a.is=="string";switch(n){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 wr=null;function yr(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var hr=null,vi=null,An=null;function Hi(n){if(n=dt(n)){if(typeof hr!="function")throw Error(i(280));var a=n.stateNode;a&&(a=Zr(a),hr(n.stateNode,n.type,a))}}function ja(n){vi?An?An.push(n):An=[n]:vi=n}function qs(){if(vi){var n=vi,a=An;if(An=vi=null,Hi(n),a)for(n=0;n<a.length;n++)Hi(a[n])}}function cs(n,a){return n(a)}function fs(){}var ds=!1;function hs(n,a,c){if(ds)return n(a,c);ds=!0;try{return cs(n,a,c)}finally{ds=!1,(vi!==null||An!==null)&&(fs(),qs())}}function Yn(n,a){var c=n.stateNode;if(c===null)return null;var h=Zr(c);if(h===null)return null;c=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(n=n.type,h=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!h;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(i(231,a,typeof c));return c}var In=!1;if(S)try{var pr={};Object.defineProperty(pr,"passive",{get:function(){In=!0}}),window.addEventListener("test",pr,pr),window.removeEventListener("test",pr,pr)}catch{In=!1}function kn(n,a,c,h,m,x,k,Y,Q){var fe=Array.prototype.slice.call(arguments,3);try{a.apply(c,fe)}catch(Fe){this.onError(Fe)}}var Ii=!1,Ea=null,ps=!1,W=null,Re={onError:function(n){Ii=!0,Ea=n}};function je(n,a,c,h,m,x,k,Y,Q){Ii=!1,Ea=null,kn.apply(Re,arguments)}function et(n,a,c,h,m,x,k,Y,Q){if(je.apply(this,arguments),Ii){if(Ii){var fe=Ea;Ii=!1,Ea=null}else throw Error(i(198));ps||(ps=!0,W=fe)}}function Ft(n){var a=n,c=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,a.flags&4098&&(c=a.return),n=a.return;while(n)}return a.tag===3?c:null}function Tt(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function Pt(n){if(Ft(n)!==n)throw Error(i(188))}function Ht(n){var a=n.alternate;if(!a){if(a=Ft(n),a===null)throw Error(i(188));return a!==n?null:n}for(var c=n,h=a;;){var m=c.return;if(m===null)break;var x=m.alternate;if(x===null){if(h=m.return,h!==null){c=h;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===c)return Pt(m),n;if(x===h)return Pt(m),a;x=x.sibling}throw Error(i(188))}if(c.return!==h.return)c=m,h=x;else{for(var k=!1,Y=m.child;Y;){if(Y===c){k=!0,c=m,h=x;break}if(Y===h){k=!0,h=m,c=x;break}Y=Y.sibling}if(!k){for(Y=x.child;Y;){if(Y===c){k=!0,c=x,h=m;break}if(Y===h){k=!0,h=x,c=m;break}Y=Y.sibling}if(!k)throw Error(i(189))}}if(c.alternate!==h)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?n:a}function ln(n){return n=Ht(n),n!==null?Hr(n):null}function Hr(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var a=Hr(n);if(a!==null)return a;n=n.sibling}return null}var Lr=r.unstable_scheduleCallback,Vn=r.unstable_cancelCallback,za=r.unstable_shouldYield,qa=r.unstable_requestPaint,Ot=r.unstable_now,Bt=r.unstable_getCurrentPriorityLevel,Ya=r.unstable_ImmediatePriority,wl=r.unstable_UserBlockingPriority,bl=r.unstable_NormalPriority,Ro=r.unstable_LowPriority,bu=r.unstable_IdlePriority,Ao=null,$i=null;function Oc(n){if($i&&typeof $i.onCommitFiberRoot=="function")try{$i.onCommitFiberRoot(Ao,n,void 0,(n.current.flags&128)===128)}catch{}}var gi=Math.clz32?Math.clz32:_u,ld=Math.log,ud=Math.LN2;function _u(n){return n>>>=0,n===0?32:31-(ld(n)/ud|0)|0}var ko=64,na=4194304;function Va(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Wa(n,a){var c=n.pendingLanes;if(c===0)return 0;var h=0,m=n.suspendedLanes,x=n.pingedLanes,k=c&268435455;if(k!==0){var Y=k&~m;Y!==0?h=Va(Y):(x&=k,x!==0&&(h=Va(x)))}else k=c&~m,k!==0?h=Va(k):x!==0&&(h=Va(x));if(h===0)return 0;if(a!==0&&a!==h&&!(a&m)&&(m=h&-h,x=a&-a,m>=x||m===16&&(x&4194240)!==0))return a;if(h&4&&(h|=c&16),a=n.entangledLanes,a!==0)for(n=n.entanglements,a&=h;0<a;)c=31-gi(a),m=1<<c,h|=n[c],a&=~m;return h}function Du(n,a){switch(n){case 1:case 2:case 4:return a+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 a+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 _l(n,a){for(var c=n.suspendedLanes,h=n.pingedLanes,m=n.expirationTimes,x=n.pendingLanes;0<x;){var k=31-gi(x),Y=1<<k,Q=m[k];Q===-1?(!(Y&c)||Y&h)&&(m[k]=Du(Y,a)):Q<=a&&(n.expiredLanes|=Y),x&=~Y}}function Fo(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function Tu(){var n=ko;return ko<<=1,!(ko&4194240)&&(ko=64),n}function Ru(n){for(var a=[],c=0;31>c;c++)a.push(n);return a}function Ys(n,a,c){n.pendingLanes|=a,a!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,a=31-gi(a),n[a]=c}function p0(n,a){var c=n.pendingLanes&~a;n.pendingLanes=a,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=a,n.mutableReadLanes&=a,n.entangledLanes&=a,a=n.entanglements;var h=n.eventTimes;for(n=n.expirationTimes;0<c;){var m=31-gi(c),x=1<<m;a[m]=0,h[m]=-1,n[m]=-1,c&=~x}}function Vs(n,a){var c=n.entangledLanes|=a;for(n=n.entanglements;c;){var h=31-gi(c),m=1<<h;m&a|n[h]&a&&(n[h]|=a),c&=~m}}var sr=0;function Au(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var Zt,Nc,vs,Dt,ku,Wn=!1,gs=[],mi=null,ms=null,Ur=null,_r=new Map,Oo=new Map,Fn=[],yi="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 Ca(n,a){switch(n){case"focusin":case"focusout":mi=null;break;case"dragenter":case"dragleave":ms=null;break;case"mouseover":case"mouseout":Ur=null;break;case"pointerover":case"pointerout":_r.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(a.pointerId)}}function Dl(n,a,c,h,m,x){return n===null||n.nativeEvent!==x?(n={blockedOn:a,domEventName:c,eventSystemFlags:h,nativeEvent:x,targetContainers:[m]},a!==null&&(a=dt(a),a!==null&&Nc(a)),n):(n.eventSystemFlags|=h,a=n.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),n)}function Bc(n,a,c,h,m){switch(a){case"focusin":return mi=Dl(mi,n,a,c,h,m),!0;case"dragenter":return ms=Dl(ms,n,a,c,h,m),!0;case"mouseover":return Ur=Dl(Ur,n,a,c,h,m),!0;case"pointerover":var x=m.pointerId;return _r.set(x,Dl(_r.get(x)||null,n,a,c,h,m)),!0;case"gotpointercapture":return x=m.pointerId,Oo.set(x,Dl(Oo.get(x)||null,n,a,c,h,m)),!0}return!1}function Mc(n){var a=Ml(n.target);if(a!==null){var c=Ft(a);if(c!==null){if(a=c.tag,a===13){if(a=Tt(c),a!==null){n.blockedOn=a,ku(n.priority,function(){vs(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function No(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var c=Nu(n.domEventName,n.eventSystemFlags,a[0],n.nativeEvent);if(c===null){c=n.nativeEvent;var h=new c.constructor(c.type,c);wr=h,c.target.dispatchEvent(h),wr=null}else return a=dt(c),a!==null&&Nc(a),n.blockedOn=c,!1;a.shift()}return!0}function Tl(n,a,c){No(n)&&c.delete(a)}function v0(){Wn=!1,mi!==null&&No(mi)&&(mi=null),ms!==null&&No(ms)&&(ms=null),Ur!==null&&No(Ur)&&(Ur=null),_r.forEach(Tl),Oo.forEach(Tl)}function Sa(n,a){n.blockedOn===a&&(n.blockedOn=null,Wn||(Wn=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,v0)))}function Ga(n){function a(m){return Sa(m,n)}if(0<gs.length){Sa(gs[0],n);for(var c=1;c<gs.length;c++){var h=gs[c];h.blockedOn===n&&(h.blockedOn=null)}}for(mi!==null&&Sa(mi,n),ms!==null&&Sa(ms,n),Ur!==null&&Sa(Ur,n),_r.forEach(a),Oo.forEach(a),c=0;c<Fn.length;c++)h=Fn[c],h.blockedOn===n&&(h.blockedOn=null);for(;0<Fn.length&&(c=Fn[0],c.blockedOn===null);)Mc(c),c.blockedOn===null&&Fn.shift()}var ys=q.ReactCurrentBatchConfig,wa=!0;function Fu(n,a,c,h){var m=sr,x=ys.transition;ys.transition=null;try{sr=1,Bo(n,a,c,h)}finally{sr=m,ys.transition=x}}function Ou(n,a,c,h){var m=sr,x=ys.transition;ys.transition=null;try{sr=4,Bo(n,a,c,h)}finally{sr=m,ys.transition=x}}function Bo(n,a,c,h){if(wa){var m=Nu(n,a,c,h);if(m===null)Cd(n,a,h,Rl,c),Ca(n,h);else if(Bc(m,n,a,c,h))h.stopPropagation();else if(Ca(n,h),a&4&&-1<yi.indexOf(n)){for(;m!==null;){var x=dt(m);if(x!==null&&Zt(x),x=Nu(n,a,c,h),x===null&&Cd(n,a,h,Rl,c),x===m)break;m=x}m!==null&&h.stopPropagation()}else Cd(n,a,h,null,c)}}var Rl=null;function Nu(n,a,c,h){if(Rl=null,n=yr(h),n=Ml(n),n!==null)if(a=Ft(n),a===null)n=null;else if(c=a.tag,c===13){if(n=Tt(a),n!==null)return n;n=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null);return Rl=n,null}function Bu(n){switch(n){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(Bt()){case Ya:return 1;case wl:return 4;case bl:case Ro:return 16;case bu:return 536870912;default:return 16}default:return 16}}var Ka=null,D=null,V=null;function ce(){if(V)return V;var n,a=D,c=a.length,h,m="value"in Ka?Ka.value:Ka.textContent,x=m.length;for(n=0;n<c&&a[n]===m[n];n++);var k=c-n;for(h=1;h<=k&&a[c-h]===m[x-h];h++);return V=m.slice(n,1<h?1-h:void 0)}function ve(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function Ie(){return!0}function pt(){return!1}function Ue(n){function a(c,h,m,x,k){this._reactName=c,this._targetInst=m,this.type=h,this.nativeEvent=x,this.target=k,this.currentTarget=null;for(var Y in n)n.hasOwnProperty(Y)&&(c=n[Y],this[Y]=c?c(x):x[Y]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ie:pt,this.isPropagationStopped=pt,this}return De(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ie)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ie)},persist:function(){},isPersistent:Ie}),a}var xt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Lt=Ue(xt),Jt=De({},xt,{view:0,detail:0}),Ir=Ue(Jt),Dr,Mt,Tr,Xr=De({},Jt,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:E0,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Tr&&(Tr&&n.type==="mousemove"?(Dr=n.screenX-Tr.screenX,Mt=n.screenY-Tr.screenY):Mt=Dr=0,Tr=n),Dr)},movementY:function(n){return"movementY"in n?n.movementY:Mt}}),Mo=Ue(Xr),Hc=De({},Xr,{dataTransfer:0}),Ws=Ue(Hc),Ic=De({},Jt,{relatedTarget:0}),Al=Ue(Ic),g0=De({},xt,{animationName:0,elapsedTime:0,pseudoElement:0}),cd=Ue(g0),m0=De({},xt,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Zv=Ue(m0),y0=De({},xt,{data:0}),x0=Ue(y0),Jv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eg={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"},C1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gs(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=C1[n])?!!a[n]:!1}function E0(){return Gs}var C0=De({},Jt,{key:function(n){if(n.key){var a=Jv[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=ve(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?eg[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:E0,charCode:function(n){return n.type==="keypress"?ve(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?ve(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),S0=Ue(C0),w0=De({},Xr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tg=Ue(w0),fd=De({},Jt,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:E0}),rg=Ue(fd),Pi=De({},xt,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ks=Ue(Pi),mn=De({},Xr,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Qs=Ue(mn),b0=[9,13,27,32],Mu=S&&"CompositionEvent"in window,$c=null;S&&"documentMode"in document&&($c=document.documentMode);var Pc=S&&"TextEvent"in window&&!$c,ng=S&&(!Mu||$c&&8<$c&&11>=$c),ig=" ",dd=!1;function ag(n,a){switch(n){case"keyup":return b0.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Hu=!1;function og(n,a){switch(n){case"compositionend":return sg(a);case"keypress":return a.which!==32?null:(dd=!0,ig);case"textInput":return n=a.data,n===ig&&dd?null:n;default:return null}}function S1(n,a){if(Hu)return n==="compositionend"||!Mu&&ag(n,a)?(n=ce(),V=D=Ka=null,Hu=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return ng&&a.locale!=="ko"?null:a.data;default:return null}}var w1={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 lg(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!w1[n.type]:a==="textarea"}function _0(n,a,c,h){ja(h),a=Yc(a,"onChange"),0<a.length&&(c=new Lt("onChange","change",null,c,h),n.push({event:c,listeners:a}))}var xs=null,kl=null;function ug(n){Nl(n,0)}function Lc(n){var a=Xa(n);if(zr(a))return n}function b1(n,a){if(n==="change")return a}var cg=!1;if(S){var D0;if(S){var T0="oninput"in document;if(!T0){var fg=document.createElement("div");fg.setAttribute("oninput","return;"),T0=typeof fg.oninput=="function"}D0=T0}else D0=!1;cg=D0&&(!document.documentMode||9<document.documentMode)}function dg(){xs&&(xs.detachEvent("onpropertychange",hg),kl=xs=null)}function hg(n){if(n.propertyName==="value"&&Lc(kl)){var a=[];_0(a,kl,n,yr(n)),hs(ug,a)}}function _1(n,a,c){n==="focusin"?(dg(),xs=a,kl=c,xs.attachEvent("onpropertychange",hg)):n==="focusout"&&dg()}function pg(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Lc(kl)}function D1(n,a){if(n==="click")return Lc(a)}function vg(n,a){if(n==="input"||n==="change")return Lc(a)}function T1(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var Qa=typeof Object.is=="function"?Object.is:T1;function Uc(n,a){if(Qa(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var c=Object.keys(n),h=Object.keys(a);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var m=c[h];if(!w.call(a,m)||!Qa(n[m],a[m]))return!1}return!0}function gg(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function hd(n,a){var c=gg(n);n=0;for(var h;c;){if(c.nodeType===3){if(h=n+c.textContent.length,n<=a&&h>=a)return{node:c,offset:a-n};n=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=gg(c)}}function Ho(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Ho(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function jc(){for(var n=window,a=Yt();a instanceof n.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)n=a.contentWindow;else break;a=Yt(n.document)}return a}function pd(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}function Iu(n){var a=jc(),c=n.focusedElem,h=n.selectionRange;if(a!==c&&c&&c.ownerDocument&&Ho(c.ownerDocument.documentElement,c)){if(h!==null&&pd(c)){if(a=h.start,n=h.end,n===void 0&&(n=a),"selectionStart"in c)c.selectionStart=a,c.selectionEnd=Math.min(n,c.value.length);else if(n=(a=c.ownerDocument||document)&&a.defaultView||window,n.getSelection){n=n.getSelection();var m=c.textContent.length,x=Math.min(h.start,m);h=h.end===void 0?x:Math.min(h.end,m),!n.extend&&x>h&&(m=h,h=x,x=m),m=hd(c,x);var k=hd(c,h);m&&k&&(n.rangeCount!==1||n.anchorNode!==m.node||n.anchorOffset!==m.offset||n.focusNode!==k.node||n.focusOffset!==k.offset)&&(a=a.createRange(),a.setStart(m.node,m.offset),n.removeAllRanges(),x>h?(n.addRange(a),n.extend(k.node,k.offset)):(a.setEnd(k.node,k.offset),n.addRange(a)))}}for(a=[],n=c;n=n.parentNode;)n.nodeType===1&&a.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<a.length;c++)n=a[c],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var R1=S&&"documentMode"in document&&11>=document.documentMode,$u=null,R0=null,zc=null,A0=!1;function k0(n,a,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;A0||$u==null||$u!==Yt(h)||(h=$u,"selectionStart"in h&&pd(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),zc&&Uc(zc,h)||(zc=h,h=Yc(R0,"onSelect"),0<h.length&&(a=new Lt("onSelect","select",null,a,c),n.push({event:a,listeners:h}),a.target=$u)))}function vd(n,a){var c={};return c[n.toLowerCase()]=a.toLowerCase(),c["Webkit"+n]="webkit"+a,c["Moz"+n]="moz"+a,c}var Fl={animationend:vd("Animation","AnimationEnd"),animationiteration:vd("Animation","AnimationIteration"),animationstart:vd("Animation","AnimationStart"),transitionend:vd("Transition","TransitionEnd")},Gn={},F0={};S&&(F0=document.createElement("div").style,"AnimationEvent"in window||(delete Fl.animationend.animation,delete Fl.animationiteration.animation,delete Fl.animationstart.animation),"TransitionEvent"in window||delete Fl.transitionend.transition);function gd(n){if(Gn[n])return Gn[n];if(!Fl[n])return n;var a=Fl[n],c;for(c in a)if(a.hasOwnProperty(c)&&c in F0)return Gn[n]=a[c];return n}var mg=gd("animationend"),yg=gd("animationiteration"),xg=gd("animationstart"),Eg=gd("transitionend"),O0=new Map,md="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 ba(n,a){O0.set(n,a),p(a,[n])}for(var N0=0;N0<md.length;N0++){var Ol=md[N0],A1=Ol.toLowerCase(),k1=Ol[0].toUpperCase()+Ol.slice(1);ba(A1,"on"+k1)}ba(mg,"onAnimationEnd"),ba(yg,"onAnimationIteration"),ba(xg,"onAnimationStart"),ba("dblclick","onDoubleClick"),ba("focusin","onFocus"),ba("focusout","onBlur"),ba(Eg,"onTransitionEnd"),v("onMouseEnter",["mouseout","mouseover"]),v("onMouseLeave",["mouseout","mouseover"]),v("onPointerEnter",["pointerout","pointerover"]),v("onPointerLeave",["pointerout","pointerover"]),p("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),p("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),p("onBeforeInput",["compositionend","keypress","textInput","paste"]),p("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),p("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),p("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qc="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(" "),B0=new Set("cancel close invalid load scroll toggle".split(" ").concat(qc));function yd(n,a,c){var h=n.type||"unknown-event";n.currentTarget=c,et(h,a,void 0,n),n.currentTarget=null}function Nl(n,a){a=(a&4)!==0;for(var c=0;c<n.length;c++){var h=n[c],m=h.event;h=h.listeners;e:{var x=void 0;if(a)for(var k=h.length-1;0<=k;k--){var Y=h[k],Q=Y.instance,fe=Y.currentTarget;if(Y=Y.listener,Q!==x&&m.isPropagationStopped())break e;yd(m,Y,fe),x=Q}else for(k=0;k<h.length;k++){if(Y=h[k],Q=Y.instance,fe=Y.currentTarget,Y=Y.listener,Q!==x&&m.isPropagationStopped())break e;yd(m,Y,fe),x=Q}}}if(ps)throw n=W,ps=!1,W=null,n}function xr(n,a){var c=a[Gc];c===void 0&&(c=a[Gc]=new Set);var h=n+"__bubble";c.has(h)||(Cg(a,n,2,!1),c.add(h))}function xd(n,a,c){var h=0;a&&(h|=4),Cg(c,n,h,a)}var Ed="_reactListening"+Math.random().toString(36).slice(2);function Pu(n){if(!n[Ed]){n[Ed]=!0,l.forEach(function(c){c!=="selectionchange"&&(B0.has(c)||xd(c,!1,n),xd(c,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Ed]||(a[Ed]=!0,xd("selectionchange",!1,a))}}function Cg(n,a,c,h){switch(Bu(a)){case 1:var m=Fu;break;case 4:m=Ou;break;default:m=Bo}c=m.bind(null,a,c,n),m=void 0,!In||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(m=!0),h?m!==void 0?n.addEventListener(a,c,{capture:!0,passive:m}):n.addEventListener(a,c,!0):m!==void 0?n.addEventListener(a,c,{passive:m}):n.addEventListener(a,c,!1)}function Cd(n,a,c,h,m){var x=h;if(!(a&1)&&!(a&2)&&h!==null)e:for(;;){if(h===null)return;var k=h.tag;if(k===3||k===4){var Y=h.stateNode.containerInfo;if(Y===m||Y.nodeType===8&&Y.parentNode===m)break;if(k===4)for(k=h.return;k!==null;){var Q=k.tag;if((Q===3||Q===4)&&(Q=k.stateNode.containerInfo,Q===m||Q.nodeType===8&&Q.parentNode===m))return;k=k.return}for(;Y!==null;){if(k=Ml(Y),k===null)return;if(Q=k.tag,Q===5||Q===6){h=x=k;continue e}Y=Y.parentNode}}h=h.return}hs(function(){var fe=x,Fe=yr(c),Ne=[];e:{var ke=O0.get(n);if(ke!==void 0){var Ke=Lt,at=n;switch(n){case"keypress":if(ve(c)===0)break e;case"keydown":case"keyup":Ke=S0;break;case"focusin":at="focus",Ke=Al;break;case"focusout":at="blur",Ke=Al;break;case"beforeblur":case"afterblur":Ke=Al;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ke=Mo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ke=Ws;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ke=rg;break;case mg:case yg:case xg:Ke=cd;break;case Eg:Ke=Ks;break;case"scroll":Ke=Ir;break;case"wheel":Ke=Qs;break;case"copy":case"cut":case"paste":Ke=Zv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ke=tg}var lt=(a&4)!==0,hn=!lt&&n==="scroll",ne=lt?ke!==null?ke+"Capture":null:ke;lt=[];for(var te=fe,oe;te!==null;){oe=te;var Oe=oe.stateNode;if(oe.tag===5&&Oe!==null&&(oe=Oe,ne!==null&&(Oe=Yn(te,ne),Oe!=null&&lt.push(Lu(te,Oe,oe)))),hn)break;te=te.return}0<lt.length&&(ke=new Ke(ke,at,null,c,Fe),Ne.push({event:ke,listeners:lt}))}}if(!(a&7)){e:{if(ke=n==="mouseover"||n==="pointerover",Ke=n==="mouseout"||n==="pointerout",ke&&c!==wr&&(at=c.relatedTarget||c.fromElement)&&(Ml(at)||at[Xs]))break e;if((Ke||ke)&&(ke=Fe.window===Fe?Fe:(ke=Fe.ownerDocument)?ke.defaultView||ke.parentWindow:window,Ke?(at=c.relatedTarget||c.toElement,Ke=fe,at=at?Ml(at):null,at!==null&&(hn=Ft(at),at!==hn||at.tag!==5&&at.tag!==6)&&(at=null)):(Ke=null,at=fe),Ke!==at)){if(lt=Mo,Oe="onMouseLeave",ne="onMouseEnter",te="mouse",(n==="pointerout"||n==="pointerover")&&(lt=tg,Oe="onPointerLeave",ne="onPointerEnter",te="pointer"),hn=Ke==null?ke:Xa(Ke),oe=at==null?ke:Xa(at),ke=new lt(Oe,te+"leave",Ke,c,Fe),ke.target=hn,ke.relatedTarget=oe,Oe=null,Ml(Fe)===fe&&(lt=new lt(ne,te+"enter",at,c,Fe),lt.target=oe,lt.relatedTarget=hn,Oe=lt),hn=Oe,Ke&&at)t:{for(lt=Ke,ne=at,te=0,oe=lt;oe;oe=Io(oe))te++;for(oe=0,Oe=ne;Oe;Oe=Io(Oe))oe++;for(;0<te-oe;)lt=Io(lt),te--;for(;0<oe-te;)ne=Io(ne),oe--;for(;te--;){if(lt===ne||ne!==null&&lt===ne.alternate)break t;lt=Io(lt),ne=Io(ne)}lt=null}else lt=null;Ke!==null&&Sg(Ne,ke,Ke,lt,!1),at!==null&&hn!==null&&Sg(Ne,hn,at,lt,!0)}}e:{if(ke=fe?Xa(fe):window,Ke=ke.nodeName&&ke.nodeName.toLowerCase(),Ke==="select"||Ke==="input"&&ke.type==="file")var st=b1;else if(lg(ke))if(cg)st=vg;else{st=pg;var yt=_1}else(Ke=ke.nodeName)&&Ke.toLowerCase()==="input"&&(ke.type==="checkbox"||ke.type==="radio")&&(st=D1);if(st&&(st=st(n,fe))){_0(Ne,st,c,Fe);break e}yt&&yt(n,ke,fe),n==="focusout"&&(yt=ke._wrapperState)&&yt.controlled&&ke.type==="number"&&vn(ke,"number",ke.value)}switch(yt=fe?Xa(fe):window,n){case"focusin":(lg(yt)||yt.contentEditable==="true")&&($u=yt,R0=fe,zc=null);break;case"focusout":zc=R0=$u=null;break;case"mousedown":A0=!0;break;case"contextmenu":case"mouseup":case"dragend":A0=!1,k0(Ne,c,Fe);break;case"selectionchange":if(R1)break;case"keydown":case"keyup":k0(Ne,c,Fe)}var Et;if(Mu)e:{switch(n){case"compositionstart":var bt="onCompositionStart";break e;case"compositionend":bt="onCompositionEnd";break e;case"compositionupdate":bt="onCompositionUpdate";break e}bt=void 0}else Hu?ag(n,c)&&(bt="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(bt="onCompositionStart");bt&&(ng&&c.locale!=="ko"&&(Hu||bt!=="onCompositionStart"?bt==="onCompositionEnd"&&Hu&&(Et=ce()):(Ka=Fe,D="value"in Ka?Ka.value:Ka.textContent,Hu=!0)),yt=Yc(fe,bt),0<yt.length&&(bt=new x0(bt,n,null,c,Fe),Ne.push({event:bt,listeners:yt}),Et?bt.data=Et:(Et=sg(c),Et!==null&&(bt.data=Et)))),(Et=Pc?og(n,c):S1(n,c))&&(fe=Yc(fe,"onBeforeInput"),0<fe.length&&(Fe=new x0("onBeforeInput","beforeinput",null,c,Fe),Ne.push({event:Fe,listeners:fe}),Fe.data=Et))}Nl(Ne,a)})}function Lu(n,a,c){return{instance:n,listener:a,currentTarget:c}}function Yc(n,a){for(var c=a+"Capture",h=[];n!==null;){var m=n,x=m.stateNode;m.tag===5&&x!==null&&(m=x,x=Yn(n,c),x!=null&&h.unshift(Lu(n,x,m)),x=Yn(n,a),x!=null&&h.push(Lu(n,x,m))),n=n.return}return h}function Io(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function Sg(n,a,c,h,m){for(var x=a._reactName,k=[];c!==null&&c!==h;){var Y=c,Q=Y.alternate,fe=Y.stateNode;if(Q!==null&&Q===h)break;Y.tag===5&&fe!==null&&(Y=fe,m?(Q=Yn(c,x),Q!=null&&k.unshift(Lu(c,Q,Y))):m||(Q=Yn(c,x),Q!=null&&k.push(Lu(c,Q,Y)))),c=c.return}k.length!==0&&n.push({event:a,listeners:k})}var wg=/\r\n?/g,F1=/\u0000|\uFFFD/g;function bg(n){return(typeof n=="string"?n:""+n).replace(wg,`
69
69
  `).replace(F1,"")}function Sd(n,a,c){if(a=bg(a),bg(n)!==a&&c)throw Error(i(425))}function $o(){}var Vc=null,Bl=null;function wd(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var bd=typeof setTimeout=="function"?setTimeout:void 0,M0=typeof clearTimeout=="function"?clearTimeout:void 0,_g=typeof Promise=="function"?Promise:void 0,Uu=typeof queueMicrotask=="function"?queueMicrotask:typeof _g<"u"?function(n){return _g.resolve(null).then(n).catch(_d)}:bd;function _d(n){setTimeout(function(){throw n})}function ju(n,a){var c=a,h=0;do{var m=c.nextSibling;if(n.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"){if(h===0){n.removeChild(m),Ga(a);return}h--}else c!=="$"&&c!=="$?"&&c!=="$!"||h++;c=m}while(c);Ga(a)}function Es(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return n}function Dg(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"){if(a===0)return n;a--}else c==="/$"&&a++}n=n.previousSibling}return null}var Po=Math.random().toString(36).slice(2),Cs="__reactFiber$"+Po,Wc="__reactProps$"+Po,Xs="__reactContainer$"+Po,Gc="__reactEvents$"+Po,zu="__reactListeners$"+Po,O1="__reactHandles$"+Po;function Ml(n){var a=n[Cs];if(a)return a;for(var c=n.parentNode;c;){if(a=c[Xs]||c[Cs]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(n=Dg(n);n!==null;){if(c=n[Cs])return c;n=Dg(n)}return a}n=c,c=n.parentNode}return null}function dt(n){return n=n[Cs]||n[Xs],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Xa(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(i(33))}function Zr(n){return n[Wc]||null}var Vt=[],_a=-1;function Da(n){return{current:n}}function $r(n){0>_a||(n.current=Vt[_a],Vt[_a]=null,_a--)}function ft(n,a){_a++,Vt[_a]=n.current,n.current=a}var ci={},an=Da(ci),On=Da(!1),Li=ci;function Ui(n,a){var c=n.type.contextTypes;if(!c)return ci;var h=n.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===a)return h.__reactInternalMemoizedMaskedChildContext;var m={},x;for(x in c)m[x]=a[x];return h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=a,n.__reactInternalMemoizedMaskedChildContext=m),m}function yn(n){return n=n.childContextTypes,n!=null}function qu(){$r(On),$r(an)}function Tg(n,a,c){if(an.current!==ci)throw Error(i(168));ft(an,a),ft(On,c)}function Kc(n,a,c){var h=n.stateNode;if(a=a.childContextTypes,typeof h.getChildContext!="function")return c;h=h.getChildContext();for(var m in h)if(!(m in a))throw Error(i(108,ut(n)||"Unknown",m));return De({},c,h)}function $n(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||ci,Li=an.current,ft(an,n),ft(On,On.current),!0}function Dd(n,a,c){var h=n.stateNode;if(!h)throw Error(i(169));c?(n=Kc(n,a,Li),h.__reactInternalMemoizedMergedChildContext=n,$r(On),$r(an),ft(an,n)):$r(On),ft(On,c)}var Ss=null,Yu=!1,Zs=!1;function Td(n){Ss===null?Ss=[n]:Ss.push(n)}function Lo(n){Yu=!0,Td(n)}function ws(){if(!Zs&&Ss!==null){Zs=!0;var n=0,a=sr;try{var c=Ss;for(sr=1;n<c.length;n++){var h=c[n];do h=h(!0);while(h!==null)}Ss=null,Yu=!1}catch(m){throw Ss!==null&&(Ss=Ss.slice(n+1)),Lr(Ya,ws),m}finally{sr=a,Zs=!1}}return null}var Uo=[],jo=0,zo=null,Js=0,xn=[],Ta=0,ia=null,bs=1,_s="";function Hl(n,a){Uo[jo++]=Js,Uo[jo++]=zo,zo=n,Js=a}function Rg(n,a,c){xn[Ta++]=bs,xn[Ta++]=_s,xn[Ta++]=ia,ia=n;var h=bs;n=_s;var m=32-gi(h)-1;h&=~(1<<m),c+=1;var x=32-gi(a)+m;if(30<x){var k=m-m%5;x=(h&(1<<k)-1).toString(32),h>>=k,m-=k,bs=1<<32-gi(a)+m|c<<m|h,_s=x+n}else bs=1<<x|c<<m|h,_s=n}function Rd(n){n.return!==null&&(Hl(n,1),Rg(n,1,0))}function Ad(n){for(;n===zo;)zo=Uo[--jo],Uo[jo]=null,Js=Uo[--jo],Uo[jo]=null;for(;n===ia;)ia=xn[--Ta],xn[Ta]=null,_s=xn[--Ta],xn[Ta]=null,bs=xn[--Ta],xn[Ta]=null}var ji=null,zi=null,Yr=!1,Ra=null;function H0(n,a){var c=Na(5,null,null,0);c.elementType="DELETED",c.stateNode=a,c.return=n,a=n.deletions,a===null?(n.deletions=[c],n.flags|=16):a.push(c)}function Ag(n,a){switch(n.tag){case 5:var c=n.type;return a=a.nodeType!==1||c.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(n.stateNode=a,ji=n,zi=Es(a.firstChild),!0):!1;case 6:return a=n.pendingProps===""||a.nodeType!==3?null:a,a!==null?(n.stateNode=a,ji=n,zi=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(c=ia!==null?{id:bs,overflow:_s}:null,n.memoizedState={dehydrated:a,treeContext:c,retryLane:1073741824},c=Na(18,null,null,0),c.stateNode=a,c.return=n,n.child=c,ji=n,zi=null,!0):!1;default:return!1}}function I0(n){return(n.mode&1)!==0&&(n.flags&128)===0}function $0(n){if(Yr){var a=zi;if(a){var c=a;if(!Ag(n,a)){if(I0(n))throw Error(i(418));a=Es(c.nextSibling);var h=ji;a&&Ag(n,a)?H0(h,c):(n.flags=n.flags&-4097|2,Yr=!1,ji=n)}}else{if(I0(n))throw Error(i(418));n.flags=n.flags&-4097|2,Yr=!1,ji=n}}}function Nn(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;ji=n}function kd(n){if(n!==ji)return!1;if(!Yr)return Nn(n),Yr=!0,!1;var a;if((a=n.tag!==3)&&!(a=n.tag!==5)&&(a=n.type,a=a!=="head"&&a!=="body"&&!wd(n.type,n.memoizedProps)),a&&(a=zi)){if(I0(n))throw Qc(),Error(i(418));for(;a;)H0(n,a),a=Es(a.nextSibling)}if(Nn(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));e:{for(n=n.nextSibling,a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"){if(a===0){zi=Es(n.nextSibling);break e}a--}else c!=="$"&&c!=="$!"&&c!=="$?"||a++}n=n.nextSibling}zi=null}}else zi=ji?Es(n.stateNode.nextSibling):null;return!0}function Qc(){for(var n=zi;n;)n=Es(n.nextSibling)}function qo(){zi=ji=null,Yr=!1}function eo(n){Ra===null?Ra=[n]:Ra.push(n)}var N1=q.ReactCurrentBatchConfig;function Il(n,a,c){if(n=c.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(i(309));var h=c.stateNode}if(!h)throw Error(i(147,n));var m=h,x=""+n;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===x?a.ref:(a=function(k){var Y=m.refs;k===null?delete Y[x]:Y[x]=k},a._stringRef=x,a)}if(typeof n!="string")throw Error(i(284));if(!c._owner)throw Error(i(290,n))}return n}function Fd(n,a){throw n=Object.prototype.toString.call(a),Error(i(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n))}function kg(n){var a=n._init;return a(n._payload)}function $l(n){function a(ne,te){if(n){var oe=ne.deletions;oe===null?(ne.deletions=[te],ne.flags|=16):oe.push(te)}}function c(ne,te){if(!n)return null;for(;te!==null;)a(ne,te),te=te.sibling;return null}function h(ne,te){for(ne=new Map;te!==null;)te.key!==null?ne.set(te.key,te):ne.set(te.index,te),te=te.sibling;return ne}function m(ne,te){return ne=Zo(ne,te),ne.index=0,ne.sibling=null,ne}function x(ne,te,oe){return ne.index=oe,n?(oe=ne.alternate,oe!==null?(oe=oe.index,oe<te?(ne.flags|=2,te):oe):(ne.flags|=2,te)):(ne.flags|=1048576,te)}function k(ne){return n&&ne.alternate===null&&(ne.flags|=2),ne}function Y(ne,te,oe,Oe){return te===null||te.tag!==6?(te=vp(oe,ne.mode,Oe),te.return=ne,te):(te=m(te,oe),te.return=ne,te)}function Q(ne,te,oe,Oe){var st=oe.type;return st===ee?Fe(ne,te,oe.props.children,Oe,oe.key):te!==null&&(te.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===$e&&kg(st)===te.type)?(Oe=m(te,oe.props),Oe.ref=Il(ne,te,oe),Oe.return=ne,Oe):(Oe=Tf(oe.type,oe.key,oe.props,null,ne.mode,Oe),Oe.ref=Il(ne,te,oe),Oe.return=ne,Oe)}function fe(ne,te,oe,Oe){return te===null||te.tag!==4||te.stateNode.containerInfo!==oe.containerInfo||te.stateNode.implementation!==oe.implementation?(te=ch(oe,ne.mode,Oe),te.return=ne,te):(te=m(te,oe.children||[]),te.return=ne,te)}function Fe(ne,te,oe,Oe,st){return te===null||te.tag!==7?(te=so(oe,ne.mode,Oe,st),te.return=ne,te):(te=m(te,oe),te.return=ne,te)}function Ne(ne,te,oe){if(typeof te=="string"&&te!==""||typeof te=="number")return te=vp(""+te,ne.mode,oe),te.return=ne,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case K:return oe=Tf(te.type,te.key,te.props,null,ne.mode,oe),oe.ref=Il(ne,null,te),oe.return=ne,oe;case Z:return te=ch(te,ne.mode,oe),te.return=ne,te;case $e:var Oe=te._init;return Ne(ne,Oe(te._payload),oe)}if(qr(te)||He(te))return te=so(te,ne.mode,oe,null),te.return=ne,te;Fd(ne,te)}return null}function ke(ne,te,oe,Oe){var st=te!==null?te.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return st!==null?null:Y(ne,te,""+oe,Oe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case K:return oe.key===st?Q(ne,te,oe,Oe):null;case Z:return oe.key===st?fe(ne,te,oe,Oe):null;case $e:return st=oe._init,ke(ne,te,st(oe._payload),Oe)}if(qr(oe)||He(oe))return st!==null?null:Fe(ne,te,oe,Oe,null);Fd(ne,oe)}return null}function Ke(ne,te,oe,Oe,st){if(typeof Oe=="string"&&Oe!==""||typeof Oe=="number")return ne=ne.get(oe)||null,Y(te,ne,""+Oe,st);if(typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case K:return ne=ne.get(Oe.key===null?oe:Oe.key)||null,Q(te,ne,Oe,st);case Z:return ne=ne.get(Oe.key===null?oe:Oe.key)||null,fe(te,ne,Oe,st);case $e:var yt=Oe._init;return Ke(ne,te,oe,yt(Oe._payload),st)}if(qr(Oe)||He(Oe))return ne=ne.get(oe)||null,Fe(te,ne,Oe,st,null);Fd(te,Oe)}return null}function at(ne,te,oe,Oe){for(var st=null,yt=null,Et=te,bt=te=0,Un=null;Et!==null&&bt<oe.length;bt++){Et.index>bt?(Un=Et,Et=null):Un=Et.sibling;var ur=ke(ne,Et,oe[bt],Oe);if(ur===null){Et===null&&(Et=Un);break}n&&Et&&ur.alternate===null&&a(ne,Et),te=x(ur,te,bt),yt===null?st=ur:yt.sibling=ur,yt=ur,Et=Un}if(bt===oe.length)return c(ne,Et),Yr&&Hl(ne,bt),st;if(Et===null){for(;bt<oe.length;bt++)Et=Ne(ne,oe[bt],Oe),Et!==null&&(te=x(Et,te,bt),yt===null?st=Et:yt.sibling=Et,yt=Et);return Yr&&Hl(ne,bt),st}for(Et=h(ne,Et);bt<oe.length;bt++)Un=Ke(Et,ne,bt,oe[bt],Oe),Un!==null&&(n&&Un.alternate!==null&&Et.delete(Un.key===null?bt:Un.key),te=x(Un,te,bt),yt===null?st=Un:yt.sibling=Un,yt=Un);return n&&Et.forEach(function(tl){return a(ne,tl)}),Yr&&Hl(ne,bt),st}function lt(ne,te,oe,Oe){var st=He(oe);if(typeof st!="function")throw Error(i(150));if(oe=st.call(oe),oe==null)throw Error(i(151));for(var yt=st=null,Et=te,bt=te=0,Un=null,ur=oe.next();Et!==null&&!ur.done;bt++,ur=oe.next()){Et.index>bt?(Un=Et,Et=null):Un=Et.sibling;var tl=ke(ne,Et,ur.value,Oe);if(tl===null){Et===null&&(Et=Un);break}n&&Et&&tl.alternate===null&&a(ne,Et),te=x(tl,te,bt),yt===null?st=tl:yt.sibling=tl,yt=tl,Et=Un}if(ur.done)return c(ne,Et),Yr&&Hl(ne,bt),st;if(Et===null){for(;!ur.done;bt++,ur=oe.next())ur=Ne(ne,ur.value,Oe),ur!==null&&(te=x(ur,te,bt),yt===null?st=ur:yt.sibling=ur,yt=ur);return Yr&&Hl(ne,bt),st}for(Et=h(ne,Et);!ur.done;bt++,ur=oe.next())ur=Ke(Et,ne,bt,ur.value,Oe),ur!==null&&(n&&ur.alternate!==null&&Et.delete(ur.key===null?bt:ur.key),te=x(ur,te,bt),yt===null?st=ur:yt.sibling=ur,yt=ur);return n&&Et.forEach(function(dm){return a(ne,dm)}),Yr&&Hl(ne,bt),st}function hn(ne,te,oe,Oe){if(typeof oe=="object"&&oe!==null&&oe.type===ee&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case K:e:{for(var st=oe.key,yt=te;yt!==null;){if(yt.key===st){if(st=oe.type,st===ee){if(yt.tag===7){c(ne,yt.sibling),te=m(yt,oe.props.children),te.return=ne,ne=te;break e}}else if(yt.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===$e&&kg(st)===yt.type){c(ne,yt.sibling),te=m(yt,oe.props),te.ref=Il(ne,yt,oe),te.return=ne,ne=te;break e}c(ne,yt);break}else a(ne,yt);yt=yt.sibling}oe.type===ee?(te=so(oe.props.children,ne.mode,Oe,oe.key),te.return=ne,ne=te):(Oe=Tf(oe.type,oe.key,oe.props,null,ne.mode,Oe),Oe.ref=Il(ne,te,oe),Oe.return=ne,ne=Oe)}return k(ne);case Z:e:{for(yt=oe.key;te!==null;){if(te.key===yt)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){c(ne,te.sibling),te=m(te,oe.children||[]),te.return=ne,ne=te;break e}else{c(ne,te);break}else a(ne,te);te=te.sibling}te=ch(oe,ne.mode,Oe),te.return=ne,ne=te}return k(ne);case $e:return yt=oe._init,hn(ne,te,yt(oe._payload),Oe)}if(qr(oe))return at(ne,te,oe,Oe);if(He(oe))return lt(ne,te,oe,Oe);Fd(ne,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,te!==null&&te.tag===6?(c(ne,te.sibling),te=m(te,oe),te.return=ne,ne=te):(c(ne,te),te=vp(oe,ne.mode,Oe),te.return=ne,ne=te),k(ne)):c(ne,te)}return hn}var un=$l(!0),ze=$l(!1),aa=Da(null),qi=null,Vu=null,P0=null;function L0(){P0=Vu=qi=null}function U0(n){var a=aa.current;$r(aa),n._currentValue=a}function j0(n,a,c){for(;n!==null;){var h=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),n===c)break;n=n.return}}function Jr(n,a){qi=n,P0=Vu=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&a&&(Cn=!0),n.firstContext=null)}function Aa(n){var a=n._currentValue;if(P0!==n)if(n={context:n,memoizedValue:a,next:null},Vu===null){if(qi===null)throw Error(i(308));Vu=n,qi.dependencies={lanes:0,firstContext:n}}else Vu=Vu.next=n;return a}var Pl=null;function z0(n){Pl===null?Pl=[n]:Pl.push(n)}function q0(n,a,c,h){var m=a.interleaved;return m===null?(c.next=c,z0(a)):(c.next=m.next,m.next=c),a.interleaved=c,sa(n,h)}function sa(n,a){n.lanes|=a;var c=n.alternate;for(c!==null&&(c.lanes|=a),c=n,n=n.return;n!==null;)n.childLanes|=a,c=n.alternate,c!==null&&(c.childLanes|=a),c=n,n=n.return;return c.tag===3?c.stateNode:null}var oa=!1;function Y0(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Fg(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function to(n,a){return{eventTime:n,lane:a,tag:0,payload:null,callback:null,next:null}}function Yo(n,a,c){var h=n.updateQueue;if(h===null)return null;if(h=h.shared,Wt&2){var m=h.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),h.pending=a,sa(n,c)}return m=h.interleaved,m===null?(a.next=a,z0(h)):(a.next=m.next,m.next=a),h.interleaved=a,sa(n,c)}function Od(n,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194240)!==0)){var h=a.lanes;h&=n.pendingLanes,c|=h,a.lanes=c,Vs(n,c)}}function Og(n,a){var c=n.updateQueue,h=n.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var m=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var k={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};x===null?m=x=k:x=x.next=k,c=c.next}while(c!==null);x===null?m=x=a:x=x.next=a}else m=x=a;c={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:h.shared,effects:h.effects},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=a:n.next=a,c.lastBaseUpdate=a}function Xc(n,a,c,h){var m=n.updateQueue;oa=!1;var x=m.firstBaseUpdate,k=m.lastBaseUpdate,Y=m.shared.pending;if(Y!==null){m.shared.pending=null;var Q=Y,fe=Q.next;Q.next=null,k===null?x=fe:k.next=fe,k=Q;var Fe=n.alternate;Fe!==null&&(Fe=Fe.updateQueue,Y=Fe.lastBaseUpdate,Y!==k&&(Y===null?Fe.firstBaseUpdate=fe:Y.next=fe,Fe.lastBaseUpdate=Q))}if(x!==null){var Ne=m.baseState;k=0,Fe=fe=Q=null,Y=x;do{var ke=Y.lane,Ke=Y.eventTime;if((h&ke)===ke){Fe!==null&&(Fe=Fe.next={eventTime:Ke,lane:0,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null});e:{var at=n,lt=Y;switch(ke=a,Ke=c,lt.tag){case 1:if(at=lt.payload,typeof at=="function"){Ne=at.call(Ke,Ne,ke);break e}Ne=at;break e;case 3:at.flags=at.flags&-65537|128;case 0:if(at=lt.payload,ke=typeof at=="function"?at.call(Ke,Ne,ke):at,ke==null)break e;Ne=De({},Ne,ke);break e;case 2:oa=!0}}Y.callback!==null&&Y.lane!==0&&(n.flags|=64,ke=m.effects,ke===null?m.effects=[Y]:ke.push(Y))}else Ke={eventTime:Ke,lane:ke,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},Fe===null?(fe=Fe=Ke,Q=Ne):Fe=Fe.next=Ke,k|=ke;if(Y=Y.next,Y===null){if(Y=m.shared.pending,Y===null)break;ke=Y,Y=ke.next,ke.next=null,m.lastBaseUpdate=ke,m.shared.pending=null}}while(!0);if(Fe===null&&(Q=Ne),m.baseState=Q,m.firstBaseUpdate=fe,m.lastBaseUpdate=Fe,a=m.shared.interleaved,a!==null){m=a;do k|=m.lane,m=m.next;while(m!==a)}else x===null&&(m.shared.lanes=0);ks|=k,n.lanes=k,n.memoizedState=Ne}}function V0(n,a,c){if(n=a.effects,a.effects=null,n!==null)for(a=0;a<n.length;a++){var h=n[a],m=h.callback;if(m!==null){if(h.callback=null,h=c,typeof m!="function")throw Error(i(191,m));m.call(h)}}}var Zc={},Ds=Da(Zc),Jc=Da(Zc),ef=Da(Zc);function Ll(n){if(n===Zc)throw Error(i(174));return n}function W0(n,a){switch(ft(ef,a),ft(Jc,n),ft(Ds,Zc),n=a.nodeType,n){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:Rn(null,"");break;default:n=n===8?a.parentNode:a,a=n.namespaceURI||null,n=n.tagName,a=Rn(a,n)}$r(Ds),ft(Ds,a)}function Ul(){$r(Ds),$r(Jc),$r(ef)}function Ng(n){Ll(ef.current);var a=Ll(Ds.current),c=Rn(a,n.type);a!==c&&(ft(Jc,n),ft(Ds,c))}function Nd(n){Jc.current===n&&($r(Ds),$r(Jc))}var en=Da(0);function Bd(n){for(var a=n;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if(a.flags&128)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var tf=[];function ht(){for(var n=0;n<tf.length;n++)tf[n]._workInProgressVersionPrimary=null;tf.length=0}var It=q.ReactCurrentDispatcher,or=q.ReactCurrentBatchConfig,Rr=0,lr=null,En=null,Pn=null,Md=!1,rf=!1,jl=0,Ae=0;function nr(){throw Error(i(321))}function St(n,a){if(a===null)return!1;for(var c=0;c<a.length&&c<n.length;c++)if(!Qa(n[c],a[c]))return!1;return!0}function Vo(n,a,c,h,m,x){if(Rr=x,lr=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,It.current=n===null||n.memoizedState===null?Qd:uf,n=c(h,m),rf){x=0;do{if(rf=!1,jl=0,25<=x)throw Error(i(301));x+=1,Pn=En=null,a.updateQueue=null,It.current=Xd,n=c(h,m)}while(rf)}if(It.current=Wl,a=En!==null&&En.next!==null,Rr=0,Pn=En=lr=null,Md=!1,a)throw Error(i(300));return n}function Za(){var n=jl!==0;return jl=0,n}function fi(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pn===null?lr.memoizedState=Pn=n:Pn=Pn.next=n,Pn}function cn(){if(En===null){var n=lr.alternate;n=n!==null?n.memoizedState:null}else n=En.next;var a=Pn===null?lr.memoizedState:Pn.next;if(a!==null)Pn=a,En=n;else{if(n===null)throw Error(i(310));En=n,n={memoizedState:En.memoizedState,baseState:En.baseState,baseQueue:En.baseQueue,queue:En.queue,next:null},Pn===null?lr.memoizedState=Pn=n:Pn=Pn.next=n}return Pn}function ro(n,a){return typeof a=="function"?a(n):a}function Wo(n){var a=cn(),c=a.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=n;var h=En,m=h.baseQueue,x=c.pending;if(x!==null){if(m!==null){var k=m.next;m.next=x.next,x.next=k}h.baseQueue=m=x,c.pending=null}if(m!==null){x=m.next,h=h.baseState;var Y=k=null,Q=null,fe=x;do{var Fe=fe.lane;if((Rr&Fe)===Fe)Q!==null&&(Q=Q.next={lane:0,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),h=fe.hasEagerState?fe.eagerState:n(h,fe.action);else{var Ne={lane:Fe,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null};Q===null?(Y=Q=Ne,k=h):Q=Q.next=Ne,lr.lanes|=Fe,ks|=Fe}fe=fe.next}while(fe!==null&&fe!==x);Q===null?k=h:Q.next=Y,Qa(h,a.memoizedState)||(Cn=!0),a.memoizedState=h,a.baseState=k,a.baseQueue=Q,c.lastRenderedState=h}if(n=c.interleaved,n!==null){m=n;do x=m.lane,lr.lanes|=x,ks|=x,m=m.next;while(m!==n)}else m===null&&(c.lanes=0);return[a.memoizedState,c.dispatch]}function zl(n){var a=cn(),c=a.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=n;var h=c.dispatch,m=c.pending,x=a.memoizedState;if(m!==null){c.pending=null;var k=m=m.next;do x=n(x,k.action),k=k.next;while(k!==m);Qa(x,a.memoizedState)||(Cn=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),c.lastRenderedState=x}return[x,h]}function Hd(){}function Id(n,a){var c=lr,h=cn(),m=a(),x=!Qa(h.memoizedState,m);if(x&&(h.memoizedState=m,Cn=!0),h=h.queue,nf(Ld.bind(null,c,h,n),[n]),h.getSnapshot!==a||x||Pn!==null&&Pn.memoizedState.tag&1){if(c.flags|=2048,ql(9,Pd.bind(null,c,h,m,a),void 0,null),Bn===null)throw Error(i(349));Rr&30||$d(c,a,m)}return m}function $d(n,a,c){n.flags|=16384,n={getSnapshot:a,value:c},a=lr.updateQueue,a===null?(a={lastEffect:null,stores:null},lr.updateQueue=a,a.stores=[n]):(c=a.stores,c===null?a.stores=[n]:c.push(n))}function Pd(n,a,c,h){a.value=c,a.getSnapshot=h,Ud(a)&&jd(n)}function Ld(n,a,c){return c(function(){Ud(a)&&jd(n)})}function Ud(n){var a=n.getSnapshot;n=n.value;try{var c=a();return!Qa(n,c)}catch{return!0}}function jd(n){var a=sa(n,1);a!==null&&Si(a,n,1,-1)}function zd(n){var a=fi();return typeof n=="function"&&(n=n()),a.memoizedState=a.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ro,lastRenderedState:n},a.queue=n,n=n.dispatch=Vl.bind(null,lr,n),[a.memoizedState,n]}function ql(n,a,c,h){return n={tag:n,create:a,destroy:c,deps:h,next:null},a=lr.updateQueue,a===null?(a={lastEffect:null,stores:null},lr.updateQueue=a,a.lastEffect=n.next=n):(c=a.lastEffect,c===null?a.lastEffect=n.next=n:(h=c.next,c.next=n,n.next=h,a.lastEffect=n)),n}function qd(){return cn().memoizedState}function Wu(n,a,c,h){var m=fi();lr.flags|=n,m.memoizedState=ql(1|a,c,void 0,h===void 0?null:h)}function Gu(n,a,c,h){var m=cn();h=h===void 0?null:h;var x=void 0;if(En!==null){var k=En.memoizedState;if(x=k.destroy,h!==null&&St(h,k.deps)){m.memoizedState=ql(a,c,x,h);return}}lr.flags|=n,m.memoizedState=ql(1|a,c,x,h)}function Yd(n,a){return Wu(8390656,8,n,a)}function nf(n,a){return Gu(2048,8,n,a)}function Vd(n,a){return Gu(4,2,n,a)}function af(n,a){return Gu(4,4,n,a)}function Yl(n,a){if(typeof a=="function")return n=n(),a(n),function(){a(null)};if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function Wd(n,a,c){return c=c!=null?c.concat([n]):null,Gu(4,4,Yl.bind(null,a,n),c)}function sf(){}function Gd(n,a){var c=cn();a=a===void 0?null:a;var h=c.memoizedState;return h!==null&&a!==null&&St(a,h[1])?h[0]:(c.memoizedState=[n,a],n)}function Kd(n,a){var c=cn();a=a===void 0?null:a;var h=c.memoizedState;return h!==null&&a!==null&&St(a,h[1])?h[0]:(n=n(),c.memoizedState=[n,a],n)}function G0(n,a,c){return Rr&21?(Qa(c,a)||(c=Tu(),lr.lanes|=c,ks|=c,n.baseState=!0),a):(n.baseState&&(n.baseState=!1,Cn=!0),n.memoizedState=c)}function of(n,a){var c=sr;sr=c!==0&&4>c?c:4,n(!0);var h=or.transition;or.transition={};try{n(!1),a()}finally{sr=c,or.transition=h}}function K0(){return cn().memoizedState}function lf(n,a,c){var h=Fs(n);if(c={lane:h,action:c,hasEagerState:!1,eagerState:null,next:null},Yi(n))Bg(a,c);else if(c=q0(n,a,c,h),c!==null){var m=bn();Si(c,n,h,m),Nr(c,a,h)}}function Vl(n,a,c){var h=Fs(n),m={lane:h,action:c,hasEagerState:!1,eagerState:null,next:null};if(Yi(n))Bg(a,m);else{var x=n.alternate;if(n.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var k=a.lastRenderedState,Y=x(k,c);if(m.hasEagerState=!0,m.eagerState=Y,Qa(Y,k)){var Q=a.interleaved;Q===null?(m.next=m,z0(a)):(m.next=Q.next,Q.next=m),a.interleaved=m;return}}catch{}finally{}c=q0(n,a,m,h),c!==null&&(m=bn(),Si(c,n,h,m),Nr(c,a,h))}}function Yi(n){var a=n.alternate;return n===lr||a!==null&&a===lr}function Bg(n,a){rf=Md=!0;var c=n.pending;c===null?a.next=a:(a.next=c.next,c.next=a),n.pending=a}function Nr(n,a,c){if(c&4194240){var h=a.lanes;h&=n.pendingLanes,c|=h,a.lanes=c,Vs(n,c)}}var Wl={readContext:Aa,useCallback:nr,useContext:nr,useEffect:nr,useImperativeHandle:nr,useInsertionEffect:nr,useLayoutEffect:nr,useMemo:nr,useReducer:nr,useRef:nr,useState:nr,useDebugValue:nr,useDeferredValue:nr,useTransition:nr,useMutableSource:nr,useSyncExternalStore:nr,useId:nr,unstable_isNewReconciler:!1},Qd={readContext:Aa,useCallback:function(n,a){return fi().memoizedState=[n,a===void 0?null:a],n},useContext:Aa,useEffect:Yd,useImperativeHandle:function(n,a,c){return c=c!=null?c.concat([n]):null,Wu(4194308,4,Yl.bind(null,a,n),c)},useLayoutEffect:function(n,a){return Wu(4194308,4,n,a)},useInsertionEffect:function(n,a){return Wu(4,2,n,a)},useMemo:function(n,a){var c=fi();return a=a===void 0?null:a,n=n(),c.memoizedState=[n,a],n},useReducer:function(n,a,c){var h=fi();return a=c!==void 0?c(a):a,h.memoizedState=h.baseState=a,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:a},h.queue=n,n=n.dispatch=lf.bind(null,lr,n),[h.memoizedState,n]},useRef:function(n){var a=fi();return n={current:n},a.memoizedState=n},useState:zd,useDebugValue:sf,useDeferredValue:function(n){return fi().memoizedState=n},useTransition:function(){var n=zd(!1),a=n[0];return n=of.bind(null,n[1]),fi().memoizedState=n,[a,n]},useMutableSource:function(){},useSyncExternalStore:function(n,a,c){var h=lr,m=fi();if(Yr){if(c===void 0)throw Error(i(407));c=c()}else{if(c=a(),Bn===null)throw Error(i(349));Rr&30||$d(h,a,c)}m.memoizedState=c;var x={value:c,getSnapshot:a};return m.queue=x,Yd(Ld.bind(null,h,x,n),[n]),h.flags|=2048,ql(9,Pd.bind(null,h,x,c,a),void 0,null),c},useId:function(){var n=fi(),a=Bn.identifierPrefix;if(Yr){var c=_s,h=bs;c=(h&~(1<<32-gi(h)-1)).toString(32)+c,a=":"+a+"R"+c,c=jl++,0<c&&(a+="H"+c.toString(32)),a+=":"}else c=Ae++,a=":"+a+"r"+c.toString(32)+":";return n.memoizedState=a},unstable_isNewReconciler:!1},uf={readContext:Aa,useCallback:Gd,useContext:Aa,useEffect:nf,useImperativeHandle:Wd,useInsertionEffect:Vd,useLayoutEffect:af,useMemo:Kd,useReducer:Wo,useRef:qd,useState:function(){return Wo(ro)},useDebugValue:sf,useDeferredValue:function(n){var a=cn();return G0(a,En.memoizedState,n)},useTransition:function(){var n=Wo(ro)[0],a=cn().memoizedState;return[n,a]},useMutableSource:Hd,useSyncExternalStore:Id,useId:K0,unstable_isNewReconciler:!1},Xd={readContext:Aa,useCallback:Gd,useContext:Aa,useEffect:nf,useImperativeHandle:Wd,useInsertionEffect:Vd,useLayoutEffect:af,useMemo:Kd,useReducer:zl,useRef:qd,useState:function(){return zl(ro)},useDebugValue:sf,useDeferredValue:function(n){var a=cn();return En===null?a.memoizedState=n:G0(a,En.memoizedState,n)},useTransition:function(){var n=zl(ro)[0],a=cn().memoizedState;return[n,a]},useMutableSource:Hd,useSyncExternalStore:Id,useId:K0,unstable_isNewReconciler:!1};function Ja(n,a){if(n&&n.defaultProps){a=De({},a),n=n.defaultProps;for(var c in n)a[c]===void 0&&(a[c]=n[c]);return a}return a}function Q0(n,a,c,h){a=n.memoizedState,c=c(h,a),c=c==null?a:De({},a,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var Zd={isMounted:function(n){return(n=n._reactInternals)?Ft(n)===n:!1},enqueueSetState:function(n,a,c){n=n._reactInternals;var h=bn(),m=Fs(n),x=to(h,m);x.payload=a,c!=null&&(x.callback=c),a=Yo(n,x,m),a!==null&&(Si(a,n,m,h),Od(a,n,m))},enqueueReplaceState:function(n,a,c){n=n._reactInternals;var h=bn(),m=Fs(n),x=to(h,m);x.tag=1,x.payload=a,c!=null&&(x.callback=c),a=Yo(n,x,m),a!==null&&(Si(a,n,m,h),Od(a,n,m))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var c=bn(),h=Fs(n),m=to(c,h);m.tag=2,a!=null&&(m.callback=a),a=Yo(n,m,h),a!==null&&(Si(a,n,h,c),Od(a,n,h))}};function Mg(n,a,c,h,m,x,k){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(h,x,k):a.prototype&&a.prototype.isPureReactComponent?!Uc(c,h)||!Uc(m,x):!0}function Jd(n,a,c){var h=!1,m=ci,x=a.contextType;return typeof x=="object"&&x!==null?x=Aa(x):(m=yn(a)?Li:an.current,h=a.contextTypes,x=(h=h!=null)?Ui(n,m):ci),a=new a(c,x),n.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Zd,n.stateNode=a,a._reactInternals=n,h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=m,n.__reactInternalMemoizedMaskedChildContext=x),a}function Hg(n,a,c,h){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,h),a.state!==n&&Zd.enqueueReplaceState(a,a.state,null)}function cf(n,a,c,h){var m=n.stateNode;m.props=c,m.state=n.memoizedState,m.refs={},Y0(n);var x=a.contextType;typeof x=="object"&&x!==null?m.context=Aa(x):(x=yn(a)?Li:an.current,m.context=Ui(n,x)),m.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Q0(n,a,x,c),m.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(a=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),a!==m.state&&Zd.enqueueReplaceState(m,m.state,null),Xc(n,c,m,h),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308)}function Gl(n,a){try{var c="",h=a;do c+=Je(h),h=h.return;while(h);var m=c}catch(x){m=`
70
70
  Error generating stack: `+x.message+`
71
71
  `+x.stack}return{value:n,source:a,stack:m,digest:null}}function X0(n,a,c){return{value:n,source:null,stack:c??null,digest:a??null}}function Z0(n,a){try{console.error(a.value)}catch(c){setTimeout(function(){throw c})}}var eh=typeof WeakMap=="function"?WeakMap:Map;function Ig(n,a,c){c=to(-1,c),c.tag=3,c.payload={element:null};var h=a.value;return c.callback=function(){ec||(ec=!0,Xl=h),Z0(n,a)},c}function J0(n,a,c){c=to(-1,c),c.tag=3;var h=n.type.getDerivedStateFromError;if(typeof h=="function"){var m=a.value;c.payload=function(){return h(m)},c.callback=function(){Z0(n,a)}}var x=n.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){Z0(n,a),typeof h!="function"&&(Qo===null?Qo=new Set([this]):Qo.add(this));var k=a.stack;this.componentDidCatch(a.value,{componentStack:k!==null?k:""})}),c}function ep(n,a,c){var h=n.pingCache;if(h===null){h=n.pingCache=new eh;var m=new Set;h.set(a,m)}else m=h.get(a),m===void 0&&(m=new Set,h.set(a,m));m.has(c)||(m.add(c),n=L1.bind(null,n,a,c),a.then(n,n))}function $g(n){do{var a;if((a=n.tag===13)&&(a=n.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return n;n=n.return}while(n!==null);return null}function Go(n,a,c,h,m){return n.mode&1?(n.flags|=65536,n.lanes=m,n):(n===a?n.flags|=65536:(n.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(a=to(-1,1),a.tag=2,Yo(c,a,1))),c.lanes|=1),n)}var ff=q.ReactCurrentOwner,Cn=!1;function Kn(n,a,c,h){a.child=n===null?ze(a,null,c,h):un(a,n.child,c,h)}function Vi(n,a,c,h,m){c=c.render;var x=a.ref;return Jr(a,m),h=Vo(n,a,c,h,x,m),c=Za(),n!==null&&!Cn?(a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~m,Fa(n,a,m)):(Yr&&c&&Rd(a),a.flags|=1,Kn(n,a,h,m),a.child)}function Kl(n,a,c,h,m){if(n===null){var x=c.type;return typeof x=="function"&&!pp(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(a.tag=15,a.type=x,Nt(n,a,x,h,m)):(n=Tf(c.type,null,h,a,a.mode,m),n.ref=a.ref,n.return=a,a.child=n)}if(x=n.child,!(n.lanes&m)){var k=x.memoizedProps;if(c=c.compare,c=c!==null?c:Uc,c(k,h)&&n.ref===a.ref)return Fa(n,a,m)}return a.flags|=1,n=Zo(x,h),n.ref=a.ref,n.return=a,a.child=n}function Nt(n,a,c,h,m){if(n!==null){var x=n.memoizedProps;if(Uc(x,h)&&n.ref===a.ref)if(Cn=!1,a.pendingProps=h=x,(n.lanes&m)!==0)n.flags&131072&&(Cn=!0);else return a.lanes=n.lanes,Fa(n,a,m)}return Pg(n,a,c,h,m)}function df(n,a,c){var h=a.pendingProps,m=h.children,x=n!==null?n.memoizedState:null;if(h.mode==="hidden")if(!(a.mode&1))a.memoizedState={baseLanes:0,cachePool:null,transitions:null},ft(Xu,la),la|=c;else{if(!(c&1073741824))return n=x!==null?x.baseLanes|c:c,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:n,cachePool:null,transitions:null},a.updateQueue=null,ft(Xu,la),la|=n,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},h=x!==null?x.baseLanes:c,ft(Xu,la),la|=h}else x!==null?(h=x.baseLanes|c,a.memoizedState=null):h=c,ft(Xu,la),la|=h;return Kn(n,a,m,c),a.child}function tp(n,a){var c=a.ref;(n===null&&c!==null||n!==null&&n.ref!==c)&&(a.flags|=512,a.flags|=2097152)}function Pg(n,a,c,h,m){var x=yn(c)?Li:an.current;return x=Ui(a,x),Jr(a,m),c=Vo(n,a,c,h,x,m),h=Za(),n!==null&&!Cn?(a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~m,Fa(n,a,m)):(Yr&&h&&Rd(a),a.flags|=1,Kn(n,a,c,m),a.child)}function Lg(n,a,c,h,m){if(yn(c)){var x=!0;$n(a)}else x=!1;if(Jr(a,m),a.stateNode===null)ka(n,a),Jd(a,c,h),cf(a,c,h,m),h=!0;else if(n===null){var k=a.stateNode,Y=a.memoizedProps;k.props=Y;var Q=k.context,fe=c.contextType;typeof fe=="object"&&fe!==null?fe=Aa(fe):(fe=yn(c)?Li:an.current,fe=Ui(a,fe));var Fe=c.getDerivedStateFromProps,Ne=typeof Fe=="function"||typeof k.getSnapshotBeforeUpdate=="function";Ne||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(Y!==h||Q!==fe)&&Hg(a,k,h,fe),oa=!1;var ke=a.memoizedState;k.state=ke,Xc(a,h,k,m),Q=a.memoizedState,Y!==h||ke!==Q||On.current||oa?(typeof Fe=="function"&&(Q0(a,c,Fe,h),Q=a.memoizedState),(Y=oa||Mg(a,c,Y,h,ke,Q,fe))?(Ne||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(a.flags|=4194308)):(typeof k.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=Q),k.props=h,k.state=Q,k.context=fe,h=Y):(typeof k.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{k=a.stateNode,Fg(n,a),Y=a.memoizedProps,fe=a.type===a.elementType?Y:Ja(a.type,Y),k.props=fe,Ne=a.pendingProps,ke=k.context,Q=c.contextType,typeof Q=="object"&&Q!==null?Q=Aa(Q):(Q=yn(c)?Li:an.current,Q=Ui(a,Q));var Ke=c.getDerivedStateFromProps;(Fe=typeof Ke=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(Y!==Ne||ke!==Q)&&Hg(a,k,h,Q),oa=!1,ke=a.memoizedState,k.state=ke,Xc(a,h,k,m);var at=a.memoizedState;Y!==Ne||ke!==at||On.current||oa?(typeof Ke=="function"&&(Q0(a,c,Ke,h),at=a.memoizedState),(fe=oa||Mg(a,c,fe,h,ke,at,Q)||!1)?(Fe||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(h,at,Q),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(h,at,Q)),typeof k.componentDidUpdate=="function"&&(a.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof k.componentDidUpdate!="function"||Y===n.memoizedProps&&ke===n.memoizedState||(a.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||Y===n.memoizedProps&&ke===n.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=at),k.props=h,k.state=at,k.context=Q,h=fe):(typeof k.componentDidUpdate!="function"||Y===n.memoizedProps&&ke===n.memoizedState||(a.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||Y===n.memoizedProps&&ke===n.memoizedState||(a.flags|=1024),h=!1)}return hf(n,a,c,h,x,m)}function hf(n,a,c,h,m,x){tp(n,a);var k=(a.flags&128)!==0;if(!h&&!k)return m&&Dd(a,c,!1),Fa(n,a,x);h=a.stateNode,ff.current=a;var Y=k&&typeof c.getDerivedStateFromError!="function"?null:h.render();return a.flags|=1,n!==null&&k?(a.child=un(a,n.child,null,x),a.child=un(a,null,Y,x)):Kn(n,a,Y,x),a.memoizedState=h.state,m&&Dd(a,c,!0),a.child}function Ku(n){var a=n.stateNode;a.pendingContext?Tg(n,a.pendingContext,a.pendingContext!==a.context):a.context&&Tg(n,a.context,!1),W0(n,a.containerInfo)}function Ug(n,a,c,h,m){return qo(),eo(m),a.flags|=256,Kn(n,a,c,h),a.child}var th={dehydrated:null,treeContext:null,retryLane:0};function rp(n){return{baseLanes:n,cachePool:null,transitions:null}}function rh(n,a,c){var h=a.pendingProps,m=en.current,x=!1,k=(a.flags&128)!==0,Y;if((Y=k)||(Y=n!==null&&n.memoizedState===null?!1:(m&2)!==0),Y?(x=!0,a.flags&=-129):(n===null||n.memoizedState!==null)&&(m|=1),ft(en,m&1),n===null)return $0(a),n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(a.mode&1?n.data==="$!"?a.lanes=8:a.lanes=1073741824:a.lanes=1,null):(k=h.children,n=h.fallback,x?(h=a.mode,x=a.child,k={mode:"hidden",children:k},!(h&1)&&x!==null?(x.childLanes=0,x.pendingProps=k):x=Jo(k,h,0,null),n=so(n,h,c,null),x.return=a,n.return=a,x.sibling=n,a.child=x,a.child.memoizedState=rp(c),a.memoizedState=th,n):np(a,k));if(m=n.memoizedState,m!==null&&(Y=m.dehydrated,Y!==null))return jg(n,a,k,h,Y,m,c);if(x){x=h.fallback,k=a.mode,m=n.child,Y=m.sibling;var Q={mode:"hidden",children:h.children};return!(k&1)&&a.child!==m?(h=a.child,h.childLanes=0,h.pendingProps=Q,a.deletions=null):(h=Zo(m,Q),h.subtreeFlags=m.subtreeFlags&14680064),Y!==null?x=Zo(Y,x):(x=so(x,k,c,null),x.flags|=2),x.return=a,h.return=a,h.sibling=x,a.child=h,h=x,x=a.child,k=n.child.memoizedState,k=k===null?rp(c):{baseLanes:k.baseLanes|c,cachePool:null,transitions:k.transitions},x.memoizedState=k,x.childLanes=n.childLanes&~c,a.memoizedState=th,h}return x=n.child,n=x.sibling,h=Zo(x,{mode:"visible",children:h.children}),!(a.mode&1)&&(h.lanes=c),h.return=a,h.sibling=null,n!==null&&(c=a.deletions,c===null?(a.deletions=[n],a.flags|=16):c.push(n)),a.child=h,a.memoizedState=null,h}function np(n,a){return a=Jo({mode:"visible",children:a},n.mode,0,null),a.return=n,n.child=a}function pf(n,a,c,h){return h!==null&&eo(h),un(a,n.child,null,c),n=np(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function jg(n,a,c,h,m,x,k){if(c)return a.flags&256?(a.flags&=-257,h=X0(Error(i(422))),pf(n,a,k,h)):a.memoizedState!==null?(a.child=n.child,a.flags|=128,null):(x=h.fallback,m=a.mode,h=Jo({mode:"visible",children:h.children},m,0,null),x=so(x,m,k,null),x.flags|=2,h.return=a,x.return=a,h.sibling=x,a.child=h,a.mode&1&&un(a,n.child,null,k),a.child.memoizedState=rp(k),a.memoizedState=th,x);if(!(a.mode&1))return pf(n,a,k,null);if(m.data==="$!"){if(h=m.nextSibling&&m.nextSibling.dataset,h)var Y=h.dgst;return h=Y,x=Error(i(419)),h=X0(x,h,void 0),pf(n,a,k,h)}if(Y=(k&n.childLanes)!==0,Cn||Y){if(h=Bn,h!==null){switch(k&-k){case 4:m=2;break;case 16:m=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:m=32;break;case 536870912:m=268435456;break;default:m=0}m=m&(h.suspendedLanes|k)?0:m,m!==0&&m!==x.retryLane&&(x.retryLane=m,sa(n,m),Si(h,n,m,-1))}return hp(),h=X0(Error(i(421))),pf(n,a,k,h)}return m.data==="$?"?(a.flags|=128,a.child=n.child,a=U1.bind(null,n),m._reactRetry=a,null):(n=x.treeContext,zi=Es(m.nextSibling),ji=a,Yr=!0,Ra=null,n!==null&&(xn[Ta++]=bs,xn[Ta++]=_s,xn[Ta++]=ia,bs=n.id,_s=n.overflow,ia=a),a=np(a,h.children),a.flags|=4096,a)}function ip(n,a,c){n.lanes|=a;var h=n.alternate;h!==null&&(h.lanes|=a),j0(n.return,a,c)}function xi(n,a,c,h,m){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:m}:(x.isBackwards=a,x.rendering=null,x.renderingStartTime=0,x.last=h,x.tail=c,x.tailMode=m)}function Ts(n,a,c){var h=a.pendingProps,m=h.revealOrder,x=h.tail;if(Kn(n,a,h.children,c),h=en.current,h&2)h=h&1|2,a.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&ip(n,c,a);else if(n.tag===19)ip(n,c,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}h&=1}if(ft(en,h),!(a.mode&1))a.memoizedState=null;else switch(m){case"forwards":for(c=a.child,m=null;c!==null;)n=c.alternate,n!==null&&Bd(n)===null&&(m=c),c=c.sibling;c=m,c===null?(m=a.child,a.child=null):(m=c.sibling,c.sibling=null),xi(a,!1,m,c,x);break;case"backwards":for(c=null,m=a.child,a.child=null;m!==null;){if(n=m.alternate,n!==null&&Bd(n)===null){a.child=m;break}n=m.sibling,m.sibling=c,c=m,m=n}xi(a,!0,c,null,x);break;case"together":xi(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function ka(n,a){!(a.mode&1)&&n!==null&&(n.alternate=null,a.alternate=null,a.flags|=2)}function Fa(n,a,c){if(n!==null&&(a.dependencies=n.dependencies),ks|=a.lanes,!(c&a.childLanes))return null;if(n!==null&&a.child!==n.child)throw Error(i(153));if(a.child!==null){for(n=a.child,c=Zo(n,n.pendingProps),a.child=c,c.return=a;n.sibling!==null;)n=n.sibling,c=c.sibling=Zo(n,n.pendingProps),c.return=a;c.sibling=null}return a.child}function vf(n,a,c){switch(a.tag){case 3:Ku(a),qo();break;case 5:Ng(a);break;case 1:yn(a.type)&&$n(a);break;case 4:W0(a,a.stateNode.containerInfo);break;case 10:var h=a.type._context,m=a.memoizedProps.value;ft(aa,h._currentValue),h._currentValue=m;break;case 13:if(h=a.memoizedState,h!==null)return h.dehydrated!==null?(ft(en,en.current&1),a.flags|=128,null):c&a.child.childLanes?rh(n,a,c):(ft(en,en.current&1),n=Fa(n,a,c),n!==null?n.sibling:null);ft(en,en.current&1);break;case 19:if(h=(c&a.childLanes)!==0,n.flags&128){if(h)return Ts(n,a,c);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),ft(en,en.current),h)break;return null;case 22:case 23:return a.lanes=0,df(n,a,c)}return Fa(n,a,c)}var Oa,Sn,zg,qg;Oa=function(n,a){for(var c=a.child;c!==null;){if(c.tag===5||c.tag===6)n.appendChild(c.stateNode);else if(c.tag!==4&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return;c=c.return}c.sibling.return=c.return,c=c.sibling}},Sn=function(){},zg=function(n,a,c,h){var m=n.memoizedProps;if(m!==h){n=a.stateNode,Ll(Ds.current);var x=null;switch(c){case"input":m=Xt(n,m),h=Xt(n,h),x=[];break;case"select":m=De({},m,{value:void 0}),h=De({},h,{value:void 0}),x=[];break;case"textarea":m=ar(n,m),h=ar(n,h),x=[];break;default:typeof m.onClick!="function"&&typeof h.onClick=="function"&&(n.onclick=$o)}Or(c,h);var k;c=null;for(fe in m)if(!h.hasOwnProperty(fe)&&m.hasOwnProperty(fe)&&m[fe]!=null)if(fe==="style"){var Y=m[fe];for(k in Y)Y.hasOwnProperty(k)&&(c||(c={}),c[k]="")}else fe!=="dangerouslySetInnerHTML"&&fe!=="children"&&fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&fe!=="autoFocus"&&(f.hasOwnProperty(fe)?x||(x=[]):(x=x||[]).push(fe,null));for(fe in h){var Q=h[fe];if(Y=m!=null?m[fe]:void 0,h.hasOwnProperty(fe)&&Q!==Y&&(Q!=null||Y!=null))if(fe==="style")if(Y){for(k in Y)!Y.hasOwnProperty(k)||Q&&Q.hasOwnProperty(k)||(c||(c={}),c[k]="");for(k in Q)Q.hasOwnProperty(k)&&Y[k]!==Q[k]&&(c||(c={}),c[k]=Q[k])}else c||(x||(x=[]),x.push(fe,c)),c=Q;else fe==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Y=Y?Y.__html:void 0,Q!=null&&Y!==Q&&(x=x||[]).push(fe,Q)):fe==="children"?typeof Q!="string"&&typeof Q!="number"||(x=x||[]).push(fe,""+Q):fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&(f.hasOwnProperty(fe)?(Q!=null&&fe==="onScroll"&&xr("scroll",n),x||Y===Q||(x=[])):(x=x||[]).push(fe,Q))}c&&(x=x||[]).push("style",c);var fe=x;(a.updateQueue=fe)&&(a.flags|=4)}},qg=function(n,a,c,h){c!==h&&(a.flags|=4)};function gf(n,a){if(!Yr)switch(n.tailMode){case"hidden":a=n.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:h.sibling=null}}function Ln(n){var a=n.alternate!==null&&n.alternate.child===n.child,c=0,h=0;if(a)for(var m=n.child;m!==null;)c|=m.lanes|m.childLanes,h|=m.subtreeFlags&14680064,h|=m.flags&14680064,m.return=n,m=m.sibling;else for(m=n.child;m!==null;)c|=m.lanes|m.childLanes,h|=m.subtreeFlags,h|=m.flags,m.return=n,m=m.sibling;return n.subtreeFlags|=h,n.childLanes=c,a}function Yg(n,a,c){var h=a.pendingProps;switch(Ad(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ln(a),null;case 1:return yn(a.type)&&qu(),Ln(a),null;case 3:return h=a.stateNode,Ul(),$r(On),$r(an),ht(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(n===null||n.child===null)&&(kd(a)?a.flags|=4:n===null||n.memoizedState.isDehydrated&&!(a.flags&256)||(a.flags|=1024,Ra!==null&&(Zl(Ra),Ra=null))),Sn(n,a),Ln(a),null;case 5:Nd(a);var m=Ll(ef.current);if(c=a.type,n!==null&&a.stateNode!=null)zg(n,a,c,h,m),n.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!h){if(a.stateNode===null)throw Error(i(166));return Ln(a),null}if(n=Ll(Ds.current),kd(a)){h=a.stateNode,c=a.type;var x=a.memoizedProps;switch(h[Cs]=a,h[Wc]=x,n=(a.mode&1)!==0,c){case"dialog":xr("cancel",h),xr("close",h);break;case"iframe":case"object":case"embed":xr("load",h);break;case"video":case"audio":for(m=0;m<qc.length;m++)xr(qc[m],h);break;case"source":xr("error",h);break;case"img":case"image":case"link":xr("error",h),xr("load",h);break;case"details":xr("toggle",h);break;case"input":Fr(h,x),xr("invalid",h);break;case"select":h._wrapperState={wasMultiple:!!x.multiple},xr("invalid",h);break;case"textarea":Pr(h,x),xr("invalid",h)}Or(c,x),m=null;for(var k in x)if(x.hasOwnProperty(k)){var Y=x[k];k==="children"?typeof Y=="string"?h.textContent!==Y&&(x.suppressHydrationWarning!==!0&&Sd(h.textContent,Y,n),m=["children",Y]):typeof Y=="number"&&h.textContent!==""+Y&&(x.suppressHydrationWarning!==!0&&Sd(h.textContent,Y,n),m=["children",""+Y]):f.hasOwnProperty(k)&&Y!=null&&k==="onScroll"&&xr("scroll",h)}switch(c){case"input":dr(h),Tn(h,x,!0);break;case"textarea":dr(h),Kr(h);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(h.onclick=$o)}h=m,a.updateQueue=h,h!==null&&(a.flags|=4)}else{k=m.nodeType===9?m:m.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=Qr(c)),n==="http://www.w3.org/1999/xhtml"?c==="script"?(n=k.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof h.is=="string"?n=k.createElement(c,{is:h.is}):(n=k.createElement(c),c==="select"&&(k=n,h.multiple?k.multiple=!0:h.size&&(k.size=h.size))):n=k.createElementNS(n,c),n[Cs]=a,n[Wc]=h,Oa(n,a,!1,!1),a.stateNode=n;e:{switch(k=gn(c,h),c){case"dialog":xr("cancel",n),xr("close",n),m=h;break;case"iframe":case"object":case"embed":xr("load",n),m=h;break;case"video":case"audio":for(m=0;m<qc.length;m++)xr(qc[m],n);m=h;break;case"source":xr("error",n),m=h;break;case"img":case"image":case"link":xr("error",n),xr("load",n),m=h;break;case"details":xr("toggle",n),m=h;break;case"input":Fr(n,h),m=Xt(n,h),xr("invalid",n);break;case"option":m=h;break;case"select":n._wrapperState={wasMultiple:!!h.multiple},m=De({},h,{value:void 0}),xr("invalid",n);break;case"textarea":Pr(n,h),m=ar(n,h),xr("invalid",n);break;default:m=h}Or(c,m),Y=m;for(x in Y)if(Y.hasOwnProperty(x)){var Q=Y[x];x==="style"?Sr(n,Q):x==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&ra(n,Q)):x==="children"?typeof Q=="string"?(c!=="textarea"||Q!=="")&&Pe(n,Q):typeof Q=="number"&&Pe(n,""+Q):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(f.hasOwnProperty(x)?Q!=null&&x==="onScroll"&&xr("scroll",n):Q!=null&&U(n,x,Q,k))}switch(c){case"input":dr(n),Tn(n,h,!1);break;case"textarea":dr(n),Kr(n);break;case"option":h.value!=null&&n.setAttribute("value",""+Se(h.value));break;case"select":n.multiple=!!h.multiple,x=h.value,x!=null?tr(n,!!h.multiple,x,!1):h.defaultValue!=null&&tr(n,!!h.multiple,h.defaultValue,!0);break;default:typeof m.onClick=="function"&&(n.onclick=$o)}switch(c){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}}h&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return Ln(a),null;case 6:if(n&&a.stateNode!=null)qg(n,a,n.memoizedProps,h);else{if(typeof h!="string"&&a.stateNode===null)throw Error(i(166));if(c=Ll(ef.current),Ll(Ds.current),kd(a)){if(h=a.stateNode,c=a.memoizedProps,h[Cs]=a,(x=h.nodeValue!==c)&&(n=ji,n!==null))switch(n.tag){case 3:Sd(h.nodeValue,c,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Sd(h.nodeValue,c,(n.mode&1)!==0)}x&&(a.flags|=4)}else h=(c.nodeType===9?c:c.ownerDocument).createTextNode(h),h[Cs]=a,a.stateNode=h}return Ln(a),null;case 13:if($r(en),h=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(Yr&&zi!==null&&a.mode&1&&!(a.flags&128))Qc(),qo(),a.flags|=98560,x=!1;else if(x=kd(a),h!==null&&h.dehydrated!==null){if(n===null){if(!x)throw Error(i(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));x[Cs]=a}else qo(),!(a.flags&128)&&(a.memoizedState=null),a.flags|=4;Ln(a),x=!1}else Ra!==null&&(Zl(Ra),Ra=null),x=!0;if(!x)return a.flags&65536?a:null}return a.flags&128?(a.lanes=c,a):(h=h!==null,h!==(n!==null&&n.memoizedState!==null)&&h&&(a.child.flags|=8192,a.mode&1&&(n===null||en.current&1?dn===0&&(dn=3):hp())),a.updateQueue!==null&&(a.flags|=4),Ln(a),null);case 4:return Ul(),Sn(n,a),n===null&&Pu(a.stateNode.containerInfo),Ln(a),null;case 10:return U0(a.type._context),Ln(a),null;case 17:return yn(a.type)&&qu(),Ln(a),null;case 19:if($r(en),x=a.memoizedState,x===null)return Ln(a),null;if(h=(a.flags&128)!==0,k=x.rendering,k===null)if(h)gf(x,!1);else{if(dn!==0||n!==null&&n.flags&128)for(n=a.child;n!==null;){if(k=Bd(n),k!==null){for(a.flags|=128,gf(x,!1),h=k.updateQueue,h!==null&&(a.updateQueue=h,a.flags|=4),a.subtreeFlags=0,h=c,c=a.child;c!==null;)x=c,n=h,x.flags&=14680066,k=x.alternate,k===null?(x.childLanes=0,x.lanes=n,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=k.childLanes,x.lanes=k.lanes,x.child=k.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=k.memoizedProps,x.memoizedState=k.memoizedState,x.updateQueue=k.updateQueue,x.type=k.type,n=k.dependencies,x.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),c=c.sibling;return ft(en,en.current&1|2),a.child}n=n.sibling}x.tail!==null&&Ot()>Ju&&(a.flags|=128,h=!0,gf(x,!1),a.lanes=4194304)}else{if(!h)if(n=Bd(k),n!==null){if(a.flags|=128,h=!0,c=n.updateQueue,c!==null&&(a.updateQueue=c,a.flags|=4),gf(x,!0),x.tail===null&&x.tailMode==="hidden"&&!k.alternate&&!Yr)return Ln(a),null}else 2*Ot()-x.renderingStartTime>Ju&&c!==1073741824&&(a.flags|=128,h=!0,gf(x,!1),a.lanes=4194304);x.isBackwards?(k.sibling=a.child,a.child=k):(c=x.last,c!==null?c.sibling=k:a.child=k,x.last=k)}return x.tail!==null?(a=x.tail,x.rendering=a,x.tail=a.sibling,x.renderingStartTime=Ot(),a.sibling=null,c=en.current,ft(en,h?c&1|2:c&1),a):(Ln(a),null);case 22:case 23:return dp(),h=a.memoizedState!==null,n!==null&&n.memoizedState!==null!==h&&(a.flags|=8192),h&&a.mode&1?la&1073741824&&(Ln(a),a.subtreeFlags&6&&(a.flags|=8192)):Ln(a),null;case 24:return null;case 25:return null}throw Error(i(156,a.tag))}function nh(n,a){switch(Ad(a),a.tag){case 1:return yn(a.type)&&qu(),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Ul(),$r(On),$r(an),ht(),n=a.flags,n&65536&&!(n&128)?(a.flags=n&-65537|128,a):null;case 5:return Nd(a),null;case 13:if($r(en),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(i(340));qo()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return $r(en),null;case 4:return Ul(),null;case 10:return U0(a.type._context),null;case 22:case 23:return dp(),null;case 24:return null;default:return null}}var mf=!1,di=!1,B1=typeof WeakSet=="function"?WeakSet:Set,Ze=null;function Qu(n,a){var c=n.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(h){Vr(n,a,h)}else c.current=null}function ih(n,a,c){try{c()}catch(h){Vr(n,a,h)}}var Vg=!1;function Wg(n,a){if(Vc=wa,n=jc(),pd(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.ownerDocument)&&c.defaultView||window;var h=c.getSelection&&c.getSelection();if(h&&h.rangeCount!==0){c=h.anchorNode;var m=h.anchorOffset,x=h.focusNode;h=h.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var k=0,Y=-1,Q=-1,fe=0,Fe=0,Ne=n,ke=null;t:for(;;){for(var Ke;Ne!==c||m!==0&&Ne.nodeType!==3||(Y=k+m),Ne!==x||h!==0&&Ne.nodeType!==3||(Q=k+h),Ne.nodeType===3&&(k+=Ne.nodeValue.length),(Ke=Ne.firstChild)!==null;)ke=Ne,Ne=Ke;for(;;){if(Ne===n)break t;if(ke===c&&++fe===m&&(Y=k),ke===x&&++Fe===h&&(Q=k),(Ke=Ne.nextSibling)!==null)break;Ne=ke,ke=Ne.parentNode}Ne=Ke}c=Y===-1||Q===-1?null:{start:Y,end:Q}}else c=null}c=c||{start:0,end:0}}else c=null;for(Bl={focusedElem:n,selectionRange:c},wa=!1,Ze=a;Ze!==null;)if(a=Ze,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,Ze=n;else for(;Ze!==null;){a=Ze;try{var at=a.alternate;if(a.flags&1024)switch(a.tag){case 0:case 11:case 15:break;case 1:if(at!==null){var lt=at.memoizedProps,hn=at.memoizedState,ne=a.stateNode,te=ne.getSnapshotBeforeUpdate(a.elementType===a.type?lt:Ja(a.type,lt),hn);ne.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var oe=a.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(Oe){Vr(a,a.return,Oe)}if(n=a.sibling,n!==null){n.return=a.return,Ze=n;break}Ze=a.return}return at=Vg,Vg=!1,at}function yf(n,a,c){var h=a.updateQueue;if(h=h!==null?h.lastEffect:null,h!==null){var m=h=h.next;do{if((m.tag&n)===n){var x=m.destroy;m.destroy=void 0,x!==void 0&&ih(a,c,x)}m=m.next}while(m!==h)}}function xf(n,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var c=a=a.next;do{if((c.tag&n)===n){var h=c.create;c.destroy=h()}c=c.next}while(c!==a)}}function ap(n){var a=n.ref;if(a!==null){var c=n.stateNode;switch(n.tag){case 5:n=c;break;default:n=c}typeof a=="function"?a(n):a.current=n}}function ah(n){var a=n.alternate;a!==null&&(n.alternate=null,ah(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&(delete a[Cs],delete a[Wc],delete a[Gc],delete a[zu],delete a[O1])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function Ef(n){return n.tag===5||n.tag===3||n.tag===4}function no(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Ef(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Rs(n,a,c){var h=n.tag;if(h===5||h===6)n=n.stateNode,a?c.nodeType===8?c.parentNode.insertBefore(n,a):c.insertBefore(n,a):(c.nodeType===8?(a=c.parentNode,a.insertBefore(n,c)):(a=c,a.appendChild(n)),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=$o));else if(h!==4&&(n=n.child,n!==null))for(Rs(n,a,c),n=n.sibling;n!==null;)Rs(n,a,c),n=n.sibling}function As(n,a,c){var h=n.tag;if(h===5||h===6)n=n.stateNode,a?c.insertBefore(n,a):c.appendChild(n);else if(h!==4&&(n=n.child,n!==null))for(As(n,a,c),n=n.sibling;n!==null;)As(n,a,c),n=n.sibling}var fn=null,Ei=!1;function Ci(n,a,c){for(c=c.child;c!==null;)Gg(n,a,c),c=c.sibling}function Gg(n,a,c){if($i&&typeof $i.onCommitFiberUnmount=="function")try{$i.onCommitFiberUnmount(Ao,c)}catch{}switch(c.tag){case 5:di||Qu(c,a);case 6:var h=fn,m=Ei;fn=null,Ci(n,a,c),fn=h,Ei=m,fn!==null&&(Ei?(n=fn,c=c.stateNode,n.nodeType===8?n.parentNode.removeChild(c):n.removeChild(c)):fn.removeChild(c.stateNode));break;case 18:fn!==null&&(Ei?(n=fn,c=c.stateNode,n.nodeType===8?ju(n.parentNode,c):n.nodeType===1&&ju(n,c),Ga(n)):ju(fn,c.stateNode));break;case 4:h=fn,m=Ei,fn=c.stateNode.containerInfo,Ei=!0,Ci(n,a,c),fn=h,Ei=m;break;case 0:case 11:case 14:case 15:if(!di&&(h=c.updateQueue,h!==null&&(h=h.lastEffect,h!==null))){m=h=h.next;do{var x=m,k=x.destroy;x=x.tag,k!==void 0&&(x&2||x&4)&&ih(c,a,k),m=m.next}while(m!==h)}Ci(n,a,c);break;case 1:if(!di&&(Qu(c,a),h=c.stateNode,typeof h.componentWillUnmount=="function"))try{h.props=c.memoizedProps,h.state=c.memoizedState,h.componentWillUnmount()}catch(Y){Vr(c,a,Y)}Ci(n,a,c);break;case 21:Ci(n,a,c);break;case 22:c.mode&1?(di=(h=di)||c.memoizedState!==null,Ci(n,a,c),di=h):Ci(n,a,c);break;default:Ci(n,a,c)}}function Kg(n){var a=n.updateQueue;if(a!==null){n.updateQueue=null;var c=n.stateNode;c===null&&(c=n.stateNode=new B1),a.forEach(function(h){var m=im.bind(null,n,h);c.has(h)||(c.add(h),h.then(m,m))})}}function es(n,a){var c=a.deletions;if(c!==null)for(var h=0;h<c.length;h++){var m=c[h];try{var x=n,k=a,Y=k;e:for(;Y!==null;){switch(Y.tag){case 5:fn=Y.stateNode,Ei=!1;break e;case 3:fn=Y.stateNode.containerInfo,Ei=!0;break e;case 4:fn=Y.stateNode.containerInfo,Ei=!0;break e}Y=Y.return}if(fn===null)throw Error(i(160));Gg(x,k,m),fn=null,Ei=!1;var Q=m.alternate;Q!==null&&(Q.return=null),m.return=null}catch(fe){Vr(m,a,fe)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)sp(a,n),a=a.sibling}function sp(n,a){var c=n.alternate,h=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(es(a,n),Wi(n),h&4){try{yf(3,n,n.return),xf(3,n)}catch(lt){Vr(n,n.return,lt)}try{yf(5,n,n.return)}catch(lt){Vr(n,n.return,lt)}}break;case 1:es(a,n),Wi(n),h&512&&c!==null&&Qu(c,c.return);break;case 5:if(es(a,n),Wi(n),h&512&&c!==null&&Qu(c,c.return),n.flags&32){var m=n.stateNode;try{Pe(m,"")}catch(lt){Vr(n,n.return,lt)}}if(h&4&&(m=n.stateNode,m!=null)){var x=n.memoizedProps,k=c!==null?c.memoizedProps:x,Y=n.type,Q=n.updateQueue;if(n.updateQueue=null,Q!==null)try{Y==="input"&&x.type==="radio"&&x.name!=null&&br(m,x),gn(Y,k);var fe=gn(Y,x);for(k=0;k<Q.length;k+=2){var Fe=Q[k],Ne=Q[k+1];Fe==="style"?Sr(m,Ne):Fe==="dangerouslySetInnerHTML"?ra(m,Ne):Fe==="children"?Pe(m,Ne):U(m,Fe,Ne,fe)}switch(Y){case"input":nn(m,x);break;case"textarea":ui(m,x);break;case"select":var ke=m._wrapperState.wasMultiple;m._wrapperState.wasMultiple=!!x.multiple;var Ke=x.value;Ke!=null?tr(m,!!x.multiple,Ke,!1):ke!==!!x.multiple&&(x.defaultValue!=null?tr(m,!!x.multiple,x.defaultValue,!0):tr(m,!!x.multiple,x.multiple?[]:"",!1))}m[Wc]=x}catch(lt){Vr(n,n.return,lt)}}break;case 6:if(es(a,n),Wi(n),h&4){if(n.stateNode===null)throw Error(i(162));m=n.stateNode,x=n.memoizedProps;try{m.nodeValue=x}catch(lt){Vr(n,n.return,lt)}}break;case 3:if(es(a,n),Wi(n),h&4&&c!==null&&c.memoizedState.isDehydrated)try{Ga(a.containerInfo)}catch(lt){Vr(n,n.return,lt)}break;case 4:es(a,n),Wi(n);break;case 13:es(a,n),Wi(n),m=n.child,m.flags&8192&&(x=m.memoizedState!==null,m.stateNode.isHidden=x,!x||m.alternate!==null&&m.alternate.memoizedState!==null||(up=Ot())),h&4&&Kg(n);break;case 22:if(Fe=c!==null&&c.memoizedState!==null,n.mode&1?(di=(fe=di)||Fe,es(a,n),di=fe):es(a,n),Wi(n),h&8192){if(fe=n.memoizedState!==null,(n.stateNode.isHidden=fe)&&!Fe&&n.mode&1)for(Ze=n,Fe=n.child;Fe!==null;){for(Ne=Ze=Fe;Ze!==null;){switch(ke=Ze,Ke=ke.child,ke.tag){case 0:case 11:case 14:case 15:yf(4,ke,ke.return);break;case 1:Qu(ke,ke.return);var at=ke.stateNode;if(typeof at.componentWillUnmount=="function"){h=ke,c=ke.return;try{a=h,at.props=a.memoizedProps,at.state=a.memoizedState,at.componentWillUnmount()}catch(lt){Vr(h,c,lt)}}break;case 5:Qu(ke,ke.return);break;case 22:if(ke.memoizedState!==null){Cf(Ne);continue}}Ke!==null?(Ke.return=ke,Ze=Ke):Cf(Ne)}Fe=Fe.sibling}e:for(Fe=null,Ne=n;;){if(Ne.tag===5){if(Fe===null){Fe=Ne;try{m=Ne.stateNode,fe?(x=m.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(Y=Ne.stateNode,Q=Ne.memoizedProps.style,k=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,Y.style.display=rr("display",k))}catch(lt){Vr(n,n.return,lt)}}}else if(Ne.tag===6){if(Fe===null)try{Ne.stateNode.nodeValue=fe?"":Ne.memoizedProps}catch(lt){Vr(n,n.return,lt)}}else if((Ne.tag!==22&&Ne.tag!==23||Ne.memoizedState===null||Ne===n)&&Ne.child!==null){Ne.child.return=Ne,Ne=Ne.child;continue}if(Ne===n)break e;for(;Ne.sibling===null;){if(Ne.return===null||Ne.return===n)break e;Fe===Ne&&(Fe=null),Ne=Ne.return}Fe===Ne&&(Fe=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:es(a,n),Wi(n),h&4&&Kg(n);break;case 21:break;default:es(a,n),Wi(n)}}function Wi(n){var a=n.flags;if(a&2){try{e:{for(var c=n.return;c!==null;){if(Ef(c)){var h=c;break e}c=c.return}throw Error(i(160))}switch(h.tag){case 5:var m=h.stateNode;h.flags&32&&(Pe(m,""),h.flags&=-33);var x=no(n);As(n,x,m);break;case 3:case 4:var k=h.stateNode.containerInfo,Y=no(n);Rs(n,Y,k);break;default:throw Error(i(161))}}catch(Q){Vr(n,n.return,Q)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function M1(n,a,c){Ze=n,op(n)}function op(n,a,c){for(var h=(n.mode&1)!==0;Ze!==null;){var m=Ze,x=m.child;if(m.tag===22&&h){var k=m.memoizedState!==null||mf;if(!k){var Y=m.alternate,Q=Y!==null&&Y.memoizedState!==null||di;Y=mf;var fe=di;if(mf=k,(di=Q)&&!fe)for(Ze=m;Ze!==null;)k=Ze,Q=k.child,k.tag===22&&k.memoizedState!==null?lp(m):Q!==null?(Q.return=k,Ze=Q):lp(m);for(;x!==null;)Ze=x,op(x),x=x.sibling;Ze=m,mf=Y,di=fe}Qg(n)}else m.subtreeFlags&8772&&x!==null?(x.return=m,Ze=x):Qg(n)}}function Qg(n){for(;Ze!==null;){var a=Ze;if(a.flags&8772){var c=a.alternate;try{if(a.flags&8772)switch(a.tag){case 0:case 11:case 15:di||xf(5,a);break;case 1:var h=a.stateNode;if(a.flags&4&&!di)if(c===null)h.componentDidMount();else{var m=a.elementType===a.type?c.memoizedProps:Ja(a.type,c.memoizedProps);h.componentDidUpdate(m,c.memoizedState,h.__reactInternalSnapshotBeforeUpdate)}var x=a.updateQueue;x!==null&&V0(a,x,h);break;case 3:var k=a.updateQueue;if(k!==null){if(c=null,a.child!==null)switch(a.child.tag){case 5:c=a.child.stateNode;break;case 1:c=a.child.stateNode}V0(a,k,c)}break;case 5:var Y=a.stateNode;if(c===null&&a.flags&4){c=Y;var Q=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":Q.autoFocus&&c.focus();break;case"img":Q.src&&(c.src=Q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var fe=a.alternate;if(fe!==null){var Fe=fe.memoizedState;if(Fe!==null){var Ne=Fe.dehydrated;Ne!==null&&Ga(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(i(163))}di||a.flags&512&&ap(a)}catch(ke){Vr(a,a.return,ke)}}if(a===n){Ze=null;break}if(c=a.sibling,c!==null){c.return=a.return,Ze=c;break}Ze=a.return}}function Cf(n){for(;Ze!==null;){var a=Ze;if(a===n){Ze=null;break}var c=a.sibling;if(c!==null){c.return=a.return,Ze=c;break}Ze=a.return}}function lp(n){for(;Ze!==null;){var a=Ze;try{switch(a.tag){case 0:case 11:case 15:var c=a.return;try{xf(4,a)}catch(Q){Vr(a,c,Q)}break;case 1:var h=a.stateNode;if(typeof h.componentDidMount=="function"){var m=a.return;try{h.componentDidMount()}catch(Q){Vr(a,m,Q)}}var x=a.return;try{ap(a)}catch(Q){Vr(a,x,Q)}break;case 5:var k=a.return;try{ap(a)}catch(Q){Vr(a,k,Q)}}}catch(Q){Vr(a,a.return,Q)}if(a===n){Ze=null;break}var Y=a.sibling;if(Y!==null){Y.return=a.return,Ze=Y;break}Ze=a.return}}var H1=Math.ceil,Ko=q.ReactCurrentDispatcher,Ql=q.ReactCurrentOwner,Qn=q.ReactCurrentBatchConfig,Wt=0,Bn=null,wn=null,Xn=0,la=0,Xu=Da(0),dn=0,Sf=null,ks=0,Zu=0,sh=0,wf=null,Gi=null,up=0,Ju=1/0,ua=null,ec=!1,Xl=null,Qo=null,oh=!1,io=null,bf=0,Xo=0,tc=null,_f=-1,hi=0;function bn(){return Wt&6?Ot():_f!==-1?_f:_f=Ot()}function Fs(n){return n.mode&1?Wt&2&&Xn!==0?Xn&-Xn:N1.transition!==null?(hi===0&&(hi=Tu()),hi):(n=sr,n!==0||(n=window.event,n=n===void 0?16:Bu(n.type)),n):1}function Si(n,a,c,h){if(50<Xo)throw Xo=0,tc=null,Error(i(185));Ys(n,c,h),(!(Wt&2)||n!==Bn)&&(n===Bn&&(!(Wt&2)&&(Zu|=c),dn===4&&ts(n,Xn)),Ki(n,h),c===1&&Wt===0&&!(a.mode&1)&&(Ju=Ot()+500,Yu&&ws()))}function Ki(n,a){var c=n.callbackNode;_l(n,a);var h=Wa(n,n===Bn?Xn:0);if(h===0)c!==null&&Vn(c),n.callbackNode=null,n.callbackPriority=0;else if(a=h&-h,n.callbackPriority!==a){if(c!=null&&Vn(c),a===1)n.tag===0?Lo(cp.bind(null,n)):Td(cp.bind(null,n)),Uu(function(){!(Wt&6)&&ws()}),c=null;else{switch(Au(h)){case 1:c=Ya;break;case 4:c=wl;break;case 16:c=bl;break;case 536870912:c=bu;break;default:c=bl}c=sm(c,lh.bind(null,n))}n.callbackPriority=a,n.callbackNode=c}}function lh(n,a){if(_f=-1,hi=0,Wt&6)throw Error(i(327));var c=n.callbackNode;if(rc()&&n.callbackNode!==c)return null;var h=Wa(n,n===Bn?Xn:0);if(h===0)return null;if(h&30||h&n.expiredLanes||a)a=uh(n,h);else{a=h;var m=Wt;Wt|=2;var x=Zg();(Bn!==n||Xn!==a)&&(ua=null,Ju=Ot()+500,ao(n,a));do try{Jg();break}catch(Y){Xg(n,Y)}while(!0);L0(),Ko.current=x,Wt=m,wn!==null?a=0:(Bn=null,Xn=0,a=dn)}if(a!==0){if(a===2&&(m=Fo(n),m!==0&&(h=m,a=Df(n,m))),a===1)throw c=Sf,ao(n,0),ts(n,h),Ki(n,Ot()),c;if(a===6)ts(n,h);else{if(m=n.current.alternate,!(h&30)&&!I1(m)&&(a=uh(n,h),a===2&&(x=Fo(n),x!==0&&(h=x,a=Df(n,x))),a===1))throw c=Sf,ao(n,0),ts(n,h),Ki(n,Ot()),c;switch(n.finishedWork=m,n.finishedLanes=h,a){case 0:case 1:throw Error(i(345));case 2:eu(n,Gi,ua);break;case 3:if(ts(n,h),(h&130023424)===h&&(a=up+500-Ot(),10<a)){if(Wa(n,0)!==0)break;if(m=n.suspendedLanes,(m&h)!==h){bn(),n.pingedLanes|=n.suspendedLanes&m;break}n.timeoutHandle=bd(eu.bind(null,n,Gi,ua),a);break}eu(n,Gi,ua);break;case 4:if(ts(n,h),(h&4194240)===h)break;for(a=n.eventTimes,m=-1;0<h;){var k=31-gi(h);x=1<<k,k=a[k],k>m&&(m=k),h&=~x}if(h=m,h=Ot()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*H1(h/1960))-h,10<h){n.timeoutHandle=bd(eu.bind(null,n,Gi,ua),h);break}eu(n,Gi,ua);break;case 5:eu(n,Gi,ua);break;default:throw Error(i(329))}}}return Ki(n,Ot()),n.callbackNode===c?lh.bind(null,n):null}function Df(n,a){var c=wf;return n.current.memoizedState.isDehydrated&&(ao(n,a).flags|=256),n=uh(n,a),n!==2&&(a=Gi,Gi=c,a!==null&&Zl(a)),n}function Zl(n){Gi===null?Gi=n:Gi.push.apply(Gi,n)}function I1(n){for(var a=n;;){if(a.flags&16384){var c=a.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var h=0;h<c.length;h++){var m=c[h],x=m.getSnapshot;m=m.value;try{if(!Qa(x(),m))return!1}catch{return!1}}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function ts(n,a){for(a&=~sh,a&=~Zu,n.suspendedLanes|=a,n.pingedLanes&=~a,n=n.expirationTimes;0<a;){var c=31-gi(a),h=1<<c;n[c]=-1,a&=~h}}function cp(n){if(Wt&6)throw Error(i(327));rc();var a=Wa(n,0);if(!(a&1))return Ki(n,Ot()),null;var c=uh(n,a);if(n.tag!==0&&c===2){var h=Fo(n);h!==0&&(a=h,c=Df(n,h))}if(c===1)throw c=Sf,ao(n,0),ts(n,a),Ki(n,Ot()),c;if(c===6)throw Error(i(345));return n.finishedWork=n.current.alternate,n.finishedLanes=a,eu(n,Gi,ua),Ki(n,Ot()),null}function fp(n,a){var c=Wt;Wt|=1;try{return n(a)}finally{Wt=c,Wt===0&&(Ju=Ot()+500,Yu&&ws())}}function Jl(n){io!==null&&io.tag===0&&!(Wt&6)&&rc();var a=Wt;Wt|=1;var c=Qn.transition,h=sr;try{if(Qn.transition=null,sr=1,n)return n()}finally{sr=h,Qn.transition=c,Wt=a,!(Wt&6)&&ws()}}function dp(){la=Xu.current,$r(Xu)}function ao(n,a){n.finishedWork=null,n.finishedLanes=0;var c=n.timeoutHandle;if(c!==-1&&(n.timeoutHandle=-1,M0(c)),wn!==null)for(c=wn.return;c!==null;){var h=c;switch(Ad(h),h.tag){case 1:h=h.type.childContextTypes,h!=null&&qu();break;case 3:Ul(),$r(On),$r(an),ht();break;case 5:Nd(h);break;case 4:Ul();break;case 13:$r(en);break;case 19:$r(en);break;case 10:U0(h.type._context);break;case 22:case 23:dp()}c=c.return}if(Bn=n,wn=n=Zo(n.current,null),Xn=la=a,dn=0,Sf=null,sh=Zu=ks=0,Gi=wf=null,Pl!==null){for(a=0;a<Pl.length;a++)if(c=Pl[a],h=c.interleaved,h!==null){c.interleaved=null;var m=h.next,x=c.pending;if(x!==null){var k=x.next;x.next=m,h.next=k}c.pending=h}Pl=null}return n}function Xg(n,a){do{var c=wn;try{if(L0(),It.current=Wl,Md){for(var h=lr.memoizedState;h!==null;){var m=h.queue;m!==null&&(m.pending=null),h=h.next}Md=!1}if(Rr=0,Pn=En=lr=null,rf=!1,jl=0,Ql.current=null,c===null||c.return===null){dn=1,Sf=a,wn=null;break}e:{var x=n,k=c.return,Y=c,Q=a;if(a=Xn,Y.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var fe=Q,Fe=Y,Ne=Fe.tag;if(!(Fe.mode&1)&&(Ne===0||Ne===11||Ne===15)){var ke=Fe.alternate;ke?(Fe.updateQueue=ke.updateQueue,Fe.memoizedState=ke.memoizedState,Fe.lanes=ke.lanes):(Fe.updateQueue=null,Fe.memoizedState=null)}var Ke=$g(k);if(Ke!==null){Ke.flags&=-257,Go(Ke,k,Y,x,a),Ke.mode&1&&ep(x,fe,a),a=Ke,Q=fe;var at=a.updateQueue;if(at===null){var lt=new Set;lt.add(Q),a.updateQueue=lt}else at.add(Q);break e}else{if(!(a&1)){ep(x,fe,a),hp();break e}Q=Error(i(426))}}else if(Yr&&Y.mode&1){var hn=$g(k);if(hn!==null){!(hn.flags&65536)&&(hn.flags|=256),Go(hn,k,Y,x,a),eo(Gl(Q,Y));break e}}x=Q=Gl(Q,Y),dn!==4&&(dn=2),wf===null?wf=[x]:wf.push(x),x=k;do{switch(x.tag){case 3:x.flags|=65536,a&=-a,x.lanes|=a;var ne=Ig(x,Q,a);Og(x,ne);break e;case 1:Y=Q;var te=x.type,oe=x.stateNode;if(!(x.flags&128)&&(typeof te.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(Qo===null||!Qo.has(oe)))){x.flags|=65536,a&=-a,x.lanes|=a;var Oe=J0(x,Y,a);Og(x,Oe);break e}}x=x.return}while(x!==null)}tm(c)}catch(st){a=st,wn===c&&c!==null&&(wn=c=c.return);continue}break}while(!0)}function Zg(){var n=Ko.current;return Ko.current=Wl,n===null?Wl:n}function hp(){(dn===0||dn===3||dn===2)&&(dn=4),Bn===null||!(ks&268435455)&&!(Zu&268435455)||ts(Bn,Xn)}function uh(n,a){var c=Wt;Wt|=2;var h=Zg();(Bn!==n||Xn!==a)&&(ua=null,ao(n,a));do try{$1();break}catch(m){Xg(n,m)}while(!0);if(L0(),Wt=c,Ko.current=h,wn!==null)throw Error(i(261));return Bn=null,Xn=0,dn}function $1(){for(;wn!==null;)em(wn)}function Jg(){for(;wn!==null&&!za();)em(wn)}function em(n){var a=am(n.alternate,n,la);n.memoizedProps=n.pendingProps,a===null?tm(n):wn=a,Ql.current=null}function tm(n){var a=n;do{var c=a.alternate;if(n=a.return,a.flags&32768){if(c=nh(c,a),c!==null){c.flags&=32767,wn=c;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{dn=6,wn=null;return}}else if(c=Yg(c,a,la),c!==null){wn=c;return}if(a=a.sibling,a!==null){wn=a;return}wn=a=n}while(a!==null);dn===0&&(dn=5)}function eu(n,a,c){var h=sr,m=Qn.transition;try{Qn.transition=null,sr=1,P1(n,a,c,h)}finally{Qn.transition=m,sr=h}return null}function P1(n,a,c,h){do rc();while(io!==null);if(Wt&6)throw Error(i(327));c=n.finishedWork;var m=n.finishedLanes;if(c===null)return null;if(n.finishedWork=null,n.finishedLanes=0,c===n.current)throw Error(i(177));n.callbackNode=null,n.callbackPriority=0;var x=c.lanes|c.childLanes;if(p0(n,x),n===Bn&&(wn=Bn=null,Xn=0),!(c.subtreeFlags&2064)&&!(c.flags&2064)||oh||(oh=!0,sm(bl,function(){return rc(),null})),x=(c.flags&15990)!==0,c.subtreeFlags&15990||x){x=Qn.transition,Qn.transition=null;var k=sr;sr=1;var Y=Wt;Wt|=4,Ql.current=null,Wg(n,c),sp(c,n),Iu(Bl),wa=!!Vc,Bl=Vc=null,n.current=c,M1(c),qa(),Wt=Y,sr=k,Qn.transition=x}else n.current=c;if(oh&&(oh=!1,io=n,bf=m),x=n.pendingLanes,x===0&&(Qo=null),Oc(c.stateNode),Ki(n,Ot()),a!==null)for(h=n.onRecoverableError,c=0;c<a.length;c++)m=a[c],h(m.value,{componentStack:m.stack,digest:m.digest});if(ec)throw ec=!1,n=Xl,Xl=null,n;return bf&1&&n.tag!==0&&rc(),x=n.pendingLanes,x&1?n===tc?Xo++:(Xo=0,tc=n):Xo=0,ws(),null}function rc(){if(io!==null){var n=Au(bf),a=Qn.transition,c=sr;try{if(Qn.transition=null,sr=16>n?16:n,io===null)var h=!1;else{if(n=io,io=null,bf=0,Wt&6)throw Error(i(331));var m=Wt;for(Wt|=4,Ze=n.current;Ze!==null;){var x=Ze,k=x.child;if(Ze.flags&16){var Y=x.deletions;if(Y!==null){for(var Q=0;Q<Y.length;Q++){var fe=Y[Q];for(Ze=fe;Ze!==null;){var Fe=Ze;switch(Fe.tag){case 0:case 11:case 15:yf(8,Fe,x)}var Ne=Fe.child;if(Ne!==null)Ne.return=Fe,Ze=Ne;else for(;Ze!==null;){Fe=Ze;var ke=Fe.sibling,Ke=Fe.return;if(ah(Fe),Fe===fe){Ze=null;break}if(ke!==null){ke.return=Ke,Ze=ke;break}Ze=Ke}}}var at=x.alternate;if(at!==null){var lt=at.child;if(lt!==null){at.child=null;do{var hn=lt.sibling;lt.sibling=null,lt=hn}while(lt!==null)}}Ze=x}}if(x.subtreeFlags&2064&&k!==null)k.return=x,Ze=k;else e:for(;Ze!==null;){if(x=Ze,x.flags&2048)switch(x.tag){case 0:case 11:case 15:yf(9,x,x.return)}var ne=x.sibling;if(ne!==null){ne.return=x.return,Ze=ne;break e}Ze=x.return}}var te=n.current;for(Ze=te;Ze!==null;){k=Ze;var oe=k.child;if(k.subtreeFlags&2064&&oe!==null)oe.return=k,Ze=oe;else e:for(k=te;Ze!==null;){if(Y=Ze,Y.flags&2048)try{switch(Y.tag){case 0:case 11:case 15:xf(9,Y)}}catch(st){Vr(Y,Y.return,st)}if(Y===k){Ze=null;break e}var Oe=Y.sibling;if(Oe!==null){Oe.return=Y.return,Ze=Oe;break e}Ze=Y.return}}if(Wt=m,ws(),$i&&typeof $i.onPostCommitFiberRoot=="function")try{$i.onPostCommitFiberRoot(Ao,n)}catch{}h=!0}return h}finally{sr=c,Qn.transition=a}}return!1}function rm(n,a,c){a=Gl(c,a),a=Ig(n,a,1),n=Yo(n,a,1),a=bn(),n!==null&&(Ys(n,1,a),Ki(n,a))}function Vr(n,a,c){if(n.tag===3)rm(n,n,c);else for(;a!==null;){if(a.tag===3){rm(a,n,c);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Qo===null||!Qo.has(h))){n=Gl(c,n),n=J0(a,n,1),a=Yo(a,n,1),n=bn(),a!==null&&(Ys(a,1,n),Ki(a,n));break}}a=a.return}}function L1(n,a,c){var h=n.pingCache;h!==null&&h.delete(a),a=bn(),n.pingedLanes|=n.suspendedLanes&c,Bn===n&&(Xn&c)===c&&(dn===4||dn===3&&(Xn&130023424)===Xn&&500>Ot()-up?ao(n,0):sh|=c),Ki(n,a)}function nm(n,a){a===0&&(n.mode&1?(a=na,na<<=1,!(na&130023424)&&(na=4194304)):a=1);var c=bn();n=sa(n,a),n!==null&&(Ys(n,a,c),Ki(n,c))}function U1(n){var a=n.memoizedState,c=0;a!==null&&(c=a.retryLane),nm(n,c)}function im(n,a){var c=0;switch(n.tag){case 13:var h=n.stateNode,m=n.memoizedState;m!==null&&(c=m.retryLane);break;case 19:h=n.stateNode;break;default:throw Error(i(314))}h!==null&&h.delete(a),nm(n,c)}var am;am=function(n,a,c){if(n!==null)if(n.memoizedProps!==a.pendingProps||On.current)Cn=!0;else{if(!(n.lanes&c)&&!(a.flags&128))return Cn=!1,vf(n,a,c);Cn=!!(n.flags&131072)}else Cn=!1,Yr&&a.flags&1048576&&Rg(a,Js,a.index);switch(a.lanes=0,a.tag){case 2:var h=a.type;ka(n,a),n=a.pendingProps;var m=Ui(a,an.current);Jr(a,c),m=Vo(null,a,h,n,m,c);var x=Za();return a.flags|=1,typeof m=="object"&&m!==null&&typeof m.render=="function"&&m.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,yn(h)?(x=!0,$n(a)):x=!1,a.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,Y0(a),m.updater=Zd,a.stateNode=m,m._reactInternals=a,cf(a,h,n,c),a=hf(null,a,h,!0,x,c)):(a.tag=0,Yr&&x&&Rd(a),Kn(null,a,m,c),a=a.child),a;case 16:h=a.elementType;e:{switch(ka(n,a),n=a.pendingProps,m=h._init,h=m(h._payload),a.type=h,m=a.tag=z1(h),n=Ja(h,n),m){case 0:a=Pg(null,a,h,n,c);break e;case 1:a=Lg(null,a,h,n,c);break e;case 11:a=Vi(null,a,h,n,c);break e;case 14:a=Kl(null,a,h,Ja(h.type,n),c);break e}throw Error(i(306,h,""))}return a;case 0:return h=a.type,m=a.pendingProps,m=a.elementType===h?m:Ja(h,m),Pg(n,a,h,m,c);case 1:return h=a.type,m=a.pendingProps,m=a.elementType===h?m:Ja(h,m),Lg(n,a,h,m,c);case 3:e:{if(Ku(a),n===null)throw Error(i(387));h=a.pendingProps,x=a.memoizedState,m=x.element,Fg(n,a),Xc(a,h,null,c);var k=a.memoizedState;if(h=k.element,x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:k.cache,pendingSuspenseBoundaries:k.pendingSuspenseBoundaries,transitions:k.transitions},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){m=Gl(Error(i(423)),a),a=Ug(n,a,h,c,m);break e}else if(h!==m){m=Gl(Error(i(424)),a),a=Ug(n,a,h,c,m);break e}else for(zi=Es(a.stateNode.containerInfo.firstChild),ji=a,Yr=!0,Ra=null,c=ze(a,null,h,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(qo(),h===m){a=Fa(n,a,c);break e}Kn(n,a,h,c)}a=a.child}return a;case 5:return Ng(a),n===null&&$0(a),h=a.type,m=a.pendingProps,x=n!==null?n.memoizedProps:null,k=m.children,wd(h,m)?k=null:x!==null&&wd(h,x)&&(a.flags|=32),tp(n,a),Kn(n,a,k,c),a.child;case 6:return n===null&&$0(a),null;case 13:return rh(n,a,c);case 4:return W0(a,a.stateNode.containerInfo),h=a.pendingProps,n===null?a.child=un(a,null,h,c):Kn(n,a,h,c),a.child;case 11:return h=a.type,m=a.pendingProps,m=a.elementType===h?m:Ja(h,m),Vi(n,a,h,m,c);case 7:return Kn(n,a,a.pendingProps,c),a.child;case 8:return Kn(n,a,a.pendingProps.children,c),a.child;case 12:return Kn(n,a,a.pendingProps.children,c),a.child;case 10:e:{if(h=a.type._context,m=a.pendingProps,x=a.memoizedProps,k=m.value,ft(aa,h._currentValue),h._currentValue=k,x!==null)if(Qa(x.value,k)){if(x.children===m.children&&!On.current){a=Fa(n,a,c);break e}}else for(x=a.child,x!==null&&(x.return=a);x!==null;){var Y=x.dependencies;if(Y!==null){k=x.child;for(var Q=Y.firstContext;Q!==null;){if(Q.context===h){if(x.tag===1){Q=to(-1,c&-c),Q.tag=2;var fe=x.updateQueue;if(fe!==null){fe=fe.shared;var Fe=fe.pending;Fe===null?Q.next=Q:(Q.next=Fe.next,Fe.next=Q),fe.pending=Q}}x.lanes|=c,Q=x.alternate,Q!==null&&(Q.lanes|=c),j0(x.return,c,a),Y.lanes|=c;break}Q=Q.next}}else if(x.tag===10)k=x.type===a.type?null:x.child;else if(x.tag===18){if(k=x.return,k===null)throw Error(i(341));k.lanes|=c,Y=k.alternate,Y!==null&&(Y.lanes|=c),j0(k,c,a),k=x.sibling}else k=x.child;if(k!==null)k.return=x;else for(k=x;k!==null;){if(k===a){k=null;break}if(x=k.sibling,x!==null){x.return=k.return,k=x;break}k=k.return}x=k}Kn(n,a,m.children,c),a=a.child}return a;case 9:return m=a.type,h=a.pendingProps.children,Jr(a,c),m=Aa(m),h=h(m),a.flags|=1,Kn(n,a,h,c),a.child;case 14:return h=a.type,m=Ja(h,a.pendingProps),m=Ja(h.type,m),Kl(n,a,h,m,c);case 15:return Nt(n,a,a.type,a.pendingProps,c);case 17:return h=a.type,m=a.pendingProps,m=a.elementType===h?m:Ja(h,m),ka(n,a),a.tag=1,yn(h)?(n=!0,$n(a)):n=!1,Jr(a,c),Jd(a,h,m),cf(a,h,m,c),hf(null,a,h,!0,n,c);case 19:return Ts(n,a,c);case 22:return df(n,a,c)}throw Error(i(156,a.tag))};function sm(n,a){return Lr(n,a)}function j1(n,a,c,h){this.tag=n,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Na(n,a,c,h){return new j1(n,a,c,h)}function pp(n){return n=n.prototype,!(!n||!n.isReactComponent)}function z1(n){if(typeof n=="function")return pp(n)?1:0;if(n!=null){if(n=n.$$typeof,n===L)return 11;if(n===be)return 14}return 2}function Zo(n,a){var c=n.alternate;return c===null?(c=Na(n.tag,a,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=a,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&14680064,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,a=n.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c}function Tf(n,a,c,h,m,x){var k=2;if(h=n,typeof n=="function")pp(n)&&(k=1);else if(typeof n=="string")k=5;else e:switch(n){case ee:return so(c.children,m,x,a);case A:k=8,m|=8;break;case Ce:return n=Na(12,c,a,m|2),n.elementType=Ce,n.lanes=x,n;case M:return n=Na(13,c,a,m),n.elementType=M,n.lanes=x,n;case _e:return n=Na(19,c,a,m),n.elementType=_e,n.lanes=x,n;case ge:return Jo(c,m,x,a);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case X:k=10;break e;case F:k=9;break e;case L:k=11;break e;case be:k=14;break e;case $e:k=16,h=null;break e}throw Error(i(130,n==null?n:typeof n,""))}return a=Na(k,c,a,m),a.elementType=n,a.type=h,a.lanes=x,a}function so(n,a,c,h){return n=Na(7,n,h,a),n.lanes=c,n}function Jo(n,a,c,h){return n=Na(22,n,h,a),n.elementType=ge,n.lanes=c,n.stateNode={isHidden:!1},n}function vp(n,a,c){return n=Na(6,n,null,a),n.lanes=c,n}function ch(n,a,c){return a=Na(4,n.children!==null?n.children:[],n.key,a),a.lanes=c,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}function om(n,a,c,h,m){this.tag=a,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ru(0),this.expirationTimes=Ru(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ru(0),this.identifierPrefix=h,this.onRecoverableError=m,this.mutableSourceEagerHydrationData=null}function fh(n,a,c,h,m,x,k,Y,Q){return n=new om(n,a,c,Y,Q),a===1?(a=1,x===!0&&(a|=8)):a=0,x=Na(3,null,null,a),n.current=x,x.stateNode=n,x.memoizedState={element:h,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},Y0(x),n}function q1(n,a,c){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Z,key:h==null?null:""+h,children:n,containerInfo:a,implementation:c}}function gp(n){if(!n)return ci;n=n._reactInternals;e:{if(Ft(n)!==n||n.tag!==1)throw Error(i(170));var a=n;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(yn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(i(171))}if(n.tag===1){var c=n.type;if(yn(c))return Kc(n,c,a)}return a}function lm(n,a,c,h,m,x,k,Y,Q){return n=fh(c,h,!0,n,m,x,k,Y,Q),n.context=gp(null),c=n.current,h=bn(),m=Fs(c),x=to(h,m),x.callback=a??null,Yo(c,x,m),n.current.lanes=m,Ys(n,m,h),Ki(n,h),n}function dh(n,a,c,h){var m=a.current,x=bn(),k=Fs(m);return c=gp(c),a.context===null?a.context=c:a.pendingContext=c,a=to(x,k),a.payload={element:n},h=h===void 0?null:h,h!==null&&(a.callback=h),n=Yo(m,a,k),n!==null&&(Si(n,m,k,x),Od(n,m,k)),k}function hh(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function mp(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<a?c:a}}function ph(n,a){mp(n,a),(n=n.alternate)&&mp(n,a)}function um(){return null}var tu=typeof reportError=="function"?reportError:function(n){console.error(n)};function yp(n){this._internalRoot=n}vh.prototype.render=yp.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(i(409));dh(n,a,null,null)},vh.prototype.unmount=yp.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;Jl(function(){dh(null,n,null,null)}),a[Xs]=null}};function vh(n){this._internalRoot=n}vh.prototype.unstable_scheduleHydration=function(n){if(n){var a=Dt();n={blockedOn:null,target:n,priority:a};for(var c=0;c<Fn.length&&a!==0&&a<Fn[c].priority;c++);Fn.splice(c,0,n),c===0&&Mc(n)}};function xp(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function gh(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function cm(){}function Y1(n,a,c,h,m){if(m){if(typeof h=="function"){var x=h;h=function(){var fe=hh(k);x.call(fe)}}var k=lm(a,h,n,0,null,!1,!1,"",cm);return n._reactRootContainer=k,n[Xs]=k.current,Pu(n.nodeType===8?n.parentNode:n),Jl(),k}for(;m=n.lastChild;)n.removeChild(m);if(typeof h=="function"){var Y=h;h=function(){var fe=hh(Q);Y.call(fe)}}var Q=fh(n,0,!1,null,null,!1,!1,"",cm);return n._reactRootContainer=Q,n[Xs]=Q.current,Pu(n.nodeType===8?n.parentNode:n),Jl(function(){dh(a,Q,c,h)}),Q}function Rf(n,a,c,h,m){var x=c._reactRootContainer;if(x){var k=x;if(typeof m=="function"){var Y=m;m=function(){var Q=hh(k);Y.call(Q)}}dh(a,k,n,m)}else k=Y1(c,a,n,m,h);return hh(k)}Zt=function(n){switch(n.tag){case 3:var a=n.stateNode;if(a.current.memoizedState.isDehydrated){var c=Va(a.pendingLanes);c!==0&&(Vs(a,c|1),Ki(a,Ot()),!(Wt&6)&&(Ju=Ot()+500,ws()))}break;case 13:Jl(function(){var h=sa(n,1);if(h!==null){var m=bn();Si(h,n,1,m)}}),ph(n,1)}},Nc=function(n){if(n.tag===13){var a=sa(n,134217728);if(a!==null){var c=bn();Si(a,n,134217728,c)}ph(n,134217728)}},vs=function(n){if(n.tag===13){var a=Fs(n),c=sa(n,a);if(c!==null){var h=bn();Si(c,n,a,h)}ph(n,a)}},Dt=function(){return sr},ku=function(n,a){var c=sr;try{return sr=n,a()}finally{sr=c}},hr=function(n,a,c){switch(a){case"input":if(nn(n,c),a=c.name,c.type==="radio"&&a!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<c.length;a++){var h=c[a];if(h!==n&&h.form===n.form){var m=Zr(h);if(!m)throw Error(i(90));zr(h),nn(h,m)}}}break;case"textarea":ui(n,c);break;case"select":a=c.value,a!=null&&tr(n,!!c.multiple,a,!1)}},cs=fp,fs=Jl;var V1={usingClientEntryPoint:!1,Events:[dt,Xa,Zr,ja,qs,fp]},Af={findFiberByHostInstance:Ml,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},fm={bundleType:Af.bundleType,version:Af.version,rendererPackageName:Af.rendererPackageName,rendererConfig:Af.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:q.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=ln(n),n===null?null:n.stateNode},findFiberByHostInstance:Af.findFiberByHostInstance||um,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var el=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!el.isDisabled&&el.supportsFiber)try{Ao=el.inject(fm),$i=el}catch{}}return va.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=V1,va.createPortal=function(n,a){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!xp(a))throw Error(i(200));return q1(n,a,null,c)},va.createRoot=function(n,a){if(!xp(n))throw Error(i(299));var c=!1,h="",m=tu;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onRecoverableError!==void 0&&(m=a.onRecoverableError)),a=fh(n,1,!1,null,null,c,!1,h,m),n[Xs]=a.current,Pu(n.nodeType===8?n.parentNode:n),new yp(a)},va.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(i(188)):(n=Object.keys(n).join(","),Error(i(268,n)));return n=ln(a),n=n===null?null:n.stateNode,n},va.flushSync=function(n){return Jl(n)},va.hydrate=function(n,a,c){if(!gh(a))throw Error(i(200));return Rf(null,n,a,!0,c)},va.hydrateRoot=function(n,a,c){if(!xp(n))throw Error(i(405));var h=c!=null&&c.hydratedSources||null,m=!1,x="",k=tu;if(c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(k=c.onRecoverableError)),a=lm(a,null,n,1,c??null,m,!1,x,k),n[Xs]=a.current,Pu(n),h)for(n=0;n<h.length;n++)c=h[n],m=c._getVersion,m=m(c._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[c,m]:a.mutableSourceEagerHydrationData.push(c,m);return new vh(a)},va.render=function(n,a,c){if(!gh(a))throw Error(i(200));return Rf(null,n,a,!1,c)},va.unmountComponentAtNode=function(n){if(!gh(n))throw Error(i(40));return n._reactRootContainer?(Jl(function(){Rf(null,null,n,!1,function(){n._reactRootContainer=null,n[Xs]=null})}),!0):!1},va.unstable_batchedUpdates=fp,va.unstable_renderSubtreeIntoContainer=function(n,a,c,h){if(!gh(c))throw Error(i(200));if(n==null||n._reactInternals===void 0)throw Error(i(38));return Rf(n,a,c,!1,h)},va.version="18.3.1-next-f1338f8080-20240426",va}var ga={};/**
@@ -76,7 +76,7 @@ Error generating stack: `+x.message+`
76
76
  *
77
77
  * This source code is licensed under the MIT license found in the
78
78
  * LICENSE file in the root directory of this source tree.
79
- */var YS;function YT(){return YS||(YS=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var o=qt,r=zS(),i=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,l=!1;function f(e){l=e}function p(e){if(!l){for(var t=arguments.length,s=new Array(t>1?t-1:0),u=1;u<t;u++)s[u-1]=arguments[u];S("warn",e,s)}}function v(e){if(!l){for(var t=arguments.length,s=new Array(t>1?t-1:0),u=1;u<t;u++)s[u-1]=arguments[u];S("error",e,s)}}function S(e,t,s){{var u=i.ReactDebugCurrentFrame,d=u.getStackAddendum();d!==""&&(t+="%s",s=s.concat([d]));var g=s.map(function(y){return String(y)});g.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,g)}}var w=0,C=1,b=2,R=3,T=4,H=5,P=6,j=7,z=8,O=9,B=10,U=11,q=12,K=13,Z=14,ee=15,A=16,Ce=17,X=18,F=19,L=21,M=22,_e=23,be=24,$e=25,ge=!0,Ee=!1,He=!1,De=!1,$=!1,G=!0,he=!0,le=!0,Je=!0,Ge=new Set,ut={},Se={};function Te(e,t){mt(e,t),mt(e+"Capture",t)}function mt(e,t){ut[e]&&v("EventRegistry: More than one plugin attempted to publish the same registration name, `%s`.",e),ut[e]=t;{var s=e.toLowerCase();Se[s]=e,e==="onDoubleClick"&&(Se.ondblclick=e)}for(var u=0;u<t.length;u++)Ge.add(t[u])}var dr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",zr=Object.prototype.hasOwnProperty;function Yt(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,s=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s}}function Xt(e){try{return Fr(e),!1}catch{return!0}}function Fr(e){return""+e}function br(e,t){if(Xt(e))return v("The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before before using it here.",t,Yt(e)),Fr(e)}function nn(e){if(Xt(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Yt(e)),Fr(e)}function Tn(e,t){if(Xt(e))return v("The provided `%s` prop is an unsupported type %s. This value must be coerced to a string before before using it here.",t,Yt(e)),Fr(e)}function vn(e,t){if(Xt(e))return v("The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before before using it here.",t,Yt(e)),Fr(e)}function qr(e){if(Xt(e))return v("The provided HTML markup uses a value of unsupported type %s. This value must be coerced to a string before before using it here.",Yt(e)),Fr(e)}function tr(e){if(Xt(e))return v("Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before before using it here.",Yt(e)),Fr(e)}var ar=0,Pr=1,ui=2,Kr=3,Qr=4,Rn=5,ta=6,ra=":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",Pe=ra+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",rt=new RegExp("^["+ra+"]["+Pe+"]*$"),_t={},rr={};function Sr(e){return zr.call(rr,e)?!0:zr.call(_t,e)?!1:rt.test(e)?(rr[e]=!0,!0):(_t[e]=!0,v("Invalid attribute name: `%s`",e),!1)}function Mr(e,t,s){return t!==null?t.type===ar:s?!1:e.length>2&&(e[0]==="o"||e[0]==="O")&&(e[1]==="n"||e[1]==="N")}function Or(e,t,s,u){if(s!==null&&s.type===ar)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":{if(u)return!1;if(s!==null)return!s.acceptsBooleans;var d=e.toLowerCase().slice(0,5);return d!=="data-"&&d!=="aria-"}default:return!1}}function gn(e,t,s,u){if(t===null||typeof t>"u"||Or(e,t,s,u))return!0;if(u)return!1;if(s!==null)switch(s.type){case Kr:return!t;case Qr:return t===!1;case Rn:return isNaN(t);case ta:return isNaN(t)||t<1}return!1}function wr(e){return hr.hasOwnProperty(e)?hr[e]:null}function yr(e,t,s,u,d,g,y){this.acceptsBooleans=t===ui||t===Kr||t===Qr,this.attributeName=u,this.attributeNamespace=d,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=g,this.removeEmptyString=y}var hr={},vi=["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"];vi.forEach(function(e){hr[e]=new yr(e,ar,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0],s=e[1];hr[t]=new yr(t,Pr,!1,s,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){hr[e]=new yr(e,ui,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){hr[e]=new yr(e,ui,!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"].forEach(function(e){hr[e]=new yr(e,Kr,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){hr[e]=new yr(e,Kr,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){hr[e]=new yr(e,Qr,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){hr[e]=new yr(e,ta,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){hr[e]=new yr(e,Rn,!1,e.toLowerCase(),null,!1,!1)});var An=/[\-\:]([a-z])/g,Hi=function(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"].forEach(function(e){var t=e.replace(An,Hi);hr[t]=new yr(t,Pr,!1,e,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(function(e){var t=e.replace(An,Hi);hr[t]=new yr(t,Pr,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(An,Hi);hr[t]=new yr(t,Pr,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){hr[e]=new yr(e,Pr,!1,e.toLowerCase(),null,!1,!1)});var ja="xlinkHref";hr[ja]=new yr("xlinkHref",Pr,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){hr[e]=new yr(e,Pr,!1,e.toLowerCase(),null,!0,!0)});var qs=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i,cs=!1;function fs(e){!cs&&qs.test(e)&&(cs=!0,v("A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed %s.",JSON.stringify(e)))}function ds(e,t,s,u){if(u.mustUseProperty){var d=u.propertyName;return e[d]}else{br(s,t),u.sanitizeURL&&fs(""+s);var g=u.attributeName,y=null;if(u.type===Qr){if(e.hasAttribute(g)){var E=e.getAttribute(g);return E===""?!0:gn(t,s,u,!1)?E:E===""+s?s:E}}else if(e.hasAttribute(g)){if(gn(t,s,u,!1))return e.getAttribute(g);if(u.type===Kr)return s;y=e.getAttribute(g)}return gn(t,s,u,!1)?y===null?s:y:y===""+s?s:y}}function hs(e,t,s,u){{if(!Sr(t))return;if(!e.hasAttribute(t))return s===void 0?void 0:null;var d=e.getAttribute(t);return br(s,t),d===""+s?s:d}}function Yn(e,t,s,u){var d=wr(t);if(!Mr(t,d,u)){if(gn(t,s,d,u)&&(s=null),u||d===null){if(Sr(t)){var g=t;s===null?e.removeAttribute(g):(br(s,t),e.setAttribute(g,""+s))}return}var y=d.mustUseProperty;if(y){var E=d.propertyName;if(s===null){var _=d.type;e[E]=_===Kr?!1:""}else e[E]=s;return}var N=d.attributeName,I=d.attributeNamespace;if(s===null)e.removeAttribute(N);else{var re=d.type,J;re===Kr||re===Qr&&s===!0?J="":(br(s,N),J=""+s,d.sanitizeURL&&fs(J.toString())),I?e.setAttributeNS(I,N,J):e.setAttribute(N,J)}}}var In=Symbol.for("react.element"),pr=Symbol.for("react.portal"),kn=Symbol.for("react.fragment"),Ii=Symbol.for("react.strict_mode"),Ea=Symbol.for("react.profiler"),ps=Symbol.for("react.provider"),W=Symbol.for("react.context"),Re=Symbol.for("react.forward_ref"),je=Symbol.for("react.suspense"),et=Symbol.for("react.suspense_list"),Ft=Symbol.for("react.memo"),Tt=Symbol.for("react.lazy"),Pt=Symbol.for("react.scope"),Ht=Symbol.for("react.debug_trace_mode"),ln=Symbol.for("react.offscreen"),Hr=Symbol.for("react.legacy_hidden"),Lr=Symbol.for("react.cache"),Vn=Symbol.for("react.tracing_marker"),za=Symbol.iterator,qa="@@iterator";function Ot(e){if(e===null||typeof e!="object")return null;var t=za&&e[za]||e[qa];return typeof t=="function"?t:null}var Bt=Object.assign,Ya=0,wl,bl,Ro,bu,Ao,$i,Oc;function gi(){}gi.__reactDisabledLog=!0;function ld(){{if(Ya===0){wl=console.log,bl=console.info,Ro=console.warn,bu=console.error,Ao=console.group,$i=console.groupCollapsed,Oc=console.groupEnd;var e={configurable:!0,enumerable:!0,value:gi,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Ya++}}function ud(){{if(Ya--,Ya===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Bt({},e,{value:wl}),info:Bt({},e,{value:bl}),warn:Bt({},e,{value:Ro}),error:Bt({},e,{value:bu}),group:Bt({},e,{value:Ao}),groupCollapsed:Bt({},e,{value:$i}),groupEnd:Bt({},e,{value:Oc})})}Ya<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var _u=i.ReactCurrentDispatcher,ko;function na(e,t,s){{if(ko===void 0)try{throw Error()}catch(d){var u=d.stack.trim().match(/\n( *(at )?)/);ko=u&&u[1]||""}return`
79
+ */var YS;function YT(){return YS||(YS=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var o=qt,r=zS(),i=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,l=!1;function f(e){l=e}function p(e){if(!l){for(var t=arguments.length,s=new Array(t>1?t-1:0),u=1;u<t;u++)s[u-1]=arguments[u];S("warn",e,s)}}function v(e){if(!l){for(var t=arguments.length,s=new Array(t>1?t-1:0),u=1;u<t;u++)s[u-1]=arguments[u];S("error",e,s)}}function S(e,t,s){{var u=i.ReactDebugCurrentFrame,d=u.getStackAddendum();d!==""&&(t+="%s",s=s.concat([d]));var g=s.map(function(y){return String(y)});g.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,g)}}var w=0,C=1,b=2,R=3,T=4,H=5,P=6,j=7,z=8,O=9,B=10,U=11,q=12,K=13,Z=14,ee=15,A=16,Ce=17,X=18,F=19,L=21,M=22,_e=23,be=24,$e=25,ge=!0,Ee=!1,He=!1,De=!1,$=!1,G=!0,he=!0,le=!0,Je=!0,Ge=new Set,ut={},Se={};function Te(e,t){mt(e,t),mt(e+"Capture",t)}function mt(e,t){ut[e]&&v("EventRegistry: More than one plugin attempted to publish the same registration name, `%s`.",e),ut[e]=t;{var s=e.toLowerCase();Se[s]=e,e==="onDoubleClick"&&(Se.ondblclick=e)}for(var u=0;u<t.length;u++)Ge.add(t[u])}var dr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",zr=Object.prototype.hasOwnProperty;function Yt(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,s=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s}}function Xt(e){try{return Fr(e),!1}catch{return!0}}function Fr(e){return""+e}function br(e,t){if(Xt(e))return v("The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before before using it here.",t,Yt(e)),Fr(e)}function nn(e){if(Xt(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Yt(e)),Fr(e)}function Tn(e,t){if(Xt(e))return v("The provided `%s` prop is an unsupported type %s. This value must be coerced to a string before before using it here.",t,Yt(e)),Fr(e)}function vn(e,t){if(Xt(e))return v("The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before before using it here.",t,Yt(e)),Fr(e)}function qr(e){if(Xt(e))return v("The provided HTML markup uses a value of unsupported type %s. This value must be coerced to a string before before using it here.",Yt(e)),Fr(e)}function tr(e){if(Xt(e))return v("Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before before using it here.",Yt(e)),Fr(e)}var ar=0,Pr=1,ui=2,Kr=3,Qr=4,Rn=5,ta=6,ra=":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",Pe=ra+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",nt=new RegExp("^["+ra+"]["+Pe+"]*$"),_t={},rr={};function Sr(e){return zr.call(rr,e)?!0:zr.call(_t,e)?!1:nt.test(e)?(rr[e]=!0,!0):(_t[e]=!0,v("Invalid attribute name: `%s`",e),!1)}function Mr(e,t,s){return t!==null?t.type===ar:s?!1:e.length>2&&(e[0]==="o"||e[0]==="O")&&(e[1]==="n"||e[1]==="N")}function Or(e,t,s,u){if(s!==null&&s.type===ar)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":{if(u)return!1;if(s!==null)return!s.acceptsBooleans;var d=e.toLowerCase().slice(0,5);return d!=="data-"&&d!=="aria-"}default:return!1}}function gn(e,t,s,u){if(t===null||typeof t>"u"||Or(e,t,s,u))return!0;if(u)return!1;if(s!==null)switch(s.type){case Kr:return!t;case Qr:return t===!1;case Rn:return isNaN(t);case ta:return isNaN(t)||t<1}return!1}function wr(e){return hr.hasOwnProperty(e)?hr[e]:null}function yr(e,t,s,u,d,g,y){this.acceptsBooleans=t===ui||t===Kr||t===Qr,this.attributeName=u,this.attributeNamespace=d,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=g,this.removeEmptyString=y}var hr={},vi=["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"];vi.forEach(function(e){hr[e]=new yr(e,ar,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0],s=e[1];hr[t]=new yr(t,Pr,!1,s,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){hr[e]=new yr(e,ui,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){hr[e]=new yr(e,ui,!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"].forEach(function(e){hr[e]=new yr(e,Kr,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){hr[e]=new yr(e,Kr,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){hr[e]=new yr(e,Qr,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){hr[e]=new yr(e,ta,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){hr[e]=new yr(e,Rn,!1,e.toLowerCase(),null,!1,!1)});var An=/[\-\:]([a-z])/g,Hi=function(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"].forEach(function(e){var t=e.replace(An,Hi);hr[t]=new yr(t,Pr,!1,e,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(function(e){var t=e.replace(An,Hi);hr[t]=new yr(t,Pr,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(An,Hi);hr[t]=new yr(t,Pr,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){hr[e]=new yr(e,Pr,!1,e.toLowerCase(),null,!1,!1)});var ja="xlinkHref";hr[ja]=new yr("xlinkHref",Pr,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){hr[e]=new yr(e,Pr,!1,e.toLowerCase(),null,!0,!0)});var qs=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i,cs=!1;function fs(e){!cs&&qs.test(e)&&(cs=!0,v("A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed %s.",JSON.stringify(e)))}function ds(e,t,s,u){if(u.mustUseProperty){var d=u.propertyName;return e[d]}else{br(s,t),u.sanitizeURL&&fs(""+s);var g=u.attributeName,y=null;if(u.type===Qr){if(e.hasAttribute(g)){var E=e.getAttribute(g);return E===""?!0:gn(t,s,u,!1)?E:E===""+s?s:E}}else if(e.hasAttribute(g)){if(gn(t,s,u,!1))return e.getAttribute(g);if(u.type===Kr)return s;y=e.getAttribute(g)}return gn(t,s,u,!1)?y===null?s:y:y===""+s?s:y}}function hs(e,t,s,u){{if(!Sr(t))return;if(!e.hasAttribute(t))return s===void 0?void 0:null;var d=e.getAttribute(t);return br(s,t),d===""+s?s:d}}function Yn(e,t,s,u){var d=wr(t);if(!Mr(t,d,u)){if(gn(t,s,d,u)&&(s=null),u||d===null){if(Sr(t)){var g=t;s===null?e.removeAttribute(g):(br(s,t),e.setAttribute(g,""+s))}return}var y=d.mustUseProperty;if(y){var E=d.propertyName;if(s===null){var _=d.type;e[E]=_===Kr?!1:""}else e[E]=s;return}var N=d.attributeName,I=d.attributeNamespace;if(s===null)e.removeAttribute(N);else{var re=d.type,J;re===Kr||re===Qr&&s===!0?J="":(br(s,N),J=""+s,d.sanitizeURL&&fs(J.toString())),I?e.setAttributeNS(I,N,J):e.setAttribute(N,J)}}}var In=Symbol.for("react.element"),pr=Symbol.for("react.portal"),kn=Symbol.for("react.fragment"),Ii=Symbol.for("react.strict_mode"),Ea=Symbol.for("react.profiler"),ps=Symbol.for("react.provider"),W=Symbol.for("react.context"),Re=Symbol.for("react.forward_ref"),je=Symbol.for("react.suspense"),et=Symbol.for("react.suspense_list"),Ft=Symbol.for("react.memo"),Tt=Symbol.for("react.lazy"),Pt=Symbol.for("react.scope"),Ht=Symbol.for("react.debug_trace_mode"),ln=Symbol.for("react.offscreen"),Hr=Symbol.for("react.legacy_hidden"),Lr=Symbol.for("react.cache"),Vn=Symbol.for("react.tracing_marker"),za=Symbol.iterator,qa="@@iterator";function Ot(e){if(e===null||typeof e!="object")return null;var t=za&&e[za]||e[qa];return typeof t=="function"?t:null}var Bt=Object.assign,Ya=0,wl,bl,Ro,bu,Ao,$i,Oc;function gi(){}gi.__reactDisabledLog=!0;function ld(){{if(Ya===0){wl=console.log,bl=console.info,Ro=console.warn,bu=console.error,Ao=console.group,$i=console.groupCollapsed,Oc=console.groupEnd;var e={configurable:!0,enumerable:!0,value:gi,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Ya++}}function ud(){{if(Ya--,Ya===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Bt({},e,{value:wl}),info:Bt({},e,{value:bl}),warn:Bt({},e,{value:Ro}),error:Bt({},e,{value:bu}),group:Bt({},e,{value:Ao}),groupCollapsed:Bt({},e,{value:$i}),groupEnd:Bt({},e,{value:Oc})})}Ya<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var _u=i.ReactCurrentDispatcher,ko;function na(e,t,s){{if(ko===void 0)try{throw Error()}catch(d){var u=d.stack.trim().match(/\n( *(at )?)/);ko=u&&u[1]||""}return`
80
80
  `+ko+e}}var Va=!1,Wa;{var Du=typeof WeakMap=="function"?WeakMap:Map;Wa=new Du}function _l(e,t){if(!e||Va)return"";{var s=Wa.get(e);if(s!==void 0)return s}var u;Va=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var g;g=_u.current,_u.current=null,ld();try{if(t){var y=function(){throw Error()};if(Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(de){u=de}Reflect.construct(e,[],y)}else{try{y.call()}catch(de){u=de}e.call(y.prototype)}}else{try{throw Error()}catch(de){u=de}e()}}catch(de){if(de&&u&&typeof de.stack=="string"){for(var E=de.stack.split(`
81
81
  `),_=u.stack.split(`
82
82
  `),N=E.length-1,I=_.length-1;N>=1&&I>=0&&E[N]!==_[I];)I--;for(;N>=1&&I>=0;N--,I--)if(E[N]!==_[I]){if(N!==1||I!==1)do if(N--,I--,I<0||E[N]!==_[I]){var re=`
@@ -230,7 +230,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
230
230
  `+ut+W}}var Te=!1,mt;{var dr=typeof WeakMap=="function"?WeakMap:Map;mt=new dr}function zr(W,Re){if(!W||Te)return"";{var je=mt.get(W);if(je!==void 0)return je}var et;Te=!0;var Ft=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Tt;Tt=Ge.current,Ge.current=null,le();try{if(Re){var Pt=function(){throw Error()};if(Object.defineProperty(Pt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Pt,[])}catch(Ot){et=Ot}Reflect.construct(W,[],Pt)}else{try{Pt.call()}catch(Ot){et=Ot}W.call(Pt.prototype)}}else{try{throw Error()}catch(Ot){et=Ot}W()}}catch(Ot){if(Ot&&et&&typeof Ot.stack=="string"){for(var Ht=Ot.stack.split(`
231
231
  `),ln=et.stack.split(`
232
232
  `),Hr=Ht.length-1,Lr=ln.length-1;Hr>=1&&Lr>=0&&Ht[Hr]!==ln[Lr];)Lr--;for(;Hr>=1&&Lr>=0;Hr--,Lr--)if(Ht[Hr]!==ln[Lr]){if(Hr!==1||Lr!==1)do if(Hr--,Lr--,Lr<0||Ht[Hr]!==ln[Lr]){var Vn=`
233
- `+Ht[Hr].replace(" at new "," at ");return W.displayName&&Vn.includes("<anonymous>")&&(Vn=Vn.replace("<anonymous>",W.displayName)),typeof W=="function"&&mt.set(W,Vn),Vn}while(Hr>=1&&Lr>=0);break}}}finally{Te=!1,Ge.current=Tt,Je(),Error.prepareStackTrace=Ft}var za=W?W.displayName||W.name:"",qa=za?Se(za):"";return typeof W=="function"&&mt.set(W,qa),qa}function Yt(W,Re,je){return zr(W,!1)}function Xt(W){var Re=W.prototype;return!!(Re&&Re.isReactComponent)}function Fr(W,Re,je){if(W==null)return"";if(typeof W=="function")return zr(W,Xt(W));if(typeof W=="string")return Se(W);switch(W){case C:return Se("Suspense");case b:return Se("SuspenseList")}if(typeof W=="object")switch(W.$$typeof){case w:return Yt(W.render);case R:return Fr(W.type,Re,je);case T:{var et=W,Ft=et._payload,Tt=et._init;try{return Fr(Tt(Ft),Re,je)}catch{}}}return""}var br=Object.prototype.hasOwnProperty,nn={},Tn=O.ReactDebugCurrentFrame;function vn(W){if(W){var Re=W._owner,je=Fr(W.type,W._source,Re?Re.type:null);Tn.setExtraStackFrame(je)}else Tn.setExtraStackFrame(null)}function qr(W,Re,je,et,Ft){{var Tt=Function.call.bind(br);for(var Pt in W)if(Tt(W,Pt)){var Ht=void 0;try{if(typeof W[Pt]!="function"){var ln=Error((et||"React class")+": "+je+" type `"+Pt+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof W[Pt]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ln.name="Invariant Violation",ln}Ht=W[Pt](Re,Pt,et,je,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Hr){Ht=Hr}Ht&&!(Ht instanceof Error)&&(vn(Ft),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",et||"React class",je,Pt,typeof Ht),vn(null)),Ht instanceof Error&&!(Ht.message in nn)&&(nn[Ht.message]=!0,vn(Ft),B("Failed %s type: %s",je,Ht.message),vn(null))}}}var tr=Array.isArray;function ar(W){return tr(W)}function Pr(W){{var Re=typeof Symbol=="function"&&Symbol.toStringTag,je=Re&&W[Symbol.toStringTag]||W.constructor.name||"Object";return je}}function ui(W){try{return Kr(W),!1}catch{return!0}}function Kr(W){return""+W}function Qr(W){if(ui(W))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Pr(W)),Kr(W)}var Rn=O.ReactCurrentOwner,ta={key:!0,ref:!0,__self:!0,__source:!0},ra,Pe;function rt(W){if(br.call(W,"ref")){var Re=Object.getOwnPropertyDescriptor(W,"ref").get;if(Re&&Re.isReactWarning)return!1}return W.ref!==void 0}function _t(W){if(br.call(W,"key")){var Re=Object.getOwnPropertyDescriptor(W,"key").get;if(Re&&Re.isReactWarning)return!1}return W.key!==void 0}function rr(W,Re){typeof W.ref=="string"&&Rn.current}function Sr(W,Re){{var je=function(){ra||(ra=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Re))};je.isReactWarning=!0,Object.defineProperty(W,"key",{get:je,configurable:!0})}}function Mr(W,Re){{var je=function(){Pe||(Pe=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Re))};je.isReactWarning=!0,Object.defineProperty(W,"ref",{get:je,configurable:!0})}}var Or=function(W,Re,je,et,Ft,Tt,Pt){var Ht={$$typeof:r,type:W,key:Re,ref:je,props:Pt,_owner:Tt};return Ht._store={},Object.defineProperty(Ht._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ht,"_self",{configurable:!1,enumerable:!1,writable:!1,value:et}),Object.defineProperty(Ht,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ft}),Object.freeze&&(Object.freeze(Ht.props),Object.freeze(Ht)),Ht};function gn(W,Re,je,et,Ft){{var Tt,Pt={},Ht=null,ln=null;je!==void 0&&(Qr(je),Ht=""+je),_t(Re)&&(Qr(Re.key),Ht=""+Re.key),rt(Re)&&(ln=Re.ref,rr(Re,Ft));for(Tt in Re)br.call(Re,Tt)&&!ta.hasOwnProperty(Tt)&&(Pt[Tt]=Re[Tt]);if(W&&W.defaultProps){var Hr=W.defaultProps;for(Tt in Hr)Pt[Tt]===void 0&&(Pt[Tt]=Hr[Tt])}if(Ht||ln){var Lr=typeof W=="function"?W.displayName||W.name||"Unknown":W;Ht&&Sr(Pt,Lr),ln&&Mr(Pt,Lr)}return Or(W,Ht,ln,Ft,et,Rn.current,Pt)}}var wr=O.ReactCurrentOwner,yr=O.ReactDebugCurrentFrame;function hr(W){if(W){var Re=W._owner,je=Fr(W.type,W._source,Re?Re.type:null);yr.setExtraStackFrame(je)}else yr.setExtraStackFrame(null)}var vi;vi=!1;function An(W){return typeof W=="object"&&W!==null&&W.$$typeof===r}function Hi(){{if(wr.current){var W=M(wr.current.type);if(W)return`
233
+ `+Ht[Hr].replace(" at new "," at ");return W.displayName&&Vn.includes("<anonymous>")&&(Vn=Vn.replace("<anonymous>",W.displayName)),typeof W=="function"&&mt.set(W,Vn),Vn}while(Hr>=1&&Lr>=0);break}}}finally{Te=!1,Ge.current=Tt,Je(),Error.prepareStackTrace=Ft}var za=W?W.displayName||W.name:"",qa=za?Se(za):"";return typeof W=="function"&&mt.set(W,qa),qa}function Yt(W,Re,je){return zr(W,!1)}function Xt(W){var Re=W.prototype;return!!(Re&&Re.isReactComponent)}function Fr(W,Re,je){if(W==null)return"";if(typeof W=="function")return zr(W,Xt(W));if(typeof W=="string")return Se(W);switch(W){case C:return Se("Suspense");case b:return Se("SuspenseList")}if(typeof W=="object")switch(W.$$typeof){case w:return Yt(W.render);case R:return Fr(W.type,Re,je);case T:{var et=W,Ft=et._payload,Tt=et._init;try{return Fr(Tt(Ft),Re,je)}catch{}}}return""}var br=Object.prototype.hasOwnProperty,nn={},Tn=O.ReactDebugCurrentFrame;function vn(W){if(W){var Re=W._owner,je=Fr(W.type,W._source,Re?Re.type:null);Tn.setExtraStackFrame(je)}else Tn.setExtraStackFrame(null)}function qr(W,Re,je,et,Ft){{var Tt=Function.call.bind(br);for(var Pt in W)if(Tt(W,Pt)){var Ht=void 0;try{if(typeof W[Pt]!="function"){var ln=Error((et||"React class")+": "+je+" type `"+Pt+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof W[Pt]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ln.name="Invariant Violation",ln}Ht=W[Pt](Re,Pt,et,je,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Hr){Ht=Hr}Ht&&!(Ht instanceof Error)&&(vn(Ft),B("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",et||"React class",je,Pt,typeof Ht),vn(null)),Ht instanceof Error&&!(Ht.message in nn)&&(nn[Ht.message]=!0,vn(Ft),B("Failed %s type: %s",je,Ht.message),vn(null))}}}var tr=Array.isArray;function ar(W){return tr(W)}function Pr(W){{var Re=typeof Symbol=="function"&&Symbol.toStringTag,je=Re&&W[Symbol.toStringTag]||W.constructor.name||"Object";return je}}function ui(W){try{return Kr(W),!1}catch{return!0}}function Kr(W){return""+W}function Qr(W){if(ui(W))return B("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Pr(W)),Kr(W)}var Rn=O.ReactCurrentOwner,ta={key:!0,ref:!0,__self:!0,__source:!0},ra,Pe;function nt(W){if(br.call(W,"ref")){var Re=Object.getOwnPropertyDescriptor(W,"ref").get;if(Re&&Re.isReactWarning)return!1}return W.ref!==void 0}function _t(W){if(br.call(W,"key")){var Re=Object.getOwnPropertyDescriptor(W,"key").get;if(Re&&Re.isReactWarning)return!1}return W.key!==void 0}function rr(W,Re){typeof W.ref=="string"&&Rn.current}function Sr(W,Re){{var je=function(){ra||(ra=!0,B("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Re))};je.isReactWarning=!0,Object.defineProperty(W,"key",{get:je,configurable:!0})}}function Mr(W,Re){{var je=function(){Pe||(Pe=!0,B("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Re))};je.isReactWarning=!0,Object.defineProperty(W,"ref",{get:je,configurable:!0})}}var Or=function(W,Re,je,et,Ft,Tt,Pt){var Ht={$$typeof:r,type:W,key:Re,ref:je,props:Pt,_owner:Tt};return Ht._store={},Object.defineProperty(Ht._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ht,"_self",{configurable:!1,enumerable:!1,writable:!1,value:et}),Object.defineProperty(Ht,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ft}),Object.freeze&&(Object.freeze(Ht.props),Object.freeze(Ht)),Ht};function gn(W,Re,je,et,Ft){{var Tt,Pt={},Ht=null,ln=null;je!==void 0&&(Qr(je),Ht=""+je),_t(Re)&&(Qr(Re.key),Ht=""+Re.key),nt(Re)&&(ln=Re.ref,rr(Re,Ft));for(Tt in Re)br.call(Re,Tt)&&!ta.hasOwnProperty(Tt)&&(Pt[Tt]=Re[Tt]);if(W&&W.defaultProps){var Hr=W.defaultProps;for(Tt in Hr)Pt[Tt]===void 0&&(Pt[Tt]=Hr[Tt])}if(Ht||ln){var Lr=typeof W=="function"?W.displayName||W.name||"Unknown":W;Ht&&Sr(Pt,Lr),ln&&Mr(Pt,Lr)}return Or(W,Ht,ln,Ft,et,Rn.current,Pt)}}var wr=O.ReactCurrentOwner,yr=O.ReactDebugCurrentFrame;function hr(W){if(W){var Re=W._owner,je=Fr(W.type,W._source,Re?Re.type:null);yr.setExtraStackFrame(je)}else yr.setExtraStackFrame(null)}var vi;vi=!1;function An(W){return typeof W=="object"&&W!==null&&W.$$typeof===r}function Hi(){{if(wr.current){var W=M(wr.current.type);if(W)return`
234
234
 
235
235
  Check the render method of \``+W+"`."}return""}}function ja(W){return""}var qs={};function cs(W){{var Re=Hi();if(!Re){var je=typeof W=="string"?W:W.displayName||W.name;je&&(Re=`
236
236
 
@@ -338,7 +338,7 @@ React keys must be passed directly to JSX without using spread:
338
338
  hover:border-primary/20 hover:bg-primary/5
339
339
  active:shadow-none active:bg-primary/10 active:scale-95
340
340
  transition-all duration-150
341
- `,children:[ie.jsx("span",{className:"text-[22px] font-medium text-gray-800 leading-none",children:r}),i?ie.jsx("span",{className:"text-[9px] text-gray-400 font-semibold tracking-[0.18em] mt-1.5",children:i}):ie.jsx("span",{className:"h-3.5"})]},r))});class oR{constructor(){this.listeners={}}on(r,i){return this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push(i),()=>this.off(r,i)}off(r,i){this.listeners[r]&&(this.listeners[r]=this.listeners[r].filter(l=>l!==i))}emitLocal(r,i){this.listeners[r]&&this.listeners[r].forEach(l=>{try{l(i)}catch(f){console.error(`Error in event listener for ${r}:`,f)}})}emitToParent(r,i){this.emitLocal(r,i)}}const nt=new oR;var e2={exports:{}};function lR(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ky={exports:{}};const uR=$T(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var t2;function er(){return t2||(t2=1,function(o,r){(function(i,l){o.exports=l()})(Ut,function(){var i=i||function(l,f){var p;if(typeof window<"u"&&window.crypto&&(p=window.crypto),typeof self<"u"&&self.crypto&&(p=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(p=globalThis.crypto),!p&&typeof window<"u"&&window.msCrypto&&(p=window.msCrypto),!p&&typeof Ut<"u"&&Ut.crypto&&(p=Ut.crypto),!p&&typeof lR=="function")try{p=uR}catch{}var v=function(){if(p){if(typeof p.getRandomValues=="function")try{return p.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof p.randomBytes=="function")try{return p.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},S=Object.create||function(){function B(){}return function(U){var q;return B.prototype=U,q=new B,B.prototype=null,q}}(),w={},C=w.lib={},b=C.Base=function(){return{extend:function(B){var U=S(this);return B&&U.mixIn(B),(!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 B=this.extend();return B.init.apply(B,arguments),B},init:function(){},mixIn:function(B){for(var U in B)B.hasOwnProperty(U)&&(this[U]=B[U]);B.hasOwnProperty("toString")&&(this.toString=B.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),R=C.WordArray=b.extend({init:function(B,U){B=this.words=B||[],U!=f?this.sigBytes=U:this.sigBytes=B.length*4},toString:function(B){return(B||H).stringify(this)},concat:function(B){var U=this.words,q=B.words,K=this.sigBytes,Z=B.sigBytes;if(this.clamp(),K%4)for(var ee=0;ee<Z;ee++){var A=q[ee>>>2]>>>24-ee%4*8&255;U[K+ee>>>2]|=A<<24-(K+ee)%4*8}else for(var Ce=0;Ce<Z;Ce+=4)U[K+Ce>>>2]=q[Ce>>>2];return this.sigBytes+=Z,this},clamp:function(){var B=this.words,U=this.sigBytes;B[U>>>2]&=4294967295<<32-U%4*8,B.length=l.ceil(U/4)},clone:function(){var B=b.clone.call(this);return B.words=this.words.slice(0),B},random:function(B){for(var U=[],q=0;q<B;q+=4)U.push(v());return new R.init(U,B)}}),T=w.enc={},H=T.Hex={stringify:function(B){for(var U=B.words,q=B.sigBytes,K=[],Z=0;Z<q;Z++){var ee=U[Z>>>2]>>>24-Z%4*8&255;K.push((ee>>>4).toString(16)),K.push((ee&15).toString(16))}return K.join("")},parse:function(B){for(var U=B.length,q=[],K=0;K<U;K+=2)q[K>>>3]|=parseInt(B.substr(K,2),16)<<24-K%8*4;return new R.init(q,U/2)}},P=T.Latin1={stringify:function(B){for(var U=B.words,q=B.sigBytes,K=[],Z=0;Z<q;Z++){var ee=U[Z>>>2]>>>24-Z%4*8&255;K.push(String.fromCharCode(ee))}return K.join("")},parse:function(B){for(var U=B.length,q=[],K=0;K<U;K++)q[K>>>2]|=(B.charCodeAt(K)&255)<<24-K%4*8;return new R.init(q,U)}},j=T.Utf8={stringify:function(B){try{return decodeURIComponent(escape(P.stringify(B)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(B){return P.parse(unescape(encodeURIComponent(B)))}},z=C.BufferedBlockAlgorithm=b.extend({reset:function(){this._data=new R.init,this._nDataBytes=0},_append:function(B){typeof B=="string"&&(B=j.parse(B)),this._data.concat(B),this._nDataBytes+=B.sigBytes},_process:function(B){var U,q=this._data,K=q.words,Z=q.sigBytes,ee=this.blockSize,A=ee*4,Ce=Z/A;B?Ce=l.ceil(Ce):Ce=l.max((Ce|0)-this._minBufferSize,0);var X=Ce*ee,F=l.min(X*4,Z);if(X){for(var L=0;L<X;L+=ee)this._doProcessBlock(K,L);U=K.splice(0,X),q.sigBytes-=F}return new R.init(U,F)},clone:function(){var B=b.clone.call(this);return B._data=this._data.clone(),B},_minBufferSize:0});C.Hasher=z.extend({cfg:b.extend(),init:function(B){this.cfg=this.cfg.extend(B),this.reset()},reset:function(){z.reset.call(this),this._doReset()},update:function(B){return this._append(B),this._process(),this},finalize:function(B){B&&this._append(B);var U=this._doFinalize();return U},blockSize:16,_createHelper:function(B){return function(U,q){return new B.init(q).finalize(U)}},_createHmacHelper:function(B){return function(U,q){return new O.HMAC.init(B,q).finalize(U)}}});var O=w.algo={};return w}(Math);return i})}(Ky)),Ky.exports}var Qy={exports:{}},r2;function Cv(){return r2||(r2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(l){var f=i,p=f.lib,v=p.Base,S=p.WordArray,w=f.x64={};w.Word=v.extend({init:function(C,b){this.high=C,this.low=b}}),w.WordArray=v.extend({init:function(C,b){C=this.words=C||[],b!=l?this.sigBytes=b:this.sigBytes=C.length*8},toX32:function(){for(var C=this.words,b=C.length,R=[],T=0;T<b;T++){var H=C[T];R.push(H.high),R.push(H.low)}return S.create(R,this.sigBytes)},clone:function(){for(var C=v.clone.call(this),b=C.words=this.words.slice(0),R=b.length,T=0;T<R;T++)b[T]=b[T].clone();return C}})}(),i})}(Qy)),Qy.exports}var Xy={exports:{}},n2;function cR(){return n2||(n2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(){if(typeof ArrayBuffer=="function"){var l=i,f=l.lib,p=f.WordArray,v=p.init,S=p.init=function(w){if(w instanceof ArrayBuffer&&(w=new Uint8Array(w)),(w instanceof Int8Array||typeof Uint8ClampedArray<"u"&&w instanceof Uint8ClampedArray||w instanceof Int16Array||w instanceof Uint16Array||w instanceof Int32Array||w instanceof Uint32Array||w instanceof Float32Array||w instanceof Float64Array)&&(w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength)),w instanceof Uint8Array){for(var C=w.byteLength,b=[],R=0;R<C;R++)b[R>>>2]|=w[R]<<24-R%4*8;v.call(this,b,C)}else v.apply(this,arguments)};S.prototype=p}}(),i.lib.WordArray})}(Xy)),Xy.exports}var Zy={exports:{}},i2;function fR(){return i2||(i2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=l.enc;v.Utf16=v.Utf16BE={stringify:function(w){for(var C=w.words,b=w.sigBytes,R=[],T=0;T<b;T+=2){var H=C[T>>>2]>>>16-T%4*8&65535;R.push(String.fromCharCode(H))}return R.join("")},parse:function(w){for(var C=w.length,b=[],R=0;R<C;R++)b[R>>>1]|=w.charCodeAt(R)<<16-R%2*16;return p.create(b,C*2)}},v.Utf16LE={stringify:function(w){for(var C=w.words,b=w.sigBytes,R=[],T=0;T<b;T+=2){var H=S(C[T>>>2]>>>16-T%4*8&65535);R.push(String.fromCharCode(H))}return R.join("")},parse:function(w){for(var C=w.length,b=[],R=0;R<C;R++)b[R>>>1]|=S(w.charCodeAt(R)<<16-R%2*16);return p.create(b,C*2)}};function S(w){return w<<8&4278255360|w>>>8&16711935}}(),i.enc.Utf16})}(Zy)),Zy.exports}var Jy={exports:{}},a2;function Cc(){return a2||(a2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=l.enc;v.Base64={stringify:function(w){var C=w.words,b=w.sigBytes,R=this._map;w.clamp();for(var T=[],H=0;H<b;H+=3)for(var P=C[H>>>2]>>>24-H%4*8&255,j=C[H+1>>>2]>>>24-(H+1)%4*8&255,z=C[H+2>>>2]>>>24-(H+2)%4*8&255,O=P<<16|j<<8|z,B=0;B<4&&H+B*.75<b;B++)T.push(R.charAt(O>>>6*(3-B)&63));var U=R.charAt(64);if(U)for(;T.length%4;)T.push(U);return T.join("")},parse:function(w){var C=w.length,b=this._map,R=this._reverseMap;if(!R){R=this._reverseMap=[];for(var T=0;T<b.length;T++)R[b.charCodeAt(T)]=T}var H=b.charAt(64);if(H){var P=w.indexOf(H);P!==-1&&(C=P)}return S(w,C,R)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function S(w,C,b){for(var R=[],T=0,H=0;H<C;H++)if(H%4){var P=b[w.charCodeAt(H-1)]<<H%4*2,j=b[w.charCodeAt(H)]>>>6-H%4*2,z=P|j;R[T>>>2]|=z<<24-T%4*8,T++}return p.create(R,T)}}(),i.enc.Base64})}(Jy)),Jy.exports}var ex={exports:{}},s2;function dR(){return s2||(s2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=l.enc;v.Base64url={stringify:function(w,C){C===void 0&&(C=!0);var b=w.words,R=w.sigBytes,T=C?this._safe_map:this._map;w.clamp();for(var H=[],P=0;P<R;P+=3)for(var j=b[P>>>2]>>>24-P%4*8&255,z=b[P+1>>>2]>>>24-(P+1)%4*8&255,O=b[P+2>>>2]>>>24-(P+2)%4*8&255,B=j<<16|z<<8|O,U=0;U<4&&P+U*.75<R;U++)H.push(T.charAt(B>>>6*(3-U)&63));var q=T.charAt(64);if(q)for(;H.length%4;)H.push(q);return H.join("")},parse:function(w,C){C===void 0&&(C=!0);var b=w.length,R=C?this._safe_map:this._map,T=this._reverseMap;if(!T){T=this._reverseMap=[];for(var H=0;H<R.length;H++)T[R.charCodeAt(H)]=H}var P=R.charAt(64);if(P){var j=w.indexOf(P);j!==-1&&(b=j)}return S(w,b,T)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function S(w,C,b){for(var R=[],T=0,H=0;H<C;H++)if(H%4){var P=b[w.charCodeAt(H-1)]<<H%4*2,j=b[w.charCodeAt(H)]>>>6-H%4*2,z=P|j;R[T>>>2]|=z<<24-T%4*8,T++}return p.create(R,T)}}(),i.enc.Base64url})}(ex)),ex.exports}var tx={exports:{}},o2;function Sc(){return o2||(o2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(l){var f=i,p=f.lib,v=p.WordArray,S=p.Hasher,w=f.algo,C=[];(function(){for(var j=0;j<64;j++)C[j]=l.abs(l.sin(j+1))*4294967296|0})();var b=w.MD5=S.extend({_doReset:function(){this._hash=new v.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(j,z){for(var O=0;O<16;O++){var B=z+O,U=j[B];j[B]=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360}var q=this._hash.words,K=j[z+0],Z=j[z+1],ee=j[z+2],A=j[z+3],Ce=j[z+4],X=j[z+5],F=j[z+6],L=j[z+7],M=j[z+8],_e=j[z+9],be=j[z+10],$e=j[z+11],ge=j[z+12],Ee=j[z+13],He=j[z+14],De=j[z+15],$=q[0],G=q[1],he=q[2],le=q[3];$=R($,G,he,le,K,7,C[0]),le=R(le,$,G,he,Z,12,C[1]),he=R(he,le,$,G,ee,17,C[2]),G=R(G,he,le,$,A,22,C[3]),$=R($,G,he,le,Ce,7,C[4]),le=R(le,$,G,he,X,12,C[5]),he=R(he,le,$,G,F,17,C[6]),G=R(G,he,le,$,L,22,C[7]),$=R($,G,he,le,M,7,C[8]),le=R(le,$,G,he,_e,12,C[9]),he=R(he,le,$,G,be,17,C[10]),G=R(G,he,le,$,$e,22,C[11]),$=R($,G,he,le,ge,7,C[12]),le=R(le,$,G,he,Ee,12,C[13]),he=R(he,le,$,G,He,17,C[14]),G=R(G,he,le,$,De,22,C[15]),$=T($,G,he,le,Z,5,C[16]),le=T(le,$,G,he,F,9,C[17]),he=T(he,le,$,G,$e,14,C[18]),G=T(G,he,le,$,K,20,C[19]),$=T($,G,he,le,X,5,C[20]),le=T(le,$,G,he,be,9,C[21]),he=T(he,le,$,G,De,14,C[22]),G=T(G,he,le,$,Ce,20,C[23]),$=T($,G,he,le,_e,5,C[24]),le=T(le,$,G,he,He,9,C[25]),he=T(he,le,$,G,A,14,C[26]),G=T(G,he,le,$,M,20,C[27]),$=T($,G,he,le,Ee,5,C[28]),le=T(le,$,G,he,ee,9,C[29]),he=T(he,le,$,G,L,14,C[30]),G=T(G,he,le,$,ge,20,C[31]),$=H($,G,he,le,X,4,C[32]),le=H(le,$,G,he,M,11,C[33]),he=H(he,le,$,G,$e,16,C[34]),G=H(G,he,le,$,He,23,C[35]),$=H($,G,he,le,Z,4,C[36]),le=H(le,$,G,he,Ce,11,C[37]),he=H(he,le,$,G,L,16,C[38]),G=H(G,he,le,$,be,23,C[39]),$=H($,G,he,le,Ee,4,C[40]),le=H(le,$,G,he,K,11,C[41]),he=H(he,le,$,G,A,16,C[42]),G=H(G,he,le,$,F,23,C[43]),$=H($,G,he,le,_e,4,C[44]),le=H(le,$,G,he,ge,11,C[45]),he=H(he,le,$,G,De,16,C[46]),G=H(G,he,le,$,ee,23,C[47]),$=P($,G,he,le,K,6,C[48]),le=P(le,$,G,he,L,10,C[49]),he=P(he,le,$,G,He,15,C[50]),G=P(G,he,le,$,X,21,C[51]),$=P($,G,he,le,ge,6,C[52]),le=P(le,$,G,he,A,10,C[53]),he=P(he,le,$,G,be,15,C[54]),G=P(G,he,le,$,Z,21,C[55]),$=P($,G,he,le,M,6,C[56]),le=P(le,$,G,he,De,10,C[57]),he=P(he,le,$,G,F,15,C[58]),G=P(G,he,le,$,Ee,21,C[59]),$=P($,G,he,le,Ce,6,C[60]),le=P(le,$,G,he,$e,10,C[61]),he=P(he,le,$,G,ee,15,C[62]),G=P(G,he,le,$,_e,21,C[63]),q[0]=q[0]+$|0,q[1]=q[1]+G|0,q[2]=q[2]+he|0,q[3]=q[3]+le|0},_doFinalize:function(){var j=this._data,z=j.words,O=this._nDataBytes*8,B=j.sigBytes*8;z[B>>>5]|=128<<24-B%32;var U=l.floor(O/4294967296),q=O;z[(B+64>>>9<<4)+15]=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360,z[(B+64>>>9<<4)+14]=(q<<8|q>>>24)&16711935|(q<<24|q>>>8)&4278255360,j.sigBytes=(z.length+1)*4,this._process();for(var K=this._hash,Z=K.words,ee=0;ee<4;ee++){var A=Z[ee];Z[ee]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}return K},clone:function(){var j=S.clone.call(this);return j._hash=this._hash.clone(),j}});function R(j,z,O,B,U,q,K){var Z=j+(z&O|~z&B)+U+K;return(Z<<q|Z>>>32-q)+z}function T(j,z,O,B,U,q,K){var Z=j+(z&B|O&~B)+U+K;return(Z<<q|Z>>>32-q)+z}function H(j,z,O,B,U,q,K){var Z=j+(z^O^B)+U+K;return(Z<<q|Z>>>32-q)+z}function P(j,z,O,B,U,q,K){var Z=j+(O^(z|~B))+U+K;return(Z<<q|Z>>>32-q)+z}f.MD5=S._createHelper(b),f.HmacMD5=S._createHmacHelper(b)}(Math),i.MD5})}(tx)),tx.exports}var rx={exports:{}},l2;function u2(){return l2||(l2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=f.Hasher,S=l.algo,w=[],C=S.SHA1=v.extend({_doReset:function(){this._hash=new p.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(b,R){for(var T=this._hash.words,H=T[0],P=T[1],j=T[2],z=T[3],O=T[4],B=0;B<80;B++){if(B<16)w[B]=b[R+B]|0;else{var U=w[B-3]^w[B-8]^w[B-14]^w[B-16];w[B]=U<<1|U>>>31}var q=(H<<5|H>>>27)+O+w[B];B<20?q+=(P&j|~P&z)+1518500249:B<40?q+=(P^j^z)+1859775393:B<60?q+=(P&j|P&z|j&z)-1894007588:q+=(P^j^z)-899497514,O=z,z=j,j=P<<30|P>>>2,P=H,H=q}T[0]=T[0]+H|0,T[1]=T[1]+P|0,T[2]=T[2]+j|0,T[3]=T[3]+z|0,T[4]=T[4]+O|0},_doFinalize:function(){var b=this._data,R=b.words,T=this._nDataBytes*8,H=b.sigBytes*8;return R[H>>>5]|=128<<24-H%32,R[(H+64>>>9<<4)+14]=Math.floor(T/4294967296),R[(H+64>>>9<<4)+15]=T,b.sigBytes=R.length*4,this._process(),this._hash},clone:function(){var b=v.clone.call(this);return b._hash=this._hash.clone(),b}});l.SHA1=v._createHelper(C),l.HmacSHA1=v._createHmacHelper(C)}(),i.SHA1})}(rx)),rx.exports}var nx={exports:{}},c2;function ix(){return c2||(c2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(l){var f=i,p=f.lib,v=p.WordArray,S=p.Hasher,w=f.algo,C=[],b=[];(function(){function H(O){for(var B=l.sqrt(O),U=2;U<=B;U++)if(!(O%U))return!1;return!0}function P(O){return(O-(O|0))*4294967296|0}for(var j=2,z=0;z<64;)H(j)&&(z<8&&(C[z]=P(l.pow(j,.5))),b[z]=P(l.pow(j,.3333333333333333)),z++),j++})();var R=[],T=w.SHA256=S.extend({_doReset:function(){this._hash=new v.init(C.slice(0))},_doProcessBlock:function(H,P){for(var j=this._hash.words,z=j[0],O=j[1],B=j[2],U=j[3],q=j[4],K=j[5],Z=j[6],ee=j[7],A=0;A<64;A++){if(A<16)R[A]=H[P+A]|0;else{var Ce=R[A-15],X=(Ce<<25|Ce>>>7)^(Ce<<14|Ce>>>18)^Ce>>>3,F=R[A-2],L=(F<<15|F>>>17)^(F<<13|F>>>19)^F>>>10;R[A]=X+R[A-7]+L+R[A-16]}var M=q&K^~q&Z,_e=z&O^z&B^O&B,be=(z<<30|z>>>2)^(z<<19|z>>>13)^(z<<10|z>>>22),$e=(q<<26|q>>>6)^(q<<21|q>>>11)^(q<<7|q>>>25),ge=ee+$e+M+b[A]+R[A],Ee=be+_e;ee=Z,Z=K,K=q,q=U+ge|0,U=B,B=O,O=z,z=ge+Ee|0}j[0]=j[0]+z|0,j[1]=j[1]+O|0,j[2]=j[2]+B|0,j[3]=j[3]+U|0,j[4]=j[4]+q|0,j[5]=j[5]+K|0,j[6]=j[6]+Z|0,j[7]=j[7]+ee|0},_doFinalize:function(){var H=this._data,P=H.words,j=this._nDataBytes*8,z=H.sigBytes*8;return P[z>>>5]|=128<<24-z%32,P[(z+64>>>9<<4)+14]=l.floor(j/4294967296),P[(z+64>>>9<<4)+15]=j,H.sigBytes=P.length*4,this._process(),this._hash},clone:function(){var H=S.clone.call(this);return H._hash=this._hash.clone(),H}});f.SHA256=S._createHelper(T),f.HmacSHA256=S._createHmacHelper(T)}(Math),i.SHA256})}(nx)),nx.exports}var ax={exports:{}},f2;function hR(){return f2||(f2=1,function(o,r){(function(i,l,f){o.exports=l(er(),ix())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=l.algo,S=v.SHA256,w=v.SHA224=S.extend({_doReset:function(){this._hash=new p.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var C=S._doFinalize.call(this);return C.sigBytes-=4,C}});l.SHA224=S._createHelper(w),l.HmacSHA224=S._createHmacHelper(w)}(),i.SHA224})}(ax)),ax.exports}var sx={exports:{}},d2;function h2(){return d2||(d2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cv())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.Hasher,v=l.x64,S=v.Word,w=v.WordArray,C=l.algo;function b(){return S.create.apply(S,arguments)}var R=[b(1116352408,3609767458),b(1899447441,602891725),b(3049323471,3964484399),b(3921009573,2173295548),b(961987163,4081628472),b(1508970993,3053834265),b(2453635748,2937671579),b(2870763221,3664609560),b(3624381080,2734883394),b(310598401,1164996542),b(607225278,1323610764),b(1426881987,3590304994),b(1925078388,4068182383),b(2162078206,991336113),b(2614888103,633803317),b(3248222580,3479774868),b(3835390401,2666613458),b(4022224774,944711139),b(264347078,2341262773),b(604807628,2007800933),b(770255983,1495990901),b(1249150122,1856431235),b(1555081692,3175218132),b(1996064986,2198950837),b(2554220882,3999719339),b(2821834349,766784016),b(2952996808,2566594879),b(3210313671,3203337956),b(3336571891,1034457026),b(3584528711,2466948901),b(113926993,3758326383),b(338241895,168717936),b(666307205,1188179964),b(773529912,1546045734),b(1294757372,1522805485),b(1396182291,2643833823),b(1695183700,2343527390),b(1986661051,1014477480),b(2177026350,1206759142),b(2456956037,344077627),b(2730485921,1290863460),b(2820302411,3158454273),b(3259730800,3505952657),b(3345764771,106217008),b(3516065817,3606008344),b(3600352804,1432725776),b(4094571909,1467031594),b(275423344,851169720),b(430227734,3100823752),b(506948616,1363258195),b(659060556,3750685593),b(883997877,3785050280),b(958139571,3318307427),b(1322822218,3812723403),b(1537002063,2003034995),b(1747873779,3602036899),b(1955562222,1575990012),b(2024104815,1125592928),b(2227730452,2716904306),b(2361852424,442776044),b(2428436474,593698344),b(2756734187,3733110249),b(3204031479,2999351573),b(3329325298,3815920427),b(3391569614,3928383900),b(3515267271,566280711),b(3940187606,3454069534),b(4118630271,4000239992),b(116418474,1914138554),b(174292421,2731055270),b(289380356,3203993006),b(460393269,320620315),b(685471733,587496836),b(852142971,1086792851),b(1017036298,365543100),b(1126000580,2618297676),b(1288033470,3409855158),b(1501505948,4234509866),b(1607167915,987167468),b(1816402316,1246189591)],T=[];(function(){for(var P=0;P<80;P++)T[P]=b()})();var H=C.SHA512=p.extend({_doReset:function(){this._hash=new w.init([new S.init(1779033703,4089235720),new S.init(3144134277,2227873595),new S.init(1013904242,4271175723),new S.init(2773480762,1595750129),new S.init(1359893119,2917565137),new S.init(2600822924,725511199),new S.init(528734635,4215389547),new S.init(1541459225,327033209)])},_doProcessBlock:function(P,j){for(var z=this._hash.words,O=z[0],B=z[1],U=z[2],q=z[3],K=z[4],Z=z[5],ee=z[6],A=z[7],Ce=O.high,X=O.low,F=B.high,L=B.low,M=U.high,_e=U.low,be=q.high,$e=q.low,ge=K.high,Ee=K.low,He=Z.high,De=Z.low,$=ee.high,G=ee.low,he=A.high,le=A.low,Je=Ce,Ge=X,ut=F,Se=L,Te=M,mt=_e,dr=be,zr=$e,Yt=ge,Xt=Ee,Fr=He,br=De,nn=$,Tn=G,vn=he,qr=le,tr=0;tr<80;tr++){var ar,Pr,ui=T[tr];if(tr<16)Pr=ui.high=P[j+tr*2]|0,ar=ui.low=P[j+tr*2+1]|0;else{var Kr=T[tr-15],Qr=Kr.high,Rn=Kr.low,ta=(Qr>>>1|Rn<<31)^(Qr>>>8|Rn<<24)^Qr>>>7,ra=(Rn>>>1|Qr<<31)^(Rn>>>8|Qr<<24)^(Rn>>>7|Qr<<25),Pe=T[tr-2],rt=Pe.high,_t=Pe.low,rr=(rt>>>19|_t<<13)^(rt<<3|_t>>>29)^rt>>>6,Sr=(_t>>>19|rt<<13)^(_t<<3|rt>>>29)^(_t>>>6|rt<<26),Mr=T[tr-7],Or=Mr.high,gn=Mr.low,wr=T[tr-16],yr=wr.high,hr=wr.low;ar=ra+gn,Pr=ta+Or+(ar>>>0<ra>>>0?1:0),ar=ar+Sr,Pr=Pr+rr+(ar>>>0<Sr>>>0?1:0),ar=ar+hr,Pr=Pr+yr+(ar>>>0<hr>>>0?1:0),ui.high=Pr,ui.low=ar}var vi=Yt&Fr^~Yt&nn,An=Xt&br^~Xt&Tn,Hi=Je&ut^Je&Te^ut&Te,ja=Ge&Se^Ge&mt^Se&mt,qs=(Je>>>28|Ge<<4)^(Je<<30|Ge>>>2)^(Je<<25|Ge>>>7),cs=(Ge>>>28|Je<<4)^(Ge<<30|Je>>>2)^(Ge<<25|Je>>>7),fs=(Yt>>>14|Xt<<18)^(Yt>>>18|Xt<<14)^(Yt<<23|Xt>>>9),ds=(Xt>>>14|Yt<<18)^(Xt>>>18|Yt<<14)^(Xt<<23|Yt>>>9),hs=R[tr],Yn=hs.high,In=hs.low,pr=qr+ds,kn=vn+fs+(pr>>>0<qr>>>0?1:0),pr=pr+An,kn=kn+vi+(pr>>>0<An>>>0?1:0),pr=pr+In,kn=kn+Yn+(pr>>>0<In>>>0?1:0),pr=pr+ar,kn=kn+Pr+(pr>>>0<ar>>>0?1:0),Ii=cs+ja,Ea=qs+Hi+(Ii>>>0<cs>>>0?1:0);vn=nn,qr=Tn,nn=Fr,Tn=br,Fr=Yt,br=Xt,Xt=zr+pr|0,Yt=dr+kn+(Xt>>>0<zr>>>0?1:0)|0,dr=Te,zr=mt,Te=ut,mt=Se,ut=Je,Se=Ge,Ge=pr+Ii|0,Je=kn+Ea+(Ge>>>0<pr>>>0?1:0)|0}X=O.low=X+Ge,O.high=Ce+Je+(X>>>0<Ge>>>0?1:0),L=B.low=L+Se,B.high=F+ut+(L>>>0<Se>>>0?1:0),_e=U.low=_e+mt,U.high=M+Te+(_e>>>0<mt>>>0?1:0),$e=q.low=$e+zr,q.high=be+dr+($e>>>0<zr>>>0?1:0),Ee=K.low=Ee+Xt,K.high=ge+Yt+(Ee>>>0<Xt>>>0?1:0),De=Z.low=De+br,Z.high=He+Fr+(De>>>0<br>>>0?1:0),G=ee.low=G+Tn,ee.high=$+nn+(G>>>0<Tn>>>0?1:0),le=A.low=le+qr,A.high=he+vn+(le>>>0<qr>>>0?1:0)},_doFinalize:function(){var P=this._data,j=P.words,z=this._nDataBytes*8,O=P.sigBytes*8;j[O>>>5]|=128<<24-O%32,j[(O+128>>>10<<5)+30]=Math.floor(z/4294967296),j[(O+128>>>10<<5)+31]=z,P.sigBytes=j.length*4,this._process();var B=this._hash.toX32();return B},clone:function(){var P=p.clone.call(this);return P._hash=this._hash.clone(),P},blockSize:1024/32});l.SHA512=p._createHelper(H),l.HmacSHA512=p._createHmacHelper(H)}(),i.SHA512})}(sx)),sx.exports}var ox={exports:{}},p2;function pR(){return p2||(p2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cv(),h2())})(Ut,function(i){return function(){var l=i,f=l.x64,p=f.Word,v=f.WordArray,S=l.algo,w=S.SHA512,C=S.SHA384=w.extend({_doReset:function(){this._hash=new v.init([new p.init(3418070365,3238371032),new p.init(1654270250,914150663),new p.init(2438529370,812702999),new p.init(355462360,4144912697),new p.init(1731405415,4290775857),new p.init(2394180231,1750603025),new p.init(3675008525,1694076839),new p.init(1203062813,3204075428)])},_doFinalize:function(){var b=w._doFinalize.call(this);return b.sigBytes-=16,b}});l.SHA384=w._createHelper(C),l.HmacSHA384=w._createHmacHelper(C)}(),i.SHA384})}(ox)),ox.exports}var lx={exports:{}},v2;function vR(){return v2||(v2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cv())})(Ut,function(i){return function(l){var f=i,p=f.lib,v=p.WordArray,S=p.Hasher,w=f.x64,C=w.Word,b=f.algo,R=[],T=[],H=[];(function(){for(var z=1,O=0,B=0;B<24;B++){R[z+5*O]=(B+1)*(B+2)/2%64;var U=O%5,q=(2*z+3*O)%5;z=U,O=q}for(var z=0;z<5;z++)for(var O=0;O<5;O++)T[z+5*O]=O+(2*z+3*O)%5*5;for(var K=1,Z=0;Z<24;Z++){for(var ee=0,A=0,Ce=0;Ce<7;Ce++){if(K&1){var X=(1<<Ce)-1;X<32?A^=1<<X:ee^=1<<X-32}K&128?K=K<<1^113:K<<=1}H[Z]=C.create(ee,A)}})();var P=[];(function(){for(var z=0;z<25;z++)P[z]=C.create()})();var j=b.SHA3=S.extend({cfg:S.cfg.extend({outputLength:512}),_doReset:function(){for(var z=this._state=[],O=0;O<25;O++)z[O]=new C.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(z,O){for(var B=this._state,U=this.blockSize/2,q=0;q<U;q++){var K=z[O+2*q],Z=z[O+2*q+1];K=(K<<8|K>>>24)&16711935|(K<<24|K>>>8)&4278255360,Z=(Z<<8|Z>>>24)&16711935|(Z<<24|Z>>>8)&4278255360;var ee=B[q];ee.high^=Z,ee.low^=K}for(var A=0;A<24;A++){for(var Ce=0;Ce<5;Ce++){for(var X=0,F=0,L=0;L<5;L++){var ee=B[Ce+5*L];X^=ee.high,F^=ee.low}var M=P[Ce];M.high=X,M.low=F}for(var Ce=0;Ce<5;Ce++)for(var _e=P[(Ce+4)%5],be=P[(Ce+1)%5],$e=be.high,ge=be.low,X=_e.high^($e<<1|ge>>>31),F=_e.low^(ge<<1|$e>>>31),L=0;L<5;L++){var ee=B[Ce+5*L];ee.high^=X,ee.low^=F}for(var Ee=1;Ee<25;Ee++){var X,F,ee=B[Ee],He=ee.high,De=ee.low,$=R[Ee];$<32?(X=He<<$|De>>>32-$,F=De<<$|He>>>32-$):(X=De<<$-32|He>>>64-$,F=He<<$-32|De>>>64-$);var G=P[T[Ee]];G.high=X,G.low=F}var he=P[0],le=B[0];he.high=le.high,he.low=le.low;for(var Ce=0;Ce<5;Ce++)for(var L=0;L<5;L++){var Ee=Ce+5*L,ee=B[Ee],Je=P[Ee],Ge=P[(Ce+1)%5+5*L],ut=P[(Ce+2)%5+5*L];ee.high=Je.high^~Ge.high&ut.high,ee.low=Je.low^~Ge.low&ut.low}var ee=B[0],Se=H[A];ee.high^=Se.high,ee.low^=Se.low}},_doFinalize:function(){var z=this._data,O=z.words;this._nDataBytes*8;var B=z.sigBytes*8,U=this.blockSize*32;O[B>>>5]|=1<<24-B%32,O[(l.ceil((B+1)/U)*U>>>5)-1]|=128,z.sigBytes=O.length*4,this._process();for(var q=this._state,K=this.cfg.outputLength/8,Z=K/8,ee=[],A=0;A<Z;A++){var Ce=q[A],X=Ce.high,F=Ce.low;X=(X<<8|X>>>24)&16711935|(X<<24|X>>>8)&4278255360,F=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,ee.push(F),ee.push(X)}return new v.init(ee,K)},clone:function(){for(var z=S.clone.call(this),O=z._state=this._state.slice(0),B=0;B<25;B++)O[B]=O[B].clone();return z}});f.SHA3=S._createHelper(j),f.HmacSHA3=S._createHmacHelper(j)}(Math),i.SHA3})}(lx)),lx.exports}var ux={exports:{}},g2;function gR(){return g2||(g2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){/** @preserve
341
+ `,children:[ie.jsx("span",{className:"text-[22px] font-medium text-gray-800 leading-none",children:r}),i?ie.jsx("span",{className:"text-[9px] text-gray-400 font-semibold tracking-[0.18em] mt-1.5",children:i}):ie.jsx("span",{className:"h-3.5"})]},r))});class oR{constructor(){this.listeners={}}on(r,i){return this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push(i),()=>this.off(r,i)}off(r,i){this.listeners[r]&&(this.listeners[r]=this.listeners[r].filter(l=>l!==i))}emitLocal(r,i){this.listeners[r]&&this.listeners[r].forEach(l=>{try{l(i)}catch(f){console.error(`Error in event listener for ${r}:`,f)}})}emitToParent(r,i){this.emitLocal(r,i)}}const tt=new oR;var e2={exports:{}};function lR(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ky={exports:{}};const uR=$T(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var t2;function er(){return t2||(t2=1,function(o,r){(function(i,l){o.exports=l()})(Ut,function(){var i=i||function(l,f){var p;if(typeof window<"u"&&window.crypto&&(p=window.crypto),typeof self<"u"&&self.crypto&&(p=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(p=globalThis.crypto),!p&&typeof window<"u"&&window.msCrypto&&(p=window.msCrypto),!p&&typeof Ut<"u"&&Ut.crypto&&(p=Ut.crypto),!p&&typeof lR=="function")try{p=uR}catch{}var v=function(){if(p){if(typeof p.getRandomValues=="function")try{return p.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof p.randomBytes=="function")try{return p.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},S=Object.create||function(){function B(){}return function(U){var q;return B.prototype=U,q=new B,B.prototype=null,q}}(),w={},C=w.lib={},b=C.Base=function(){return{extend:function(B){var U=S(this);return B&&U.mixIn(B),(!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 B=this.extend();return B.init.apply(B,arguments),B},init:function(){},mixIn:function(B){for(var U in B)B.hasOwnProperty(U)&&(this[U]=B[U]);B.hasOwnProperty("toString")&&(this.toString=B.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),R=C.WordArray=b.extend({init:function(B,U){B=this.words=B||[],U!=f?this.sigBytes=U:this.sigBytes=B.length*4},toString:function(B){return(B||H).stringify(this)},concat:function(B){var U=this.words,q=B.words,K=this.sigBytes,Z=B.sigBytes;if(this.clamp(),K%4)for(var ee=0;ee<Z;ee++){var A=q[ee>>>2]>>>24-ee%4*8&255;U[K+ee>>>2]|=A<<24-(K+ee)%4*8}else for(var Ce=0;Ce<Z;Ce+=4)U[K+Ce>>>2]=q[Ce>>>2];return this.sigBytes+=Z,this},clamp:function(){var B=this.words,U=this.sigBytes;B[U>>>2]&=4294967295<<32-U%4*8,B.length=l.ceil(U/4)},clone:function(){var B=b.clone.call(this);return B.words=this.words.slice(0),B},random:function(B){for(var U=[],q=0;q<B;q+=4)U.push(v());return new R.init(U,B)}}),T=w.enc={},H=T.Hex={stringify:function(B){for(var U=B.words,q=B.sigBytes,K=[],Z=0;Z<q;Z++){var ee=U[Z>>>2]>>>24-Z%4*8&255;K.push((ee>>>4).toString(16)),K.push((ee&15).toString(16))}return K.join("")},parse:function(B){for(var U=B.length,q=[],K=0;K<U;K+=2)q[K>>>3]|=parseInt(B.substr(K,2),16)<<24-K%8*4;return new R.init(q,U/2)}},P=T.Latin1={stringify:function(B){for(var U=B.words,q=B.sigBytes,K=[],Z=0;Z<q;Z++){var ee=U[Z>>>2]>>>24-Z%4*8&255;K.push(String.fromCharCode(ee))}return K.join("")},parse:function(B){for(var U=B.length,q=[],K=0;K<U;K++)q[K>>>2]|=(B.charCodeAt(K)&255)<<24-K%4*8;return new R.init(q,U)}},j=T.Utf8={stringify:function(B){try{return decodeURIComponent(escape(P.stringify(B)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(B){return P.parse(unescape(encodeURIComponent(B)))}},z=C.BufferedBlockAlgorithm=b.extend({reset:function(){this._data=new R.init,this._nDataBytes=0},_append:function(B){typeof B=="string"&&(B=j.parse(B)),this._data.concat(B),this._nDataBytes+=B.sigBytes},_process:function(B){var U,q=this._data,K=q.words,Z=q.sigBytes,ee=this.blockSize,A=ee*4,Ce=Z/A;B?Ce=l.ceil(Ce):Ce=l.max((Ce|0)-this._minBufferSize,0);var X=Ce*ee,F=l.min(X*4,Z);if(X){for(var L=0;L<X;L+=ee)this._doProcessBlock(K,L);U=K.splice(0,X),q.sigBytes-=F}return new R.init(U,F)},clone:function(){var B=b.clone.call(this);return B._data=this._data.clone(),B},_minBufferSize:0});C.Hasher=z.extend({cfg:b.extend(),init:function(B){this.cfg=this.cfg.extend(B),this.reset()},reset:function(){z.reset.call(this),this._doReset()},update:function(B){return this._append(B),this._process(),this},finalize:function(B){B&&this._append(B);var U=this._doFinalize();return U},blockSize:16,_createHelper:function(B){return function(U,q){return new B.init(q).finalize(U)}},_createHmacHelper:function(B){return function(U,q){return new O.HMAC.init(B,q).finalize(U)}}});var O=w.algo={};return w}(Math);return i})}(Ky)),Ky.exports}var Qy={exports:{}},r2;function Cv(){return r2||(r2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(l){var f=i,p=f.lib,v=p.Base,S=p.WordArray,w=f.x64={};w.Word=v.extend({init:function(C,b){this.high=C,this.low=b}}),w.WordArray=v.extend({init:function(C,b){C=this.words=C||[],b!=l?this.sigBytes=b:this.sigBytes=C.length*8},toX32:function(){for(var C=this.words,b=C.length,R=[],T=0;T<b;T++){var H=C[T];R.push(H.high),R.push(H.low)}return S.create(R,this.sigBytes)},clone:function(){for(var C=v.clone.call(this),b=C.words=this.words.slice(0),R=b.length,T=0;T<R;T++)b[T]=b[T].clone();return C}})}(),i})}(Qy)),Qy.exports}var Xy={exports:{}},n2;function cR(){return n2||(n2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(){if(typeof ArrayBuffer=="function"){var l=i,f=l.lib,p=f.WordArray,v=p.init,S=p.init=function(w){if(w instanceof ArrayBuffer&&(w=new Uint8Array(w)),(w instanceof Int8Array||typeof Uint8ClampedArray<"u"&&w instanceof Uint8ClampedArray||w instanceof Int16Array||w instanceof Uint16Array||w instanceof Int32Array||w instanceof Uint32Array||w instanceof Float32Array||w instanceof Float64Array)&&(w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength)),w instanceof Uint8Array){for(var C=w.byteLength,b=[],R=0;R<C;R++)b[R>>>2]|=w[R]<<24-R%4*8;v.call(this,b,C)}else v.apply(this,arguments)};S.prototype=p}}(),i.lib.WordArray})}(Xy)),Xy.exports}var Zy={exports:{}},i2;function fR(){return i2||(i2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=l.enc;v.Utf16=v.Utf16BE={stringify:function(w){for(var C=w.words,b=w.sigBytes,R=[],T=0;T<b;T+=2){var H=C[T>>>2]>>>16-T%4*8&65535;R.push(String.fromCharCode(H))}return R.join("")},parse:function(w){for(var C=w.length,b=[],R=0;R<C;R++)b[R>>>1]|=w.charCodeAt(R)<<16-R%2*16;return p.create(b,C*2)}},v.Utf16LE={stringify:function(w){for(var C=w.words,b=w.sigBytes,R=[],T=0;T<b;T+=2){var H=S(C[T>>>2]>>>16-T%4*8&65535);R.push(String.fromCharCode(H))}return R.join("")},parse:function(w){for(var C=w.length,b=[],R=0;R<C;R++)b[R>>>1]|=S(w.charCodeAt(R)<<16-R%2*16);return p.create(b,C*2)}};function S(w){return w<<8&4278255360|w>>>8&16711935}}(),i.enc.Utf16})}(Zy)),Zy.exports}var Jy={exports:{}},a2;function Cc(){return a2||(a2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=l.enc;v.Base64={stringify:function(w){var C=w.words,b=w.sigBytes,R=this._map;w.clamp();for(var T=[],H=0;H<b;H+=3)for(var P=C[H>>>2]>>>24-H%4*8&255,j=C[H+1>>>2]>>>24-(H+1)%4*8&255,z=C[H+2>>>2]>>>24-(H+2)%4*8&255,O=P<<16|j<<8|z,B=0;B<4&&H+B*.75<b;B++)T.push(R.charAt(O>>>6*(3-B)&63));var U=R.charAt(64);if(U)for(;T.length%4;)T.push(U);return T.join("")},parse:function(w){var C=w.length,b=this._map,R=this._reverseMap;if(!R){R=this._reverseMap=[];for(var T=0;T<b.length;T++)R[b.charCodeAt(T)]=T}var H=b.charAt(64);if(H){var P=w.indexOf(H);P!==-1&&(C=P)}return S(w,C,R)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function S(w,C,b){for(var R=[],T=0,H=0;H<C;H++)if(H%4){var P=b[w.charCodeAt(H-1)]<<H%4*2,j=b[w.charCodeAt(H)]>>>6-H%4*2,z=P|j;R[T>>>2]|=z<<24-T%4*8,T++}return p.create(R,T)}}(),i.enc.Base64})}(Jy)),Jy.exports}var ex={exports:{}},s2;function dR(){return s2||(s2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=l.enc;v.Base64url={stringify:function(w,C){C===void 0&&(C=!0);var b=w.words,R=w.sigBytes,T=C?this._safe_map:this._map;w.clamp();for(var H=[],P=0;P<R;P+=3)for(var j=b[P>>>2]>>>24-P%4*8&255,z=b[P+1>>>2]>>>24-(P+1)%4*8&255,O=b[P+2>>>2]>>>24-(P+2)%4*8&255,B=j<<16|z<<8|O,U=0;U<4&&P+U*.75<R;U++)H.push(T.charAt(B>>>6*(3-U)&63));var q=T.charAt(64);if(q)for(;H.length%4;)H.push(q);return H.join("")},parse:function(w,C){C===void 0&&(C=!0);var b=w.length,R=C?this._safe_map:this._map,T=this._reverseMap;if(!T){T=this._reverseMap=[];for(var H=0;H<R.length;H++)T[R.charCodeAt(H)]=H}var P=R.charAt(64);if(P){var j=w.indexOf(P);j!==-1&&(b=j)}return S(w,b,T)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function S(w,C,b){for(var R=[],T=0,H=0;H<C;H++)if(H%4){var P=b[w.charCodeAt(H-1)]<<H%4*2,j=b[w.charCodeAt(H)]>>>6-H%4*2,z=P|j;R[T>>>2]|=z<<24-T%4*8,T++}return p.create(R,T)}}(),i.enc.Base64url})}(ex)),ex.exports}var tx={exports:{}},o2;function Sc(){return o2||(o2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(l){var f=i,p=f.lib,v=p.WordArray,S=p.Hasher,w=f.algo,C=[];(function(){for(var j=0;j<64;j++)C[j]=l.abs(l.sin(j+1))*4294967296|0})();var b=w.MD5=S.extend({_doReset:function(){this._hash=new v.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(j,z){for(var O=0;O<16;O++){var B=z+O,U=j[B];j[B]=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360}var q=this._hash.words,K=j[z+0],Z=j[z+1],ee=j[z+2],A=j[z+3],Ce=j[z+4],X=j[z+5],F=j[z+6],L=j[z+7],M=j[z+8],_e=j[z+9],be=j[z+10],$e=j[z+11],ge=j[z+12],Ee=j[z+13],He=j[z+14],De=j[z+15],$=q[0],G=q[1],he=q[2],le=q[3];$=R($,G,he,le,K,7,C[0]),le=R(le,$,G,he,Z,12,C[1]),he=R(he,le,$,G,ee,17,C[2]),G=R(G,he,le,$,A,22,C[3]),$=R($,G,he,le,Ce,7,C[4]),le=R(le,$,G,he,X,12,C[5]),he=R(he,le,$,G,F,17,C[6]),G=R(G,he,le,$,L,22,C[7]),$=R($,G,he,le,M,7,C[8]),le=R(le,$,G,he,_e,12,C[9]),he=R(he,le,$,G,be,17,C[10]),G=R(G,he,le,$,$e,22,C[11]),$=R($,G,he,le,ge,7,C[12]),le=R(le,$,G,he,Ee,12,C[13]),he=R(he,le,$,G,He,17,C[14]),G=R(G,he,le,$,De,22,C[15]),$=T($,G,he,le,Z,5,C[16]),le=T(le,$,G,he,F,9,C[17]),he=T(he,le,$,G,$e,14,C[18]),G=T(G,he,le,$,K,20,C[19]),$=T($,G,he,le,X,5,C[20]),le=T(le,$,G,he,be,9,C[21]),he=T(he,le,$,G,De,14,C[22]),G=T(G,he,le,$,Ce,20,C[23]),$=T($,G,he,le,_e,5,C[24]),le=T(le,$,G,he,He,9,C[25]),he=T(he,le,$,G,A,14,C[26]),G=T(G,he,le,$,M,20,C[27]),$=T($,G,he,le,Ee,5,C[28]),le=T(le,$,G,he,ee,9,C[29]),he=T(he,le,$,G,L,14,C[30]),G=T(G,he,le,$,ge,20,C[31]),$=H($,G,he,le,X,4,C[32]),le=H(le,$,G,he,M,11,C[33]),he=H(he,le,$,G,$e,16,C[34]),G=H(G,he,le,$,He,23,C[35]),$=H($,G,he,le,Z,4,C[36]),le=H(le,$,G,he,Ce,11,C[37]),he=H(he,le,$,G,L,16,C[38]),G=H(G,he,le,$,be,23,C[39]),$=H($,G,he,le,Ee,4,C[40]),le=H(le,$,G,he,K,11,C[41]),he=H(he,le,$,G,A,16,C[42]),G=H(G,he,le,$,F,23,C[43]),$=H($,G,he,le,_e,4,C[44]),le=H(le,$,G,he,ge,11,C[45]),he=H(he,le,$,G,De,16,C[46]),G=H(G,he,le,$,ee,23,C[47]),$=P($,G,he,le,K,6,C[48]),le=P(le,$,G,he,L,10,C[49]),he=P(he,le,$,G,He,15,C[50]),G=P(G,he,le,$,X,21,C[51]),$=P($,G,he,le,ge,6,C[52]),le=P(le,$,G,he,A,10,C[53]),he=P(he,le,$,G,be,15,C[54]),G=P(G,he,le,$,Z,21,C[55]),$=P($,G,he,le,M,6,C[56]),le=P(le,$,G,he,De,10,C[57]),he=P(he,le,$,G,F,15,C[58]),G=P(G,he,le,$,Ee,21,C[59]),$=P($,G,he,le,Ce,6,C[60]),le=P(le,$,G,he,$e,10,C[61]),he=P(he,le,$,G,ee,15,C[62]),G=P(G,he,le,$,_e,21,C[63]),q[0]=q[0]+$|0,q[1]=q[1]+G|0,q[2]=q[2]+he|0,q[3]=q[3]+le|0},_doFinalize:function(){var j=this._data,z=j.words,O=this._nDataBytes*8,B=j.sigBytes*8;z[B>>>5]|=128<<24-B%32;var U=l.floor(O/4294967296),q=O;z[(B+64>>>9<<4)+15]=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360,z[(B+64>>>9<<4)+14]=(q<<8|q>>>24)&16711935|(q<<24|q>>>8)&4278255360,j.sigBytes=(z.length+1)*4,this._process();for(var K=this._hash,Z=K.words,ee=0;ee<4;ee++){var A=Z[ee];Z[ee]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}return K},clone:function(){var j=S.clone.call(this);return j._hash=this._hash.clone(),j}});function R(j,z,O,B,U,q,K){var Z=j+(z&O|~z&B)+U+K;return(Z<<q|Z>>>32-q)+z}function T(j,z,O,B,U,q,K){var Z=j+(z&B|O&~B)+U+K;return(Z<<q|Z>>>32-q)+z}function H(j,z,O,B,U,q,K){var Z=j+(z^O^B)+U+K;return(Z<<q|Z>>>32-q)+z}function P(j,z,O,B,U,q,K){var Z=j+(O^(z|~B))+U+K;return(Z<<q|Z>>>32-q)+z}f.MD5=S._createHelper(b),f.HmacMD5=S._createHmacHelper(b)}(Math),i.MD5})}(tx)),tx.exports}var rx={exports:{}},l2;function u2(){return l2||(l2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=f.Hasher,S=l.algo,w=[],C=S.SHA1=v.extend({_doReset:function(){this._hash=new p.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(b,R){for(var T=this._hash.words,H=T[0],P=T[1],j=T[2],z=T[3],O=T[4],B=0;B<80;B++){if(B<16)w[B]=b[R+B]|0;else{var U=w[B-3]^w[B-8]^w[B-14]^w[B-16];w[B]=U<<1|U>>>31}var q=(H<<5|H>>>27)+O+w[B];B<20?q+=(P&j|~P&z)+1518500249:B<40?q+=(P^j^z)+1859775393:B<60?q+=(P&j|P&z|j&z)-1894007588:q+=(P^j^z)-899497514,O=z,z=j,j=P<<30|P>>>2,P=H,H=q}T[0]=T[0]+H|0,T[1]=T[1]+P|0,T[2]=T[2]+j|0,T[3]=T[3]+z|0,T[4]=T[4]+O|0},_doFinalize:function(){var b=this._data,R=b.words,T=this._nDataBytes*8,H=b.sigBytes*8;return R[H>>>5]|=128<<24-H%32,R[(H+64>>>9<<4)+14]=Math.floor(T/4294967296),R[(H+64>>>9<<4)+15]=T,b.sigBytes=R.length*4,this._process(),this._hash},clone:function(){var b=v.clone.call(this);return b._hash=this._hash.clone(),b}});l.SHA1=v._createHelper(C),l.HmacSHA1=v._createHmacHelper(C)}(),i.SHA1})}(rx)),rx.exports}var nx={exports:{}},c2;function ix(){return c2||(c2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){return function(l){var f=i,p=f.lib,v=p.WordArray,S=p.Hasher,w=f.algo,C=[],b=[];(function(){function H(O){for(var B=l.sqrt(O),U=2;U<=B;U++)if(!(O%U))return!1;return!0}function P(O){return(O-(O|0))*4294967296|0}for(var j=2,z=0;z<64;)H(j)&&(z<8&&(C[z]=P(l.pow(j,.5))),b[z]=P(l.pow(j,.3333333333333333)),z++),j++})();var R=[],T=w.SHA256=S.extend({_doReset:function(){this._hash=new v.init(C.slice(0))},_doProcessBlock:function(H,P){for(var j=this._hash.words,z=j[0],O=j[1],B=j[2],U=j[3],q=j[4],K=j[5],Z=j[6],ee=j[7],A=0;A<64;A++){if(A<16)R[A]=H[P+A]|0;else{var Ce=R[A-15],X=(Ce<<25|Ce>>>7)^(Ce<<14|Ce>>>18)^Ce>>>3,F=R[A-2],L=(F<<15|F>>>17)^(F<<13|F>>>19)^F>>>10;R[A]=X+R[A-7]+L+R[A-16]}var M=q&K^~q&Z,_e=z&O^z&B^O&B,be=(z<<30|z>>>2)^(z<<19|z>>>13)^(z<<10|z>>>22),$e=(q<<26|q>>>6)^(q<<21|q>>>11)^(q<<7|q>>>25),ge=ee+$e+M+b[A]+R[A],Ee=be+_e;ee=Z,Z=K,K=q,q=U+ge|0,U=B,B=O,O=z,z=ge+Ee|0}j[0]=j[0]+z|0,j[1]=j[1]+O|0,j[2]=j[2]+B|0,j[3]=j[3]+U|0,j[4]=j[4]+q|0,j[5]=j[5]+K|0,j[6]=j[6]+Z|0,j[7]=j[7]+ee|0},_doFinalize:function(){var H=this._data,P=H.words,j=this._nDataBytes*8,z=H.sigBytes*8;return P[z>>>5]|=128<<24-z%32,P[(z+64>>>9<<4)+14]=l.floor(j/4294967296),P[(z+64>>>9<<4)+15]=j,H.sigBytes=P.length*4,this._process(),this._hash},clone:function(){var H=S.clone.call(this);return H._hash=this._hash.clone(),H}});f.SHA256=S._createHelper(T),f.HmacSHA256=S._createHmacHelper(T)}(Math),i.SHA256})}(nx)),nx.exports}var ax={exports:{}},f2;function hR(){return f2||(f2=1,function(o,r){(function(i,l,f){o.exports=l(er(),ix())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=l.algo,S=v.SHA256,w=v.SHA224=S.extend({_doReset:function(){this._hash=new p.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var C=S._doFinalize.call(this);return C.sigBytes-=4,C}});l.SHA224=S._createHelper(w),l.HmacSHA224=S._createHmacHelper(w)}(),i.SHA224})}(ax)),ax.exports}var sx={exports:{}},d2;function h2(){return d2||(d2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cv())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.Hasher,v=l.x64,S=v.Word,w=v.WordArray,C=l.algo;function b(){return S.create.apply(S,arguments)}var R=[b(1116352408,3609767458),b(1899447441,602891725),b(3049323471,3964484399),b(3921009573,2173295548),b(961987163,4081628472),b(1508970993,3053834265),b(2453635748,2937671579),b(2870763221,3664609560),b(3624381080,2734883394),b(310598401,1164996542),b(607225278,1323610764),b(1426881987,3590304994),b(1925078388,4068182383),b(2162078206,991336113),b(2614888103,633803317),b(3248222580,3479774868),b(3835390401,2666613458),b(4022224774,944711139),b(264347078,2341262773),b(604807628,2007800933),b(770255983,1495990901),b(1249150122,1856431235),b(1555081692,3175218132),b(1996064986,2198950837),b(2554220882,3999719339),b(2821834349,766784016),b(2952996808,2566594879),b(3210313671,3203337956),b(3336571891,1034457026),b(3584528711,2466948901),b(113926993,3758326383),b(338241895,168717936),b(666307205,1188179964),b(773529912,1546045734),b(1294757372,1522805485),b(1396182291,2643833823),b(1695183700,2343527390),b(1986661051,1014477480),b(2177026350,1206759142),b(2456956037,344077627),b(2730485921,1290863460),b(2820302411,3158454273),b(3259730800,3505952657),b(3345764771,106217008),b(3516065817,3606008344),b(3600352804,1432725776),b(4094571909,1467031594),b(275423344,851169720),b(430227734,3100823752),b(506948616,1363258195),b(659060556,3750685593),b(883997877,3785050280),b(958139571,3318307427),b(1322822218,3812723403),b(1537002063,2003034995),b(1747873779,3602036899),b(1955562222,1575990012),b(2024104815,1125592928),b(2227730452,2716904306),b(2361852424,442776044),b(2428436474,593698344),b(2756734187,3733110249),b(3204031479,2999351573),b(3329325298,3815920427),b(3391569614,3928383900),b(3515267271,566280711),b(3940187606,3454069534),b(4118630271,4000239992),b(116418474,1914138554),b(174292421,2731055270),b(289380356,3203993006),b(460393269,320620315),b(685471733,587496836),b(852142971,1086792851),b(1017036298,365543100),b(1126000580,2618297676),b(1288033470,3409855158),b(1501505948,4234509866),b(1607167915,987167468),b(1816402316,1246189591)],T=[];(function(){for(var P=0;P<80;P++)T[P]=b()})();var H=C.SHA512=p.extend({_doReset:function(){this._hash=new w.init([new S.init(1779033703,4089235720),new S.init(3144134277,2227873595),new S.init(1013904242,4271175723),new S.init(2773480762,1595750129),new S.init(1359893119,2917565137),new S.init(2600822924,725511199),new S.init(528734635,4215389547),new S.init(1541459225,327033209)])},_doProcessBlock:function(P,j){for(var z=this._hash.words,O=z[0],B=z[1],U=z[2],q=z[3],K=z[4],Z=z[5],ee=z[6],A=z[7],Ce=O.high,X=O.low,F=B.high,L=B.low,M=U.high,_e=U.low,be=q.high,$e=q.low,ge=K.high,Ee=K.low,He=Z.high,De=Z.low,$=ee.high,G=ee.low,he=A.high,le=A.low,Je=Ce,Ge=X,ut=F,Se=L,Te=M,mt=_e,dr=be,zr=$e,Yt=ge,Xt=Ee,Fr=He,br=De,nn=$,Tn=G,vn=he,qr=le,tr=0;tr<80;tr++){var ar,Pr,ui=T[tr];if(tr<16)Pr=ui.high=P[j+tr*2]|0,ar=ui.low=P[j+tr*2+1]|0;else{var Kr=T[tr-15],Qr=Kr.high,Rn=Kr.low,ta=(Qr>>>1|Rn<<31)^(Qr>>>8|Rn<<24)^Qr>>>7,ra=(Rn>>>1|Qr<<31)^(Rn>>>8|Qr<<24)^(Rn>>>7|Qr<<25),Pe=T[tr-2],nt=Pe.high,_t=Pe.low,rr=(nt>>>19|_t<<13)^(nt<<3|_t>>>29)^nt>>>6,Sr=(_t>>>19|nt<<13)^(_t<<3|nt>>>29)^(_t>>>6|nt<<26),Mr=T[tr-7],Or=Mr.high,gn=Mr.low,wr=T[tr-16],yr=wr.high,hr=wr.low;ar=ra+gn,Pr=ta+Or+(ar>>>0<ra>>>0?1:0),ar=ar+Sr,Pr=Pr+rr+(ar>>>0<Sr>>>0?1:0),ar=ar+hr,Pr=Pr+yr+(ar>>>0<hr>>>0?1:0),ui.high=Pr,ui.low=ar}var vi=Yt&Fr^~Yt&nn,An=Xt&br^~Xt&Tn,Hi=Je&ut^Je&Te^ut&Te,ja=Ge&Se^Ge&mt^Se&mt,qs=(Je>>>28|Ge<<4)^(Je<<30|Ge>>>2)^(Je<<25|Ge>>>7),cs=(Ge>>>28|Je<<4)^(Ge<<30|Je>>>2)^(Ge<<25|Je>>>7),fs=(Yt>>>14|Xt<<18)^(Yt>>>18|Xt<<14)^(Yt<<23|Xt>>>9),ds=(Xt>>>14|Yt<<18)^(Xt>>>18|Yt<<14)^(Xt<<23|Yt>>>9),hs=R[tr],Yn=hs.high,In=hs.low,pr=qr+ds,kn=vn+fs+(pr>>>0<qr>>>0?1:0),pr=pr+An,kn=kn+vi+(pr>>>0<An>>>0?1:0),pr=pr+In,kn=kn+Yn+(pr>>>0<In>>>0?1:0),pr=pr+ar,kn=kn+Pr+(pr>>>0<ar>>>0?1:0),Ii=cs+ja,Ea=qs+Hi+(Ii>>>0<cs>>>0?1:0);vn=nn,qr=Tn,nn=Fr,Tn=br,Fr=Yt,br=Xt,Xt=zr+pr|0,Yt=dr+kn+(Xt>>>0<zr>>>0?1:0)|0,dr=Te,zr=mt,Te=ut,mt=Se,ut=Je,Se=Ge,Ge=pr+Ii|0,Je=kn+Ea+(Ge>>>0<pr>>>0?1:0)|0}X=O.low=X+Ge,O.high=Ce+Je+(X>>>0<Ge>>>0?1:0),L=B.low=L+Se,B.high=F+ut+(L>>>0<Se>>>0?1:0),_e=U.low=_e+mt,U.high=M+Te+(_e>>>0<mt>>>0?1:0),$e=q.low=$e+zr,q.high=be+dr+($e>>>0<zr>>>0?1:0),Ee=K.low=Ee+Xt,K.high=ge+Yt+(Ee>>>0<Xt>>>0?1:0),De=Z.low=De+br,Z.high=He+Fr+(De>>>0<br>>>0?1:0),G=ee.low=G+Tn,ee.high=$+nn+(G>>>0<Tn>>>0?1:0),le=A.low=le+qr,A.high=he+vn+(le>>>0<qr>>>0?1:0)},_doFinalize:function(){var P=this._data,j=P.words,z=this._nDataBytes*8,O=P.sigBytes*8;j[O>>>5]|=128<<24-O%32,j[(O+128>>>10<<5)+30]=Math.floor(z/4294967296),j[(O+128>>>10<<5)+31]=z,P.sigBytes=j.length*4,this._process();var B=this._hash.toX32();return B},clone:function(){var P=p.clone.call(this);return P._hash=this._hash.clone(),P},blockSize:1024/32});l.SHA512=p._createHelper(H),l.HmacSHA512=p._createHmacHelper(H)}(),i.SHA512})}(sx)),sx.exports}var ox={exports:{}},p2;function pR(){return p2||(p2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cv(),h2())})(Ut,function(i){return function(){var l=i,f=l.x64,p=f.Word,v=f.WordArray,S=l.algo,w=S.SHA512,C=S.SHA384=w.extend({_doReset:function(){this._hash=new v.init([new p.init(3418070365,3238371032),new p.init(1654270250,914150663),new p.init(2438529370,812702999),new p.init(355462360,4144912697),new p.init(1731405415,4290775857),new p.init(2394180231,1750603025),new p.init(3675008525,1694076839),new p.init(1203062813,3204075428)])},_doFinalize:function(){var b=w._doFinalize.call(this);return b.sigBytes-=16,b}});l.SHA384=w._createHelper(C),l.HmacSHA384=w._createHmacHelper(C)}(),i.SHA384})}(ox)),ox.exports}var lx={exports:{}},v2;function vR(){return v2||(v2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cv())})(Ut,function(i){return function(l){var f=i,p=f.lib,v=p.WordArray,S=p.Hasher,w=f.x64,C=w.Word,b=f.algo,R=[],T=[],H=[];(function(){for(var z=1,O=0,B=0;B<24;B++){R[z+5*O]=(B+1)*(B+2)/2%64;var U=O%5,q=(2*z+3*O)%5;z=U,O=q}for(var z=0;z<5;z++)for(var O=0;O<5;O++)T[z+5*O]=O+(2*z+3*O)%5*5;for(var K=1,Z=0;Z<24;Z++){for(var ee=0,A=0,Ce=0;Ce<7;Ce++){if(K&1){var X=(1<<Ce)-1;X<32?A^=1<<X:ee^=1<<X-32}K&128?K=K<<1^113:K<<=1}H[Z]=C.create(ee,A)}})();var P=[];(function(){for(var z=0;z<25;z++)P[z]=C.create()})();var j=b.SHA3=S.extend({cfg:S.cfg.extend({outputLength:512}),_doReset:function(){for(var z=this._state=[],O=0;O<25;O++)z[O]=new C.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(z,O){for(var B=this._state,U=this.blockSize/2,q=0;q<U;q++){var K=z[O+2*q],Z=z[O+2*q+1];K=(K<<8|K>>>24)&16711935|(K<<24|K>>>8)&4278255360,Z=(Z<<8|Z>>>24)&16711935|(Z<<24|Z>>>8)&4278255360;var ee=B[q];ee.high^=Z,ee.low^=K}for(var A=0;A<24;A++){for(var Ce=0;Ce<5;Ce++){for(var X=0,F=0,L=0;L<5;L++){var ee=B[Ce+5*L];X^=ee.high,F^=ee.low}var M=P[Ce];M.high=X,M.low=F}for(var Ce=0;Ce<5;Ce++)for(var _e=P[(Ce+4)%5],be=P[(Ce+1)%5],$e=be.high,ge=be.low,X=_e.high^($e<<1|ge>>>31),F=_e.low^(ge<<1|$e>>>31),L=0;L<5;L++){var ee=B[Ce+5*L];ee.high^=X,ee.low^=F}for(var Ee=1;Ee<25;Ee++){var X,F,ee=B[Ee],He=ee.high,De=ee.low,$=R[Ee];$<32?(X=He<<$|De>>>32-$,F=De<<$|He>>>32-$):(X=De<<$-32|He>>>64-$,F=He<<$-32|De>>>64-$);var G=P[T[Ee]];G.high=X,G.low=F}var he=P[0],le=B[0];he.high=le.high,he.low=le.low;for(var Ce=0;Ce<5;Ce++)for(var L=0;L<5;L++){var Ee=Ce+5*L,ee=B[Ee],Je=P[Ee],Ge=P[(Ce+1)%5+5*L],ut=P[(Ce+2)%5+5*L];ee.high=Je.high^~Ge.high&ut.high,ee.low=Je.low^~Ge.low&ut.low}var ee=B[0],Se=H[A];ee.high^=Se.high,ee.low^=Se.low}},_doFinalize:function(){var z=this._data,O=z.words;this._nDataBytes*8;var B=z.sigBytes*8,U=this.blockSize*32;O[B>>>5]|=1<<24-B%32,O[(l.ceil((B+1)/U)*U>>>5)-1]|=128,z.sigBytes=O.length*4,this._process();for(var q=this._state,K=this.cfg.outputLength/8,Z=K/8,ee=[],A=0;A<Z;A++){var Ce=q[A],X=Ce.high,F=Ce.low;X=(X<<8|X>>>24)&16711935|(X<<24|X>>>8)&4278255360,F=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,ee.push(F),ee.push(X)}return new v.init(ee,K)},clone:function(){for(var z=S.clone.call(this),O=z._state=this._state.slice(0),B=0;B<25;B++)O[B]=O[B].clone();return z}});f.SHA3=S._createHelper(j),f.HmacSHA3=S._createHmacHelper(j)}(Math),i.SHA3})}(lx)),lx.exports}var ux={exports:{}},g2;function gR(){return g2||(g2=1,function(o,r){(function(i,l){o.exports=l(er())})(Ut,function(i){/** @preserve
342
342
  (c) 2012 by Cédric Mesnil. All rights reserved.
343
343
 
344
344
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -351,7 +351,7 @@ React keys must be passed directly to JSX without using spread:
351
351
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
352
352
  * derived from CryptoJS.mode.CTR
353
353
  * Jan Hruby jhruby.web@gmail.com
354
- */return i.mode.CTRGladman=function(){var l=i.lib.BlockCipherMode.extend();function f(S){if((S>>24&255)===255){var w=S>>16&255,C=S>>8&255,b=S&255;w===255?(w=0,C===255?(C=0,b===255?b=0:++b):++C):++w,S=0,S+=w<<16,S+=C<<8,S+=b}else S+=16777216;return S}function p(S){return(S[0]=f(S[0]))===0&&(S[1]=f(S[1])),S}var v=l.Encryptor=l.extend({processBlock:function(S,w){var C=this._cipher,b=C.blockSize,R=this._iv,T=this._counter;R&&(T=this._counter=R.slice(0),this._iv=void 0),p(T);var H=T.slice(0);C.encryptBlock(H,0);for(var P=0;P<b;P++)S[w+P]^=H[P]}});return l.Decryptor=v,l}(),i.mode.CTRGladman})}(mx)),mx.exports}var yx={exports:{}},b2;function CR(){return b2||(b2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.mode.OFB=function(){var l=i.lib.BlockCipherMode.extend(),f=l.Encryptor=l.extend({processBlock:function(p,v){var S=this._cipher,w=S.blockSize,C=this._iv,b=this._keystream;C&&(b=this._keystream=C.slice(0),this._iv=void 0),S.encryptBlock(b,0);for(var R=0;R<w;R++)p[v+R]^=b[R]}});return l.Decryptor=f,l}(),i.mode.OFB})}(yx)),yx.exports}var xx={exports:{}},_2;function SR(){return _2||(_2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.mode.ECB=function(){var l=i.lib.BlockCipherMode.extend();return l.Encryptor=l.extend({processBlock:function(f,p){this._cipher.encryptBlock(f,p)}}),l.Decryptor=l.extend({processBlock:function(f,p){this._cipher.decryptBlock(f,p)}}),l}(),i.mode.ECB})}(xx)),xx.exports}var Ex={exports:{}},D2;function wR(){return D2||(D2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.pad.AnsiX923={pad:function(l,f){var p=l.sigBytes,v=f*4,S=v-p%v,w=p+S-1;l.clamp(),l.words[w>>>2]|=S<<24-w%4*8,l.sigBytes+=S},unpad:function(l){var f=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=f}},i.pad.Ansix923})}(Ex)),Ex.exports}var Cx={exports:{}},T2;function bR(){return T2||(T2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.pad.Iso10126={pad:function(l,f){var p=f*4,v=p-l.sigBytes%p;l.concat(i.lib.WordArray.random(v-1)).concat(i.lib.WordArray.create([v<<24],1))},unpad:function(l){var f=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=f}},i.pad.Iso10126})}(Cx)),Cx.exports}var Sx={exports:{}},R2;function _R(){return R2||(R2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.pad.Iso97971={pad:function(l,f){l.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(l,f)},unpad:function(l){i.pad.ZeroPadding.unpad(l),l.sigBytes--}},i.pad.Iso97971})}(Sx)),Sx.exports}var wx={exports:{}},A2;function DR(){return A2||(A2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.pad.ZeroPadding={pad:function(l,f){var p=f*4;l.clamp(),l.sigBytes+=p-(l.sigBytes%p||p)},unpad:function(l){for(var f=l.words,p=l.sigBytes-1,p=l.sigBytes-1;p>=0;p--)if(f[p>>>2]>>>24-p%4*8&255){l.sigBytes=p+1;break}}},i.pad.ZeroPadding})}(wx)),wx.exports}var bx={exports:{}},k2;function TR(){return k2||(k2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding})}(bx)),bx.exports}var _x={exports:{}},F2;function RR(){return F2||(F2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return function(l){var f=i,p=f.lib,v=p.CipherParams,S=f.enc,w=S.Hex,C=f.format;C.Hex={stringify:function(b){return b.ciphertext.toString(w)},parse:function(b){var R=w.parse(b);return v.create({ciphertext:R})}}}(),i.format.Hex})}(_x)),_x.exports}var Dx={exports:{}},O2;function AR(){return O2||(O2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.BlockCipher,v=l.algo,S=[],w=[],C=[],b=[],R=[],T=[],H=[],P=[],j=[],z=[];(function(){for(var U=[],q=0;q<256;q++)q<128?U[q]=q<<1:U[q]=q<<1^283;for(var K=0,Z=0,q=0;q<256;q++){var ee=Z^Z<<1^Z<<2^Z<<3^Z<<4;ee=ee>>>8^ee&255^99,S[K]=ee,w[ee]=K;var A=U[K],Ce=U[A],X=U[Ce],F=U[ee]*257^ee*16843008;C[K]=F<<24|F>>>8,b[K]=F<<16|F>>>16,R[K]=F<<8|F>>>24,T[K]=F;var F=X*16843009^Ce*65537^A*257^K*16843008;H[ee]=F<<24|F>>>8,P[ee]=F<<16|F>>>16,j[ee]=F<<8|F>>>24,z[ee]=F,K?(K=A^U[U[U[X^A]]],Z^=U[U[Z]]):K=Z=1}})();var O=[0,1,2,4,8,16,32,64,128,27,54],B=v.AES=p.extend({_doReset:function(){var U;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var q=this._keyPriorReset=this._key,K=q.words,Z=q.sigBytes/4,ee=this._nRounds=Z+6,A=(ee+1)*4,Ce=this._keySchedule=[],X=0;X<A;X++)X<Z?Ce[X]=K[X]:(U=Ce[X-1],X%Z?Z>6&&X%Z==4&&(U=S[U>>>24]<<24|S[U>>>16&255]<<16|S[U>>>8&255]<<8|S[U&255]):(U=U<<8|U>>>24,U=S[U>>>24]<<24|S[U>>>16&255]<<16|S[U>>>8&255]<<8|S[U&255],U^=O[X/Z|0]<<24),Ce[X]=Ce[X-Z]^U);for(var F=this._invKeySchedule=[],L=0;L<A;L++){var X=A-L;if(L%4)var U=Ce[X];else var U=Ce[X-4];L<4||X<=4?F[L]=U:F[L]=H[S[U>>>24]]^P[S[U>>>16&255]]^j[S[U>>>8&255]]^z[S[U&255]]}}},encryptBlock:function(U,q){this._doCryptBlock(U,q,this._keySchedule,C,b,R,T,S)},decryptBlock:function(U,q){var K=U[q+1];U[q+1]=U[q+3],U[q+3]=K,this._doCryptBlock(U,q,this._invKeySchedule,H,P,j,z,w);var K=U[q+1];U[q+1]=U[q+3],U[q+3]=K},_doCryptBlock:function(U,q,K,Z,ee,A,Ce,X){for(var F=this._nRounds,L=U[q]^K[0],M=U[q+1]^K[1],_e=U[q+2]^K[2],be=U[q+3]^K[3],$e=4,ge=1;ge<F;ge++){var Ee=Z[L>>>24]^ee[M>>>16&255]^A[_e>>>8&255]^Ce[be&255]^K[$e++],He=Z[M>>>24]^ee[_e>>>16&255]^A[be>>>8&255]^Ce[L&255]^K[$e++],De=Z[_e>>>24]^ee[be>>>16&255]^A[L>>>8&255]^Ce[M&255]^K[$e++],$=Z[be>>>24]^ee[L>>>16&255]^A[M>>>8&255]^Ce[_e&255]^K[$e++];L=Ee,M=He,_e=De,be=$}var Ee=(X[L>>>24]<<24|X[M>>>16&255]<<16|X[_e>>>8&255]<<8|X[be&255])^K[$e++],He=(X[M>>>24]<<24|X[_e>>>16&255]<<16|X[be>>>8&255]<<8|X[L&255])^K[$e++],De=(X[_e>>>24]<<24|X[be>>>16&255]<<16|X[L>>>8&255]<<8|X[M&255])^K[$e++],$=(X[be>>>24]<<24|X[L>>>16&255]<<16|X[M>>>8&255]<<8|X[_e&255])^K[$e++];U[q]=Ee,U[q+1]=He,U[q+2]=De,U[q+3]=$},keySize:256/32});l.AES=p._createHelper(B)}(),i.AES})}(Dx)),Dx.exports}var Tx={exports:{}},N2;function kR(){return N2||(N2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=f.BlockCipher,S=l.algo,w=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],C=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],b=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],R=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],T=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],H=S.DES=v.extend({_doReset:function(){for(var O=this._key,B=O.words,U=[],q=0;q<56;q++){var K=w[q]-1;U[q]=B[K>>>5]>>>31-K%32&1}for(var Z=this._subKeys=[],ee=0;ee<16;ee++){for(var A=Z[ee]=[],Ce=b[ee],q=0;q<24;q++)A[q/6|0]|=U[(C[q]-1+Ce)%28]<<31-q%6,A[4+(q/6|0)]|=U[28+(C[q+24]-1+Ce)%28]<<31-q%6;A[0]=A[0]<<1|A[0]>>>31;for(var q=1;q<7;q++)A[q]=A[q]>>>(q-1)*4+3;A[7]=A[7]<<5|A[7]>>>27}for(var X=this._invSubKeys=[],q=0;q<16;q++)X[q]=Z[15-q]},encryptBlock:function(O,B){this._doCryptBlock(O,B,this._subKeys)},decryptBlock:function(O,B){this._doCryptBlock(O,B,this._invSubKeys)},_doCryptBlock:function(O,B,U){this._lBlock=O[B],this._rBlock=O[B+1],P.call(this,4,252645135),P.call(this,16,65535),j.call(this,2,858993459),j.call(this,8,16711935),P.call(this,1,1431655765);for(var q=0;q<16;q++){for(var K=U[q],Z=this._lBlock,ee=this._rBlock,A=0,Ce=0;Ce<8;Ce++)A|=R[Ce][((ee^K[Ce])&T[Ce])>>>0];this._lBlock=ee,this._rBlock=Z^A}var X=this._lBlock;this._lBlock=this._rBlock,this._rBlock=X,P.call(this,1,1431655765),j.call(this,8,16711935),j.call(this,2,858993459),P.call(this,16,65535),P.call(this,4,252645135),O[B]=this._lBlock,O[B+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function P(O,B){var U=(this._lBlock>>>O^this._rBlock)&B;this._rBlock^=U,this._lBlock^=U<<O}function j(O,B){var U=(this._rBlock>>>O^this._lBlock)&B;this._lBlock^=U,this._rBlock^=U<<O}l.DES=v._createHelper(H);var z=S.TripleDES=v.extend({_doReset:function(){var O=this._key,B=O.words;if(B.length!==2&&B.length!==4&&B.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var U=B.slice(0,2),q=B.length<4?B.slice(0,2):B.slice(2,4),K=B.length<6?B.slice(0,2):B.slice(4,6);this._des1=H.createEncryptor(p.create(U)),this._des2=H.createEncryptor(p.create(q)),this._des3=H.createEncryptor(p.create(K))},encryptBlock:function(O,B){this._des1.encryptBlock(O,B),this._des2.decryptBlock(O,B),this._des3.encryptBlock(O,B)},decryptBlock:function(O,B){this._des3.decryptBlock(O,B),this._des2.encryptBlock(O,B),this._des1.decryptBlock(O,B)},keySize:192/32,ivSize:64/32,blockSize:64/32});l.TripleDES=v._createHelper(z)}(),i.TripleDES})}(Tx)),Tx.exports}var Rx={exports:{}},B2;function FR(){return B2||(B2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.StreamCipher,v=l.algo,S=v.RC4=p.extend({_doReset:function(){for(var b=this._key,R=b.words,T=b.sigBytes,H=this._S=[],P=0;P<256;P++)H[P]=P;for(var P=0,j=0;P<256;P++){var z=P%T,O=R[z>>>2]>>>24-z%4*8&255;j=(j+H[P]+O)%256;var B=H[P];H[P]=H[j],H[j]=B}this._i=this._j=0},_doProcessBlock:function(b,R){b[R]^=w.call(this)},keySize:256/32,ivSize:0});function w(){for(var b=this._S,R=this._i,T=this._j,H=0,P=0;P<4;P++){R=(R+1)%256,T=(T+b[R])%256;var j=b[R];b[R]=b[T],b[T]=j,H|=b[(b[R]+b[T])%256]<<24-P*8}return this._i=R,this._j=T,H}l.RC4=p._createHelper(S);var C=v.RC4Drop=S.extend({cfg:S.cfg.extend({drop:192}),_doReset:function(){S._doReset.call(this);for(var b=this.cfg.drop;b>0;b--)w.call(this)}});l.RC4Drop=p._createHelper(C)}(),i.RC4})}(Rx)),Rx.exports}var Ax={exports:{}},M2;function OR(){return M2||(M2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.StreamCipher,v=l.algo,S=[],w=[],C=[],b=v.Rabbit=p.extend({_doReset:function(){for(var T=this._key.words,H=this.cfg.iv,P=0;P<4;P++)T[P]=(T[P]<<8|T[P]>>>24)&16711935|(T[P]<<24|T[P]>>>8)&4278255360;var j=this._X=[T[0],T[3]<<16|T[2]>>>16,T[1],T[0]<<16|T[3]>>>16,T[2],T[1]<<16|T[0]>>>16,T[3],T[2]<<16|T[1]>>>16],z=this._C=[T[2]<<16|T[2]>>>16,T[0]&4294901760|T[1]&65535,T[3]<<16|T[3]>>>16,T[1]&4294901760|T[2]&65535,T[0]<<16|T[0]>>>16,T[2]&4294901760|T[3]&65535,T[1]<<16|T[1]>>>16,T[3]&4294901760|T[0]&65535];this._b=0;for(var P=0;P<4;P++)R.call(this);for(var P=0;P<8;P++)z[P]^=j[P+4&7];if(H){var O=H.words,B=O[0],U=O[1],q=(B<<8|B>>>24)&16711935|(B<<24|B>>>8)&4278255360,K=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360,Z=q>>>16|K&4294901760,ee=K<<16|q&65535;z[0]^=q,z[1]^=Z,z[2]^=K,z[3]^=ee,z[4]^=q,z[5]^=Z,z[6]^=K,z[7]^=ee;for(var P=0;P<4;P++)R.call(this)}},_doProcessBlock:function(T,H){var P=this._X;R.call(this),S[0]=P[0]^P[5]>>>16^P[3]<<16,S[1]=P[2]^P[7]>>>16^P[5]<<16,S[2]=P[4]^P[1]>>>16^P[7]<<16,S[3]=P[6]^P[3]>>>16^P[1]<<16;for(var j=0;j<4;j++)S[j]=(S[j]<<8|S[j]>>>24)&16711935|(S[j]<<24|S[j]>>>8)&4278255360,T[H+j]^=S[j]},blockSize:128/32,ivSize:64/32});function R(){for(var T=this._X,H=this._C,P=0;P<8;P++)w[P]=H[P];H[0]=H[0]+1295307597+this._b|0,H[1]=H[1]+3545052371+(H[0]>>>0<w[0]>>>0?1:0)|0,H[2]=H[2]+886263092+(H[1]>>>0<w[1]>>>0?1:0)|0,H[3]=H[3]+1295307597+(H[2]>>>0<w[2]>>>0?1:0)|0,H[4]=H[4]+3545052371+(H[3]>>>0<w[3]>>>0?1:0)|0,H[5]=H[5]+886263092+(H[4]>>>0<w[4]>>>0?1:0)|0,H[6]=H[6]+1295307597+(H[5]>>>0<w[5]>>>0?1:0)|0,H[7]=H[7]+3545052371+(H[6]>>>0<w[6]>>>0?1:0)|0,this._b=H[7]>>>0<w[7]>>>0?1:0;for(var P=0;P<8;P++){var j=T[P]+H[P],z=j&65535,O=j>>>16,B=((z*z>>>17)+z*O>>>15)+O*O,U=((j&4294901760)*j|0)+((j&65535)*j|0);C[P]=B^U}T[0]=C[0]+(C[7]<<16|C[7]>>>16)+(C[6]<<16|C[6]>>>16)|0,T[1]=C[1]+(C[0]<<8|C[0]>>>24)+C[7]|0,T[2]=C[2]+(C[1]<<16|C[1]>>>16)+(C[0]<<16|C[0]>>>16)|0,T[3]=C[3]+(C[2]<<8|C[2]>>>24)+C[1]|0,T[4]=C[4]+(C[3]<<16|C[3]>>>16)+(C[2]<<16|C[2]>>>16)|0,T[5]=C[5]+(C[4]<<8|C[4]>>>24)+C[3]|0,T[6]=C[6]+(C[5]<<16|C[5]>>>16)+(C[4]<<16|C[4]>>>16)|0,T[7]=C[7]+(C[6]<<8|C[6]>>>24)+C[5]|0}l.Rabbit=p._createHelper(b)}(),i.Rabbit})}(Ax)),Ax.exports}var kx={exports:{}},H2;function NR(){return H2||(H2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.StreamCipher,v=l.algo,S=[],w=[],C=[],b=v.RabbitLegacy=p.extend({_doReset:function(){var T=this._key.words,H=this.cfg.iv,P=this._X=[T[0],T[3]<<16|T[2]>>>16,T[1],T[0]<<16|T[3]>>>16,T[2],T[1]<<16|T[0]>>>16,T[3],T[2]<<16|T[1]>>>16],j=this._C=[T[2]<<16|T[2]>>>16,T[0]&4294901760|T[1]&65535,T[3]<<16|T[3]>>>16,T[1]&4294901760|T[2]&65535,T[0]<<16|T[0]>>>16,T[2]&4294901760|T[3]&65535,T[1]<<16|T[1]>>>16,T[3]&4294901760|T[0]&65535];this._b=0;for(var z=0;z<4;z++)R.call(this);for(var z=0;z<8;z++)j[z]^=P[z+4&7];if(H){var O=H.words,B=O[0],U=O[1],q=(B<<8|B>>>24)&16711935|(B<<24|B>>>8)&4278255360,K=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360,Z=q>>>16|K&4294901760,ee=K<<16|q&65535;j[0]^=q,j[1]^=Z,j[2]^=K,j[3]^=ee,j[4]^=q,j[5]^=Z,j[6]^=K,j[7]^=ee;for(var z=0;z<4;z++)R.call(this)}},_doProcessBlock:function(T,H){var P=this._X;R.call(this),S[0]=P[0]^P[5]>>>16^P[3]<<16,S[1]=P[2]^P[7]>>>16^P[5]<<16,S[2]=P[4]^P[1]>>>16^P[7]<<16,S[3]=P[6]^P[3]>>>16^P[1]<<16;for(var j=0;j<4;j++)S[j]=(S[j]<<8|S[j]>>>24)&16711935|(S[j]<<24|S[j]>>>8)&4278255360,T[H+j]^=S[j]},blockSize:128/32,ivSize:64/32});function R(){for(var T=this._X,H=this._C,P=0;P<8;P++)w[P]=H[P];H[0]=H[0]+1295307597+this._b|0,H[1]=H[1]+3545052371+(H[0]>>>0<w[0]>>>0?1:0)|0,H[2]=H[2]+886263092+(H[1]>>>0<w[1]>>>0?1:0)|0,H[3]=H[3]+1295307597+(H[2]>>>0<w[2]>>>0?1:0)|0,H[4]=H[4]+3545052371+(H[3]>>>0<w[3]>>>0?1:0)|0,H[5]=H[5]+886263092+(H[4]>>>0<w[4]>>>0?1:0)|0,H[6]=H[6]+1295307597+(H[5]>>>0<w[5]>>>0?1:0)|0,H[7]=H[7]+3545052371+(H[6]>>>0<w[6]>>>0?1:0)|0,this._b=H[7]>>>0<w[7]>>>0?1:0;for(var P=0;P<8;P++){var j=T[P]+H[P],z=j&65535,O=j>>>16,B=((z*z>>>17)+z*O>>>15)+O*O,U=((j&4294901760)*j|0)+((j&65535)*j|0);C[P]=B^U}T[0]=C[0]+(C[7]<<16|C[7]>>>16)+(C[6]<<16|C[6]>>>16)|0,T[1]=C[1]+(C[0]<<8|C[0]>>>24)+C[7]|0,T[2]=C[2]+(C[1]<<16|C[1]>>>16)+(C[0]<<16|C[0]>>>16)|0,T[3]=C[3]+(C[2]<<8|C[2]>>>24)+C[1]|0,T[4]=C[4]+(C[3]<<16|C[3]>>>16)+(C[2]<<16|C[2]>>>16)|0,T[5]=C[5]+(C[4]<<8|C[4]>>>24)+C[3]|0,T[6]=C[6]+(C[5]<<16|C[5]>>>16)+(C[4]<<16|C[4]>>>16)|0,T[7]=C[7]+(C[6]<<8|C[6]>>>24)+C[5]|0}l.RabbitLegacy=p._createHelper(b)}(),i.RabbitLegacy})}(kx)),kx.exports}var Fx={exports:{}},I2;function BR(){return I2||(I2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.BlockCipher,v=l.algo;const S=16,w=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],C=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var b={pbox:[],sbox:[]};function R(z,O){let B=O>>24&255,U=O>>16&255,q=O>>8&255,K=O&255,Z=z.sbox[0][B]+z.sbox[1][U];return Z=Z^z.sbox[2][q],Z=Z+z.sbox[3][K],Z}function T(z,O,B){let U=O,q=B,K;for(let Z=0;Z<S;++Z)U=U^z.pbox[Z],q=R(z,U)^q,K=U,U=q,q=K;return K=U,U=q,q=K,q=q^z.pbox[S],U=U^z.pbox[S+1],{left:U,right:q}}function H(z,O,B){let U=O,q=B,K;for(let Z=S+1;Z>1;--Z)U=U^z.pbox[Z],q=R(z,U)^q,K=U,U=q,q=K;return K=U,U=q,q=K,q=q^z.pbox[1],U=U^z.pbox[0],{left:U,right:q}}function P(z,O,B){for(let ee=0;ee<4;ee++){z.sbox[ee]=[];for(let A=0;A<256;A++)z.sbox[ee][A]=C[ee][A]}let U=0;for(let ee=0;ee<S+2;ee++)z.pbox[ee]=w[ee]^O[U],U++,U>=B&&(U=0);let q=0,K=0,Z=0;for(let ee=0;ee<S+2;ee+=2)Z=T(z,q,K),q=Z.left,K=Z.right,z.pbox[ee]=q,z.pbox[ee+1]=K;for(let ee=0;ee<4;ee++)for(let A=0;A<256;A+=2)Z=T(z,q,K),q=Z.left,K=Z.right,z.sbox[ee][A]=q,z.sbox[ee][A+1]=K;return!0}var j=v.Blowfish=p.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var z=this._keyPriorReset=this._key,O=z.words,B=z.sigBytes/4;P(b,O,B)}},encryptBlock:function(z,O){var B=T(b,z[O],z[O+1]);z[O]=B.left,z[O+1]=B.right},decryptBlock:function(z,O){var B=H(b,z[O],z[O+1]);z[O]=B.left,z[O+1]=B.right},blockSize:64/32,keySize:128/32,ivSize:64/32});l.Blowfish=p._createHelper(j)}(),i.Blowfish})}(Fx)),Fx.exports}(function(o,r){(function(i,l,f){o.exports=l(er(),Cv(),cR(),fR(),Cc(),dR(),Sc(),u2(),ix(),hR(),h2(),pR(),vR(),gR(),fx(),mR(),pu(),si(),yR(),xR(),ER(),CR(),SR(),wR(),bR(),_R(),DR(),TR(),RR(),AR(),kR(),FR(),OR(),NR(),BR())})(Ut,function(i){return i})})(e2);var MR=e2.exports;const wc=IS(MR);let Ct=null,sn=null,Gf=null;const Ni={setConfig(o){Ct=o},getConfig(){return Ct},decrypt(o,r=null,i=null){var l,f;try{const p=r||((l=Ct==null?void 0:Ct.env)==null?void 0:l.DECODE_IV)||"default_iv_1234",v=i||((f=Ct==null?void 0:Ct.env)==null?void 0:f.DECODE_KEY)||"default_key_1234",S=wc.enc.Base64.parse(o),w=wc.enc.Utf8.parse(v),C=wc.enc.Utf8.parse(p);return wc.AES.decrypt({ciphertext:S},w,{iv:C,mode:wc.mode.CTR,padding:wc.pad.NoPadding}).toString(wc.enc.Utf8)}catch(p){return console.log("ERROR ===> failed decrypt:",p),!1}},pushSound(){try{Gf&&clearInterval(Gf);const o=()=>{try{(!sn||sn.state==="closed")&&(sn=new(window.AudioContext||window.webkitAudioContext)),sn.state==="suspended"&&sn.resume();const r=sn.createOscillator(),i=sn.createOscillator(),l=sn.createGain();r.type="sine",i.type="sine",r.frequency.setValueAtTime(400,sn.currentTime),i.frequency.setValueAtTime(450,sn.currentTime);const f=sn.createOscillator(),p=sn.createGain();f.frequency.value=25,p.gain.value=15,f.connect(p),p.connect(r.frequency),p.connect(i.frequency),r.connect(l),i.connect(l),l.connect(sn.destination),l.gain.setValueAtTime(0,sn.currentTime),l.gain.linearRampToValueAtTime(.08,sn.currentTime+.05),l.gain.setValueAtTime(.08,sn.currentTime+1.2),l.gain.linearRampToValueAtTime(0,sn.currentTime+1.3),f.start(),r.start(),i.start(),f.stop(sn.currentTime+1.4),r.stop(sn.currentTime+1.4),i.stop(sn.currentTime+1.4)}catch(r){console.warn("Failed to play synthesized tone:",r)}};o(),Gf=setInterval(o,3e3)}catch(o){console.warn("AudioContext initialization failed:",o)}},stopSound(){Gf&&(clearInterval(Gf),Gf=null),sn&&(sn.close().catch(()=>{}),sn=null)},pushNotification(o){nt.emitToParent("show_notification",{message:o})},toHHMMSS(o){const r=parseInt(o,10),i=Math.floor(r/3600),l=Math.floor(r/60)%60,f=r%60;return[i,l,f].map(p=>p<10?"0"+p:p).filter((p,v)=>p!=="00"||v>0).join(":")},mute(o,r,i,l){o?r?o.unmute():o.mute():l&&(r?l.unmuteAudio():l.muteAudio()),i(!r)},hold(o,r,i,l){o?r?o.unhold():o.hold():l&&(r?l.unhold():l.hold()),i(!r)},async hangup(o,r,i,l,f,p,v,S){l&&await l(!1),f&&f(!1),p&&p(0),o&&o.current&&clearInterval(o.current),r?(await(r==null?void 0:r.terminate("hangup")),v&&v(!1),nt.emitLocal("yeastarSession",!1)):i&&(await(i==null?void 0:i.hangup()),S&&S(!1),nt.emitLocal("flashphonerCall",!1))},attachRemoteAudio(o){if(!o)return;let r=document.getElementById("ys-remote-audio");r||(r=document.createElement("audio"),r.id="ys-remote-audio",r.autoplay=!0,r.playsInline=!0,r.hidden=!0,document.body.appendChild(r)),r.srcObject=o,r.play().catch(()=>{console.warn("User gesture needed to play audio"),nt.emitLocal("needUserGestureToPlay",!0)})},getContactName(o){return o&&((Ct==null?void 0:Ct.contacts)||{1001:"John Doe",1002:"Jane Smith","08123456789":"Alice Johnson",123:"Customer Support"})[o]||null},async updateExtensionStatus(o,r="Ready",i="ready"){var l,f,p;try{const v=(Ct==null?void 0:Ct["X-CPAAS-Key-Fingerprint"])||(Ct==null?void 0:Ct.fingerprint)||(Ct==null?void 0:Ct.cpaasKeyFingerprint)||((l=Ct==null?void 0:Ct.env)==null?void 0:l.fingerprint)||((f=Ct==null?void 0:Ct.env)==null?void 0:f.X_CPAAS_Key_Fingerprint)||((p=Ct==null?void 0:Ct.pabxConfig)==null?void 0:p["X-CPAAS-Key-Fingerprint"]);if(!v)return console.warn("X-CPAAS-Key-Fingerprint not found. Cannot update extension status."),!1;const S=await fetch("https://api-cpaas.omnix.co.id/voice/extensions/status",{method:"POST",headers:{"X-CPAAS-Key-Fingerprint":v,"Content-Type":"application/json"},body:JSON.stringify({extension:o,status:r,reason:i})}),w=await S.json();return console.log(`[ExtStatus] ${r}/${i}:`,w),S.ok}catch(v){return console.error("Failed to update extension status:",v),!1}},async fetchExtensionStatus(o){var r,i,l,f;try{const p=(Ct==null?void 0:Ct["X-CPAAS-Key-Fingerprint"])||(Ct==null?void 0:Ct.fingerprint)||(Ct==null?void 0:Ct.cpaasKeyFingerprint)||((r=Ct==null?void 0:Ct.env)==null?void 0:r.fingerprint)||((i=Ct==null?void 0:Ct.env)==null?void 0:i.X_CPAAS_Key_Fingerprint)||((l=Ct==null?void 0:Ct.pabxConfig)==null?void 0:l["X-CPAAS-Key-Fingerprint"]);if(!p)return console.warn("X-CPAAS-Key-Fingerprint not found. Cannot fetch extension status."),null;const v=await fetch(`https://api-cpaas.omnix.co.id/voice/portal/extension?extension=${encodeURIComponent(o)}`,{method:"GET",headers:{"X-CPAAS-Key-Fingerprint":p,"Content-Type":"application/json"}});if(!v.ok)return null;const S=await v.json(),w=(f=S==null?void 0:S.data)==null?void 0:f[0];return console.log(`[ExtStatus] fetch ${o}:`,w),w||null}catch(p){return console.error("Failed to fetch extension status:",p),null}},getExtensionUsername(){var o,r;return((o=Ct==null?void 0:Ct.auth)==null?void 0:o.user_pbx)||((r=Ct==null?void 0:Ct.auth)==null?void 0:r.username)||null}};function HR({initialRegisterStatus:o="CONNECTING",autoReady:r=!0,showAuxButton:i=!1,auxOptions:l=[]}){const[f,p]=qt.useState(""),[v,S]=qt.useState("Idle"),[w,C]=qt.useState("00:00"),[b,R]=qt.useState(!1),[T,H]=qt.useState(!1),[P,j]=qt.useState(!1),[z,O]=qt.useState(""),[B,U]=qt.useState(""),[q,K]=qt.useState(""),[Z,ee]=qt.useState(o),[A,Ce]=qt.useState(""),[X,F]=qt.useState(r&&o==="REGISTERED"?"READY":"NOT_READY"),[L,M]=qt.useState(!1),[_e,be]=qt.useState(null),$e=qt.useCallback(Se=>{U(Se),setTimeout(()=>U(""),4e3)},[]);qt.useEffect(()=>{const Se=[nt.on("call_status",Te=>{S(Te),Te!=="InCall"&&(j(!1),O(""),H(!1),R(!1))}),nt.on("call_duration",C),nt.on("incoming_call",Te=>{var zr,Yt,Xt,Fr,br,nn,Tn,vn;const mt=((Yt=(zr=Te==null?void 0:Te.remoteIdentity)==null?void 0:zr.uri)==null?void 0:Yt.user)||(Te==null?void 0:Te.from_id)||"Unknown",dr=((Xt=Te==null?void 0:Te.remoteIdentity)==null?void 0:Xt.displayName)||((br=(Fr=Te==null?void 0:Te.request)==null?void 0:Fr.from)==null?void 0:br.displayName)||((vn=(Tn=(nn=Te==null?void 0:Te.incomingInviteRequest)==null?void 0:nn.message)==null?void 0:Tn.from)==null?void 0:vn.displayName)||(Te==null?void 0:Te.from_name)||Ni.getContactName(mt)||"";p(mt),K(dr),S("Ringing")}),nt.on("register_status",Te=>{const mt=typeof Te=="string"?Te:(Te==null?void 0:Te.status)??"FAILED",dr=typeof Te=="object"?Te==null?void 0:Te.reason:"";ee(mt),Ce(mt==="FAILED"?dr||"Failed to connect to Voice Platform":""),mt!=="REGISTERED"&&mt!=="SIP_CONNECTED"&&F("NOT_READY")}),nt.on("agent_status",Te=>{F(Te),Te!=="AUX"&&be(null)}),nt.on("call_failed",Te=>$e(Te||"Call Failed"))];return()=>Se.forEach(Te=>Te())},[$e]),qt.useEffect(()=>{v==="Idle"&&K(Ni.getContactName(f)||"")},[f,v]),qt.useEffect(()=>{const Se=Te=>{Te.metaKey||Te.ctrlKey||Te.altKey||(v==="InCall"&&/^[0-9*#]$/.test(Te.key)?G(Te.key):v==="Idle"&&Z==="REGISTERED"&&/^[0-9+*#]$/.test(Te.key)?p(mt=>mt+Te.key):v==="Idle"&&Te.key==="Backspace"?p(mt=>mt.slice(0,-1)):v==="Idle"&&Te.key==="Enter"&&$())};return window.addEventListener("keydown",Se),()=>window.removeEventListener("keydown",Se)},[v,Z,f]);const ge=async(Se,Te)=>{const mt=Ni.getExtensionUsername();if(!mt)return!1;M(!0);const dr=await Ni.updateExtensionStatus(mt,Se,Te);return M(!1),dr},Ee=async()=>{await ge("Ready","ready")&&(F("READY"),be(null),nt.emitLocal("register_status","REGISTERED"),nt.emitLocal("agent_status","READY"))},He=async()=>{await ge("Logout","not_ready")&&(F("NOT_READY"),be(null),nt.emitLocal("agent_status","NOT_READY"))},De=async(Se=null)=>{const Te=(Se==null?void 0:Se.code)||"AUX",mt=(Se==null?void 0:Se.label)||"AUX";await ge("AUX",Te)&&(F("AUX"),be({code:Te,label:mt}),nt.emitLocal("agent_status","AUX")),setShowAuxMenu(!1)},$=()=>{const Se=f.trim();Se&&nt.emitLocal("local_dial",{number:Se})},G=Se=>{O(Te=>Te+Se),nt.emitLocal("local_dtmf",{key:Se})},he=()=>nt.emitLocal("local_hangup"),le=()=>nt.emitLocal("local_answer"),Je=()=>nt.emitLocal("local_reject"),Ge=()=>{const Se=!b;R(Se),nt.emitLocal("local_toggle_mute",{muted:Se})},ut=()=>{nt.emitLocal("local_toggle_hold",{isOnHold:T,setIsOnHold:H})};if(v==="Ringing")return ie.jsxs(Kf,{error:B,children:[ie.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[ie.jsx(Ox,{color:"green",pulse:!0,children:ie.jsx(ZS,{className:"w-9 h-9 text-green-600"})}),ie.jsxs("div",{className:"text-center space-y-1",children:[ie.jsx("p",{className:"text-lg font-bold text-gray-800 leading-tight",children:q||f||"Unknown"}),q&&ie.jsx("p",{className:"text-sm font-mono text-gray-400 tracking-wider",children:f}),ie.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-green-50 border border-green-100 mt-1",children:[ie.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),ie.jsx("span",{className:"text-[11px] font-semibold text-green-600 uppercase tracking-widest",children:"Incoming Call"})]})]})]}),ie.jsxs($2,{children:[ie.jsx(Nx,{color:"red",size:"lg",onClick:Je,title:"Reject",children:ie.jsx(Ev,{className:"w-6 h-6"})}),ie.jsx(Nx,{color:"green",size:"lg",onClick:le,title:"Answer",pulse:!0,children:ie.jsx(Xh,{className:"w-6 h-6 fill-white"})})]})]});if(v==="Calling...")return ie.jsxs(Kf,{error:B,children:[ie.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[ie.jsx(Ox,{color:"primary",pulse:!0,children:ie.jsx(nR,{className:"w-9 h-9 text-primary"})}),ie.jsxs("div",{className:"text-center space-y-1",children:[ie.jsx("p",{className:"text-lg font-bold text-gray-800 leading-tight",children:q||f}),q&&ie.jsx("p",{className:"text-xs font-mono text-gray-400 tracking-wider",children:f}),ie.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-primary/8 border border-primary/15 mt-1",children:[ie.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary animate-pulse"}),ie.jsx("span",{className:"text-[11px] font-semibold text-primary uppercase tracking-widest",children:"Dialing..."})]})]})]}),ie.jsx($2,{children:ie.jsx(Nx,{color:"red",size:"lg",onClick:he,title:"Cancel",children:ie.jsx(Ev,{className:"w-6 h-6"})})})]});if(v==="InCall")return ie.jsxs(Kf,{error:B,children:[P?ie.jsxs("div",{className:"animate-fadeIn",children:[ie.jsxs("div",{className:"px-6 pt-5 pb-2 text-center",children:[ie.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-[0.2em] mb-2",children:"DTMF"}),ie.jsx("div",{className:"min-h-[44px] flex items-center justify-center",children:ie.jsx("span",{className:"text-3xl font-light text-gray-700 tracking-[0.25em] font-mono",children:z||ie.jsx("span",{className:"text-gray-200",children:"—"})})})]}),ie.jsx(JS,{onKeyPress:G})]}):ie.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[ie.jsx(Ox,{color:T?"primary":"green",pulse:!T,children:T?ie.jsx(XS,{className:"w-9 h-9 text-primary"}):ie.jsx(ZS,{className:"w-9 h-9 text-green-600"})}),ie.jsxs("div",{className:"text-center space-y-1",children:[ie.jsx("p",{className:"text-base font-bold text-gray-800 leading-tight",children:q||f||"Connected"}),q&&ie.jsx("p",{className:"text-xs font-mono text-gray-400 tracking-wider",children:f}),ie.jsxs("div",{className:"flex items-center justify-center gap-2 mt-1",children:[!T&&ie.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),ie.jsx("span",{className:`text-sm font-mono font-semibold ${T?"text-primary":"text-green-600"}`,children:T?"On Hold":w})]})]})]}),ie.jsx("div",{className:"border-t border-gray-100 bg-gray-50/60 px-6 py-4",children:ie.jsxs("div",{className:"flex items-center justify-between gap-2 max-w-[260px] mx-auto",children:[ie.jsx(Bx,{onClick:Ge,active:b,activeColor:"red",title:b?"Unmute":"Mute",children:b?ie.jsx(tR,{className:"w-[18px] h-[18px]"}):ie.jsx(rR,{className:"w-[18px] h-[18px]"})}),ie.jsx(Bx,{onClick:ut,active:T,activeColor:"primary",title:T?"Resume":"Hold",children:T?ie.jsx(iR,{className:"w-[18px] h-[18px]"}):ie.jsx(XS,{className:"w-[18px] h-[18px]"})}),ie.jsx(Bx,{onClick:()=>j(Se=>!Se),active:P,activeColor:"primary",title:"Keypad",children:ie.jsx(eR,{className:"w-[18px] h-[18px]"})}),ie.jsx("button",{onClick:he,title:"End Call",className:"w-12 h-12 rounded-full bg-red-500 hover:bg-red-600 text-white flex items-center justify-center shadow-[0_4px_14px_rgba(239,68,68,0.4)] hover:shadow-[0_6px_18px_rgba(239,68,68,0.5)] transition-all active:scale-95",children:ie.jsx(Ev,{className:"w-5 h-5"})})]})})]});if(Z==="REGISTERED")return ie.jsxs(Kf,{error:B,children:[ie.jsxs("div",{className:"px-5 pt-5 pb-1",children:[ie.jsxs("div",{className:"relative flex items-center justify-center min-h-[56px] bg-gray-50 rounded-2xl border border-gray-100 px-10",children:[ie.jsx("input",{type:"text",value:f,onChange:Se=>p(Se.target.value.replace(/[^0-9+*#]/g,"")),onKeyDown:Se=>Se.key==="Enter"&&$(),className:"w-full text-center text-[28px] font-light text-gray-800 tracking-[0.12em] bg-transparent outline-none placeholder:text-gray-300 placeholder:text-2xl placeholder:font-normal",placeholder:"Enter number"}),f&&ie.jsx("button",{onClick:()=>p(Se=>Se.slice(0,-1)),onMouseDown:Se=>Se.preventDefault(),className:"absolute right-3 p-1.5 rounded-full text-gray-300 hover:text-gray-500 hover:bg-gray-200 transition-all",children:ie.jsx(JT,{className:"w-4 h-4"})})]}),q&&ie.jsx("p",{className:"text-center text-xs text-primary/70 font-medium mt-1.5 tracking-wide",children:q})]}),ie.jsx(JS,{onKeyPress:Se=>p(Te=>Te+Se)}),ie.jsx("div",{className:"px-5 pb-4 pt-1 flex justify-center",children:ie.jsxs("button",{onClick:$,disabled:!f.trim(),className:`
354
+ */return i.mode.CTRGladman=function(){var l=i.lib.BlockCipherMode.extend();function f(S){if((S>>24&255)===255){var w=S>>16&255,C=S>>8&255,b=S&255;w===255?(w=0,C===255?(C=0,b===255?b=0:++b):++C):++w,S=0,S+=w<<16,S+=C<<8,S+=b}else S+=16777216;return S}function p(S){return(S[0]=f(S[0]))===0&&(S[1]=f(S[1])),S}var v=l.Encryptor=l.extend({processBlock:function(S,w){var C=this._cipher,b=C.blockSize,R=this._iv,T=this._counter;R&&(T=this._counter=R.slice(0),this._iv=void 0),p(T);var H=T.slice(0);C.encryptBlock(H,0);for(var P=0;P<b;P++)S[w+P]^=H[P]}});return l.Decryptor=v,l}(),i.mode.CTRGladman})}(mx)),mx.exports}var yx={exports:{}},b2;function CR(){return b2||(b2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.mode.OFB=function(){var l=i.lib.BlockCipherMode.extend(),f=l.Encryptor=l.extend({processBlock:function(p,v){var S=this._cipher,w=S.blockSize,C=this._iv,b=this._keystream;C&&(b=this._keystream=C.slice(0),this._iv=void 0),S.encryptBlock(b,0);for(var R=0;R<w;R++)p[v+R]^=b[R]}});return l.Decryptor=f,l}(),i.mode.OFB})}(yx)),yx.exports}var xx={exports:{}},_2;function SR(){return _2||(_2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.mode.ECB=function(){var l=i.lib.BlockCipherMode.extend();return l.Encryptor=l.extend({processBlock:function(f,p){this._cipher.encryptBlock(f,p)}}),l.Decryptor=l.extend({processBlock:function(f,p){this._cipher.decryptBlock(f,p)}}),l}(),i.mode.ECB})}(xx)),xx.exports}var Ex={exports:{}},D2;function wR(){return D2||(D2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.pad.AnsiX923={pad:function(l,f){var p=l.sigBytes,v=f*4,S=v-p%v,w=p+S-1;l.clamp(),l.words[w>>>2]|=S<<24-w%4*8,l.sigBytes+=S},unpad:function(l){var f=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=f}},i.pad.Ansix923})}(Ex)),Ex.exports}var Cx={exports:{}},T2;function bR(){return T2||(T2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.pad.Iso10126={pad:function(l,f){var p=f*4,v=p-l.sigBytes%p;l.concat(i.lib.WordArray.random(v-1)).concat(i.lib.WordArray.create([v<<24],1))},unpad:function(l){var f=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=f}},i.pad.Iso10126})}(Cx)),Cx.exports}var Sx={exports:{}},R2;function _R(){return R2||(R2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.pad.Iso97971={pad:function(l,f){l.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(l,f)},unpad:function(l){i.pad.ZeroPadding.unpad(l),l.sigBytes--}},i.pad.Iso97971})}(Sx)),Sx.exports}var wx={exports:{}},A2;function DR(){return A2||(A2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.pad.ZeroPadding={pad:function(l,f){var p=f*4;l.clamp(),l.sigBytes+=p-(l.sigBytes%p||p)},unpad:function(l){for(var f=l.words,p=l.sigBytes-1,p=l.sigBytes-1;p>=0;p--)if(f[p>>>2]>>>24-p%4*8&255){l.sigBytes=p+1;break}}},i.pad.ZeroPadding})}(wx)),wx.exports}var bx={exports:{}},k2;function TR(){return k2||(k2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return i.pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding})}(bx)),bx.exports}var _x={exports:{}},F2;function RR(){return F2||(F2=1,function(o,r){(function(i,l,f){o.exports=l(er(),si())})(Ut,function(i){return function(l){var f=i,p=f.lib,v=p.CipherParams,S=f.enc,w=S.Hex,C=f.format;C.Hex={stringify:function(b){return b.ciphertext.toString(w)},parse:function(b){var R=w.parse(b);return v.create({ciphertext:R})}}}(),i.format.Hex})}(_x)),_x.exports}var Dx={exports:{}},O2;function AR(){return O2||(O2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.BlockCipher,v=l.algo,S=[],w=[],C=[],b=[],R=[],T=[],H=[],P=[],j=[],z=[];(function(){for(var U=[],q=0;q<256;q++)q<128?U[q]=q<<1:U[q]=q<<1^283;for(var K=0,Z=0,q=0;q<256;q++){var ee=Z^Z<<1^Z<<2^Z<<3^Z<<4;ee=ee>>>8^ee&255^99,S[K]=ee,w[ee]=K;var A=U[K],Ce=U[A],X=U[Ce],F=U[ee]*257^ee*16843008;C[K]=F<<24|F>>>8,b[K]=F<<16|F>>>16,R[K]=F<<8|F>>>24,T[K]=F;var F=X*16843009^Ce*65537^A*257^K*16843008;H[ee]=F<<24|F>>>8,P[ee]=F<<16|F>>>16,j[ee]=F<<8|F>>>24,z[ee]=F,K?(K=A^U[U[U[X^A]]],Z^=U[U[Z]]):K=Z=1}})();var O=[0,1,2,4,8,16,32,64,128,27,54],B=v.AES=p.extend({_doReset:function(){var U;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var q=this._keyPriorReset=this._key,K=q.words,Z=q.sigBytes/4,ee=this._nRounds=Z+6,A=(ee+1)*4,Ce=this._keySchedule=[],X=0;X<A;X++)X<Z?Ce[X]=K[X]:(U=Ce[X-1],X%Z?Z>6&&X%Z==4&&(U=S[U>>>24]<<24|S[U>>>16&255]<<16|S[U>>>8&255]<<8|S[U&255]):(U=U<<8|U>>>24,U=S[U>>>24]<<24|S[U>>>16&255]<<16|S[U>>>8&255]<<8|S[U&255],U^=O[X/Z|0]<<24),Ce[X]=Ce[X-Z]^U);for(var F=this._invKeySchedule=[],L=0;L<A;L++){var X=A-L;if(L%4)var U=Ce[X];else var U=Ce[X-4];L<4||X<=4?F[L]=U:F[L]=H[S[U>>>24]]^P[S[U>>>16&255]]^j[S[U>>>8&255]]^z[S[U&255]]}}},encryptBlock:function(U,q){this._doCryptBlock(U,q,this._keySchedule,C,b,R,T,S)},decryptBlock:function(U,q){var K=U[q+1];U[q+1]=U[q+3],U[q+3]=K,this._doCryptBlock(U,q,this._invKeySchedule,H,P,j,z,w);var K=U[q+1];U[q+1]=U[q+3],U[q+3]=K},_doCryptBlock:function(U,q,K,Z,ee,A,Ce,X){for(var F=this._nRounds,L=U[q]^K[0],M=U[q+1]^K[1],_e=U[q+2]^K[2],be=U[q+3]^K[3],$e=4,ge=1;ge<F;ge++){var Ee=Z[L>>>24]^ee[M>>>16&255]^A[_e>>>8&255]^Ce[be&255]^K[$e++],He=Z[M>>>24]^ee[_e>>>16&255]^A[be>>>8&255]^Ce[L&255]^K[$e++],De=Z[_e>>>24]^ee[be>>>16&255]^A[L>>>8&255]^Ce[M&255]^K[$e++],$=Z[be>>>24]^ee[L>>>16&255]^A[M>>>8&255]^Ce[_e&255]^K[$e++];L=Ee,M=He,_e=De,be=$}var Ee=(X[L>>>24]<<24|X[M>>>16&255]<<16|X[_e>>>8&255]<<8|X[be&255])^K[$e++],He=(X[M>>>24]<<24|X[_e>>>16&255]<<16|X[be>>>8&255]<<8|X[L&255])^K[$e++],De=(X[_e>>>24]<<24|X[be>>>16&255]<<16|X[L>>>8&255]<<8|X[M&255])^K[$e++],$=(X[be>>>24]<<24|X[L>>>16&255]<<16|X[M>>>8&255]<<8|X[_e&255])^K[$e++];U[q]=Ee,U[q+1]=He,U[q+2]=De,U[q+3]=$},keySize:256/32});l.AES=p._createHelper(B)}(),i.AES})}(Dx)),Dx.exports}var Tx={exports:{}},N2;function kR(){return N2||(N2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.WordArray,v=f.BlockCipher,S=l.algo,w=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],C=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],b=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],R=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],T=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],H=S.DES=v.extend({_doReset:function(){for(var O=this._key,B=O.words,U=[],q=0;q<56;q++){var K=w[q]-1;U[q]=B[K>>>5]>>>31-K%32&1}for(var Z=this._subKeys=[],ee=0;ee<16;ee++){for(var A=Z[ee]=[],Ce=b[ee],q=0;q<24;q++)A[q/6|0]|=U[(C[q]-1+Ce)%28]<<31-q%6,A[4+(q/6|0)]|=U[28+(C[q+24]-1+Ce)%28]<<31-q%6;A[0]=A[0]<<1|A[0]>>>31;for(var q=1;q<7;q++)A[q]=A[q]>>>(q-1)*4+3;A[7]=A[7]<<5|A[7]>>>27}for(var X=this._invSubKeys=[],q=0;q<16;q++)X[q]=Z[15-q]},encryptBlock:function(O,B){this._doCryptBlock(O,B,this._subKeys)},decryptBlock:function(O,B){this._doCryptBlock(O,B,this._invSubKeys)},_doCryptBlock:function(O,B,U){this._lBlock=O[B],this._rBlock=O[B+1],P.call(this,4,252645135),P.call(this,16,65535),j.call(this,2,858993459),j.call(this,8,16711935),P.call(this,1,1431655765);for(var q=0;q<16;q++){for(var K=U[q],Z=this._lBlock,ee=this._rBlock,A=0,Ce=0;Ce<8;Ce++)A|=R[Ce][((ee^K[Ce])&T[Ce])>>>0];this._lBlock=ee,this._rBlock=Z^A}var X=this._lBlock;this._lBlock=this._rBlock,this._rBlock=X,P.call(this,1,1431655765),j.call(this,8,16711935),j.call(this,2,858993459),P.call(this,16,65535),P.call(this,4,252645135),O[B]=this._lBlock,O[B+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function P(O,B){var U=(this._lBlock>>>O^this._rBlock)&B;this._rBlock^=U,this._lBlock^=U<<O}function j(O,B){var U=(this._rBlock>>>O^this._lBlock)&B;this._lBlock^=U,this._rBlock^=U<<O}l.DES=v._createHelper(H);var z=S.TripleDES=v.extend({_doReset:function(){var O=this._key,B=O.words;if(B.length!==2&&B.length!==4&&B.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var U=B.slice(0,2),q=B.length<4?B.slice(0,2):B.slice(2,4),K=B.length<6?B.slice(0,2):B.slice(4,6);this._des1=H.createEncryptor(p.create(U)),this._des2=H.createEncryptor(p.create(q)),this._des3=H.createEncryptor(p.create(K))},encryptBlock:function(O,B){this._des1.encryptBlock(O,B),this._des2.decryptBlock(O,B),this._des3.encryptBlock(O,B)},decryptBlock:function(O,B){this._des3.decryptBlock(O,B),this._des2.encryptBlock(O,B),this._des1.decryptBlock(O,B)},keySize:192/32,ivSize:64/32,blockSize:64/32});l.TripleDES=v._createHelper(z)}(),i.TripleDES})}(Tx)),Tx.exports}var Rx={exports:{}},B2;function FR(){return B2||(B2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.StreamCipher,v=l.algo,S=v.RC4=p.extend({_doReset:function(){for(var b=this._key,R=b.words,T=b.sigBytes,H=this._S=[],P=0;P<256;P++)H[P]=P;for(var P=0,j=0;P<256;P++){var z=P%T,O=R[z>>>2]>>>24-z%4*8&255;j=(j+H[P]+O)%256;var B=H[P];H[P]=H[j],H[j]=B}this._i=this._j=0},_doProcessBlock:function(b,R){b[R]^=w.call(this)},keySize:256/32,ivSize:0});function w(){for(var b=this._S,R=this._i,T=this._j,H=0,P=0;P<4;P++){R=(R+1)%256,T=(T+b[R])%256;var j=b[R];b[R]=b[T],b[T]=j,H|=b[(b[R]+b[T])%256]<<24-P*8}return this._i=R,this._j=T,H}l.RC4=p._createHelper(S);var C=v.RC4Drop=S.extend({cfg:S.cfg.extend({drop:192}),_doReset:function(){S._doReset.call(this);for(var b=this.cfg.drop;b>0;b--)w.call(this)}});l.RC4Drop=p._createHelper(C)}(),i.RC4})}(Rx)),Rx.exports}var Ax={exports:{}},M2;function OR(){return M2||(M2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.StreamCipher,v=l.algo,S=[],w=[],C=[],b=v.Rabbit=p.extend({_doReset:function(){for(var T=this._key.words,H=this.cfg.iv,P=0;P<4;P++)T[P]=(T[P]<<8|T[P]>>>24)&16711935|(T[P]<<24|T[P]>>>8)&4278255360;var j=this._X=[T[0],T[3]<<16|T[2]>>>16,T[1],T[0]<<16|T[3]>>>16,T[2],T[1]<<16|T[0]>>>16,T[3],T[2]<<16|T[1]>>>16],z=this._C=[T[2]<<16|T[2]>>>16,T[0]&4294901760|T[1]&65535,T[3]<<16|T[3]>>>16,T[1]&4294901760|T[2]&65535,T[0]<<16|T[0]>>>16,T[2]&4294901760|T[3]&65535,T[1]<<16|T[1]>>>16,T[3]&4294901760|T[0]&65535];this._b=0;for(var P=0;P<4;P++)R.call(this);for(var P=0;P<8;P++)z[P]^=j[P+4&7];if(H){var O=H.words,B=O[0],U=O[1],q=(B<<8|B>>>24)&16711935|(B<<24|B>>>8)&4278255360,K=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360,Z=q>>>16|K&4294901760,ee=K<<16|q&65535;z[0]^=q,z[1]^=Z,z[2]^=K,z[3]^=ee,z[4]^=q,z[5]^=Z,z[6]^=K,z[7]^=ee;for(var P=0;P<4;P++)R.call(this)}},_doProcessBlock:function(T,H){var P=this._X;R.call(this),S[0]=P[0]^P[5]>>>16^P[3]<<16,S[1]=P[2]^P[7]>>>16^P[5]<<16,S[2]=P[4]^P[1]>>>16^P[7]<<16,S[3]=P[6]^P[3]>>>16^P[1]<<16;for(var j=0;j<4;j++)S[j]=(S[j]<<8|S[j]>>>24)&16711935|(S[j]<<24|S[j]>>>8)&4278255360,T[H+j]^=S[j]},blockSize:128/32,ivSize:64/32});function R(){for(var T=this._X,H=this._C,P=0;P<8;P++)w[P]=H[P];H[0]=H[0]+1295307597+this._b|0,H[1]=H[1]+3545052371+(H[0]>>>0<w[0]>>>0?1:0)|0,H[2]=H[2]+886263092+(H[1]>>>0<w[1]>>>0?1:0)|0,H[3]=H[3]+1295307597+(H[2]>>>0<w[2]>>>0?1:0)|0,H[4]=H[4]+3545052371+(H[3]>>>0<w[3]>>>0?1:0)|0,H[5]=H[5]+886263092+(H[4]>>>0<w[4]>>>0?1:0)|0,H[6]=H[6]+1295307597+(H[5]>>>0<w[5]>>>0?1:0)|0,H[7]=H[7]+3545052371+(H[6]>>>0<w[6]>>>0?1:0)|0,this._b=H[7]>>>0<w[7]>>>0?1:0;for(var P=0;P<8;P++){var j=T[P]+H[P],z=j&65535,O=j>>>16,B=((z*z>>>17)+z*O>>>15)+O*O,U=((j&4294901760)*j|0)+((j&65535)*j|0);C[P]=B^U}T[0]=C[0]+(C[7]<<16|C[7]>>>16)+(C[6]<<16|C[6]>>>16)|0,T[1]=C[1]+(C[0]<<8|C[0]>>>24)+C[7]|0,T[2]=C[2]+(C[1]<<16|C[1]>>>16)+(C[0]<<16|C[0]>>>16)|0,T[3]=C[3]+(C[2]<<8|C[2]>>>24)+C[1]|0,T[4]=C[4]+(C[3]<<16|C[3]>>>16)+(C[2]<<16|C[2]>>>16)|0,T[5]=C[5]+(C[4]<<8|C[4]>>>24)+C[3]|0,T[6]=C[6]+(C[5]<<16|C[5]>>>16)+(C[4]<<16|C[4]>>>16)|0,T[7]=C[7]+(C[6]<<8|C[6]>>>24)+C[5]|0}l.Rabbit=p._createHelper(b)}(),i.Rabbit})}(Ax)),Ax.exports}var kx={exports:{}},H2;function NR(){return H2||(H2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.StreamCipher,v=l.algo,S=[],w=[],C=[],b=v.RabbitLegacy=p.extend({_doReset:function(){var T=this._key.words,H=this.cfg.iv,P=this._X=[T[0],T[3]<<16|T[2]>>>16,T[1],T[0]<<16|T[3]>>>16,T[2],T[1]<<16|T[0]>>>16,T[3],T[2]<<16|T[1]>>>16],j=this._C=[T[2]<<16|T[2]>>>16,T[0]&4294901760|T[1]&65535,T[3]<<16|T[3]>>>16,T[1]&4294901760|T[2]&65535,T[0]<<16|T[0]>>>16,T[2]&4294901760|T[3]&65535,T[1]<<16|T[1]>>>16,T[3]&4294901760|T[0]&65535];this._b=0;for(var z=0;z<4;z++)R.call(this);for(var z=0;z<8;z++)j[z]^=P[z+4&7];if(H){var O=H.words,B=O[0],U=O[1],q=(B<<8|B>>>24)&16711935|(B<<24|B>>>8)&4278255360,K=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360,Z=q>>>16|K&4294901760,ee=K<<16|q&65535;j[0]^=q,j[1]^=Z,j[2]^=K,j[3]^=ee,j[4]^=q,j[5]^=Z,j[6]^=K,j[7]^=ee;for(var z=0;z<4;z++)R.call(this)}},_doProcessBlock:function(T,H){var P=this._X;R.call(this),S[0]=P[0]^P[5]>>>16^P[3]<<16,S[1]=P[2]^P[7]>>>16^P[5]<<16,S[2]=P[4]^P[1]>>>16^P[7]<<16,S[3]=P[6]^P[3]>>>16^P[1]<<16;for(var j=0;j<4;j++)S[j]=(S[j]<<8|S[j]>>>24)&16711935|(S[j]<<24|S[j]>>>8)&4278255360,T[H+j]^=S[j]},blockSize:128/32,ivSize:64/32});function R(){for(var T=this._X,H=this._C,P=0;P<8;P++)w[P]=H[P];H[0]=H[0]+1295307597+this._b|0,H[1]=H[1]+3545052371+(H[0]>>>0<w[0]>>>0?1:0)|0,H[2]=H[2]+886263092+(H[1]>>>0<w[1]>>>0?1:0)|0,H[3]=H[3]+1295307597+(H[2]>>>0<w[2]>>>0?1:0)|0,H[4]=H[4]+3545052371+(H[3]>>>0<w[3]>>>0?1:0)|0,H[5]=H[5]+886263092+(H[4]>>>0<w[4]>>>0?1:0)|0,H[6]=H[6]+1295307597+(H[5]>>>0<w[5]>>>0?1:0)|0,H[7]=H[7]+3545052371+(H[6]>>>0<w[6]>>>0?1:0)|0,this._b=H[7]>>>0<w[7]>>>0?1:0;for(var P=0;P<8;P++){var j=T[P]+H[P],z=j&65535,O=j>>>16,B=((z*z>>>17)+z*O>>>15)+O*O,U=((j&4294901760)*j|0)+((j&65535)*j|0);C[P]=B^U}T[0]=C[0]+(C[7]<<16|C[7]>>>16)+(C[6]<<16|C[6]>>>16)|0,T[1]=C[1]+(C[0]<<8|C[0]>>>24)+C[7]|0,T[2]=C[2]+(C[1]<<16|C[1]>>>16)+(C[0]<<16|C[0]>>>16)|0,T[3]=C[3]+(C[2]<<8|C[2]>>>24)+C[1]|0,T[4]=C[4]+(C[3]<<16|C[3]>>>16)+(C[2]<<16|C[2]>>>16)|0,T[5]=C[5]+(C[4]<<8|C[4]>>>24)+C[3]|0,T[6]=C[6]+(C[5]<<16|C[5]>>>16)+(C[4]<<16|C[4]>>>16)|0,T[7]=C[7]+(C[6]<<8|C[6]>>>24)+C[5]|0}l.RabbitLegacy=p._createHelper(b)}(),i.RabbitLegacy})}(kx)),kx.exports}var Fx={exports:{}},I2;function BR(){return I2||(I2=1,function(o,r){(function(i,l,f){o.exports=l(er(),Cc(),Sc(),pu(),si())})(Ut,function(i){return function(){var l=i,f=l.lib,p=f.BlockCipher,v=l.algo;const S=16,w=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],C=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var b={pbox:[],sbox:[]};function R(z,O){let B=O>>24&255,U=O>>16&255,q=O>>8&255,K=O&255,Z=z.sbox[0][B]+z.sbox[1][U];return Z=Z^z.sbox[2][q],Z=Z+z.sbox[3][K],Z}function T(z,O,B){let U=O,q=B,K;for(let Z=0;Z<S;++Z)U=U^z.pbox[Z],q=R(z,U)^q,K=U,U=q,q=K;return K=U,U=q,q=K,q=q^z.pbox[S],U=U^z.pbox[S+1],{left:U,right:q}}function H(z,O,B){let U=O,q=B,K;for(let Z=S+1;Z>1;--Z)U=U^z.pbox[Z],q=R(z,U)^q,K=U,U=q,q=K;return K=U,U=q,q=K,q=q^z.pbox[1],U=U^z.pbox[0],{left:U,right:q}}function P(z,O,B){for(let ee=0;ee<4;ee++){z.sbox[ee]=[];for(let A=0;A<256;A++)z.sbox[ee][A]=C[ee][A]}let U=0;for(let ee=0;ee<S+2;ee++)z.pbox[ee]=w[ee]^O[U],U++,U>=B&&(U=0);let q=0,K=0,Z=0;for(let ee=0;ee<S+2;ee+=2)Z=T(z,q,K),q=Z.left,K=Z.right,z.pbox[ee]=q,z.pbox[ee+1]=K;for(let ee=0;ee<4;ee++)for(let A=0;A<256;A+=2)Z=T(z,q,K),q=Z.left,K=Z.right,z.sbox[ee][A]=q,z.sbox[ee][A+1]=K;return!0}var j=v.Blowfish=p.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var z=this._keyPriorReset=this._key,O=z.words,B=z.sigBytes/4;P(b,O,B)}},encryptBlock:function(z,O){var B=T(b,z[O],z[O+1]);z[O]=B.left,z[O+1]=B.right},decryptBlock:function(z,O){var B=H(b,z[O],z[O+1]);z[O]=B.left,z[O+1]=B.right},blockSize:64/32,keySize:128/32,ivSize:64/32});l.Blowfish=p._createHelper(j)}(),i.Blowfish})}(Fx)),Fx.exports}(function(o,r){(function(i,l,f){o.exports=l(er(),Cv(),cR(),fR(),Cc(),dR(),Sc(),u2(),ix(),hR(),h2(),pR(),vR(),gR(),fx(),mR(),pu(),si(),yR(),xR(),ER(),CR(),SR(),wR(),bR(),_R(),DR(),TR(),RR(),AR(),kR(),FR(),OR(),NR(),BR())})(Ut,function(i){return i})})(e2);var MR=e2.exports;const wc=IS(MR);let Ct=null,sn=null,Gf=null;const Ni={setConfig(o){Ct=o},getConfig(){return Ct},decrypt(o,r=null,i=null){var l,f;try{const p=r||((l=Ct==null?void 0:Ct.env)==null?void 0:l.DECODE_IV)||"default_iv_1234",v=i||((f=Ct==null?void 0:Ct.env)==null?void 0:f.DECODE_KEY)||"default_key_1234",S=wc.enc.Base64.parse(o),w=wc.enc.Utf8.parse(v),C=wc.enc.Utf8.parse(p);return wc.AES.decrypt({ciphertext:S},w,{iv:C,mode:wc.mode.CTR,padding:wc.pad.NoPadding}).toString(wc.enc.Utf8)}catch(p){return console.log("ERROR ===> failed decrypt:",p),!1}},pushSound(){try{Gf&&clearInterval(Gf);const o=()=>{try{(!sn||sn.state==="closed")&&(sn=new(window.AudioContext||window.webkitAudioContext)),sn.state==="suspended"&&sn.resume();const r=sn.createOscillator(),i=sn.createOscillator(),l=sn.createGain();r.type="sine",i.type="sine",r.frequency.setValueAtTime(400,sn.currentTime),i.frequency.setValueAtTime(450,sn.currentTime);const f=sn.createOscillator(),p=sn.createGain();f.frequency.value=25,p.gain.value=15,f.connect(p),p.connect(r.frequency),p.connect(i.frequency),r.connect(l),i.connect(l),l.connect(sn.destination),l.gain.setValueAtTime(0,sn.currentTime),l.gain.linearRampToValueAtTime(.08,sn.currentTime+.05),l.gain.setValueAtTime(.08,sn.currentTime+1.2),l.gain.linearRampToValueAtTime(0,sn.currentTime+1.3),f.start(),r.start(),i.start(),f.stop(sn.currentTime+1.4),r.stop(sn.currentTime+1.4),i.stop(sn.currentTime+1.4)}catch(r){console.warn("Failed to play synthesized tone:",r)}};o(),Gf=setInterval(o,3e3)}catch(o){console.warn("AudioContext initialization failed:",o)}},stopSound(){Gf&&(clearInterval(Gf),Gf=null),sn&&(sn.close().catch(()=>{}),sn=null)},pushNotification(o){tt.emitToParent("show_notification",{message:o})},toHHMMSS(o){const r=parseInt(o,10),i=Math.floor(r/3600),l=Math.floor(r/60)%60,f=r%60;return[i,l,f].map(p=>p<10?"0"+p:p).filter((p,v)=>p!=="00"||v>0).join(":")},mute(o,r,i,l){o?r?o.unmute():o.mute():l&&(r?l.unmuteAudio():l.muteAudio()),i(!r)},hold(o,r,i,l){o?r?o.unhold():o.hold():l&&(r?l.unhold():l.hold()),i(!r)},async hangup(o,r,i,l,f,p,v,S){l&&await l(!1),f&&f(!1),p&&p(0),o&&o.current&&clearInterval(o.current),r?(await(r==null?void 0:r.terminate("hangup")),v&&v(!1),tt.emitLocal("yeastarSession",!1)):i&&(await(i==null?void 0:i.hangup()),S&&S(!1),tt.emitLocal("flashphonerCall",!1))},attachRemoteAudio(o){if(!o)return;let r=document.getElementById("ys-remote-audio");r||(r=document.createElement("audio"),r.id="ys-remote-audio",r.autoplay=!0,r.playsInline=!0,r.hidden=!0,document.body.appendChild(r)),r.srcObject=o,r.play().catch(()=>{console.warn("User gesture needed to play audio"),tt.emitLocal("needUserGestureToPlay",!0)})},getContactName(o){return o&&((Ct==null?void 0:Ct.contacts)||{1001:"John Doe",1002:"Jane Smith","08123456789":"Alice Johnson",123:"Customer Support"})[o]||null},async updateExtensionStatus(o,r="Ready",i="ready"){var l,f,p;try{const v=(Ct==null?void 0:Ct["X-CPAAS-Key-Fingerprint"])||(Ct==null?void 0:Ct.fingerprint)||(Ct==null?void 0:Ct.cpaasKeyFingerprint)||((l=Ct==null?void 0:Ct.env)==null?void 0:l.fingerprint)||((f=Ct==null?void 0:Ct.env)==null?void 0:f.X_CPAAS_Key_Fingerprint)||((p=Ct==null?void 0:Ct.pabxConfig)==null?void 0:p["X-CPAAS-Key-Fingerprint"]);if(!v)return console.warn("X-CPAAS-Key-Fingerprint not found. Cannot update extension status."),!1;const S=await fetch("https://api-cpaas.omnix.co.id/voice/extensions/status",{method:"POST",headers:{"X-CPAAS-Key-Fingerprint":v,"Content-Type":"application/json"},body:JSON.stringify({extension:o,status:r,reason:i})}),w=await S.json();return console.log(`[ExtStatus] ${r}/${i}:`,w),S.ok}catch(v){return console.error("Failed to update extension status:",v),!1}},async fetchExtensionStatus(o){var r,i,l,f;try{const p=(Ct==null?void 0:Ct["X-CPAAS-Key-Fingerprint"])||(Ct==null?void 0:Ct.fingerprint)||(Ct==null?void 0:Ct.cpaasKeyFingerprint)||((r=Ct==null?void 0:Ct.env)==null?void 0:r.fingerprint)||((i=Ct==null?void 0:Ct.env)==null?void 0:i.X_CPAAS_Key_Fingerprint)||((l=Ct==null?void 0:Ct.pabxConfig)==null?void 0:l["X-CPAAS-Key-Fingerprint"]);if(!p)return console.warn("X-CPAAS-Key-Fingerprint not found. Cannot fetch extension status."),null;const v=await fetch(`https://api-cpaas.omnix.co.id/voice/portal/extension?extension=${encodeURIComponent(o)}`,{method:"GET",headers:{"X-CPAAS-Key-Fingerprint":p,"Content-Type":"application/json"}});if(!v.ok)return null;const S=await v.json(),w=(f=S==null?void 0:S.data)==null?void 0:f[0];return console.log(`[ExtStatus] fetch ${o}:`,w),w||null}catch(p){return console.error("Failed to fetch extension status:",p),null}},getExtensionUsername(){var o,r;return((o=Ct==null?void 0:Ct.auth)==null?void 0:o.user_pbx)||((r=Ct==null?void 0:Ct.auth)==null?void 0:r.username)||null}};function HR({initialRegisterStatus:o="CONNECTING",autoReady:r=!0,showAuxButton:i=!1,auxOptions:l=[]}){const[f,p]=qt.useState(""),[v,S]=qt.useState("Idle"),[w,C]=qt.useState("00:00"),[b,R]=qt.useState(!1),[T,H]=qt.useState(!1),[P,j]=qt.useState(!1),[z,O]=qt.useState(""),[B,U]=qt.useState(""),[q,K]=qt.useState(""),[Z,ee]=qt.useState(o),[A,Ce]=qt.useState(""),[X,F]=qt.useState(r&&o==="REGISTERED"?"READY":"NOT_READY"),[L,M]=qt.useState(!1),[_e,be]=qt.useState(null),$e=qt.useCallback(Se=>{U(Se),setTimeout(()=>U(""),4e3)},[]);qt.useEffect(()=>{const Se=[tt.on("call_status",Te=>{S(Te),Te!=="InCall"&&(j(!1),O(""),H(!1),R(!1))}),tt.on("call_duration",C),tt.on("incoming_call",Te=>{var zr,Yt,Xt,Fr,br,nn,Tn,vn;const mt=((Yt=(zr=Te==null?void 0:Te.remoteIdentity)==null?void 0:zr.uri)==null?void 0:Yt.user)||(Te==null?void 0:Te.from_id)||"Unknown",dr=((Xt=Te==null?void 0:Te.remoteIdentity)==null?void 0:Xt.displayName)||((br=(Fr=Te==null?void 0:Te.request)==null?void 0:Fr.from)==null?void 0:br.displayName)||((vn=(Tn=(nn=Te==null?void 0:Te.incomingInviteRequest)==null?void 0:nn.message)==null?void 0:Tn.from)==null?void 0:vn.displayName)||(Te==null?void 0:Te.from_name)||Ni.getContactName(mt)||"";p(mt),K(dr),S("Ringing")}),tt.on("register_status",Te=>{const mt=typeof Te=="string"?Te:(Te==null?void 0:Te.status)??"FAILED",dr=typeof Te=="object"?Te==null?void 0:Te.reason:"";ee(mt),Ce(mt==="FAILED"?dr||"Failed to connect to Voice Platform":""),mt!=="REGISTERED"&&mt!=="SIP_CONNECTED"&&F("NOT_READY")}),tt.on("agent_status",Te=>{F(Te),Te!=="AUX"&&be(null)}),tt.on("call_failed",Te=>$e(Te||"Call Failed"))];return()=>Se.forEach(Te=>Te())},[$e]),qt.useEffect(()=>{v==="Idle"&&K(Ni.getContactName(f)||"")},[f,v]),qt.useEffect(()=>{const Se=Te=>{Te.metaKey||Te.ctrlKey||Te.altKey||(v==="InCall"&&/^[0-9*#]$/.test(Te.key)?G(Te.key):v==="Idle"&&Z==="REGISTERED"&&/^[0-9+*#]$/.test(Te.key)?p(mt=>mt+Te.key):v==="Idle"&&Te.key==="Backspace"?p(mt=>mt.slice(0,-1)):v==="Idle"&&Te.key==="Enter"&&$())};return window.addEventListener("keydown",Se),()=>window.removeEventListener("keydown",Se)},[v,Z,f]);const ge=async(Se,Te)=>{const mt=Ni.getExtensionUsername();if(!mt)return!1;M(!0);const dr=await Ni.updateExtensionStatus(mt,Se,Te);return M(!1),dr},Ee=async()=>{await ge("Ready","ready")&&(F("READY"),be(null),tt.emitLocal("register_status","REGISTERED"),tt.emitLocal("agent_status","READY"))},He=async()=>{await ge("Logout","not_ready")&&(F("NOT_READY"),be(null),tt.emitLocal("register_status","SIP_CONNECTED"),tt.emitLocal("agent_status","NOT_READY"))},De=async(Se=null)=>{const Te=(Se==null?void 0:Se.code)||"AUX",mt=(Se==null?void 0:Se.label)||"AUX";await ge("AUX",Te)&&(F("AUX"),be({code:Te,label:mt}),tt.emitLocal("agent_status","AUX")),setShowAuxMenu(!1)},$=()=>{const Se=f.trim();Se&&tt.emitLocal("local_dial",{number:Se})},G=Se=>{O(Te=>Te+Se),tt.emitLocal("local_dtmf",{key:Se})},he=()=>tt.emitLocal("local_hangup"),le=()=>tt.emitLocal("local_answer"),Je=()=>tt.emitLocal("local_reject"),Ge=()=>{const Se=!b;R(Se),tt.emitLocal("local_toggle_mute",{muted:Se})},ut=()=>{tt.emitLocal("local_toggle_hold",{isOnHold:T,setIsOnHold:H})};if(v==="Ringing")return ie.jsxs(Kf,{error:B,children:[ie.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[ie.jsx(Ox,{color:"green",pulse:!0,children:ie.jsx(ZS,{className:"w-9 h-9 text-green-600"})}),ie.jsxs("div",{className:"text-center space-y-1",children:[ie.jsx("p",{className:"text-lg font-bold text-gray-800 leading-tight",children:q||f||"Unknown"}),q&&ie.jsx("p",{className:"text-sm font-mono text-gray-400 tracking-wider",children:f}),ie.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-green-50 border border-green-100 mt-1",children:[ie.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),ie.jsx("span",{className:"text-[11px] font-semibold text-green-600 uppercase tracking-widest",children:"Incoming Call"})]})]})]}),ie.jsxs($2,{children:[ie.jsx(Nx,{color:"red",size:"lg",onClick:Je,title:"Reject",children:ie.jsx(Ev,{className:"w-6 h-6"})}),ie.jsx(Nx,{color:"green",size:"lg",onClick:le,title:"Answer",pulse:!0,children:ie.jsx(Xh,{className:"w-6 h-6 fill-white"})})]})]});if(v==="Calling...")return ie.jsxs(Kf,{error:B,children:[ie.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[ie.jsx(Ox,{color:"primary",pulse:!0,children:ie.jsx(nR,{className:"w-9 h-9 text-primary"})}),ie.jsxs("div",{className:"text-center space-y-1",children:[ie.jsx("p",{className:"text-lg font-bold text-gray-800 leading-tight",children:q||f}),q&&ie.jsx("p",{className:"text-xs font-mono text-gray-400 tracking-wider",children:f}),ie.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-primary/8 border border-primary/15 mt-1",children:[ie.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary animate-pulse"}),ie.jsx("span",{className:"text-[11px] font-semibold text-primary uppercase tracking-widest",children:"Dialing..."})]})]})]}),ie.jsx($2,{children:ie.jsx(Nx,{color:"red",size:"lg",onClick:he,title:"Cancel",children:ie.jsx(Ev,{className:"w-6 h-6"})})})]});if(v==="InCall")return ie.jsxs(Kf,{error:B,children:[P?ie.jsxs("div",{className:"animate-fadeIn",children:[ie.jsxs("div",{className:"px-6 pt-5 pb-2 text-center",children:[ie.jsx("p",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-[0.2em] mb-2",children:"DTMF"}),ie.jsx("div",{className:"min-h-[44px] flex items-center justify-center",children:ie.jsx("span",{className:"text-3xl font-light text-gray-700 tracking-[0.25em] font-mono",children:z||ie.jsx("span",{className:"text-gray-200",children:"—"})})})]}),ie.jsx(JS,{onKeyPress:G})]}):ie.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-10 gap-7 min-h-[300px] animate-fadeIn",children:[ie.jsx(Ox,{color:T?"primary":"green",pulse:!T,children:T?ie.jsx(XS,{className:"w-9 h-9 text-primary"}):ie.jsx(ZS,{className:"w-9 h-9 text-green-600"})}),ie.jsxs("div",{className:"text-center space-y-1",children:[ie.jsx("p",{className:"text-base font-bold text-gray-800 leading-tight",children:q||f||"Connected"}),q&&ie.jsx("p",{className:"text-xs font-mono text-gray-400 tracking-wider",children:f}),ie.jsxs("div",{className:"flex items-center justify-center gap-2 mt-1",children:[!T&&ie.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),ie.jsx("span",{className:`text-sm font-mono font-semibold ${T?"text-primary":"text-green-600"}`,children:T?"On Hold":w})]})]})]}),ie.jsx("div",{className:"border-t border-gray-100 bg-gray-50/60 px-6 py-4",children:ie.jsxs("div",{className:"flex items-center justify-between gap-2 max-w-[260px] mx-auto",children:[ie.jsx(Bx,{onClick:Ge,active:b,activeColor:"red",title:b?"Unmute":"Mute",children:b?ie.jsx(tR,{className:"w-[18px] h-[18px]"}):ie.jsx(rR,{className:"w-[18px] h-[18px]"})}),ie.jsx(Bx,{onClick:ut,active:T,activeColor:"primary",title:T?"Resume":"Hold",children:T?ie.jsx(iR,{className:"w-[18px] h-[18px]"}):ie.jsx(XS,{className:"w-[18px] h-[18px]"})}),ie.jsx(Bx,{onClick:()=>j(Se=>!Se),active:P,activeColor:"primary",title:"Keypad",children:ie.jsx(eR,{className:"w-[18px] h-[18px]"})}),ie.jsx("button",{onClick:he,title:"End Call",className:"w-12 h-12 rounded-full bg-red-500 hover:bg-red-600 text-white flex items-center justify-center shadow-[0_4px_14px_rgba(239,68,68,0.4)] hover:shadow-[0_6px_18px_rgba(239,68,68,0.5)] transition-all active:scale-95",children:ie.jsx(Ev,{className:"w-5 h-5"})})]})})]});if(Z==="REGISTERED")return ie.jsxs(Kf,{error:B,children:[ie.jsxs("div",{className:"px-5 pt-5 pb-1",children:[ie.jsxs("div",{className:"relative flex items-center justify-center min-h-[56px] bg-gray-50 rounded-2xl border border-gray-100 px-10",children:[ie.jsx("input",{type:"text",value:f,onChange:Se=>p(Se.target.value.replace(/[^0-9+*#]/g,"")),onKeyDown:Se=>Se.key==="Enter"&&$(),className:"w-full text-center text-[28px] font-light text-gray-800 tracking-[0.12em] bg-transparent outline-none placeholder:text-gray-300 placeholder:text-2xl placeholder:font-normal",placeholder:"Enter number"}),f&&ie.jsx("button",{onClick:()=>p(Se=>Se.slice(0,-1)),onMouseDown:Se=>Se.preventDefault(),className:"absolute right-3 p-1.5 rounded-full text-gray-300 hover:text-gray-500 hover:bg-gray-200 transition-all",children:ie.jsx(JT,{className:"w-4 h-4"})})]}),q&&ie.jsx("p",{className:"text-center text-xs text-primary/70 font-medium mt-1.5 tracking-wide",children:q})]}),ie.jsx(JS,{onKeyPress:Se=>p(Te=>Te+Se)}),ie.jsx("div",{className:"px-5 pb-4 pt-1 flex justify-center",children:ie.jsxs("button",{onClick:$,disabled:!f.trim(),className:`
355
355
  flex items-center gap-3 px-10 py-3.5 rounded-full
356
356
  bg-gradient-to-r from-green-500 to-green-600
357
357
  hover:from-green-600 hover:to-green-700
@@ -386,10 +386,10 @@ React keys must be passed directly to JSX without using spread:
386
386
  \r
387
387
  `:r+=`Content-Length: 0\r
388
388
  \r
389
- `,r}}function z2(o){return o==="application/sdp"?"session":"render"}function bv(o){const r=typeof o=="string"?o:o.body,i=typeof o=="string"?"application/sdp":o.contentType;return{contentDisposition:z2(i),contentType:i,content:r}}function q2(o){return o&&typeof o.content=="string"&&typeof o.contentType=="string"&&o.contentDisposition===void 0?!0:typeof o.contentDisposition=="string"}function t0(o){let r,i,l;if(o instanceof Xf&&o.body){const f=o.parseHeader("Content-Disposition");r=f?f.type:void 0,i=o.parseHeader("Content-Type"),l=o.body}if(o instanceof vu&&o.body){const f=o.parseHeader("Content-Disposition");r=f?f.type:void 0,i=o.parseHeader("Content-Type"),l=o.body}if(o instanceof Dc&&o.body)if(r=o.getHeader("Content-Disposition"),i=o.getHeader("Content-Type"),typeof o.body=="string"){if(!i)throw new Error("Header content type header does not equal body content type.");l=o.body}else{if(i&&i!==o.body.contentType)throw new Error("Header content type header does not equal body content type.");i=o.body.contentType,l=o.body.body}if(q2(o)&&(r=o.contentDisposition,i=o.contentType,l=o.content),!!l){if(i&&!r&&(r=z2(i)),!r)throw new Error("Content disposition undefined.");if(!i)throw new Error("Content type undefined.");return{contentDisposition:r,contentType:i,content:l}}}var as;(function(o){o.Initial="Initial",o.Early="Early",o.AckWait="AckWait",o.Confirmed="Confirmed",o.Terminated="Terminated"})(as=as||(as={}));var Ye;(function(o){o.Initial="Initial",o.HaveLocalOffer="HaveLocalOffer",o.HaveRemoteOffer="HaveRemoteOffer",o.Stable="Stable",o.Closed="Closed"})(Ye=Ye||(Ye={}));const dl=500,WR=4e3,Y2=5e3,oi={T1:dl,T2:WR,TIMER_B:64*dl,TIMER_D:0*dl,TIMER_F:64*dl,TIMER_H:64*dl,TIMER_I:0*Y2,TIMER_J:0*dl,TIMER_K:0*Y2,TIMER_L:64*dl,TIMER_M:64*dl,TIMER_N:64*dl,PROVISIONAL_RESPONSE_INTERVAL:6e4};class gu extends bc{constructor(r){super(r||"Transaction state error.")}}var tt;(function(o){o.ACK="ACK",o.BYE="BYE",o.CANCEL="CANCEL",o.INFO="INFO",o.INVITE="INVITE",o.MESSAGE="MESSAGE",o.NOTIFY="NOTIFY",o.OPTIONS="OPTIONS",o.REGISTER="REGISTER",o.UPDATE="UPDATE",o.SUBSCRIBE="SUBSCRIBE",o.PUBLISH="PUBLISH",o.REFER="REFER",o.PRACK="PRACK"})(tt=tt||(tt={}));const mu=[tt.ACK,tt.BYE,tt.CANCEL,tt.INFO,tt.INVITE,tt.MESSAGE,tt.NOTIFY,tt.OPTIONS,tt.PRACK,tt.REFER,tt.REGISTER,tt.SUBSCRIBE];class V2{constructor(r){this.incomingMessageRequest=r}get request(){return this.incomingMessageRequest.message}accept(r){return this.incomingMessageRequest.accept(r),Promise.resolve()}reject(r){return this.incomingMessageRequest.reject(r),Promise.resolve()}}class Px{constructor(r){this.incomingNotifyRequest=r}get request(){return this.incomingNotifyRequest.message}accept(r){return this.incomingNotifyRequest.accept(r),Promise.resolve()}reject(r){return this.incomingNotifyRequest.reject(r),Promise.resolve()}}class GR{constructor(r,i){this.incomingReferRequest=r,this.session=i}get referTo(){const r=this.incomingReferRequest.message.parseHeader("refer-to");if(!(r instanceof ma))throw new Error("Failed to parse Refer-To header.");return r}get referredBy(){return this.incomingReferRequest.message.getHeader("referred-by")}get replaces(){const r=this.referTo.uri.getHeader("replaces");return r instanceof Array?r[0]:r}get request(){return this.incomingReferRequest.message}accept(r={statusCode:202}){return this.incomingReferRequest.accept(r),Promise.resolve()}reject(r){return this.incomingReferRequest.reject(r),Promise.resolve()}makeInviter(r){if(this.inviter)return this.inviter;const i=this.referTo.uri.clone();i.clearHeaders(),r=r||{};const l=(r.extraHeaders||[]).slice(),f=this.replaces;f&&l.push("Replaces: "+decodeURIComponent(f));const p=this.referredBy;return p&&l.push("Referred-By: "+p),r.extraHeaders=l,this.inviter=this.session.userAgent._makeInviter(i,r),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}}var xe;(function(o){o.Initial="Initial",o.Establishing="Establishing",o.Established="Established",o.Terminating="Terminating",o.Terminated="Terminated"})(xe=xe||(xe={}));class r0{constructor(r,i={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=xe.Initial,this.delegate=i.delegate,this._stateEventEmitter=new Jh,this._userAgent=r}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case xe.Initial:break;case xe.Establishing:break;case xe.Established:return new Promise(r=>{this._bye({onAccept:()=>r(),onRedirect:()=>r(),onReject:()=>r()})});case xe.Terminating:break;case xe.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(r){this._sessionDescriptionHandlerModifiers=r.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(r){this._sessionDescriptionHandlerOptions=Object.assign({},r)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(r){this._sessionDescriptionHandlerModifiersReInvite=r.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(r){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},r)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(r={}){let i="Session.bye() may only be called if established session.";switch(this.state){case xe.Initial:typeof this.cancel=="function"?(i+=" However Inviter.invite() has not yet been called.",i+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(i+=" However Invitation.accept() has not yet been called.",i+=" Perhaps you should have called Invitation.reject()?");break;case xe.Establishing:typeof this.cancel=="function"?(i+=" However a dialog does not yet exist.",i+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(i+=" However Invitation.accept() has not yet been called (or not yet resolved).",i+=" Perhaps you should have called Invitation.reject()?");break;case xe.Established:{const l=r.requestDelegate,f=this.copyRequestOptions(r.requestOptions);return this._bye(l,f)}case xe.Terminating:i+=" However this session is already terminating.",typeof this.cancel=="function"?i+=" Perhaps you have already called Inviter.cancel()?":typeof this.reject=="function"&&(i+=" Perhaps you have already called Session.bye()?");break;case xe.Terminated:i+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(i),Promise.reject(new Error(`Invalid session state ${this.state}`))}info(r={}){if(this.state!==xe.Established)return this.logger.error("Session.info() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const i=r.requestDelegate,l=this.copyRequestOptions(r.requestOptions);return this._info(i,l)}invite(r={}){if(this.logger.log("Session.invite"),this.state!==xe.Established)return Promise.reject(new Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new Hx("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=r.sessionDescriptionHandlerOptions);const i={onAccept:p=>{const v=t0(p.message);if(!v){this.logger.error("Received 2xx response to re-INVITE without a session description"),this.ackAndBye(p,400,"Missing session description"),this.stateTransition(xe.Terminated),this.pendingReinvite=!1;return}if(r.withoutSdp){const S={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(v,S).then(w=>{p.ack({body:w})}).catch(w=>{this.logger.error("Failed to handle offer in 2xx response to re-INVITE"),this.logger.error(w.message),this.state===xe.Terminated?p.ack():(this.ackAndBye(p,488,"Bad Media Description"),this.stateTransition(xe.Terminated))}).then(()=>{this.pendingReinvite=!1,r.requestDelegate&&r.requestDelegate.onAccept&&r.requestDelegate.onAccept(p)})}else{const S={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(v,S).then(()=>{p.ack()}).catch(w=>{this.logger.error("Failed to handle answer in 2xx response to re-INVITE"),this.logger.error(w.message),this.state!==xe.Terminated?(this.ackAndBye(p,488,"Bad Media Description"),this.stateTransition(xe.Terminated)):p.ack()}).then(()=>{this.pendingReinvite=!1,r.requestDelegate&&r.requestDelegate.onAccept&&r.requestDelegate.onAccept(p)})}},onProgress:p=>{},onRedirect:p=>{},onReject:p=>{this.logger.warn("Received a non-2xx response to re-INVITE"),this.pendingReinvite=!1,r.withoutSdp?r.requestDelegate&&r.requestDelegate.onReject&&r.requestDelegate.onReject(p):this.rollbackOffer().catch(v=>{if(this.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),this.logger.error(v.message),this.state!==xe.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const S=[];S.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:S}),this.stateTransition(xe.Terminated)}}).then(()=>{r.requestDelegate&&r.requestDelegate.onReject&&r.requestDelegate.onReject(p)})},onTrying:p=>{}},l=r.requestOptions||{};if(l.extraHeaders=(l.extraHeaders||[]).slice(),l.extraHeaders.push("Allow: "+mu.toString()),l.extraHeaders.push("Contact: "+this._contact),r.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(i,l))}const f={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(f).then(p=>{if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return l.body=p,this.dialog.invite(i,l)}).catch(p=>{throw this.logger.error(p.message),this.logger.error("Failed to send re-INVITE"),this.pendingReinvite=!1,p})}message(r={}){if(this.state!==xe.Established)return this.logger.error("Session.message() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const i=r.requestDelegate,l=this.copyRequestOptions(r.requestOptions);return this._message(i,l)}refer(r,i={}){if(this.state!==xe.Established)return this.logger.error("Session.refer() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));if(r instanceof r0&&!r.dialog)return this.logger.error("Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer)."),Promise.reject(new Error(`Invalid session state ${this.state}`));const l=i.requestDelegate,f=this.copyRequestOptions(i.requestOptions);return f.extraHeaders=f.extraHeaders?f.extraHeaders.concat(this.referExtraHeaders(this.referToString(r))):this.referExtraHeaders(this.referToString(r)),this._refer(i.onNotify,l,f)}_bye(r,i){if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));const l=this.dialog;switch(l.sessionState){case as.Initial:throw new Error(`Invalid dialog state ${l.sessionState}`);case as.Early:throw new Error(`Invalid dialog state ${l.sessionState}`);case as.AckWait:return this.stateTransition(xe.Terminating),new Promise(f=>{l.delegate={onAck:()=>{const p=l.bye(r,i);return this.stateTransition(xe.Terminated),f(p),Promise.resolve()},onAckTimeout:()=>{const p=l.bye(r,i);this.stateTransition(xe.Terminated),f(p)}}});case as.Confirmed:{const f=l.bye(r,i);return this.stateTransition(xe.Terminated),Promise.resolve(f)}case as.Terminated:throw new Error(`Invalid dialog state ${l.sessionState}`);default:throw new Error("Unrecognized state.")}}_info(r,i){return this.dialog?Promise.resolve(this.dialog.info(r,i)):Promise.reject(new Error("Session dialog undefined."))}_message(r,i){return this.dialog?Promise.resolve(this.dialog.message(r,i)):Promise.reject(new Error("Session dialog undefined."))}_refer(r,i,l){return this.dialog?(this.onNotify=r,Promise.resolve(this.dialog.refer(i,l))):Promise.reject(new Error("Session dialog undefined."))}ackAndBye(r,i,l){r.ack();const f=[];i&&f.push("Reason: "+this.getReasonHeaderValue(i,l)),r.session.bye(void 0,{extraHeaders:f})}onAckRequest(r){if(this.logger.log("Session.onAckRequest"),this.state!==xe.Established&&this.state!==xe.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();const i=this.dialog;if(!i)throw new Error("Dialog undefined.");const l={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){const f=new LR(r);this.delegate.onAck(f)}switch(this.pendingReinviteAck=!1,i.signalingState){case Ye.Initial:{this.logger.error(`Invalid signaling state ${i.signalingState}.`);const f=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return i.bye(void 0,{extraHeaders:f}),this.stateTransition(xe.Terminated),Promise.resolve()}case Ye.Stable:{const f=t0(r.message);return f?f.contentDisposition==="render"?(this._renderbody=f.content,this._rendertype=f.contentType,Promise.resolve()):f.contentDisposition!=="session"?Promise.resolve():this.setAnswer(f,l).catch(p=>{this.logger.error(p.message);const v=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];i.bye(void 0,{extraHeaders:v}),this.stateTransition(xe.Terminated)}):Promise.resolve()}case Ye.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${i.signalingState}.`);const f=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return i.bye(void 0,{extraHeaders:f}),this.stateTransition(xe.Terminated),Promise.resolve()}case Ye.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${i.signalingState}.`);const f=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return i.bye(void 0,{extraHeaders:f}),this.stateTransition(xe.Terminated),Promise.resolve()}case Ye.Closed:throw new Error(`Invalid signaling state ${i.signalingState}.`);default:throw new Error(`Invalid signaling state ${i.signalingState}.`)}}onByeRequest(r){if(this.logger.log("Session.onByeRequest"),this.state!==xe.Established){this.logger.error(`BYE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onBye){const i=new UR(r);this.delegate.onBye(i)}else r.accept();this.stateTransition(xe.Terminated)}onInfoRequest(r){if(this.logger.log("Session.onInfoRequest"),this.state!==xe.Established){this.logger.error(`INFO received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onInfo){const i=new zR(r);this.delegate.onInfo(i)}else r.accept()}onInviteRequest(r){if(this.logger.log("Session.onInviteRequest"),this.state!==xe.Established){this.logger.error(`INVITE received while in state ${this.state}, dropping request`);return}this.pendingReinviteAck=!0;const i=["Contact: "+this._contact];if(r.message.hasHeader("P-Asserted-Identity")){const f=r.message.getHeader("P-Asserted-Identity");if(!f)throw new Error("Header undefined.");this._assertedIdentity=zn.nameAddrHeaderParse(f)}const l={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(l).then(f=>{const p=r.accept({statusCode:200,extraHeaders:i,body:f});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(r.message,p.message,200)}).catch(f=>{if(this.logger.error(f.message),this.logger.error("Failed to handle to re-INVITE request"),!this.dialog)throw new Error("Dialog undefined.");if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===Ye.Stable){const p=r.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(r.message,p.message,488);return}this.rollbackOffer().then(()=>{const p=r.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(r.message,p.message,488)}).catch(p=>{this.logger.error(p.message),this.logger.error("Failed to rollback offer on re-INVITE request");const v=r.reject({statusCode:488});if(this.state!==xe.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const S=[];S.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:S}),this.stateTransition(xe.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(r.message,v.message,488)})})}onMessageRequest(r){if(this.logger.log("Session.onMessageRequest"),this.state!==xe.Established){this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onMessage){const i=new V2(r);this.delegate.onMessage(i)}else r.accept()}onNotifyRequest(r){if(this.logger.log("Session.onNotifyRequest"),this.state!==xe.Established){this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`);return}if(this.onNotify){const i=new Px(r);this.onNotify(i);return}if(this.delegate&&this.delegate.onNotify){const i=new Px(r);this.delegate.onNotify(i)}else r.accept()}onPrackRequest(r){if(this.logger.log("Session.onPrackRequest"),this.state!==xe.Established){this.logger.error(`PRACK received while in state ${this.state}, dropping request`);return}throw new Error("Unimplemented.")}onReferRequest(r){if(this.logger.log("Session.onReferRequest"),this.state!==xe.Established){this.logger.error(`REFER received while in state ${this.state}, dropping request`);return}if(!r.message.hasHeader("refer-to")){this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),r.reject();return}const i=new GR(r,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(i):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),i.accept().then(()=>i.makeInviter(this._referralInviterOptions).invite()).catch(l=>{this.logger.error(l.message)}))}generateResponseOfferAnswer(r,i){if(this.dialog)return this.generateResponseOfferAnswerInDialog(i);const l=t0(r.message);return!l||l.contentDisposition!=="session"?this.getOffer(i):this.setOfferAndGetAnswer(l,i)}generateResponseOfferAnswerInDialog(r){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case Ye.Initial:return this.getOffer(r);case Ye.HaveLocalOffer:return Promise.resolve(void 0);case Ye.HaveRemoteOffer:if(!this.dialog.offer)throw new Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,r);case Ye.Stable:return this.state!==xe.Established?Promise.resolve(void 0):this.getOffer(r);case Ye.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(r){const i=this.setupSessionDescriptionHandler(),l=r.sessionDescriptionHandlerOptions,f=r.sessionDescriptionHandlerModifiers;try{return i.getDescription(l,f).then(p=>bv(p)).catch(p=>{this.logger.error("Session.getOffer: SDH getDescription rejected...");const v=p instanceof Error?p:new Error("Session.getOffer unknown error.");throw this.logger.error(v.message),v})}catch(p){this.logger.error("Session.getOffer: SDH getDescription threw...");const v=p instanceof Error?p:new Error(p);return this.logger.error(v.message),Promise.reject(v)}}rollbackOffer(){const r=this.setupSessionDescriptionHandler();if(r.rollbackDescription===void 0)return Promise.resolve();try{return r.rollbackDescription().catch(i=>{this.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");const l=i instanceof Error?i:new Error("Session.rollbackOffer unknown error.");throw this.logger.error(l.message),l})}catch(i){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");const l=i instanceof Error?i:new Error(i);return this.logger.error(l.message),Promise.reject(l)}}setAnswer(r,i){const l=this.setupSessionDescriptionHandler(),f=i.sessionDescriptionHandlerOptions,p=i.sessionDescriptionHandlerModifiers;try{if(!l.hasDescription(r.contentType))return Promise.reject(new Mx)}catch(v){this.logger.error("Session.setAnswer: SDH hasDescription threw...");const S=v instanceof Error?v:new Error(v);return this.logger.error(S.message),Promise.reject(S)}try{return l.setDescription(r.content,f,p).catch(v=>{this.logger.error("Session.setAnswer: SDH setDescription rejected...");const S=v instanceof Error?v:new Error("Session.setAnswer unknown error.");throw this.logger.error(S.message),S})}catch(v){this.logger.error("Session.setAnswer: SDH setDescription threw...");const S=v instanceof Error?v:new Error(v);return this.logger.error(S.message),Promise.reject(S)}}setOfferAndGetAnswer(r,i){const l=this.setupSessionDescriptionHandler(),f=i.sessionDescriptionHandlerOptions,p=i.sessionDescriptionHandlerModifiers;try{if(!l.hasDescription(r.contentType))return Promise.reject(new Mx)}catch(v){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");const S=v instanceof Error?v:new Error(v);return this.logger.error(S.message),Promise.reject(S)}try{return l.setDescription(r.content,f,p).then(()=>l.getDescription(f,p)).then(v=>bv(v)).catch(v=>{this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");const S=v instanceof Error?v:new Error("Session.setOfferAndGetAnswer unknown error.");throw this.logger.error(S.message),S})}catch(v){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");const S=v instanceof Error?v:new Error(v);return this.logger.error(S.message),Promise.reject(S)}}setSessionDescriptionHandler(r){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=r}setupSessionDescriptionHandler(){var r;return this._sessionDescriptionHandler?this._sessionDescriptionHandler:(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),!((r=this.delegate)===null||r===void 0)&&r.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1),this._sessionDescriptionHandler)}stateTransition(r){const i=()=>{throw new Error(`Invalid state transition from ${this._state} to ${r}`)};switch(this._state){case xe.Initial:r!==xe.Establishing&&r!==xe.Established&&r!==xe.Terminating&&r!==xe.Terminated&&i();break;case xe.Establishing:r!==xe.Established&&r!==xe.Terminating&&r!==xe.Terminated&&i();break;case xe.Established:r!==xe.Terminating&&r!==xe.Terminated&&i();break;case xe.Terminating:r!==xe.Terminated&&i();break;case xe.Terminated:i();break;default:throw new Error("Unrecognized state.")}this._state=r,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),r===xe.Terminated&&this.dispose()}copyRequestOptions(r={}){const i=r.extraHeaders?r.extraHeaders.slice():void 0,l=r.body?{contentDisposition:r.body.contentDisposition||"render",contentType:r.body.contentType||"text/plain",content:r.body.content||""}:void 0;return{extraHeaders:i,body:l}}getReasonHeaderValue(r,i){const l=r;let f=Sv(r);return!f&&i&&(f=i),"SIP;cause="+l+';text="'+f+'"'}referExtraHeaders(r){const i=[];return i.push("Referred-By: <"+this.userAgent.configuration.uri+">"),i.push("Contact: "+this._contact),i.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),i.push("Refer-To: "+r),i}referToString(r){let i;if(r instanceof xo)i=r.toString();else{if(!r.dialog)throw new Error("Dialog undefined.");const l=r.remoteIdentity.friendlyName,f=r.dialog.remoteTarget.toString(),p=r.dialog.callId,v=r.dialog.remoteTag,S=r.dialog.localTag,w=encodeURIComponent(`${p};to-tag=${v};from-tag=${S}`);i=`"${l}" <${f}?Replaces=${w}>`}return i}}var Ps;(function(o){o.Required="Required",o.Supported="Supported",o.Unsupported="Unsupported"})(Ps=Ps||(Ps={}));const KR={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0};class QR extends r0{constructor(r,i){super(r),this.incomingInviteRequest=i,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100="none",this.rseq=Math.floor(Math.random()*1e4),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=r.getLogger("sip.Invitation");const l=this.incomingInviteRequest.message,f=l.getHeader("require");f&&f.toLowerCase().includes("100rel")&&(this.rel100="required");const p=l.getHeader("supported");if(p&&p.toLowerCase().includes("100rel")&&(this.rel100="supported"),l.toTag=i.toTag,typeof l.toTag!="string")throw new TypeError("toTag should have been a string.");if(this.userNoAnswerTimer=setTimeout(()=>{i.reject({statusCode:480}),this.stateTransition(xe.Terminated)},this.userAgent.configuration.noAnswerTimeout?this.userAgent.configuration.noAnswerTimeout*1e3:6e4),l.hasHeader("expires")){const w=Number(l.getHeader("expires")||0)*1e3;this.expiresTimer=setTimeout(()=>{this.state===xe.Initial&&(i.reject({statusCode:487}),this.stateTransition(xe.Terminated))},w)}const v=this.request.getHeader("P-Asserted-Identity");v&&(this._assertedIdentity=zn.nameAddrHeaderParse(v)),this._contact=this.userAgent.contact.toString();const S=l.parseHeader("Content-Disposition");S&&S.type==="render"&&(this._renderbody=l.body,this._rendertype=l.getHeader("Content-Type")),this._id=l.callId+l.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case xe.Initial:return this.reject().then(()=>super.dispose());case xe.Establishing:return this.reject().then(()=>super.dispose());case xe.Established:return super.dispose();case xe.Terminating:return super.dispose();case xe.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get autoSendAnInitialProvisionalResponse(){return this.rel100!=="required"&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(r={}){if(this.logger.log("Invitation.accept"),this.state!==xe.Initial){const i=new Error(`Invalid session state ${this.state}`);return this.logger.error(i.message),Promise.reject(i)}return r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),this.stateTransition(xe.Establishing),this.sendAccept(r).then(({message:i,session:l})=>{l.delegate={onAck:f=>this.onAckRequest(f),onAckTimeout:()=>this.onAckTimeout(),onBye:f=>this.onByeRequest(f),onInfo:f=>this.onInfoRequest(f),onInvite:f=>this.onInviteRequest(f),onMessage:f=>this.onMessageRequest(f),onNotify:f=>this.onNotifyRequest(f),onPrack:f=>this.onPrackRequest(f),onRefer:f=>this.onReferRequest(f)},this._dialog=l,this.stateTransition(xe.Established),this._replacee&&this._replacee._bye()}).catch(i=>this.handleResponseError(i))}progress(r={}){if(this.logger.log("Invitation.progress"),this.state!==xe.Initial){const l=new Error(`Invalid session state ${this.state}`);return this.logger.error(l.message),Promise.reject(l)}const i=r.statusCode||180;if(i<100||i>199)throw new TypeError("Invalid statusCode: "+i);return r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):r.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(l=>this.handleResponseError(l)):this.rel100!=="required"&&!(this.rel100==="supported"&&r.rel100)&&!(this.rel100==="supported"&&this.userAgent.configuration.sipExtension100rel===Ps.Required)?this.sendProgress(r).then(()=>{}).catch(l=>this.handleResponseError(l)):this.sendProgressReliableWaitForPrack(r).then(()=>{}).catch(l=>this.handleResponseError(l))}reject(r={}){if(this.logger.log("Invitation.reject"),this.state!==xe.Initial&&this.state!==xe.Establishing){const v=new Error(`Invalid session state ${this.state}`);return this.logger.error(v.message),Promise.reject(v)}const i=r.statusCode||480,l=r.reasonPhrase?r.reasonPhrase:Sv(i),f=r.extraHeaders||[];if(i<300||i>699)throw new TypeError("Invalid statusCode: "+i);const p=r.body?bv(r.body):void 0;return i<400?this.incomingInviteRequest.redirect([],{statusCode:i,reasonPhrase:l,extraHeaders:f,body:p}):this.incomingInviteRequest.reject({statusCode:i,reasonPhrase:l,extraHeaders:f,body:p}),this.stateTransition(xe.Terminated),Promise.resolve()}_onCancel(r){if(this.logger.log("Invitation._onCancel"),this.state!==xe.Initial&&this.state!==xe.Establishing){this.logger.error(`CANCEL received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onCancel){const i=new jR(r);this.delegate.onCancel(i)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(xe.Terminated)}handlePrackOfferAnswer(r){if(!this.dialog)throw new Error("Dialog undefined.");const i=t0(r.message);if(!i||i.contentDisposition!=="session")return Promise.resolve(void 0);const l={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case Ye.Initial:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case Ye.Stable:return this.setAnswer(i,l).then(()=>{});case Ye.HaveLocalOffer:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case Ye.HaveRemoteOffer:return this.setOfferAndGetAnswer(i,l);case Ye.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(r){let i=480;if(r instanceof Error?this.logger.error(r.message):this.logger.error(r),r instanceof Mx?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),i=415):r instanceof PR?this.logger.error("A session description handler occurred while sending response"):r instanceof Ix?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):r instanceof gu&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===xe.Initial||this.state===xe.Establishing)try{this.incomingInviteRequest.reject({statusCode:i}),this.stateTransition(xe.Terminated)}catch(l){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),l}if(this.isCanceled){this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.");return}throw r}onAckTimeout(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(xe.Terminated)}sendAccept(r={}){const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},l=r.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,i)).then(f=>this.incomingInviteRequest.accept({statusCode:200,body:f,extraHeaders:l})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,i).then(f=>this.incomingInviteRequest.accept({statusCode:200,body:f,extraHeaders:l})))}sendProgress(r={}){const i=r.statusCode||180,l=r.reasonPhrase,f=(r.extraHeaders||[]).slice(),p=r.body?bv(r.body):void 0;if(i===183&&!p)return this.sendProgressWithSDP(r);try{const v=this.incomingInviteRequest.progress({statusCode:i,reasonPhrase:l,extraHeaders:f,body:p});return this._dialog=v.session,Promise.resolve(v)}catch(v){return Promise.reject(v)}}sendProgressWithSDP(r={}){const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},l=r.statusCode||183,f=r.reasonPhrase,p=(r.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,i).then(v=>this.incomingInviteRequest.progress({statusCode:l,reasonPhrase:f,extraHeaders:p,body:v})).then(v=>(this._dialog=v.session,v))}sendProgressReliable(r={}){return r.extraHeaders=(r.extraHeaders||[]).slice(),r.extraHeaders.push("Require: 100rel"),r.extraHeaders.push("RSeq: "+Math.floor(Math.random()*1e4)),this.sendProgressWithSDP(r)}sendProgressReliableWaitForPrack(r={}){const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},l=r.statusCode||183,f=r.reasonPhrase,p=(r.extraHeaders||[]).slice();p.push("Require: 100rel"),p.push("RSeq: "+this.rseq++);let v;return new Promise((S,w)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,i).then(C=>(v=C,this.incomingInviteRequest.progress({statusCode:l,reasonPhrase:f,extraHeaders:p,body:v}))).then(C=>{this._dialog=C.session;let b,R;C.session.delegate={onPrack:O=>{b=O,clearTimeout(H),clearTimeout(z),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(b).then(B=>{try{R=b.accept({statusCode:200,body:B}),this.prackArrived(),S({prackRequest:b,prackResponse:R,progressResponse:C})}catch(U){w(U)}}).catch(B=>w(B)))}};const H=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(z),this.reject({statusCode:504}).then(()=>w(new Ix)).catch(O=>w(O)))},oi.T1*64),P=()=>{try{this.incomingInviteRequest.progress({statusCode:l,reasonPhrase:f,extraHeaders:p,body:v})}catch(O){this.waitingForPrack=!1,w(O);return}z=setTimeout(P,j*=2)};let j=oi.T1,z=setTimeout(P,j)}).catch(C=>{this.waitingForPrack=!1,w(C)})})}sendProgressTrying(){try{const r=this.incomingInviteRequest.trying();return Promise.resolve(r)}catch(r){return Promise.reject(r)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((r,i)=>{this.waitingForPrackResolve=r,this.waitingForPrackReject=i}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new Ix),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}}class W2 extends r0{constructor(r,i,l={}){super(r,l),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=r.getLogger("sip.Inviter"),this.earlyMedia=l.earlyMedia!==void 0?l.earlyMedia:this.earlyMedia,this.fromTag=wv(),this.inviteWithoutSdp=l.inviteWithoutSdp!==void 0?l.inviteWithoutSdp:this.inviteWithoutSdp;const f=Object.assign({},l);f.params=Object.assign({},l.params);const p=l.anonymous||!1,v=r.contact.toString({anonymous:p,outbound:p?!r.contact.tempGruu:!r.contact.pubGruu});p&&r.configuration.uri&&(f.params.fromDisplayName="Anonymous",f.params.fromUri="sip:anonymous@anonymous.invalid");let S=r.userAgentCore.configuration.aor;if(f.params.fromUri&&(S=typeof f.params.fromUri=="string"?zn.URIParse(f.params.fromUri):f.params.fromUri),!S)throw new TypeError("Invalid from URI: "+f.params.fromUri);let w=i;if(f.params.toUri&&(w=typeof f.params.toUri=="string"?zn.URIParse(f.params.toUri):f.params.toUri),!w)throw new TypeError("Invalid to URI: "+f.params.toUri);const C=Object.assign({},f.params);C.fromTag=this.fromTag;const b=(f.extraHeaders||[]).slice();p&&r.configuration.uri&&(b.push("P-Preferred-Identity: "+r.configuration.uri.toString()),b.push("Privacy: id")),b.push("Contact: "+v),b.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),r.configuration.sipExtension100rel===Ps.Required&&b.push("Require: 100rel"),r.configuration.sipExtensionReplaces===Ps.Required&&b.push("Require: replaces"),f.extraHeaders=b;const R=void 0;this.outgoingRequestMessage=r.userAgentCore.makeOutgoingRequestMessage(tt.INVITE,i,S,w,C,b,R),this._contact=v,this._referralInviterOptions=f,this._renderbody=l.renderbody,this._rendertype=l.rendertype,l.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=l.sessionDescriptionHandlerModifiers),l.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=l.sessionDescriptionHandlerOptions),l.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=l.sessionDescriptionHandlerModifiersReInvite),l.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=l.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case xe.Initial:return this.cancel().then(()=>super.dispose());case xe.Establishing:return this.cancel().then(()=>super.dispose());case xe.Established:return super.dispose();case xe.Terminating:return super.dispose();case xe.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(r={}){if(this.logger.log("Inviter.cancel"),this.state!==xe.Initial&&this.state!==xe.Establishing){const l=new Error(`Invalid session state ${this.state}`);return this.logger.error(l.message),Promise.reject(l)}this.isCanceled=!0,this.stateTransition(xe.Terminating);function i(l,f){if(l&&l<200||l>699)throw new TypeError("Invalid statusCode: "+l);if(l){const p=l,v=Sv(l)||f;return"SIP;cause="+p+';text="'+v+'"'}}if(this.outgoingInviteRequest){let l;r.statusCode&&r.reasonPhrase&&(l=i(r.statusCode,r.reasonPhrase)),this.outgoingInviteRequest.cancel(l,r)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(xe.Terminated);return Promise.resolve()}invite(r={}){if(this.logger.log("Inviter.invite"),this.state!==xe.Initial)return super.invite(r);if(r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),r.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(xe.Establishing),Promise.resolve(this.sendInvite(r));const i={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(i).then(l=>(this.outgoingRequestMessage.body={body:l.content,contentType:l.contentType},this.stateTransition(xe.Establishing),this.sendInvite(r))).catch(l=>{throw this.logger.log(l.message),this.state!==xe.Terminated&&this.stateTransition(xe.Terminated),l})}sendInvite(r={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:i=>{if(this.dialog){this.logger.log("Additional confirmed dialog, sending ACK and BYE"),this.ackAndBye(i);return}if(this.isCanceled){this.logger.log("Canceled session accepted, sending ACK and BYE"),this.ackAndBye(i),this.stateTransition(xe.Terminated);return}this.notifyReferer(i),this.onAccept(i).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{r.requestDelegate&&r.requestDelegate.onAccept&&r.requestDelegate.onAccept(i)})},onProgress:i=>{this.isCanceled||(this.notifyReferer(i),this.onProgress(i).catch(()=>{this.disposeEarlyMedia()}).then(()=>{r.requestDelegate&&r.requestDelegate.onProgress&&r.requestDelegate.onProgress(i)}))},onRedirect:i=>{this.notifyReferer(i),this.onRedirect(i),r.requestDelegate&&r.requestDelegate.onRedirect&&r.requestDelegate.onRedirect(i)},onReject:i=>{this.notifyReferer(i),this.onReject(i),r.requestDelegate&&r.requestDelegate.onReject&&r.requestDelegate.onReject(i)},onTrying:i=>{this.notifyReferer(i),this.onTrying(i),r.requestDelegate&&r.requestDelegate.onTrying&&r.requestDelegate.onTrying(i)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(r=>{r.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(r){if(!this._referred)return;if(!(this._referred instanceof r0))throw new Error("Referred session not instance of session");if(!this._referred.dialog)return;if(!r.message.statusCode)throw new Error("Status code undefined.");if(!r.message.reasonPhrase)throw new Error("Reason phrase undefined.");const i=r.message.statusCode,l=r.message.reasonPhrase,f=`SIP/2.0 ${i} ${l}`.trim(),p=this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:f}});p.delegate={onReject:()=>{this._referred=void 0}}}onAccept(r){if(this.logger.log("Inviter.onAccept"),this.state!==xe.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));const i=r.message,l=r.session;switch(i.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=zn.nameAddrHeaderParse(i.getHeader("P-Asserted-Identity"))),l.delegate={onAck:f=>this.onAckRequest(f),onBye:f=>this.onByeRequest(f),onInfo:f=>this.onInfoRequest(f),onInvite:f=>this.onInviteRequest(f),onMessage:f=>this.onMessageRequest(f),onNotify:f=>this.onNotifyRequest(f),onPrack:f=>this.onPrackRequest(f),onRefer:f=>this.onReferRequest(f)},this._dialog=l,l.signalingState){case Ye.Initial:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(r,400,"Missing session description"),this.stateTransition(xe.Terminated),Promise.reject(new Error("Bad Media Description"));case Ye.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(r,400,"Missing session description"),this.stateTransition(xe.Terminated),Promise.reject(new Error("Bad Media Description"));case Ye.HaveRemoteOffer:{if(!this._dialog.offer)throw new Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);const f={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,f).then(p=>{r.ack({body:p}),this.stateTransition(xe.Established)}).catch(p=>{throw this.ackAndBye(r,488,"Invalid session description"),this.stateTransition(xe.Terminated),p})}case Ye.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){const v=this.earlyMediaSessionDescriptionHandlers.get(l.id);if(!v)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(v),this.earlyMediaSessionDescriptionHandlers.delete(l.id),r.ack(),this.stateTransition(xe.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==l){this.earlyMedia&&this.logger.error("You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.");const v=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(v.message),this.ackAndBye(r,488,"Not Acceptable Here"),this.stateTransition(xe.Terminated),Promise.reject(v)}return r.ack(),this.stateTransition(xe.Established),Promise.resolve()}const f=l.answer;if(!f)throw new Error("Answer is undefined.");const p={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(f,p).then(()=>{let v;this._renderbody&&this._rendertype&&(v={body:{contentDisposition:"render",contentType:this._rendertype,content:this._renderbody}}),r.ack(v),this.stateTransition(xe.Established)}).catch(v=>{throw this.logger.error(v.message),this.ackAndBye(r,488,"Not Acceptable Here"),this.stateTransition(xe.Terminated),v})}case Ye.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onProgress(r){var i;if(this.logger.log("Inviter.onProgress"),this.state!==xe.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");const l=r.message,f=r.session;l.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=zn.nameAddrHeaderParse(l.getHeader("P-Asserted-Identity")));const p=l.getHeader("require"),v=l.getHeader("rseq"),w=!!(p&&p.includes("100rel")&&v?Number(v):void 0),C=[];switch(w&&C.push("RAck: "+l.getHeader("rseq")+" "+l.getHeader("cseq")),f.signalingState){case Ye.Initial:return w&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),r.prack({extraHeaders:C})),Promise.resolve();case Ye.HaveLocalOffer:return w&&r.prack({extraHeaders:C}),Promise.resolve();case Ye.HaveRemoteOffer:if(!w)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();{const b=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return!((i=this.delegate)===null||i===void 0)&&i.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(b,!0),this.earlyMediaSessionDescriptionHandlers.set(f.id,b),b.setDescription(l.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>b.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(R=>{const T={contentDisposition:"session",contentType:R.contentType,content:R.body};r.prack({extraHeaders:C,body:T})}).catch(R=>{throw this.stateTransition(xe.Terminated),R})}case Ye.Stable:if(w&&r.prack({extraHeaders:C}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=f;const b=f.answer;if(!b)throw new Error("Answer is undefined.");const R={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(b,R).catch(T=>{throw this.stateTransition(xe.Terminated),T})}return Promise.resolve();case Ye.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onRedirect(r){if(this.logger.log("Inviter.onRedirect"),this.state!==xe.Establishing&&this.state!==xe.Terminating){this.logger.error(`Redirect received while in state ${this.state}, dropping response`);return}this.stateTransition(xe.Terminated)}onReject(r){if(this.logger.log("Inviter.onReject"),this.state!==xe.Establishing&&this.state!==xe.Terminating){this.logger.error(`Reject received while in state ${this.state}, dropping response`);return}this.stateTransition(xe.Terminated)}onTrying(r){if(this.logger.log("Inviter.onTrying"),this.state!==xe.Establishing){this.logger.error(`Trying received while in state ${this.state}, dropping response`);return}}}var Cr;(function(o){o.Initial="Initial",o.Registered="Registered",o.Unregistered="Unregistered",o.Terminated="Terminated"})(Cr=Cr||(Cr={}));class Co{constructor(r,i={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=Cr.Initial,this._waiting=!1,this._stateEventEmitter=new Jh,this._waitingEventEmitter=new Jh,this.userAgent=r;const l=r.configuration.uri.clone();if(l.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},Co.defaultOptions()),{registrar:l}),Co.stripUndefinedProperties(i)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&zn.parse(this.options.instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");const f=this.options.registrar,p=this.options.params&&this.options.params.fromUri||r.userAgentCore.configuration.aor,v=this.options.params&&this.options.params.toUri||r.configuration.uri,S=this.options.params||{},w=(i.extraHeaders||[]).slice();if(this.request=r.userAgentCore.makeOutgoingRequestMessage(tt.REGISTER,f,p,v,S,w,void 0),this.expires=this.options.expires||Co.defaultExpires,this.expires<0)throw new Error("Invalid expires.");if(this.refreshFrequency=this.options.refreshFrequency||Co.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");this.logger=r.getLogger("sip.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(C=>{const b=this.options[C];switch(C){case"registrar":this.logger.log("· "+C+": "+b);break;default:this.logger.log("· "+C+": "+JSON.stringify(b))}})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:Co.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new xo("sip","anonymous","anonymous.invalid"),refreshFrequency:Co.defaultRefreshFrequency}}static stripUndefinedProperties(r){return Object.keys(r).reduce((i,l)=>(r[l]!==void 0&&(i[l]=r[l]),i),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(r=>{const i=()=>{if(!this.waiting&&this._state===Cr.Registered){this.stateChange.addListener(()=>{this.terminated(),r()},{once:!0}),this.unregister();return}this.terminated(),r()};this.waiting?this.waitingChange.addListener(()=>{i()},{once:!0}):i()}))}register(r={}){if(this.state===Cr.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const f=new Hx("REGISTER request already in progress, waiting for final response");return Promise.reject(f)}r.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),r.requestOptions));const i=(this.options.extraHeaders||[]).slice();i.push("Contact: "+this.generateContactHeader(this.expires)),i.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=i,this.waitingToggle(!0);const l=this.userAgent.userAgentCore.register(this.request,{onAccept:f=>{let p;f.message.hasHeader("expires")&&(p=Number(f.message.getHeader("expires"))),this._contacts=f.message.getHeaders("contact");let v=this._contacts.length;if(!v){this.logger.error("No Contact header in response to REGISTER, dropping response."),this.unregistered();return}let S;for(;v--;){if(S=f.message.parseHeader("contact",v),!S)throw new Error("Contact undefined");if(this.userAgent.contact.pubGruu&&U2(S.uri,this.userAgent.contact.pubGruu)){p=Number(S.getParam("expires"));break}if(this.userAgent.configuration.contactName===""){if(S.uri.user===this.userAgent.contact.uri.user){p=Number(S.getParam("expires"));break}}else if(U2(S.uri,this.userAgent.contact.uri)){p=Number(S.getParam("expires"));break}S=void 0}if(S===void 0){this.logger.error("No Contact header pointing to us, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(p===void 0){this.logger.error("Contact pointing to us is missing expires parameter, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(S.hasParam("temp-gruu")){const w=S.getParam("temp-gruu");w&&(this.userAgent.contact.tempGruu=zn.URIParse(w.replace(/"/g,"")))}if(S.hasParam("pub-gruu")){const w=S.getParam("pub-gruu");w&&(this.userAgent.contact.pubGruu=zn.URIParse(w.replace(/"/g,"")))}this.registered(p),r.requestDelegate&&r.requestDelegate.onAccept&&r.requestDelegate.onAccept(f),this.waitingToggle(!1)},onProgress:f=>{r.requestDelegate&&r.requestDelegate.onProgress&&r.requestDelegate.onProgress(f)},onRedirect:f=>{this.logger.error("Redirect received. Not supported."),this.unregistered(),r.requestDelegate&&r.requestDelegate.onRedirect&&r.requestDelegate.onRedirect(f),this.waitingToggle(!1)},onReject:f=>{if(f.message.statusCode===423){if(!f.message.hasHeader("min-expires")){this.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),this.unregistered(),this.waitingToggle(!1);return}this.expires=Number(f.message.getHeader("min-expires")),this.waitingToggle(!1),this.register();return}this.logger.warn(`Failed to register, status code ${f.message.statusCode}`);let p=NaN;if(f.message.statusCode===500||f.message.statusCode===503){const v=f.message.getHeader("retry-after");v&&(p=Number.parseInt(v,void 0))}this._retryAfter=isNaN(p)?void 0:p,this.unregistered(),r.requestDelegate&&r.requestDelegate.onReject&&r.requestDelegate.onReject(f),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:f=>{r.requestDelegate&&r.requestDelegate.onTrying&&r.requestDelegate.onTrying(f)}});return Promise.resolve(l)}unregister(r={}){if(this.state===Cr.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==Cr.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const f=new Hx("REGISTER request already in progress, waiting for final response");return Promise.reject(f)}this._state!==Cr.Registered&&!r.all&&this.logger.warn("Not currently registered, but sending an unregister anyway.");const i=(r.requestOptions&&r.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=i,r.all?(i.push("Contact: *"),i.push("Expires: 0")):i.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);const l=this.userAgent.userAgentCore.register(this.request,{onAccept:f=>{this._contacts=f.message.getHeaders("contact"),this.unregistered(),r.requestDelegate&&r.requestDelegate.onAccept&&r.requestDelegate.onAccept(f),this.waitingToggle(!1)},onProgress:f=>{r.requestDelegate&&r.requestDelegate.onProgress&&r.requestDelegate.onProgress(f)},onRedirect:f=>{this.logger.error("Unregister redirected. Not currently supported."),this.unregistered(),r.requestDelegate&&r.requestDelegate.onRedirect&&r.requestDelegate.onRedirect(f),this.waitingToggle(!1)},onReject:f=>{this.logger.error(`Unregister rejected with status code ${f.message.statusCode}`),this.unregistered(),r.requestDelegate&&r.requestDelegate.onReject&&r.requestDelegate.onReject(f),this.waitingToggle(!1)},onTrying:f=>{r.requestDelegate&&r.requestDelegate.onTrying&&r.requestDelegate.onTrying(f)}});return Promise.resolve(l)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(r){let i=this.userAgent.contact.toString({register:!0});return this.options.regId&&this.options.instanceId&&(i+=";reg-id="+this.options.regId,i+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach(l=>{i+=";"+l}),i+=";expires="+r,i}registered(r){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*r*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn("Registration expired"),this.unregistered()},r*1e3),this._state!==Cr.Registered&&this.stateTransition(Cr.Registered)}unregistered(){this.clearTimers(),this._state!==Cr.Unregistered&&this.stateTransition(Cr.Unregistered)}terminated(){this.clearTimers(),this._state!==Cr.Terminated&&this.stateTransition(Cr.Terminated)}stateTransition(r){const i=()=>{throw new Error(`Invalid state transition from ${this._state} to ${r}`)};switch(this._state){case Cr.Initial:r!==Cr.Registered&&r!==Cr.Unregistered&&r!==Cr.Terminated&&i();break;case Cr.Registered:r!==Cr.Unregistered&&r!==Cr.Terminated&&i();break;case Cr.Unregistered:r!==Cr.Registered&&r!==Cr.Terminated&&i();break;case Cr.Terminated:i();break;default:throw new Error("Unrecognized state.")}this._state=r,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),r===Cr.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(r){if(this._waiting===r)throw new Error(`Invalid waiting transition from ${this._waiting} to ${r}`);this._waiting=r,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){let r="An attempt was made to send a REGISTER request while a prior one was still in progress.";r+=" RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response",r+=" from the registrar for the previous one or the previous REGISTER request has timed out.",r+=" Note that if the transport disconnects, you still must wait for the prior request to time out before",r+=" sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.",this.logger.warn(r)}stateError(){let i=`An attempt was made to send a REGISTER request when the Registerer ${this.state===Cr.Terminated?"is in 'Terminated' state":"has been disposed"}.`;i+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",i+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(i)}}Co.defaultExpires=600,Co.defaultRefreshFrequency=99;var vr;(function(o){o.Initial="Initial",o.NotifyWait="NotifyWait",o.Pending="Pending",o.Active="Active",o.Terminated="Terminated"})(vr=vr||(vr={}));var At;(function(o){o.Connecting="Connecting",o.Connected="Connected",o.Disconnecting="Disconnecting",o.Disconnected="Disconnected"})(At=At||(At={}));var pi;(function(o){o.Started="Started",o.Stopped="Stopped"})(pi=pi||(pi={}));class Hn{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(r,i=!1){return this.onePassHasher.start().appendStr(r).end(i)}static hashAsciiStr(r,i=!1){return this.onePassHasher.start().appendAsciiStr(r).end(i)}static _hex(r){const i=Hn.hexChars,l=Hn.hexOut;let f,p,v,S;for(S=0;S<4;S+=1)for(p=S*8,f=r[S],v=0;v<8;v+=2)l[p+1+v]=i.charAt(f&15),f>>>=4,l[p+0+v]=i.charAt(f&15),f>>>=4;return l.join("")}static _md5cycle(r,i){let l=r[0],f=r[1],p=r[2],v=r[3];l+=(f&p|~f&v)+i[0]-680876936|0,l=(l<<7|l>>>25)+f|0,v+=(l&f|~l&p)+i[1]-389564586|0,v=(v<<12|v>>>20)+l|0,p+=(v&l|~v&f)+i[2]+606105819|0,p=(p<<17|p>>>15)+v|0,f+=(p&v|~p&l)+i[3]-1044525330|0,f=(f<<22|f>>>10)+p|0,l+=(f&p|~f&v)+i[4]-176418897|0,l=(l<<7|l>>>25)+f|0,v+=(l&f|~l&p)+i[5]+1200080426|0,v=(v<<12|v>>>20)+l|0,p+=(v&l|~v&f)+i[6]-1473231341|0,p=(p<<17|p>>>15)+v|0,f+=(p&v|~p&l)+i[7]-45705983|0,f=(f<<22|f>>>10)+p|0,l+=(f&p|~f&v)+i[8]+1770035416|0,l=(l<<7|l>>>25)+f|0,v+=(l&f|~l&p)+i[9]-1958414417|0,v=(v<<12|v>>>20)+l|0,p+=(v&l|~v&f)+i[10]-42063|0,p=(p<<17|p>>>15)+v|0,f+=(p&v|~p&l)+i[11]-1990404162|0,f=(f<<22|f>>>10)+p|0,l+=(f&p|~f&v)+i[12]+1804603682|0,l=(l<<7|l>>>25)+f|0,v+=(l&f|~l&p)+i[13]-40341101|0,v=(v<<12|v>>>20)+l|0,p+=(v&l|~v&f)+i[14]-1502002290|0,p=(p<<17|p>>>15)+v|0,f+=(p&v|~p&l)+i[15]+1236535329|0,f=(f<<22|f>>>10)+p|0,l+=(f&v|p&~v)+i[1]-165796510|0,l=(l<<5|l>>>27)+f|0,v+=(l&p|f&~p)+i[6]-1069501632|0,v=(v<<9|v>>>23)+l|0,p+=(v&f|l&~f)+i[11]+643717713|0,p=(p<<14|p>>>18)+v|0,f+=(p&l|v&~l)+i[0]-373897302|0,f=(f<<20|f>>>12)+p|0,l+=(f&v|p&~v)+i[5]-701558691|0,l=(l<<5|l>>>27)+f|0,v+=(l&p|f&~p)+i[10]+38016083|0,v=(v<<9|v>>>23)+l|0,p+=(v&f|l&~f)+i[15]-660478335|0,p=(p<<14|p>>>18)+v|0,f+=(p&l|v&~l)+i[4]-405537848|0,f=(f<<20|f>>>12)+p|0,l+=(f&v|p&~v)+i[9]+568446438|0,l=(l<<5|l>>>27)+f|0,v+=(l&p|f&~p)+i[14]-1019803690|0,v=(v<<9|v>>>23)+l|0,p+=(v&f|l&~f)+i[3]-187363961|0,p=(p<<14|p>>>18)+v|0,f+=(p&l|v&~l)+i[8]+1163531501|0,f=(f<<20|f>>>12)+p|0,l+=(f&v|p&~v)+i[13]-1444681467|0,l=(l<<5|l>>>27)+f|0,v+=(l&p|f&~p)+i[2]-51403784|0,v=(v<<9|v>>>23)+l|0,p+=(v&f|l&~f)+i[7]+1735328473|0,p=(p<<14|p>>>18)+v|0,f+=(p&l|v&~l)+i[12]-1926607734|0,f=(f<<20|f>>>12)+p|0,l+=(f^p^v)+i[5]-378558|0,l=(l<<4|l>>>28)+f|0,v+=(l^f^p)+i[8]-2022574463|0,v=(v<<11|v>>>21)+l|0,p+=(v^l^f)+i[11]+1839030562|0,p=(p<<16|p>>>16)+v|0,f+=(p^v^l)+i[14]-35309556|0,f=(f<<23|f>>>9)+p|0,l+=(f^p^v)+i[1]-1530992060|0,l=(l<<4|l>>>28)+f|0,v+=(l^f^p)+i[4]+1272893353|0,v=(v<<11|v>>>21)+l|0,p+=(v^l^f)+i[7]-155497632|0,p=(p<<16|p>>>16)+v|0,f+=(p^v^l)+i[10]-1094730640|0,f=(f<<23|f>>>9)+p|0,l+=(f^p^v)+i[13]+681279174|0,l=(l<<4|l>>>28)+f|0,v+=(l^f^p)+i[0]-358537222|0,v=(v<<11|v>>>21)+l|0,p+=(v^l^f)+i[3]-722521979|0,p=(p<<16|p>>>16)+v|0,f+=(p^v^l)+i[6]+76029189|0,f=(f<<23|f>>>9)+p|0,l+=(f^p^v)+i[9]-640364487|0,l=(l<<4|l>>>28)+f|0,v+=(l^f^p)+i[12]-421815835|0,v=(v<<11|v>>>21)+l|0,p+=(v^l^f)+i[15]+530742520|0,p=(p<<16|p>>>16)+v|0,f+=(p^v^l)+i[2]-995338651|0,f=(f<<23|f>>>9)+p|0,l+=(p^(f|~v))+i[0]-198630844|0,l=(l<<6|l>>>26)+f|0,v+=(f^(l|~p))+i[7]+1126891415|0,v=(v<<10|v>>>22)+l|0,p+=(l^(v|~f))+i[14]-1416354905|0,p=(p<<15|p>>>17)+v|0,f+=(v^(p|~l))+i[5]-57434055|0,f=(f<<21|f>>>11)+p|0,l+=(p^(f|~v))+i[12]+1700485571|0,l=(l<<6|l>>>26)+f|0,v+=(f^(l|~p))+i[3]-1894986606|0,v=(v<<10|v>>>22)+l|0,p+=(l^(v|~f))+i[10]-1051523|0,p=(p<<15|p>>>17)+v|0,f+=(v^(p|~l))+i[1]-2054922799|0,f=(f<<21|f>>>11)+p|0,l+=(p^(f|~v))+i[8]+1873313359|0,l=(l<<6|l>>>26)+f|0,v+=(f^(l|~p))+i[15]-30611744|0,v=(v<<10|v>>>22)+l|0,p+=(l^(v|~f))+i[6]-1560198380|0,p=(p<<15|p>>>17)+v|0,f+=(v^(p|~l))+i[13]+1309151649|0,f=(f<<21|f>>>11)+p|0,l+=(p^(f|~v))+i[4]-145523070|0,l=(l<<6|l>>>26)+f|0,v+=(f^(l|~p))+i[11]-1120210379|0,v=(v<<10|v>>>22)+l|0,p+=(l^(v|~f))+i[2]+718787259|0,p=(p<<15|p>>>17)+v|0,f+=(v^(p|~l))+i[9]-343485551|0,f=(f<<21|f>>>11)+p|0,r[0]=l+r[0]|0,r[1]=f+r[1]|0,r[2]=p+r[2]|0,r[3]=v+r[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(Hn.stateIdentity),this}appendStr(r){const i=this._buffer8,l=this._buffer32;let f=this._bufferLength,p,v;for(v=0;v<r.length;v+=1){if(p=r.charCodeAt(v),p<128)i[f++]=p;else if(p<2048)i[f++]=(p>>>6)+192,i[f++]=p&63|128;else if(p<55296||p>56319)i[f++]=(p>>>12)+224,i[f++]=p>>>6&63|128,i[f++]=p&63|128;else{if(p=(p-55296)*1024+(r.charCodeAt(++v)-56320)+65536,p>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");i[f++]=(p>>>18)+240,i[f++]=p>>>12&63|128,i[f++]=p>>>6&63|128,i[f++]=p&63|128}f>=64&&(this._dataLength+=64,Hn._md5cycle(this._state,l),f-=64,l[0]=l[16])}return this._bufferLength=f,this}appendAsciiStr(r){const i=this._buffer8,l=this._buffer32;let f=this._bufferLength,p,v=0;for(;;){for(p=Math.min(r.length-v,64-f);p--;)i[f++]=r.charCodeAt(v++);if(f<64)break;this._dataLength+=64,Hn._md5cycle(this._state,l),f=0}return this._bufferLength=f,this}appendByteArray(r){const i=this._buffer8,l=this._buffer32;let f=this._bufferLength,p,v=0;for(;;){for(p=Math.min(r.length-v,64-f);p--;)i[f++]=r[v++];if(f<64)break;this._dataLength+=64,Hn._md5cycle(this._state,l),f=0}return this._bufferLength=f,this}getState(){const r=this,i=r._state;return{buffer:String.fromCharCode.apply(null,r._buffer8),buflen:r._bufferLength,length:r._dataLength,state:[i[0],i[1],i[2],i[3]]}}setState(r){const i=r.buffer,l=r.state,f=this._state;let p;for(this._dataLength=r.length,this._bufferLength=r.buflen,f[0]=l[0],f[1]=l[1],f[2]=l[2],f[3]=l[3],p=0;p<i.length;p+=1)this._buffer8[p]=i.charCodeAt(p)}end(r=!1){const i=this._bufferLength,l=this._buffer8,f=this._buffer32,p=(i>>2)+1;let v;if(this._dataLength+=i,l[i]=128,l[i+1]=l[i+2]=l[i+3]=0,f.set(Hn.buffer32Identity.subarray(p),p),i>55&&(Hn._md5cycle(this._state,f),f.set(Hn.buffer32Identity)),v=this._dataLength*8,v<=4294967295)f[14]=v;else{const S=v.toString(16).match(/(.*?)(.{0,8})$/);if(S===null)return;const w=parseInt(S[2],16),C=parseInt(S[1],16)||0;f[14]=w,f[15]=C}return Hn._md5cycle(this._state,f),r?this._state:Hn._hex(this._state)}}Hn.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),Hn.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Hn.hexChars="0123456789abcdef",Hn.hexOut=[],Hn.onePassHasher=new Hn,Hn.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592"&&console.error("Md5 self test failed.");function yu(o){return Hn.hashStr(o)}class XR{constructor(r,i,l,f){this.logger=r.getLogger("sipjs.digestauthentication"),this.username=l,this.password=f,this.ha1=i,this.nc=0,this.ncHex="00000000"}authenticate(r,i,l){if(this.algorithm=i.algorithm,this.realm=i.realm,this.nonce=i.nonce,this.opaque=i.opaque,this.stale=i.stale,this.algorithm){if(this.algorithm!=="MD5")return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(i.qop)if(i.qop.indexOf("auth")>-1)this.qop="auth";else if(i.qop.indexOf("auth-int")>-1)this.qop="auth-int";else return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;else this.qop=void 0;return this.method=r.method,this.uri=r.ruri,this.cnonce=_c(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(l),!0}toString(){const r=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return r.push("algorithm="+this.algorithm),r.push('username="'+this.username+'"'),r.push('realm="'+this.realm+'"'),r.push('nonce="'+this.nonce+'"'),r.push('uri="'+this.uri+'"'),r.push('response="'+this.response+'"'),this.opaque&&r.push('opaque="'+this.opaque+'"'),this.qop&&(r.push("qop="+this.qop),r.push('cnonce="'+this.cnonce+'"'),r.push("nc="+this.ncHex)),"Digest "+r.join(", ")}updateNcHex(){const r=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-r.length)+r}calculateResponse(r){let i,l;i=this.ha1,(i===""||i===void 0)&&(i=yu(this.username+":"+this.realm+":"+this.password)),this.qop==="auth"?(l=yu(this.method+":"+this.uri),this.response=yu(i+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+l)):this.qop==="auth-int"?(l=yu(this.method+":"+this.uri+":"+yu(r||"")),this.response=yu(i+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+l)):this.qop===void 0&&(l=yu(this.method+":"+this.uri),this.response=yu(i+":"+this.nonce+":"+l))}}var li;(function(o){o[o.error=0]="error",o[o.warn=1]="warn",o[o.log=2]="log",o[o.debug=3]="debug"})(li=li||(li={}));class G2{constructor(r,i,l){this.logger=r,this.category=i,this.label=l}error(r){this.genericLog(li.error,r)}warn(r){this.genericLog(li.warn,r)}log(r){this.genericLog(li.log,r)}debug(r){this.genericLog(li.debug,r)}genericLog(r,i){this.logger.genericLog(r,this.category,this.label,i)}get level(){return this.logger.level}set level(r){this.logger.level=r}}class ZR{constructor(){this.builtinEnabled=!0,this._level=li.log,this.loggers={},this.logger=this.getLogger("sip:loggerfactory")}get level(){return this._level}set level(r){r>=0&&r<=3?this._level=r:r>3?this._level=3:li.hasOwnProperty(r)?this._level=r:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(r))}get connector(){return this._connector}set connector(r){r?typeof r=="function"?this._connector=r:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(r)):this._connector=void 0}getLogger(r,i){if(i&&this.level===3)return new G2(this,r,i);if(this.loggers[r])return this.loggers[r];{const l=new G2(this,r);return this.loggers[r]=l,l}}genericLog(r,i,l,f){this.level>=r&&this.builtinEnabled&&this.print(r,i,l,f),this.connector&&this.connector(li[r],i,l,f)}print(r,i,l,f){if(typeof f=="string"){const p=[new Date,i];l&&p.push(l),f=p.concat(f).join(" | ")}switch(r){case li.error:console.error(f);break;case li.warn:console.warn(f);break;case li.log:console.log(f);break;case li.debug:console.debug(f);break}}}var _v;(function(o){function r(f,p){let v=p,S=0,w=0;if(f.substring(v,v+2).match(/(^\r\n)/))return-2;for(;S===0;){if(w=f.indexOf(`\r
389
+ `,r}}function z2(o){return o==="application/sdp"?"session":"render"}function bv(o){const r=typeof o=="string"?o:o.body,i=typeof o=="string"?"application/sdp":o.contentType;return{contentDisposition:z2(i),contentType:i,content:r}}function q2(o){return o&&typeof o.content=="string"&&typeof o.contentType=="string"&&o.contentDisposition===void 0?!0:typeof o.contentDisposition=="string"}function t0(o){let r,i,l;if(o instanceof Xf&&o.body){const f=o.parseHeader("Content-Disposition");r=f?f.type:void 0,i=o.parseHeader("Content-Type"),l=o.body}if(o instanceof vu&&o.body){const f=o.parseHeader("Content-Disposition");r=f?f.type:void 0,i=o.parseHeader("Content-Type"),l=o.body}if(o instanceof Dc&&o.body)if(r=o.getHeader("Content-Disposition"),i=o.getHeader("Content-Type"),typeof o.body=="string"){if(!i)throw new Error("Header content type header does not equal body content type.");l=o.body}else{if(i&&i!==o.body.contentType)throw new Error("Header content type header does not equal body content type.");i=o.body.contentType,l=o.body.body}if(q2(o)&&(r=o.contentDisposition,i=o.contentType,l=o.content),!!l){if(i&&!r&&(r=z2(i)),!r)throw new Error("Content disposition undefined.");if(!i)throw new Error("Content type undefined.");return{contentDisposition:r,contentType:i,content:l}}}var as;(function(o){o.Initial="Initial",o.Early="Early",o.AckWait="AckWait",o.Confirmed="Confirmed",o.Terminated="Terminated"})(as=as||(as={}));var Ye;(function(o){o.Initial="Initial",o.HaveLocalOffer="HaveLocalOffer",o.HaveRemoteOffer="HaveRemoteOffer",o.Stable="Stable",o.Closed="Closed"})(Ye=Ye||(Ye={}));const dl=500,WR=4e3,Y2=5e3,oi={T1:dl,T2:WR,TIMER_B:64*dl,TIMER_D:0*dl,TIMER_F:64*dl,TIMER_H:64*dl,TIMER_I:0*Y2,TIMER_J:0*dl,TIMER_K:0*Y2,TIMER_L:64*dl,TIMER_M:64*dl,TIMER_N:64*dl,PROVISIONAL_RESPONSE_INTERVAL:6e4};class gu extends bc{constructor(r){super(r||"Transaction state error.")}}var rt;(function(o){o.ACK="ACK",o.BYE="BYE",o.CANCEL="CANCEL",o.INFO="INFO",o.INVITE="INVITE",o.MESSAGE="MESSAGE",o.NOTIFY="NOTIFY",o.OPTIONS="OPTIONS",o.REGISTER="REGISTER",o.UPDATE="UPDATE",o.SUBSCRIBE="SUBSCRIBE",o.PUBLISH="PUBLISH",o.REFER="REFER",o.PRACK="PRACK"})(rt=rt||(rt={}));const mu=[rt.ACK,rt.BYE,rt.CANCEL,rt.INFO,rt.INVITE,rt.MESSAGE,rt.NOTIFY,rt.OPTIONS,rt.PRACK,rt.REFER,rt.REGISTER,rt.SUBSCRIBE];class V2{constructor(r){this.incomingMessageRequest=r}get request(){return this.incomingMessageRequest.message}accept(r){return this.incomingMessageRequest.accept(r),Promise.resolve()}reject(r){return this.incomingMessageRequest.reject(r),Promise.resolve()}}class Px{constructor(r){this.incomingNotifyRequest=r}get request(){return this.incomingNotifyRequest.message}accept(r){return this.incomingNotifyRequest.accept(r),Promise.resolve()}reject(r){return this.incomingNotifyRequest.reject(r),Promise.resolve()}}class GR{constructor(r,i){this.incomingReferRequest=r,this.session=i}get referTo(){const r=this.incomingReferRequest.message.parseHeader("refer-to");if(!(r instanceof ma))throw new Error("Failed to parse Refer-To header.");return r}get referredBy(){return this.incomingReferRequest.message.getHeader("referred-by")}get replaces(){const r=this.referTo.uri.getHeader("replaces");return r instanceof Array?r[0]:r}get request(){return this.incomingReferRequest.message}accept(r={statusCode:202}){return this.incomingReferRequest.accept(r),Promise.resolve()}reject(r){return this.incomingReferRequest.reject(r),Promise.resolve()}makeInviter(r){if(this.inviter)return this.inviter;const i=this.referTo.uri.clone();i.clearHeaders(),r=r||{};const l=(r.extraHeaders||[]).slice(),f=this.replaces;f&&l.push("Replaces: "+decodeURIComponent(f));const p=this.referredBy;return p&&l.push("Referred-By: "+p),r.extraHeaders=l,this.inviter=this.session.userAgent._makeInviter(i,r),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}}var xe;(function(o){o.Initial="Initial",o.Establishing="Establishing",o.Established="Established",o.Terminating="Terminating",o.Terminated="Terminated"})(xe=xe||(xe={}));class r0{constructor(r,i={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=xe.Initial,this.delegate=i.delegate,this._stateEventEmitter=new Jh,this._userAgent=r}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case xe.Initial:break;case xe.Establishing:break;case xe.Established:return new Promise(r=>{this._bye({onAccept:()=>r(),onRedirect:()=>r(),onReject:()=>r()})});case xe.Terminating:break;case xe.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(r){this._sessionDescriptionHandlerModifiers=r.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(r){this._sessionDescriptionHandlerOptions=Object.assign({},r)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(r){this._sessionDescriptionHandlerModifiersReInvite=r.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(r){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},r)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(r={}){let i="Session.bye() may only be called if established session.";switch(this.state){case xe.Initial:typeof this.cancel=="function"?(i+=" However Inviter.invite() has not yet been called.",i+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(i+=" However Invitation.accept() has not yet been called.",i+=" Perhaps you should have called Invitation.reject()?");break;case xe.Establishing:typeof this.cancel=="function"?(i+=" However a dialog does not yet exist.",i+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(i+=" However Invitation.accept() has not yet been called (or not yet resolved).",i+=" Perhaps you should have called Invitation.reject()?");break;case xe.Established:{const l=r.requestDelegate,f=this.copyRequestOptions(r.requestOptions);return this._bye(l,f)}case xe.Terminating:i+=" However this session is already terminating.",typeof this.cancel=="function"?i+=" Perhaps you have already called Inviter.cancel()?":typeof this.reject=="function"&&(i+=" Perhaps you have already called Session.bye()?");break;case xe.Terminated:i+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(i),Promise.reject(new Error(`Invalid session state ${this.state}`))}info(r={}){if(this.state!==xe.Established)return this.logger.error("Session.info() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const i=r.requestDelegate,l=this.copyRequestOptions(r.requestOptions);return this._info(i,l)}invite(r={}){if(this.logger.log("Session.invite"),this.state!==xe.Established)return Promise.reject(new Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new Hx("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=r.sessionDescriptionHandlerOptions);const i={onAccept:p=>{const v=t0(p.message);if(!v){this.logger.error("Received 2xx response to re-INVITE without a session description"),this.ackAndBye(p,400,"Missing session description"),this.stateTransition(xe.Terminated),this.pendingReinvite=!1;return}if(r.withoutSdp){const S={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(v,S).then(w=>{p.ack({body:w})}).catch(w=>{this.logger.error("Failed to handle offer in 2xx response to re-INVITE"),this.logger.error(w.message),this.state===xe.Terminated?p.ack():(this.ackAndBye(p,488,"Bad Media Description"),this.stateTransition(xe.Terminated))}).then(()=>{this.pendingReinvite=!1,r.requestDelegate&&r.requestDelegate.onAccept&&r.requestDelegate.onAccept(p)})}else{const S={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(v,S).then(()=>{p.ack()}).catch(w=>{this.logger.error("Failed to handle answer in 2xx response to re-INVITE"),this.logger.error(w.message),this.state!==xe.Terminated?(this.ackAndBye(p,488,"Bad Media Description"),this.stateTransition(xe.Terminated)):p.ack()}).then(()=>{this.pendingReinvite=!1,r.requestDelegate&&r.requestDelegate.onAccept&&r.requestDelegate.onAccept(p)})}},onProgress:p=>{},onRedirect:p=>{},onReject:p=>{this.logger.warn("Received a non-2xx response to re-INVITE"),this.pendingReinvite=!1,r.withoutSdp?r.requestDelegate&&r.requestDelegate.onReject&&r.requestDelegate.onReject(p):this.rollbackOffer().catch(v=>{if(this.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),this.logger.error(v.message),this.state!==xe.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const S=[];S.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:S}),this.stateTransition(xe.Terminated)}}).then(()=>{r.requestDelegate&&r.requestDelegate.onReject&&r.requestDelegate.onReject(p)})},onTrying:p=>{}},l=r.requestOptions||{};if(l.extraHeaders=(l.extraHeaders||[]).slice(),l.extraHeaders.push("Allow: "+mu.toString()),l.extraHeaders.push("Contact: "+this._contact),r.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(i,l))}const f={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(f).then(p=>{if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return l.body=p,this.dialog.invite(i,l)}).catch(p=>{throw this.logger.error(p.message),this.logger.error("Failed to send re-INVITE"),this.pendingReinvite=!1,p})}message(r={}){if(this.state!==xe.Established)return this.logger.error("Session.message() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const i=r.requestDelegate,l=this.copyRequestOptions(r.requestOptions);return this._message(i,l)}refer(r,i={}){if(this.state!==xe.Established)return this.logger.error("Session.refer() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));if(r instanceof r0&&!r.dialog)return this.logger.error("Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer)."),Promise.reject(new Error(`Invalid session state ${this.state}`));const l=i.requestDelegate,f=this.copyRequestOptions(i.requestOptions);return f.extraHeaders=f.extraHeaders?f.extraHeaders.concat(this.referExtraHeaders(this.referToString(r))):this.referExtraHeaders(this.referToString(r)),this._refer(i.onNotify,l,f)}_bye(r,i){if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));const l=this.dialog;switch(l.sessionState){case as.Initial:throw new Error(`Invalid dialog state ${l.sessionState}`);case as.Early:throw new Error(`Invalid dialog state ${l.sessionState}`);case as.AckWait:return this.stateTransition(xe.Terminating),new Promise(f=>{l.delegate={onAck:()=>{const p=l.bye(r,i);return this.stateTransition(xe.Terminated),f(p),Promise.resolve()},onAckTimeout:()=>{const p=l.bye(r,i);this.stateTransition(xe.Terminated),f(p)}}});case as.Confirmed:{const f=l.bye(r,i);return this.stateTransition(xe.Terminated),Promise.resolve(f)}case as.Terminated:throw new Error(`Invalid dialog state ${l.sessionState}`);default:throw new Error("Unrecognized state.")}}_info(r,i){return this.dialog?Promise.resolve(this.dialog.info(r,i)):Promise.reject(new Error("Session dialog undefined."))}_message(r,i){return this.dialog?Promise.resolve(this.dialog.message(r,i)):Promise.reject(new Error("Session dialog undefined."))}_refer(r,i,l){return this.dialog?(this.onNotify=r,Promise.resolve(this.dialog.refer(i,l))):Promise.reject(new Error("Session dialog undefined."))}ackAndBye(r,i,l){r.ack();const f=[];i&&f.push("Reason: "+this.getReasonHeaderValue(i,l)),r.session.bye(void 0,{extraHeaders:f})}onAckRequest(r){if(this.logger.log("Session.onAckRequest"),this.state!==xe.Established&&this.state!==xe.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();const i=this.dialog;if(!i)throw new Error("Dialog undefined.");const l={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){const f=new LR(r);this.delegate.onAck(f)}switch(this.pendingReinviteAck=!1,i.signalingState){case Ye.Initial:{this.logger.error(`Invalid signaling state ${i.signalingState}.`);const f=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return i.bye(void 0,{extraHeaders:f}),this.stateTransition(xe.Terminated),Promise.resolve()}case Ye.Stable:{const f=t0(r.message);return f?f.contentDisposition==="render"?(this._renderbody=f.content,this._rendertype=f.contentType,Promise.resolve()):f.contentDisposition!=="session"?Promise.resolve():this.setAnswer(f,l).catch(p=>{this.logger.error(p.message);const v=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];i.bye(void 0,{extraHeaders:v}),this.stateTransition(xe.Terminated)}):Promise.resolve()}case Ye.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${i.signalingState}.`);const f=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return i.bye(void 0,{extraHeaders:f}),this.stateTransition(xe.Terminated),Promise.resolve()}case Ye.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${i.signalingState}.`);const f=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return i.bye(void 0,{extraHeaders:f}),this.stateTransition(xe.Terminated),Promise.resolve()}case Ye.Closed:throw new Error(`Invalid signaling state ${i.signalingState}.`);default:throw new Error(`Invalid signaling state ${i.signalingState}.`)}}onByeRequest(r){if(this.logger.log("Session.onByeRequest"),this.state!==xe.Established){this.logger.error(`BYE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onBye){const i=new UR(r);this.delegate.onBye(i)}else r.accept();this.stateTransition(xe.Terminated)}onInfoRequest(r){if(this.logger.log("Session.onInfoRequest"),this.state!==xe.Established){this.logger.error(`INFO received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onInfo){const i=new zR(r);this.delegate.onInfo(i)}else r.accept()}onInviteRequest(r){if(this.logger.log("Session.onInviteRequest"),this.state!==xe.Established){this.logger.error(`INVITE received while in state ${this.state}, dropping request`);return}this.pendingReinviteAck=!0;const i=["Contact: "+this._contact];if(r.message.hasHeader("P-Asserted-Identity")){const f=r.message.getHeader("P-Asserted-Identity");if(!f)throw new Error("Header undefined.");this._assertedIdentity=zn.nameAddrHeaderParse(f)}const l={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(l).then(f=>{const p=r.accept({statusCode:200,extraHeaders:i,body:f});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(r.message,p.message,200)}).catch(f=>{if(this.logger.error(f.message),this.logger.error("Failed to handle to re-INVITE request"),!this.dialog)throw new Error("Dialog undefined.");if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===Ye.Stable){const p=r.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(r.message,p.message,488);return}this.rollbackOffer().then(()=>{const p=r.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(r.message,p.message,488)}).catch(p=>{this.logger.error(p.message),this.logger.error("Failed to rollback offer on re-INVITE request");const v=r.reject({statusCode:488});if(this.state!==xe.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const S=[];S.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:S}),this.stateTransition(xe.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(r.message,v.message,488)})})}onMessageRequest(r){if(this.logger.log("Session.onMessageRequest"),this.state!==xe.Established){this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onMessage){const i=new V2(r);this.delegate.onMessage(i)}else r.accept()}onNotifyRequest(r){if(this.logger.log("Session.onNotifyRequest"),this.state!==xe.Established){this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`);return}if(this.onNotify){const i=new Px(r);this.onNotify(i);return}if(this.delegate&&this.delegate.onNotify){const i=new Px(r);this.delegate.onNotify(i)}else r.accept()}onPrackRequest(r){if(this.logger.log("Session.onPrackRequest"),this.state!==xe.Established){this.logger.error(`PRACK received while in state ${this.state}, dropping request`);return}throw new Error("Unimplemented.")}onReferRequest(r){if(this.logger.log("Session.onReferRequest"),this.state!==xe.Established){this.logger.error(`REFER received while in state ${this.state}, dropping request`);return}if(!r.message.hasHeader("refer-to")){this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),r.reject();return}const i=new GR(r,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(i):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),i.accept().then(()=>i.makeInviter(this._referralInviterOptions).invite()).catch(l=>{this.logger.error(l.message)}))}generateResponseOfferAnswer(r,i){if(this.dialog)return this.generateResponseOfferAnswerInDialog(i);const l=t0(r.message);return!l||l.contentDisposition!=="session"?this.getOffer(i):this.setOfferAndGetAnswer(l,i)}generateResponseOfferAnswerInDialog(r){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case Ye.Initial:return this.getOffer(r);case Ye.HaveLocalOffer:return Promise.resolve(void 0);case Ye.HaveRemoteOffer:if(!this.dialog.offer)throw new Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,r);case Ye.Stable:return this.state!==xe.Established?Promise.resolve(void 0):this.getOffer(r);case Ye.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(r){const i=this.setupSessionDescriptionHandler(),l=r.sessionDescriptionHandlerOptions,f=r.sessionDescriptionHandlerModifiers;try{return i.getDescription(l,f).then(p=>bv(p)).catch(p=>{this.logger.error("Session.getOffer: SDH getDescription rejected...");const v=p instanceof Error?p:new Error("Session.getOffer unknown error.");throw this.logger.error(v.message),v})}catch(p){this.logger.error("Session.getOffer: SDH getDescription threw...");const v=p instanceof Error?p:new Error(p);return this.logger.error(v.message),Promise.reject(v)}}rollbackOffer(){const r=this.setupSessionDescriptionHandler();if(r.rollbackDescription===void 0)return Promise.resolve();try{return r.rollbackDescription().catch(i=>{this.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");const l=i instanceof Error?i:new Error("Session.rollbackOffer unknown error.");throw this.logger.error(l.message),l})}catch(i){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");const l=i instanceof Error?i:new Error(i);return this.logger.error(l.message),Promise.reject(l)}}setAnswer(r,i){const l=this.setupSessionDescriptionHandler(),f=i.sessionDescriptionHandlerOptions,p=i.sessionDescriptionHandlerModifiers;try{if(!l.hasDescription(r.contentType))return Promise.reject(new Mx)}catch(v){this.logger.error("Session.setAnswer: SDH hasDescription threw...");const S=v instanceof Error?v:new Error(v);return this.logger.error(S.message),Promise.reject(S)}try{return l.setDescription(r.content,f,p).catch(v=>{this.logger.error("Session.setAnswer: SDH setDescription rejected...");const S=v instanceof Error?v:new Error("Session.setAnswer unknown error.");throw this.logger.error(S.message),S})}catch(v){this.logger.error("Session.setAnswer: SDH setDescription threw...");const S=v instanceof Error?v:new Error(v);return this.logger.error(S.message),Promise.reject(S)}}setOfferAndGetAnswer(r,i){const l=this.setupSessionDescriptionHandler(),f=i.sessionDescriptionHandlerOptions,p=i.sessionDescriptionHandlerModifiers;try{if(!l.hasDescription(r.contentType))return Promise.reject(new Mx)}catch(v){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");const S=v instanceof Error?v:new Error(v);return this.logger.error(S.message),Promise.reject(S)}try{return l.setDescription(r.content,f,p).then(()=>l.getDescription(f,p)).then(v=>bv(v)).catch(v=>{this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");const S=v instanceof Error?v:new Error("Session.setOfferAndGetAnswer unknown error.");throw this.logger.error(S.message),S})}catch(v){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");const S=v instanceof Error?v:new Error(v);return this.logger.error(S.message),Promise.reject(S)}}setSessionDescriptionHandler(r){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=r}setupSessionDescriptionHandler(){var r;return this._sessionDescriptionHandler?this._sessionDescriptionHandler:(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),!((r=this.delegate)===null||r===void 0)&&r.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1),this._sessionDescriptionHandler)}stateTransition(r){const i=()=>{throw new Error(`Invalid state transition from ${this._state} to ${r}`)};switch(this._state){case xe.Initial:r!==xe.Establishing&&r!==xe.Established&&r!==xe.Terminating&&r!==xe.Terminated&&i();break;case xe.Establishing:r!==xe.Established&&r!==xe.Terminating&&r!==xe.Terminated&&i();break;case xe.Established:r!==xe.Terminating&&r!==xe.Terminated&&i();break;case xe.Terminating:r!==xe.Terminated&&i();break;case xe.Terminated:i();break;default:throw new Error("Unrecognized state.")}this._state=r,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),r===xe.Terminated&&this.dispose()}copyRequestOptions(r={}){const i=r.extraHeaders?r.extraHeaders.slice():void 0,l=r.body?{contentDisposition:r.body.contentDisposition||"render",contentType:r.body.contentType||"text/plain",content:r.body.content||""}:void 0;return{extraHeaders:i,body:l}}getReasonHeaderValue(r,i){const l=r;let f=Sv(r);return!f&&i&&(f=i),"SIP;cause="+l+';text="'+f+'"'}referExtraHeaders(r){const i=[];return i.push("Referred-By: <"+this.userAgent.configuration.uri+">"),i.push("Contact: "+this._contact),i.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),i.push("Refer-To: "+r),i}referToString(r){let i;if(r instanceof xo)i=r.toString();else{if(!r.dialog)throw new Error("Dialog undefined.");const l=r.remoteIdentity.friendlyName,f=r.dialog.remoteTarget.toString(),p=r.dialog.callId,v=r.dialog.remoteTag,S=r.dialog.localTag,w=encodeURIComponent(`${p};to-tag=${v};from-tag=${S}`);i=`"${l}" <${f}?Replaces=${w}>`}return i}}var Ps;(function(o){o.Required="Required",o.Supported="Supported",o.Unsupported="Unsupported"})(Ps=Ps||(Ps={}));const KR={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0};class QR extends r0{constructor(r,i){super(r),this.incomingInviteRequest=i,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100="none",this.rseq=Math.floor(Math.random()*1e4),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=r.getLogger("sip.Invitation");const l=this.incomingInviteRequest.message,f=l.getHeader("require");f&&f.toLowerCase().includes("100rel")&&(this.rel100="required");const p=l.getHeader("supported");if(p&&p.toLowerCase().includes("100rel")&&(this.rel100="supported"),l.toTag=i.toTag,typeof l.toTag!="string")throw new TypeError("toTag should have been a string.");if(this.userNoAnswerTimer=setTimeout(()=>{i.reject({statusCode:480}),this.stateTransition(xe.Terminated)},this.userAgent.configuration.noAnswerTimeout?this.userAgent.configuration.noAnswerTimeout*1e3:6e4),l.hasHeader("expires")){const w=Number(l.getHeader("expires")||0)*1e3;this.expiresTimer=setTimeout(()=>{this.state===xe.Initial&&(i.reject({statusCode:487}),this.stateTransition(xe.Terminated))},w)}const v=this.request.getHeader("P-Asserted-Identity");v&&(this._assertedIdentity=zn.nameAddrHeaderParse(v)),this._contact=this.userAgent.contact.toString();const S=l.parseHeader("Content-Disposition");S&&S.type==="render"&&(this._renderbody=l.body,this._rendertype=l.getHeader("Content-Type")),this._id=l.callId+l.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case xe.Initial:return this.reject().then(()=>super.dispose());case xe.Establishing:return this.reject().then(()=>super.dispose());case xe.Established:return super.dispose();case xe.Terminating:return super.dispose();case xe.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get autoSendAnInitialProvisionalResponse(){return this.rel100!=="required"&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(r={}){if(this.logger.log("Invitation.accept"),this.state!==xe.Initial){const i=new Error(`Invalid session state ${this.state}`);return this.logger.error(i.message),Promise.reject(i)}return r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),this.stateTransition(xe.Establishing),this.sendAccept(r).then(({message:i,session:l})=>{l.delegate={onAck:f=>this.onAckRequest(f),onAckTimeout:()=>this.onAckTimeout(),onBye:f=>this.onByeRequest(f),onInfo:f=>this.onInfoRequest(f),onInvite:f=>this.onInviteRequest(f),onMessage:f=>this.onMessageRequest(f),onNotify:f=>this.onNotifyRequest(f),onPrack:f=>this.onPrackRequest(f),onRefer:f=>this.onReferRequest(f)},this._dialog=l,this.stateTransition(xe.Established),this._replacee&&this._replacee._bye()}).catch(i=>this.handleResponseError(i))}progress(r={}){if(this.logger.log("Invitation.progress"),this.state!==xe.Initial){const l=new Error(`Invalid session state ${this.state}`);return this.logger.error(l.message),Promise.reject(l)}const i=r.statusCode||180;if(i<100||i>199)throw new TypeError("Invalid statusCode: "+i);return r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):r.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(l=>this.handleResponseError(l)):this.rel100!=="required"&&!(this.rel100==="supported"&&r.rel100)&&!(this.rel100==="supported"&&this.userAgent.configuration.sipExtension100rel===Ps.Required)?this.sendProgress(r).then(()=>{}).catch(l=>this.handleResponseError(l)):this.sendProgressReliableWaitForPrack(r).then(()=>{}).catch(l=>this.handleResponseError(l))}reject(r={}){if(this.logger.log("Invitation.reject"),this.state!==xe.Initial&&this.state!==xe.Establishing){const v=new Error(`Invalid session state ${this.state}`);return this.logger.error(v.message),Promise.reject(v)}const i=r.statusCode||480,l=r.reasonPhrase?r.reasonPhrase:Sv(i),f=r.extraHeaders||[];if(i<300||i>699)throw new TypeError("Invalid statusCode: "+i);const p=r.body?bv(r.body):void 0;return i<400?this.incomingInviteRequest.redirect([],{statusCode:i,reasonPhrase:l,extraHeaders:f,body:p}):this.incomingInviteRequest.reject({statusCode:i,reasonPhrase:l,extraHeaders:f,body:p}),this.stateTransition(xe.Terminated),Promise.resolve()}_onCancel(r){if(this.logger.log("Invitation._onCancel"),this.state!==xe.Initial&&this.state!==xe.Establishing){this.logger.error(`CANCEL received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onCancel){const i=new jR(r);this.delegate.onCancel(i)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(xe.Terminated)}handlePrackOfferAnswer(r){if(!this.dialog)throw new Error("Dialog undefined.");const i=t0(r.message);if(!i||i.contentDisposition!=="session")return Promise.resolve(void 0);const l={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case Ye.Initial:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case Ye.Stable:return this.setAnswer(i,l).then(()=>{});case Ye.HaveLocalOffer:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case Ye.HaveRemoteOffer:return this.setOfferAndGetAnswer(i,l);case Ye.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(r){let i=480;if(r instanceof Error?this.logger.error(r.message):this.logger.error(r),r instanceof Mx?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),i=415):r instanceof PR?this.logger.error("A session description handler occurred while sending response"):r instanceof Ix?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):r instanceof gu&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===xe.Initial||this.state===xe.Establishing)try{this.incomingInviteRequest.reject({statusCode:i}),this.stateTransition(xe.Terminated)}catch(l){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),l}if(this.isCanceled){this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.");return}throw r}onAckTimeout(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(xe.Terminated)}sendAccept(r={}){const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},l=r.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,i)).then(f=>this.incomingInviteRequest.accept({statusCode:200,body:f,extraHeaders:l})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,i).then(f=>this.incomingInviteRequest.accept({statusCode:200,body:f,extraHeaders:l})))}sendProgress(r={}){const i=r.statusCode||180,l=r.reasonPhrase,f=(r.extraHeaders||[]).slice(),p=r.body?bv(r.body):void 0;if(i===183&&!p)return this.sendProgressWithSDP(r);try{const v=this.incomingInviteRequest.progress({statusCode:i,reasonPhrase:l,extraHeaders:f,body:p});return this._dialog=v.session,Promise.resolve(v)}catch(v){return Promise.reject(v)}}sendProgressWithSDP(r={}){const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},l=r.statusCode||183,f=r.reasonPhrase,p=(r.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,i).then(v=>this.incomingInviteRequest.progress({statusCode:l,reasonPhrase:f,extraHeaders:p,body:v})).then(v=>(this._dialog=v.session,v))}sendProgressReliable(r={}){return r.extraHeaders=(r.extraHeaders||[]).slice(),r.extraHeaders.push("Require: 100rel"),r.extraHeaders.push("RSeq: "+Math.floor(Math.random()*1e4)),this.sendProgressWithSDP(r)}sendProgressReliableWaitForPrack(r={}){const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},l=r.statusCode||183,f=r.reasonPhrase,p=(r.extraHeaders||[]).slice();p.push("Require: 100rel"),p.push("RSeq: "+this.rseq++);let v;return new Promise((S,w)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,i).then(C=>(v=C,this.incomingInviteRequest.progress({statusCode:l,reasonPhrase:f,extraHeaders:p,body:v}))).then(C=>{this._dialog=C.session;let b,R;C.session.delegate={onPrack:O=>{b=O,clearTimeout(H),clearTimeout(z),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(b).then(B=>{try{R=b.accept({statusCode:200,body:B}),this.prackArrived(),S({prackRequest:b,prackResponse:R,progressResponse:C})}catch(U){w(U)}}).catch(B=>w(B)))}};const H=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(z),this.reject({statusCode:504}).then(()=>w(new Ix)).catch(O=>w(O)))},oi.T1*64),P=()=>{try{this.incomingInviteRequest.progress({statusCode:l,reasonPhrase:f,extraHeaders:p,body:v})}catch(O){this.waitingForPrack=!1,w(O);return}z=setTimeout(P,j*=2)};let j=oi.T1,z=setTimeout(P,j)}).catch(C=>{this.waitingForPrack=!1,w(C)})})}sendProgressTrying(){try{const r=this.incomingInviteRequest.trying();return Promise.resolve(r)}catch(r){return Promise.reject(r)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((r,i)=>{this.waitingForPrackResolve=r,this.waitingForPrackReject=i}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new Ix),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}}class W2 extends r0{constructor(r,i,l={}){super(r,l),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=r.getLogger("sip.Inviter"),this.earlyMedia=l.earlyMedia!==void 0?l.earlyMedia:this.earlyMedia,this.fromTag=wv(),this.inviteWithoutSdp=l.inviteWithoutSdp!==void 0?l.inviteWithoutSdp:this.inviteWithoutSdp;const f=Object.assign({},l);f.params=Object.assign({},l.params);const p=l.anonymous||!1,v=r.contact.toString({anonymous:p,outbound:p?!r.contact.tempGruu:!r.contact.pubGruu});p&&r.configuration.uri&&(f.params.fromDisplayName="Anonymous",f.params.fromUri="sip:anonymous@anonymous.invalid");let S=r.userAgentCore.configuration.aor;if(f.params.fromUri&&(S=typeof f.params.fromUri=="string"?zn.URIParse(f.params.fromUri):f.params.fromUri),!S)throw new TypeError("Invalid from URI: "+f.params.fromUri);let w=i;if(f.params.toUri&&(w=typeof f.params.toUri=="string"?zn.URIParse(f.params.toUri):f.params.toUri),!w)throw new TypeError("Invalid to URI: "+f.params.toUri);const C=Object.assign({},f.params);C.fromTag=this.fromTag;const b=(f.extraHeaders||[]).slice();p&&r.configuration.uri&&(b.push("P-Preferred-Identity: "+r.configuration.uri.toString()),b.push("Privacy: id")),b.push("Contact: "+v),b.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),r.configuration.sipExtension100rel===Ps.Required&&b.push("Require: 100rel"),r.configuration.sipExtensionReplaces===Ps.Required&&b.push("Require: replaces"),f.extraHeaders=b;const R=void 0;this.outgoingRequestMessage=r.userAgentCore.makeOutgoingRequestMessage(rt.INVITE,i,S,w,C,b,R),this._contact=v,this._referralInviterOptions=f,this._renderbody=l.renderbody,this._rendertype=l.rendertype,l.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=l.sessionDescriptionHandlerModifiers),l.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=l.sessionDescriptionHandlerOptions),l.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=l.sessionDescriptionHandlerModifiersReInvite),l.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=l.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case xe.Initial:return this.cancel().then(()=>super.dispose());case xe.Establishing:return this.cancel().then(()=>super.dispose());case xe.Established:return super.dispose();case xe.Terminating:return super.dispose();case xe.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(r={}){if(this.logger.log("Inviter.cancel"),this.state!==xe.Initial&&this.state!==xe.Establishing){const l=new Error(`Invalid session state ${this.state}`);return this.logger.error(l.message),Promise.reject(l)}this.isCanceled=!0,this.stateTransition(xe.Terminating);function i(l,f){if(l&&l<200||l>699)throw new TypeError("Invalid statusCode: "+l);if(l){const p=l,v=Sv(l)||f;return"SIP;cause="+p+';text="'+v+'"'}}if(this.outgoingInviteRequest){let l;r.statusCode&&r.reasonPhrase&&(l=i(r.statusCode,r.reasonPhrase)),this.outgoingInviteRequest.cancel(l,r)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(xe.Terminated);return Promise.resolve()}invite(r={}){if(this.logger.log("Inviter.invite"),this.state!==xe.Initial)return super.invite(r);if(r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),r.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(xe.Establishing),Promise.resolve(this.sendInvite(r));const i={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(i).then(l=>(this.outgoingRequestMessage.body={body:l.content,contentType:l.contentType},this.stateTransition(xe.Establishing),this.sendInvite(r))).catch(l=>{throw this.logger.log(l.message),this.state!==xe.Terminated&&this.stateTransition(xe.Terminated),l})}sendInvite(r={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:i=>{if(this.dialog){this.logger.log("Additional confirmed dialog, sending ACK and BYE"),this.ackAndBye(i);return}if(this.isCanceled){this.logger.log("Canceled session accepted, sending ACK and BYE"),this.ackAndBye(i),this.stateTransition(xe.Terminated);return}this.notifyReferer(i),this.onAccept(i).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{r.requestDelegate&&r.requestDelegate.onAccept&&r.requestDelegate.onAccept(i)})},onProgress:i=>{this.isCanceled||(this.notifyReferer(i),this.onProgress(i).catch(()=>{this.disposeEarlyMedia()}).then(()=>{r.requestDelegate&&r.requestDelegate.onProgress&&r.requestDelegate.onProgress(i)}))},onRedirect:i=>{this.notifyReferer(i),this.onRedirect(i),r.requestDelegate&&r.requestDelegate.onRedirect&&r.requestDelegate.onRedirect(i)},onReject:i=>{this.notifyReferer(i),this.onReject(i),r.requestDelegate&&r.requestDelegate.onReject&&r.requestDelegate.onReject(i)},onTrying:i=>{this.notifyReferer(i),this.onTrying(i),r.requestDelegate&&r.requestDelegate.onTrying&&r.requestDelegate.onTrying(i)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(r=>{r.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(r){if(!this._referred)return;if(!(this._referred instanceof r0))throw new Error("Referred session not instance of session");if(!this._referred.dialog)return;if(!r.message.statusCode)throw new Error("Status code undefined.");if(!r.message.reasonPhrase)throw new Error("Reason phrase undefined.");const i=r.message.statusCode,l=r.message.reasonPhrase,f=`SIP/2.0 ${i} ${l}`.trim(),p=this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:f}});p.delegate={onReject:()=>{this._referred=void 0}}}onAccept(r){if(this.logger.log("Inviter.onAccept"),this.state!==xe.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));const i=r.message,l=r.session;switch(i.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=zn.nameAddrHeaderParse(i.getHeader("P-Asserted-Identity"))),l.delegate={onAck:f=>this.onAckRequest(f),onBye:f=>this.onByeRequest(f),onInfo:f=>this.onInfoRequest(f),onInvite:f=>this.onInviteRequest(f),onMessage:f=>this.onMessageRequest(f),onNotify:f=>this.onNotifyRequest(f),onPrack:f=>this.onPrackRequest(f),onRefer:f=>this.onReferRequest(f)},this._dialog=l,l.signalingState){case Ye.Initial:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(r,400,"Missing session description"),this.stateTransition(xe.Terminated),Promise.reject(new Error("Bad Media Description"));case Ye.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(r,400,"Missing session description"),this.stateTransition(xe.Terminated),Promise.reject(new Error("Bad Media Description"));case Ye.HaveRemoteOffer:{if(!this._dialog.offer)throw new Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);const f={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,f).then(p=>{r.ack({body:p}),this.stateTransition(xe.Established)}).catch(p=>{throw this.ackAndBye(r,488,"Invalid session description"),this.stateTransition(xe.Terminated),p})}case Ye.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){const v=this.earlyMediaSessionDescriptionHandlers.get(l.id);if(!v)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(v),this.earlyMediaSessionDescriptionHandlers.delete(l.id),r.ack(),this.stateTransition(xe.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==l){this.earlyMedia&&this.logger.error("You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.");const v=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(v.message),this.ackAndBye(r,488,"Not Acceptable Here"),this.stateTransition(xe.Terminated),Promise.reject(v)}return r.ack(),this.stateTransition(xe.Established),Promise.resolve()}const f=l.answer;if(!f)throw new Error("Answer is undefined.");const p={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(f,p).then(()=>{let v;this._renderbody&&this._rendertype&&(v={body:{contentDisposition:"render",contentType:this._rendertype,content:this._renderbody}}),r.ack(v),this.stateTransition(xe.Established)}).catch(v=>{throw this.logger.error(v.message),this.ackAndBye(r,488,"Not Acceptable Here"),this.stateTransition(xe.Terminated),v})}case Ye.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onProgress(r){var i;if(this.logger.log("Inviter.onProgress"),this.state!==xe.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");const l=r.message,f=r.session;l.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=zn.nameAddrHeaderParse(l.getHeader("P-Asserted-Identity")));const p=l.getHeader("require"),v=l.getHeader("rseq"),w=!!(p&&p.includes("100rel")&&v?Number(v):void 0),C=[];switch(w&&C.push("RAck: "+l.getHeader("rseq")+" "+l.getHeader("cseq")),f.signalingState){case Ye.Initial:return w&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),r.prack({extraHeaders:C})),Promise.resolve();case Ye.HaveLocalOffer:return w&&r.prack({extraHeaders:C}),Promise.resolve();case Ye.HaveRemoteOffer:if(!w)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();{const b=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return!((i=this.delegate)===null||i===void 0)&&i.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(b,!0),this.earlyMediaSessionDescriptionHandlers.set(f.id,b),b.setDescription(l.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>b.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(R=>{const T={contentDisposition:"session",contentType:R.contentType,content:R.body};r.prack({extraHeaders:C,body:T})}).catch(R=>{throw this.stateTransition(xe.Terminated),R})}case Ye.Stable:if(w&&r.prack({extraHeaders:C}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=f;const b=f.answer;if(!b)throw new Error("Answer is undefined.");const R={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(b,R).catch(T=>{throw this.stateTransition(xe.Terminated),T})}return Promise.resolve();case Ye.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onRedirect(r){if(this.logger.log("Inviter.onRedirect"),this.state!==xe.Establishing&&this.state!==xe.Terminating){this.logger.error(`Redirect received while in state ${this.state}, dropping response`);return}this.stateTransition(xe.Terminated)}onReject(r){if(this.logger.log("Inviter.onReject"),this.state!==xe.Establishing&&this.state!==xe.Terminating){this.logger.error(`Reject received while in state ${this.state}, dropping response`);return}this.stateTransition(xe.Terminated)}onTrying(r){if(this.logger.log("Inviter.onTrying"),this.state!==xe.Establishing){this.logger.error(`Trying received while in state ${this.state}, dropping response`);return}}}var Cr;(function(o){o.Initial="Initial",o.Registered="Registered",o.Unregistered="Unregistered",o.Terminated="Terminated"})(Cr=Cr||(Cr={}));class Co{constructor(r,i={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=Cr.Initial,this._waiting=!1,this._stateEventEmitter=new Jh,this._waitingEventEmitter=new Jh,this.userAgent=r;const l=r.configuration.uri.clone();if(l.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},Co.defaultOptions()),{registrar:l}),Co.stripUndefinedProperties(i)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&zn.parse(this.options.instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");const f=this.options.registrar,p=this.options.params&&this.options.params.fromUri||r.userAgentCore.configuration.aor,v=this.options.params&&this.options.params.toUri||r.configuration.uri,S=this.options.params||{},w=(i.extraHeaders||[]).slice();if(this.request=r.userAgentCore.makeOutgoingRequestMessage(rt.REGISTER,f,p,v,S,w,void 0),this.expires=this.options.expires||Co.defaultExpires,this.expires<0)throw new Error("Invalid expires.");if(this.refreshFrequency=this.options.refreshFrequency||Co.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");this.logger=r.getLogger("sip.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(C=>{const b=this.options[C];switch(C){case"registrar":this.logger.log("· "+C+": "+b);break;default:this.logger.log("· "+C+": "+JSON.stringify(b))}})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:Co.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new xo("sip","anonymous","anonymous.invalid"),refreshFrequency:Co.defaultRefreshFrequency}}static stripUndefinedProperties(r){return Object.keys(r).reduce((i,l)=>(r[l]!==void 0&&(i[l]=r[l]),i),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(r=>{const i=()=>{if(!this.waiting&&this._state===Cr.Registered){this.stateChange.addListener(()=>{this.terminated(),r()},{once:!0}),this.unregister();return}this.terminated(),r()};this.waiting?this.waitingChange.addListener(()=>{i()},{once:!0}):i()}))}register(r={}){if(this.state===Cr.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const f=new Hx("REGISTER request already in progress, waiting for final response");return Promise.reject(f)}r.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),r.requestOptions));const i=(this.options.extraHeaders||[]).slice();i.push("Contact: "+this.generateContactHeader(this.expires)),i.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=i,this.waitingToggle(!0);const l=this.userAgent.userAgentCore.register(this.request,{onAccept:f=>{let p;f.message.hasHeader("expires")&&(p=Number(f.message.getHeader("expires"))),this._contacts=f.message.getHeaders("contact");let v=this._contacts.length;if(!v){this.logger.error("No Contact header in response to REGISTER, dropping response."),this.unregistered();return}let S;for(;v--;){if(S=f.message.parseHeader("contact",v),!S)throw new Error("Contact undefined");if(this.userAgent.contact.pubGruu&&U2(S.uri,this.userAgent.contact.pubGruu)){p=Number(S.getParam("expires"));break}if(this.userAgent.configuration.contactName===""){if(S.uri.user===this.userAgent.contact.uri.user){p=Number(S.getParam("expires"));break}}else if(U2(S.uri,this.userAgent.contact.uri)){p=Number(S.getParam("expires"));break}S=void 0}if(S===void 0){this.logger.error("No Contact header pointing to us, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(p===void 0){this.logger.error("Contact pointing to us is missing expires parameter, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(S.hasParam("temp-gruu")){const w=S.getParam("temp-gruu");w&&(this.userAgent.contact.tempGruu=zn.URIParse(w.replace(/"/g,"")))}if(S.hasParam("pub-gruu")){const w=S.getParam("pub-gruu");w&&(this.userAgent.contact.pubGruu=zn.URIParse(w.replace(/"/g,"")))}this.registered(p),r.requestDelegate&&r.requestDelegate.onAccept&&r.requestDelegate.onAccept(f),this.waitingToggle(!1)},onProgress:f=>{r.requestDelegate&&r.requestDelegate.onProgress&&r.requestDelegate.onProgress(f)},onRedirect:f=>{this.logger.error("Redirect received. Not supported."),this.unregistered(),r.requestDelegate&&r.requestDelegate.onRedirect&&r.requestDelegate.onRedirect(f),this.waitingToggle(!1)},onReject:f=>{if(f.message.statusCode===423){if(!f.message.hasHeader("min-expires")){this.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),this.unregistered(),this.waitingToggle(!1);return}this.expires=Number(f.message.getHeader("min-expires")),this.waitingToggle(!1),this.register();return}this.logger.warn(`Failed to register, status code ${f.message.statusCode}`);let p=NaN;if(f.message.statusCode===500||f.message.statusCode===503){const v=f.message.getHeader("retry-after");v&&(p=Number.parseInt(v,void 0))}this._retryAfter=isNaN(p)?void 0:p,this.unregistered(),r.requestDelegate&&r.requestDelegate.onReject&&r.requestDelegate.onReject(f),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:f=>{r.requestDelegate&&r.requestDelegate.onTrying&&r.requestDelegate.onTrying(f)}});return Promise.resolve(l)}unregister(r={}){if(this.state===Cr.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==Cr.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const f=new Hx("REGISTER request already in progress, waiting for final response");return Promise.reject(f)}this._state!==Cr.Registered&&!r.all&&this.logger.warn("Not currently registered, but sending an unregister anyway.");const i=(r.requestOptions&&r.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=i,r.all?(i.push("Contact: *"),i.push("Expires: 0")):i.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);const l=this.userAgent.userAgentCore.register(this.request,{onAccept:f=>{this._contacts=f.message.getHeaders("contact"),this.unregistered(),r.requestDelegate&&r.requestDelegate.onAccept&&r.requestDelegate.onAccept(f),this.waitingToggle(!1)},onProgress:f=>{r.requestDelegate&&r.requestDelegate.onProgress&&r.requestDelegate.onProgress(f)},onRedirect:f=>{this.logger.error("Unregister redirected. Not currently supported."),this.unregistered(),r.requestDelegate&&r.requestDelegate.onRedirect&&r.requestDelegate.onRedirect(f),this.waitingToggle(!1)},onReject:f=>{this.logger.error(`Unregister rejected with status code ${f.message.statusCode}`),this.unregistered(),r.requestDelegate&&r.requestDelegate.onReject&&r.requestDelegate.onReject(f),this.waitingToggle(!1)},onTrying:f=>{r.requestDelegate&&r.requestDelegate.onTrying&&r.requestDelegate.onTrying(f)}});return Promise.resolve(l)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(r){let i=this.userAgent.contact.toString({register:!0});return this.options.regId&&this.options.instanceId&&(i+=";reg-id="+this.options.regId,i+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach(l=>{i+=";"+l}),i+=";expires="+r,i}registered(r){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*r*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn("Registration expired"),this.unregistered()},r*1e3),this._state!==Cr.Registered&&this.stateTransition(Cr.Registered)}unregistered(){this.clearTimers(),this._state!==Cr.Unregistered&&this.stateTransition(Cr.Unregistered)}terminated(){this.clearTimers(),this._state!==Cr.Terminated&&this.stateTransition(Cr.Terminated)}stateTransition(r){const i=()=>{throw new Error(`Invalid state transition from ${this._state} to ${r}`)};switch(this._state){case Cr.Initial:r!==Cr.Registered&&r!==Cr.Unregistered&&r!==Cr.Terminated&&i();break;case Cr.Registered:r!==Cr.Unregistered&&r!==Cr.Terminated&&i();break;case Cr.Unregistered:r!==Cr.Registered&&r!==Cr.Terminated&&i();break;case Cr.Terminated:i();break;default:throw new Error("Unrecognized state.")}this._state=r,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),r===Cr.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(r){if(this._waiting===r)throw new Error(`Invalid waiting transition from ${this._waiting} to ${r}`);this._waiting=r,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){let r="An attempt was made to send a REGISTER request while a prior one was still in progress.";r+=" RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response",r+=" from the registrar for the previous one or the previous REGISTER request has timed out.",r+=" Note that if the transport disconnects, you still must wait for the prior request to time out before",r+=" sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.",this.logger.warn(r)}stateError(){let i=`An attempt was made to send a REGISTER request when the Registerer ${this.state===Cr.Terminated?"is in 'Terminated' state":"has been disposed"}.`;i+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",i+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(i)}}Co.defaultExpires=600,Co.defaultRefreshFrequency=99;var vr;(function(o){o.Initial="Initial",o.NotifyWait="NotifyWait",o.Pending="Pending",o.Active="Active",o.Terminated="Terminated"})(vr=vr||(vr={}));var At;(function(o){o.Connecting="Connecting",o.Connected="Connected",o.Disconnecting="Disconnecting",o.Disconnected="Disconnected"})(At=At||(At={}));var pi;(function(o){o.Started="Started",o.Stopped="Stopped"})(pi=pi||(pi={}));class Hn{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(r,i=!1){return this.onePassHasher.start().appendStr(r).end(i)}static hashAsciiStr(r,i=!1){return this.onePassHasher.start().appendAsciiStr(r).end(i)}static _hex(r){const i=Hn.hexChars,l=Hn.hexOut;let f,p,v,S;for(S=0;S<4;S+=1)for(p=S*8,f=r[S],v=0;v<8;v+=2)l[p+1+v]=i.charAt(f&15),f>>>=4,l[p+0+v]=i.charAt(f&15),f>>>=4;return l.join("")}static _md5cycle(r,i){let l=r[0],f=r[1],p=r[2],v=r[3];l+=(f&p|~f&v)+i[0]-680876936|0,l=(l<<7|l>>>25)+f|0,v+=(l&f|~l&p)+i[1]-389564586|0,v=(v<<12|v>>>20)+l|0,p+=(v&l|~v&f)+i[2]+606105819|0,p=(p<<17|p>>>15)+v|0,f+=(p&v|~p&l)+i[3]-1044525330|0,f=(f<<22|f>>>10)+p|0,l+=(f&p|~f&v)+i[4]-176418897|0,l=(l<<7|l>>>25)+f|0,v+=(l&f|~l&p)+i[5]+1200080426|0,v=(v<<12|v>>>20)+l|0,p+=(v&l|~v&f)+i[6]-1473231341|0,p=(p<<17|p>>>15)+v|0,f+=(p&v|~p&l)+i[7]-45705983|0,f=(f<<22|f>>>10)+p|0,l+=(f&p|~f&v)+i[8]+1770035416|0,l=(l<<7|l>>>25)+f|0,v+=(l&f|~l&p)+i[9]-1958414417|0,v=(v<<12|v>>>20)+l|0,p+=(v&l|~v&f)+i[10]-42063|0,p=(p<<17|p>>>15)+v|0,f+=(p&v|~p&l)+i[11]-1990404162|0,f=(f<<22|f>>>10)+p|0,l+=(f&p|~f&v)+i[12]+1804603682|0,l=(l<<7|l>>>25)+f|0,v+=(l&f|~l&p)+i[13]-40341101|0,v=(v<<12|v>>>20)+l|0,p+=(v&l|~v&f)+i[14]-1502002290|0,p=(p<<17|p>>>15)+v|0,f+=(p&v|~p&l)+i[15]+1236535329|0,f=(f<<22|f>>>10)+p|0,l+=(f&v|p&~v)+i[1]-165796510|0,l=(l<<5|l>>>27)+f|0,v+=(l&p|f&~p)+i[6]-1069501632|0,v=(v<<9|v>>>23)+l|0,p+=(v&f|l&~f)+i[11]+643717713|0,p=(p<<14|p>>>18)+v|0,f+=(p&l|v&~l)+i[0]-373897302|0,f=(f<<20|f>>>12)+p|0,l+=(f&v|p&~v)+i[5]-701558691|0,l=(l<<5|l>>>27)+f|0,v+=(l&p|f&~p)+i[10]+38016083|0,v=(v<<9|v>>>23)+l|0,p+=(v&f|l&~f)+i[15]-660478335|0,p=(p<<14|p>>>18)+v|0,f+=(p&l|v&~l)+i[4]-405537848|0,f=(f<<20|f>>>12)+p|0,l+=(f&v|p&~v)+i[9]+568446438|0,l=(l<<5|l>>>27)+f|0,v+=(l&p|f&~p)+i[14]-1019803690|0,v=(v<<9|v>>>23)+l|0,p+=(v&f|l&~f)+i[3]-187363961|0,p=(p<<14|p>>>18)+v|0,f+=(p&l|v&~l)+i[8]+1163531501|0,f=(f<<20|f>>>12)+p|0,l+=(f&v|p&~v)+i[13]-1444681467|0,l=(l<<5|l>>>27)+f|0,v+=(l&p|f&~p)+i[2]-51403784|0,v=(v<<9|v>>>23)+l|0,p+=(v&f|l&~f)+i[7]+1735328473|0,p=(p<<14|p>>>18)+v|0,f+=(p&l|v&~l)+i[12]-1926607734|0,f=(f<<20|f>>>12)+p|0,l+=(f^p^v)+i[5]-378558|0,l=(l<<4|l>>>28)+f|0,v+=(l^f^p)+i[8]-2022574463|0,v=(v<<11|v>>>21)+l|0,p+=(v^l^f)+i[11]+1839030562|0,p=(p<<16|p>>>16)+v|0,f+=(p^v^l)+i[14]-35309556|0,f=(f<<23|f>>>9)+p|0,l+=(f^p^v)+i[1]-1530992060|0,l=(l<<4|l>>>28)+f|0,v+=(l^f^p)+i[4]+1272893353|0,v=(v<<11|v>>>21)+l|0,p+=(v^l^f)+i[7]-155497632|0,p=(p<<16|p>>>16)+v|0,f+=(p^v^l)+i[10]-1094730640|0,f=(f<<23|f>>>9)+p|0,l+=(f^p^v)+i[13]+681279174|0,l=(l<<4|l>>>28)+f|0,v+=(l^f^p)+i[0]-358537222|0,v=(v<<11|v>>>21)+l|0,p+=(v^l^f)+i[3]-722521979|0,p=(p<<16|p>>>16)+v|0,f+=(p^v^l)+i[6]+76029189|0,f=(f<<23|f>>>9)+p|0,l+=(f^p^v)+i[9]-640364487|0,l=(l<<4|l>>>28)+f|0,v+=(l^f^p)+i[12]-421815835|0,v=(v<<11|v>>>21)+l|0,p+=(v^l^f)+i[15]+530742520|0,p=(p<<16|p>>>16)+v|0,f+=(p^v^l)+i[2]-995338651|0,f=(f<<23|f>>>9)+p|0,l+=(p^(f|~v))+i[0]-198630844|0,l=(l<<6|l>>>26)+f|0,v+=(f^(l|~p))+i[7]+1126891415|0,v=(v<<10|v>>>22)+l|0,p+=(l^(v|~f))+i[14]-1416354905|0,p=(p<<15|p>>>17)+v|0,f+=(v^(p|~l))+i[5]-57434055|0,f=(f<<21|f>>>11)+p|0,l+=(p^(f|~v))+i[12]+1700485571|0,l=(l<<6|l>>>26)+f|0,v+=(f^(l|~p))+i[3]-1894986606|0,v=(v<<10|v>>>22)+l|0,p+=(l^(v|~f))+i[10]-1051523|0,p=(p<<15|p>>>17)+v|0,f+=(v^(p|~l))+i[1]-2054922799|0,f=(f<<21|f>>>11)+p|0,l+=(p^(f|~v))+i[8]+1873313359|0,l=(l<<6|l>>>26)+f|0,v+=(f^(l|~p))+i[15]-30611744|0,v=(v<<10|v>>>22)+l|0,p+=(l^(v|~f))+i[6]-1560198380|0,p=(p<<15|p>>>17)+v|0,f+=(v^(p|~l))+i[13]+1309151649|0,f=(f<<21|f>>>11)+p|0,l+=(p^(f|~v))+i[4]-145523070|0,l=(l<<6|l>>>26)+f|0,v+=(f^(l|~p))+i[11]-1120210379|0,v=(v<<10|v>>>22)+l|0,p+=(l^(v|~f))+i[2]+718787259|0,p=(p<<15|p>>>17)+v|0,f+=(v^(p|~l))+i[9]-343485551|0,f=(f<<21|f>>>11)+p|0,r[0]=l+r[0]|0,r[1]=f+r[1]|0,r[2]=p+r[2]|0,r[3]=v+r[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(Hn.stateIdentity),this}appendStr(r){const i=this._buffer8,l=this._buffer32;let f=this._bufferLength,p,v;for(v=0;v<r.length;v+=1){if(p=r.charCodeAt(v),p<128)i[f++]=p;else if(p<2048)i[f++]=(p>>>6)+192,i[f++]=p&63|128;else if(p<55296||p>56319)i[f++]=(p>>>12)+224,i[f++]=p>>>6&63|128,i[f++]=p&63|128;else{if(p=(p-55296)*1024+(r.charCodeAt(++v)-56320)+65536,p>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");i[f++]=(p>>>18)+240,i[f++]=p>>>12&63|128,i[f++]=p>>>6&63|128,i[f++]=p&63|128}f>=64&&(this._dataLength+=64,Hn._md5cycle(this._state,l),f-=64,l[0]=l[16])}return this._bufferLength=f,this}appendAsciiStr(r){const i=this._buffer8,l=this._buffer32;let f=this._bufferLength,p,v=0;for(;;){for(p=Math.min(r.length-v,64-f);p--;)i[f++]=r.charCodeAt(v++);if(f<64)break;this._dataLength+=64,Hn._md5cycle(this._state,l),f=0}return this._bufferLength=f,this}appendByteArray(r){const i=this._buffer8,l=this._buffer32;let f=this._bufferLength,p,v=0;for(;;){for(p=Math.min(r.length-v,64-f);p--;)i[f++]=r[v++];if(f<64)break;this._dataLength+=64,Hn._md5cycle(this._state,l),f=0}return this._bufferLength=f,this}getState(){const r=this,i=r._state;return{buffer:String.fromCharCode.apply(null,r._buffer8),buflen:r._bufferLength,length:r._dataLength,state:[i[0],i[1],i[2],i[3]]}}setState(r){const i=r.buffer,l=r.state,f=this._state;let p;for(this._dataLength=r.length,this._bufferLength=r.buflen,f[0]=l[0],f[1]=l[1],f[2]=l[2],f[3]=l[3],p=0;p<i.length;p+=1)this._buffer8[p]=i.charCodeAt(p)}end(r=!1){const i=this._bufferLength,l=this._buffer8,f=this._buffer32,p=(i>>2)+1;let v;if(this._dataLength+=i,l[i]=128,l[i+1]=l[i+2]=l[i+3]=0,f.set(Hn.buffer32Identity.subarray(p),p),i>55&&(Hn._md5cycle(this._state,f),f.set(Hn.buffer32Identity)),v=this._dataLength*8,v<=4294967295)f[14]=v;else{const S=v.toString(16).match(/(.*?)(.{0,8})$/);if(S===null)return;const w=parseInt(S[2],16),C=parseInt(S[1],16)||0;f[14]=w,f[15]=C}return Hn._md5cycle(this._state,f),r?this._state:Hn._hex(this._state)}}Hn.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),Hn.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Hn.hexChars="0123456789abcdef",Hn.hexOut=[],Hn.onePassHasher=new Hn,Hn.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592"&&console.error("Md5 self test failed.");function yu(o){return Hn.hashStr(o)}class XR{constructor(r,i,l,f){this.logger=r.getLogger("sipjs.digestauthentication"),this.username=l,this.password=f,this.ha1=i,this.nc=0,this.ncHex="00000000"}authenticate(r,i,l){if(this.algorithm=i.algorithm,this.realm=i.realm,this.nonce=i.nonce,this.opaque=i.opaque,this.stale=i.stale,this.algorithm){if(this.algorithm!=="MD5")return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(i.qop)if(i.qop.indexOf("auth")>-1)this.qop="auth";else if(i.qop.indexOf("auth-int")>-1)this.qop="auth-int";else return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;else this.qop=void 0;return this.method=r.method,this.uri=r.ruri,this.cnonce=_c(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(l),!0}toString(){const r=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return r.push("algorithm="+this.algorithm),r.push('username="'+this.username+'"'),r.push('realm="'+this.realm+'"'),r.push('nonce="'+this.nonce+'"'),r.push('uri="'+this.uri+'"'),r.push('response="'+this.response+'"'),this.opaque&&r.push('opaque="'+this.opaque+'"'),this.qop&&(r.push("qop="+this.qop),r.push('cnonce="'+this.cnonce+'"'),r.push("nc="+this.ncHex)),"Digest "+r.join(", ")}updateNcHex(){const r=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-r.length)+r}calculateResponse(r){let i,l;i=this.ha1,(i===""||i===void 0)&&(i=yu(this.username+":"+this.realm+":"+this.password)),this.qop==="auth"?(l=yu(this.method+":"+this.uri),this.response=yu(i+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+l)):this.qop==="auth-int"?(l=yu(this.method+":"+this.uri+":"+yu(r||"")),this.response=yu(i+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+l)):this.qop===void 0&&(l=yu(this.method+":"+this.uri),this.response=yu(i+":"+this.nonce+":"+l))}}var li;(function(o){o[o.error=0]="error",o[o.warn=1]="warn",o[o.log=2]="log",o[o.debug=3]="debug"})(li=li||(li={}));class G2{constructor(r,i,l){this.logger=r,this.category=i,this.label=l}error(r){this.genericLog(li.error,r)}warn(r){this.genericLog(li.warn,r)}log(r){this.genericLog(li.log,r)}debug(r){this.genericLog(li.debug,r)}genericLog(r,i){this.logger.genericLog(r,this.category,this.label,i)}get level(){return this.logger.level}set level(r){this.logger.level=r}}class ZR{constructor(){this.builtinEnabled=!0,this._level=li.log,this.loggers={},this.logger=this.getLogger("sip:loggerfactory")}get level(){return this._level}set level(r){r>=0&&r<=3?this._level=r:r>3?this._level=3:li.hasOwnProperty(r)?this._level=r:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(r))}get connector(){return this._connector}set connector(r){r?typeof r=="function"?this._connector=r:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(r)):this._connector=void 0}getLogger(r,i){if(i&&this.level===3)return new G2(this,r,i);if(this.loggers[r])return this.loggers[r];{const l=new G2(this,r);return this.loggers[r]=l,l}}genericLog(r,i,l,f){this.level>=r&&this.builtinEnabled&&this.print(r,i,l,f),this.connector&&this.connector(li[r],i,l,f)}print(r,i,l,f){if(typeof f=="string"){const p=[new Date,i];l&&p.push(l),f=p.concat(f).join(" | ")}switch(r){case li.error:console.error(f);break;case li.warn:console.warn(f);break;case li.log:console.log(f);break;case li.debug:console.debug(f);break}}}var _v;(function(o){function r(f,p){let v=p,S=0,w=0;if(f.substring(v,v+2).match(/(^\r\n)/))return-2;for(;S===0;){if(w=f.indexOf(`\r
390
390
  `,v),w===-1)return w;!f.substring(w+2,w+4).match(/(^\r\n)/)&&f.charAt(w+2).match(/(^\s+)/)?v=w+2:S=w}return S}o.getHeader=r;function i(f,p,v,S){const w=p.indexOf(":",v),C=p.substring(v,w).trim(),b=p.substring(w+1,S).trim();let R;switch(C.toLowerCase()){case"via":case"v":f.addHeader("via",b),f.getHeaders("via").length===1?(R=f.parseHeader("Via"),R&&(f.via=R,f.viaBranch=R.branch)):R=0;break;case"from":case"f":f.setHeader("from",b),R=f.parseHeader("from"),R&&(f.from=R,f.fromTag=R.getParam("tag"));break;case"to":case"t":f.setHeader("to",b),R=f.parseHeader("to"),R&&(f.to=R,f.toTag=R.getParam("tag"));break;case"record-route":if(R=zn.parse(b,"Record_Route"),R===-1){R=void 0;break}if(!(R instanceof Array)){R=void 0;break}R.forEach(T=>{f.addHeader("record-route",b.substring(T.position,T.offset)),f.headers["Record-Route"][f.getHeaders("record-route").length-1].parsed=T.parsed});break;case"call-id":case"i":f.setHeader("call-id",b),R=f.parseHeader("call-id"),R&&(f.callId=b);break;case"contact":case"m":if(R=zn.parse(b,"Contact"),R===-1){R=void 0;break}if(!(R instanceof Array)){R=void 0;break}R.forEach(T=>{f.addHeader("contact",b.substring(T.position,T.offset)),f.headers.Contact[f.getHeaders("contact").length-1].parsed=T.parsed});break;case"content-length":case"l":f.setHeader("content-length",b),R=f.parseHeader("content-length");break;case"content-type":case"c":f.setHeader("content-type",b),R=f.parseHeader("content-type");break;case"cseq":f.setHeader("cseq",b),R=f.parseHeader("cseq"),R&&(f.cseq=R.value),f instanceof vu&&(f.method=R.method);break;case"max-forwards":f.setHeader("max-forwards",b),R=f.parseHeader("max-forwards");break;case"www-authenticate":f.setHeader("www-authenticate",b),R=f.parseHeader("www-authenticate");break;case"proxy-authenticate":f.setHeader("proxy-authenticate",b),R=f.parseHeader("proxy-authenticate");break;case"refer-to":case"r":f.setHeader("refer-to",b),R=f.parseHeader("refer-to"),R&&(f.referTo=R);break;default:f.addHeader(C.toLowerCase(),b),R=0}return R===void 0?{error:"error parsing header '"+C+"'"}:!0}o.parseHeader=i;function l(f,p){let v=0,S=f.indexOf(`\r
391
391
  `);if(S===-1){p.warn("no CRLF found, not a SIP message, discarded");return}const w=f.substring(0,S),C=zn.parse(w,"Request_Response");let b;if(C===-1){p.warn('error parsing first line of SIP message: "'+w+'"');return}else C.status_code?(b=new vu,b.statusCode=C.status_code,b.reasonPhrase=C.reason_phrase):(b=new Xf,b.method=C.method,b.ruri=C.uri);b.data=f,v=S+2;let R;for(;;){if(S=r(f,v),S===-2){R=v+2;break}else if(S===-1){p.error("malformed message");return}const T=i(b,f,v,S);if(T&&T!==!0){p.error(T.error);return}v=S+2}return b.hasHeader("content-length")?b.body=f.substr(R,Number(b.getHeader("content-length"))):b.body=f.substring(R),b}o.parseMessage=l})(_v=_v||(_v={}));function K2(o,r){const i=`\r
392
- `;if(r.statusCode<100||r.statusCode>699)throw new TypeError("Invalid statusCode: "+r.statusCode);const l=r.reasonPhrase?r.reasonPhrase:Sv(r.statusCode);let f="SIP/2.0 "+r.statusCode+" "+l+i;r.statusCode>=100&&r.statusCode<200,r.statusCode;const p="From: "+o.getHeader("From")+i,v="Call-ID: "+o.callId+i,S="CSeq: "+o.cseq+" "+o.method+i,w=o.getHeaders("via").reduce((H,P)=>H+"Via: "+P+i,"");let C="To: "+o.getHeader("to");if(r.statusCode>100&&!o.parseHeader("to").hasParam("tag")){let H=r.toTag;H||(H=wv()),C+=";tag="+H}C+=i;let b="";r.supported&&(b="Supported: "+r.supported.join(", ")+i);let R="";r.userAgent&&(R="User-Agent: "+r.userAgent+i);let T="";return r.extraHeaders&&(T=r.extraHeaders.reduce((H,P)=>H+P.trim()+i,"")),f+=w,f+=p,f+=C,f+=S,f+=v,f+=b,f+=R,f+=T,r.body?(f+="Content-Type: "+r.body.contentType+i,f+="Content-Length: "+e0(r.body.content)+i+i,f+=r.body.content):f+="Content-Length: 0"+i+i,{message:f}}class Lx extends bc{constructor(r){super(r||"Unspecified transport error.")}}class Q2{constructor(r,i,l,f,p){this._transport=r,this._user=i,this._id=l,this._state=f,this.listeners=new Array,this.logger=i.loggerFactory.getLogger(p,l),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw new Error("Invalid kind.")}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(r,i){const l=()=>{this.removeStateChangeListener(l),r()};(i==null?void 0:i.once)===!0?this.listeners.push(l):this.listeners.push(r)}notifyStateChangeListeners(){this.listeners.slice().forEach(r=>r())}removeStateChangeListener(r){this.listeners=this.listeners.filter(i=>i!==r)}logTransportError(r,i){this.logger.error(r.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(i)}send(r){return this.transport.send(r).catch(i=>{if(i instanceof Lx)throw this.onTransportError(i),i;let l;throw i&&typeof i.message=="string"?l=new Lx(i.message):l=new Lx,this.onTransportError(l),l})}setState(r){this.logger.debug(`State change to "${r}" on ${this.typeToString()} with id ${this.id}.`),this._state=r,this._user.onStateChange&&this._user.onStateChange(r),this.notifyStateChangeListeners()}typeToString(){return"UnknownType"}}class X2 extends Q2{constructor(r,i,l,f,p){super(i,l,r.viaBranch,f,p),this._request=r,this.user=l}get request(){return this._request}}var pe;(function(o){o.Accepted="Accepted",o.Calling="Calling",o.Completed="Completed",o.Confirmed="Confirmed",o.Proceeding="Proceeding",o.Terminated="Terminated",o.Trying="Trying"})(pe=pe||(pe={}));class ya extends X2{constructor(r,i,l){super(r,i,l,pe.Proceeding,"sip.transaction.ist")}dispose(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),super.dispose()}get kind(){return"ist"}receiveRequest(r){switch(this.state){case pe.Proceeding:if(r.method===tt.INVITE){this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(l=>{this.logTransportError(l,"Failed to send retransmission of provisional response.")});return}break;case pe.Accepted:if(r.method===tt.INVITE)return;break;case pe.Completed:if(r.method===tt.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");this.send(this.lastFinalResponse).catch(l=>{this.logTransportError(l,"Failed to send retransmission of final response.")});return}if(r.method===tt.ACK){this.stateTransition(pe.Confirmed);return}break;case pe.Confirmed:if(r.method===tt.INVITE||r.method===tt.ACK)return;break;case pe.Terminated:if(r.method===tt.INVITE||r.method===tt.ACK)return;break;default:throw new Error(`Invalid state ${this.state}`)}const i=`INVITE server transaction received unexpected ${r.method} request while in state ${this.state}.`;this.logger.warn(i)}receiveResponse(r,i){if(r<100||r>699)throw new Error(`Invalid status code ${r}`);switch(this.state){case pe.Proceeding:if(r>=100&&r<=199){this.lastProvisionalResponse=i,r>100&&this.startProgressExtensionTimer(),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send 1xx response.")});return}if(r>=200&&r<=299){this.lastFinalResponse=i,this.stateTransition(pe.Accepted),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send 2xx response.")});return}if(r>=300&&r<=699){this.lastFinalResponse=i,this.stateTransition(pe.Completed),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send non-2xx final response.")});return}break;case pe.Accepted:if(r>=200&&r<=299){this.send(i).catch(f=>{this.logTransportError(f,"Failed to send 2xx response.")});return}break;case pe.Completed:break;case pe.Confirmed:break;case pe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const l=`INVITE server transaction received unexpected ${r} response from TU while in state ${this.state}.`;throw this.logger.error(l),new Error(l)}retransmitAcceptedResponse(){this.state===pe.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(r=>{this.logTransportError(r,"Failed to send 2xx response.")})}onTransportError(r){this.user.onTransportError&&this.user.onTransportError(r)}typeToString(){return"INVITE server transaction"}stateTransition(r){const i=()=>{throw new Error(`Invalid state transition from ${this.state} to ${r}`)};switch(r){case pe.Proceeding:i();break;case pe.Accepted:case pe.Completed:this.state!==pe.Proceeding&&i();break;case pe.Confirmed:this.state!==pe.Completed&&i();break;case pe.Terminated:this.state!==pe.Accepted&&this.state!==pe.Completed&&this.state!==pe.Confirmed&&i();break;default:i()}this.stopProgressExtensionTimer(),r===pe.Accepted&&(this.L=setTimeout(()=>this.timerL(),oi.TIMER_L)),r===pe.Completed&&(this.H=setTimeout(()=>this.timerH(),oi.TIMER_H)),r===pe.Confirmed&&(this.I=setTimeout(()=>this.timerI(),oi.TIMER_I)),r===pe.Terminated&&this.dispose(),this.setState(r)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw new Error("Last provisional response undefined.");this.send(this.lastProvisionalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of provisional response.")})},oi.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===pe.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(pe.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(pe.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===pe.Accepted&&this.stateTransition(pe.Terminated)}}class Dv extends Q2{constructor(r,i,l,f,p){super(i,l,Dv.makeId(r),f,p),this._request=r,this.user=l,r.setViaHeader(this.id,i.protocol)}static makeId(r){if(r.method==="CANCEL"){if(!r.branch)throw new Error("Outgoing CANCEL request without a branch.");return r.branch}else return"z9hG4bK"+Math.floor(Math.random()*1e7)}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}}class Pa extends Dv{constructor(r,i,l){super(r,i,l,pe.Trying,"sip.transaction.nict"),this.F=setTimeout(()=>this.timerF(),oi.TIMER_F),this.send(r.toString()).catch(f=>{this.logTransportError(f,"Failed to send initial outgoing request.")})}dispose(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),super.dispose()}get kind(){return"nict"}receiveResponse(r){const i=r.statusCode;if(!i||i<100||i>699)throw new Error(`Invalid status code ${i}`);switch(this.state){case pe.Trying:if(i>=100&&i<=199){this.stateTransition(pe.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(r);return}if(i>=200&&i<=699){if(this.stateTransition(pe.Completed),i===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(r);return}break;case pe.Proceeding:if(i>=100&&i<=199&&this.user.receiveResponse)return this.user.receiveResponse(r);if(i>=200&&i<=699){if(this.stateTransition(pe.Completed),i===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(r);return}break;case pe.Completed:return;case pe.Terminated:return;default:throw new Error(`Invalid state ${this.state}`)}const l=`Non-INVITE client transaction received unexpected ${i} response while in state ${this.state}.`;this.logger.warn(l)}onTransportError(r){this.user.onTransportError&&this.user.onTransportError(r),this.stateTransition(pe.Terminated,!0)}typeToString(){return"non-INVITE client transaction"}stateTransition(r,i=!1){const l=()=>{throw new Error(`Invalid state transition from ${this.state} to ${r}`)};switch(r){case pe.Trying:l();break;case pe.Proceeding:this.state!==pe.Trying&&l();break;case pe.Completed:this.state!==pe.Trying&&this.state!==pe.Proceeding&&l();break;case pe.Terminated:this.state!==pe.Trying&&this.state!==pe.Proceeding&&this.state!==pe.Completed&&(i||l());break;default:l()}r===pe.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout(()=>this.timerK(),oi.TIMER_K)),r===pe.Terminated&&this.dispose(),this.setState(r)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),(this.state===pe.Trying||this.state===pe.Proceeding)&&(this.onRequestTimeout(),this.stateTransition(pe.Terminated))}timerK(){this.state===pe.Completed&&this.stateTransition(pe.Terminated)}}class Zf{constructor(r,i){this.core=r,this.dialogState=i,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(r,i){const f=i.getHeaders("record-route").reverse(),p=i.parseHeader("contact");if(!p)throw new Error("Contact undefined.");if(!(p instanceof ma))throw new Error("Contact not instance of NameAddrHeader.");const v=p.uri,S=r.cseq,w=void 0,C=r.callId,b=r.fromTag,R=i.toTag;if(!C)throw new Error("Call id undefined.");if(!b)throw new Error("From tag undefined.");if(!R)throw new Error("To tag undefined.");if(!r.from)throw new Error("From undefined.");if(!r.to)throw new Error("To undefined.");const T=r.from.uri,H=r.to.uri;if(!i.statusCode)throw new Error("Incoming response status code undefined.");const P=i.statusCode<200;return{id:C+b+R,early:P,callId:C,localTag:b,remoteTag:R,localSequenceNumber:S,remoteSequenceNumber:w,localURI:T,remoteURI:H,remoteTarget:v,routeSet:f,secure:!1}}static initialDialogStateForUserAgentServer(r,i,l=!1){const p=r.getHeaders("record-route"),v=r.parseHeader("contact");if(!v)throw new Error("Contact undefined.");if(!(v instanceof ma))throw new Error("Contact not instance of NameAddrHeader.");const S=v.uri,w=r.cseq,C=void 0,b=r.callId,R=i,T=r.fromTag,H=r.from.uri,P=r.to.uri;return{id:b+R+T,early:l,callId:b,localTag:R,remoteTag:T,localSequenceNumber:C,remoteSequenceNumber:w,localURI:P,remoteURI:H,remoteTarget:S,routeSet:p,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(r){if(r.method!==tt.ACK){if(this.remoteSequenceNumber){if(r.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=r.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=r.cseq)}}recomputeRouteSet(r){this.dialogState.routeSet=r.getHeaders("record-route").reverse()}createOutgoingRequestMessage(r,i){const l=this.remoteURI,f=this.remoteTag,p=this.localURI,v=this.localTag,S=this.callId;let w;i&&i.cseq?w=i.cseq:this.dialogState.localSequenceNumber?w=this.dialogState.localSequenceNumber+=1:w=this.dialogState.localSequenceNumber=1;const C=this.remoteTarget,b=this.routeSet,R=i&&i.extraHeaders,T=i&&i.body;return this.userAgentCore.makeOutgoingRequestMessage(r,C,p,l,{callId:S,cseq:w,fromTag:v,toTag:f,routeSet:b},R,T)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1}sequenceGuard(r){return r.method===tt.ACK?!0:this.remoteSequenceNumber&&r.cseq<=this.remoteSequenceNumber?(this.core.replyStateless(r,{statusCode:500}),!1):!0}}class xu extends Dv{constructor(r,i,l){super(r,i,l,pe.Calling,"sip.transaction.ict"),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),oi.TIMER_B),this.send(r.toString()).catch(f=>{this.logTransportError(f,"Failed to send initial outgoing request.")})}dispose(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),super.dispose()}get kind(){return"ict"}ackResponse(r){const i=r.toTag;if(!i)throw new Error("To tag undefined.");const l="z9hG4bK"+Math.floor(Math.random()*1e7);r.setViaHeader(l,this.transport.protocol),this.ackRetransmissionCache.set(i,r),this.send(r.toString()).catch(f=>{this.logTransportError(f,"Failed to send ACK to 2xx response.")})}receiveResponse(r){const i=r.statusCode;if(!i||i<100||i>699)throw new Error(`Invalid status code ${i}`);switch(this.state){case pe.Calling:if(i>=100&&i<=199){this.stateTransition(pe.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(r);return}if(i>=200&&i<=299){this.ackRetransmissionCache.set(r.toTag,void 0),this.stateTransition(pe.Accepted),this.user.receiveResponse&&this.user.receiveResponse(r);return}if(i>=300&&i<=699){this.stateTransition(pe.Completed),this.ack(r),this.user.receiveResponse&&this.user.receiveResponse(r);return}break;case pe.Proceeding:if(i>=100&&i<=199){this.user.receiveResponse&&this.user.receiveResponse(r);return}if(i>=200&&i<=299){this.ackRetransmissionCache.set(r.toTag,void 0),this.stateTransition(pe.Accepted),this.user.receiveResponse&&this.user.receiveResponse(r);return}if(i>=300&&i<=699){this.stateTransition(pe.Completed),this.ack(r),this.user.receiveResponse&&this.user.receiveResponse(r);return}break;case pe.Accepted:if(i>=200&&i<=299){if(!this.ackRetransmissionCache.has(r.toTag)){this.ackRetransmissionCache.set(r.toTag,void 0),this.user.receiveResponse&&this.user.receiveResponse(r);return}const f=this.ackRetransmissionCache.get(r.toTag);if(f){this.send(f.toString()).catch(p=>{this.logTransportError(p,"Failed to send retransmission of ACK to 2xx response.")});return}return}break;case pe.Completed:if(i>=300&&i<=699){this.ack(r);return}break;case pe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const l=`Received unexpected ${i} response while in state ${this.state}.`;this.logger.warn(l)}onTransportError(r){this.user.onTransportError&&this.user.onTransportError(r),this.stateTransition(pe.Terminated,!0)}typeToString(){return"INVITE client transaction"}ack(r){const i=this.request.ruri,l=this.request.callId,f=this.request.cseq,p=this.request.getHeader("from"),v=r.getHeader("to"),S=this.request.getHeader("via"),w=this.request.getHeader("route");if(!p)throw new Error("From undefined.");if(!v)throw new Error("To undefined.");if(!S)throw new Error("Via undefined.");let C=`ACK ${i} SIP/2.0\r
392
+ `;if(r.statusCode<100||r.statusCode>699)throw new TypeError("Invalid statusCode: "+r.statusCode);const l=r.reasonPhrase?r.reasonPhrase:Sv(r.statusCode);let f="SIP/2.0 "+r.statusCode+" "+l+i;r.statusCode>=100&&r.statusCode<200,r.statusCode;const p="From: "+o.getHeader("From")+i,v="Call-ID: "+o.callId+i,S="CSeq: "+o.cseq+" "+o.method+i,w=o.getHeaders("via").reduce((H,P)=>H+"Via: "+P+i,"");let C="To: "+o.getHeader("to");if(r.statusCode>100&&!o.parseHeader("to").hasParam("tag")){let H=r.toTag;H||(H=wv()),C+=";tag="+H}C+=i;let b="";r.supported&&(b="Supported: "+r.supported.join(", ")+i);let R="";r.userAgent&&(R="User-Agent: "+r.userAgent+i);let T="";return r.extraHeaders&&(T=r.extraHeaders.reduce((H,P)=>H+P.trim()+i,"")),f+=w,f+=p,f+=C,f+=S,f+=v,f+=b,f+=R,f+=T,r.body?(f+="Content-Type: "+r.body.contentType+i,f+="Content-Length: "+e0(r.body.content)+i+i,f+=r.body.content):f+="Content-Length: 0"+i+i,{message:f}}class Lx extends bc{constructor(r){super(r||"Unspecified transport error.")}}class Q2{constructor(r,i,l,f,p){this._transport=r,this._user=i,this._id=l,this._state=f,this.listeners=new Array,this.logger=i.loggerFactory.getLogger(p,l),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw new Error("Invalid kind.")}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(r,i){const l=()=>{this.removeStateChangeListener(l),r()};(i==null?void 0:i.once)===!0?this.listeners.push(l):this.listeners.push(r)}notifyStateChangeListeners(){this.listeners.slice().forEach(r=>r())}removeStateChangeListener(r){this.listeners=this.listeners.filter(i=>i!==r)}logTransportError(r,i){this.logger.error(r.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(i)}send(r){return this.transport.send(r).catch(i=>{if(i instanceof Lx)throw this.onTransportError(i),i;let l;throw i&&typeof i.message=="string"?l=new Lx(i.message):l=new Lx,this.onTransportError(l),l})}setState(r){this.logger.debug(`State change to "${r}" on ${this.typeToString()} with id ${this.id}.`),this._state=r,this._user.onStateChange&&this._user.onStateChange(r),this.notifyStateChangeListeners()}typeToString(){return"UnknownType"}}class X2 extends Q2{constructor(r,i,l,f,p){super(i,l,r.viaBranch,f,p),this._request=r,this.user=l}get request(){return this._request}}var pe;(function(o){o.Accepted="Accepted",o.Calling="Calling",o.Completed="Completed",o.Confirmed="Confirmed",o.Proceeding="Proceeding",o.Terminated="Terminated",o.Trying="Trying"})(pe=pe||(pe={}));class ya extends X2{constructor(r,i,l){super(r,i,l,pe.Proceeding,"sip.transaction.ist")}dispose(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),super.dispose()}get kind(){return"ist"}receiveRequest(r){switch(this.state){case pe.Proceeding:if(r.method===rt.INVITE){this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(l=>{this.logTransportError(l,"Failed to send retransmission of provisional response.")});return}break;case pe.Accepted:if(r.method===rt.INVITE)return;break;case pe.Completed:if(r.method===rt.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");this.send(this.lastFinalResponse).catch(l=>{this.logTransportError(l,"Failed to send retransmission of final response.")});return}if(r.method===rt.ACK){this.stateTransition(pe.Confirmed);return}break;case pe.Confirmed:if(r.method===rt.INVITE||r.method===rt.ACK)return;break;case pe.Terminated:if(r.method===rt.INVITE||r.method===rt.ACK)return;break;default:throw new Error(`Invalid state ${this.state}`)}const i=`INVITE server transaction received unexpected ${r.method} request while in state ${this.state}.`;this.logger.warn(i)}receiveResponse(r,i){if(r<100||r>699)throw new Error(`Invalid status code ${r}`);switch(this.state){case pe.Proceeding:if(r>=100&&r<=199){this.lastProvisionalResponse=i,r>100&&this.startProgressExtensionTimer(),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send 1xx response.")});return}if(r>=200&&r<=299){this.lastFinalResponse=i,this.stateTransition(pe.Accepted),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send 2xx response.")});return}if(r>=300&&r<=699){this.lastFinalResponse=i,this.stateTransition(pe.Completed),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send non-2xx final response.")});return}break;case pe.Accepted:if(r>=200&&r<=299){this.send(i).catch(f=>{this.logTransportError(f,"Failed to send 2xx response.")});return}break;case pe.Completed:break;case pe.Confirmed:break;case pe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const l=`INVITE server transaction received unexpected ${r} response from TU while in state ${this.state}.`;throw this.logger.error(l),new Error(l)}retransmitAcceptedResponse(){this.state===pe.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(r=>{this.logTransportError(r,"Failed to send 2xx response.")})}onTransportError(r){this.user.onTransportError&&this.user.onTransportError(r)}typeToString(){return"INVITE server transaction"}stateTransition(r){const i=()=>{throw new Error(`Invalid state transition from ${this.state} to ${r}`)};switch(r){case pe.Proceeding:i();break;case pe.Accepted:case pe.Completed:this.state!==pe.Proceeding&&i();break;case pe.Confirmed:this.state!==pe.Completed&&i();break;case pe.Terminated:this.state!==pe.Accepted&&this.state!==pe.Completed&&this.state!==pe.Confirmed&&i();break;default:i()}this.stopProgressExtensionTimer(),r===pe.Accepted&&(this.L=setTimeout(()=>this.timerL(),oi.TIMER_L)),r===pe.Completed&&(this.H=setTimeout(()=>this.timerH(),oi.TIMER_H)),r===pe.Confirmed&&(this.I=setTimeout(()=>this.timerI(),oi.TIMER_I)),r===pe.Terminated&&this.dispose(),this.setState(r)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw new Error("Last provisional response undefined.");this.send(this.lastProvisionalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of provisional response.")})},oi.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===pe.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(pe.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(pe.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===pe.Accepted&&this.stateTransition(pe.Terminated)}}class Dv extends Q2{constructor(r,i,l,f,p){super(i,l,Dv.makeId(r),f,p),this._request=r,this.user=l,r.setViaHeader(this.id,i.protocol)}static makeId(r){if(r.method==="CANCEL"){if(!r.branch)throw new Error("Outgoing CANCEL request without a branch.");return r.branch}else return"z9hG4bK"+Math.floor(Math.random()*1e7)}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}}class Pa extends Dv{constructor(r,i,l){super(r,i,l,pe.Trying,"sip.transaction.nict"),this.F=setTimeout(()=>this.timerF(),oi.TIMER_F),this.send(r.toString()).catch(f=>{this.logTransportError(f,"Failed to send initial outgoing request.")})}dispose(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),super.dispose()}get kind(){return"nict"}receiveResponse(r){const i=r.statusCode;if(!i||i<100||i>699)throw new Error(`Invalid status code ${i}`);switch(this.state){case pe.Trying:if(i>=100&&i<=199){this.stateTransition(pe.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(r);return}if(i>=200&&i<=699){if(this.stateTransition(pe.Completed),i===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(r);return}break;case pe.Proceeding:if(i>=100&&i<=199&&this.user.receiveResponse)return this.user.receiveResponse(r);if(i>=200&&i<=699){if(this.stateTransition(pe.Completed),i===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(r);return}break;case pe.Completed:return;case pe.Terminated:return;default:throw new Error(`Invalid state ${this.state}`)}const l=`Non-INVITE client transaction received unexpected ${i} response while in state ${this.state}.`;this.logger.warn(l)}onTransportError(r){this.user.onTransportError&&this.user.onTransportError(r),this.stateTransition(pe.Terminated,!0)}typeToString(){return"non-INVITE client transaction"}stateTransition(r,i=!1){const l=()=>{throw new Error(`Invalid state transition from ${this.state} to ${r}`)};switch(r){case pe.Trying:l();break;case pe.Proceeding:this.state!==pe.Trying&&l();break;case pe.Completed:this.state!==pe.Trying&&this.state!==pe.Proceeding&&l();break;case pe.Terminated:this.state!==pe.Trying&&this.state!==pe.Proceeding&&this.state!==pe.Completed&&(i||l());break;default:l()}r===pe.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout(()=>this.timerK(),oi.TIMER_K)),r===pe.Terminated&&this.dispose(),this.setState(r)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),(this.state===pe.Trying||this.state===pe.Proceeding)&&(this.onRequestTimeout(),this.stateTransition(pe.Terminated))}timerK(){this.state===pe.Completed&&this.stateTransition(pe.Terminated)}}class Zf{constructor(r,i){this.core=r,this.dialogState=i,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(r,i){const f=i.getHeaders("record-route").reverse(),p=i.parseHeader("contact");if(!p)throw new Error("Contact undefined.");if(!(p instanceof ma))throw new Error("Contact not instance of NameAddrHeader.");const v=p.uri,S=r.cseq,w=void 0,C=r.callId,b=r.fromTag,R=i.toTag;if(!C)throw new Error("Call id undefined.");if(!b)throw new Error("From tag undefined.");if(!R)throw new Error("To tag undefined.");if(!r.from)throw new Error("From undefined.");if(!r.to)throw new Error("To undefined.");const T=r.from.uri,H=r.to.uri;if(!i.statusCode)throw new Error("Incoming response status code undefined.");const P=i.statusCode<200;return{id:C+b+R,early:P,callId:C,localTag:b,remoteTag:R,localSequenceNumber:S,remoteSequenceNumber:w,localURI:T,remoteURI:H,remoteTarget:v,routeSet:f,secure:!1}}static initialDialogStateForUserAgentServer(r,i,l=!1){const p=r.getHeaders("record-route"),v=r.parseHeader("contact");if(!v)throw new Error("Contact undefined.");if(!(v instanceof ma))throw new Error("Contact not instance of NameAddrHeader.");const S=v.uri,w=r.cseq,C=void 0,b=r.callId,R=i,T=r.fromTag,H=r.from.uri,P=r.to.uri;return{id:b+R+T,early:l,callId:b,localTag:R,remoteTag:T,localSequenceNumber:C,remoteSequenceNumber:w,localURI:P,remoteURI:H,remoteTarget:S,routeSet:p,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(r){if(r.method!==rt.ACK){if(this.remoteSequenceNumber){if(r.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=r.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=r.cseq)}}recomputeRouteSet(r){this.dialogState.routeSet=r.getHeaders("record-route").reverse()}createOutgoingRequestMessage(r,i){const l=this.remoteURI,f=this.remoteTag,p=this.localURI,v=this.localTag,S=this.callId;let w;i&&i.cseq?w=i.cseq:this.dialogState.localSequenceNumber?w=this.dialogState.localSequenceNumber+=1:w=this.dialogState.localSequenceNumber=1;const C=this.remoteTarget,b=this.routeSet,R=i&&i.extraHeaders,T=i&&i.body;return this.userAgentCore.makeOutgoingRequestMessage(r,C,p,l,{callId:S,cseq:w,fromTag:v,toTag:f,routeSet:b},R,T)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1}sequenceGuard(r){return r.method===rt.ACK?!0:this.remoteSequenceNumber&&r.cseq<=this.remoteSequenceNumber?(this.core.replyStateless(r,{statusCode:500}),!1):!0}}class xu extends Dv{constructor(r,i,l){super(r,i,l,pe.Calling,"sip.transaction.ict"),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),oi.TIMER_B),this.send(r.toString()).catch(f=>{this.logTransportError(f,"Failed to send initial outgoing request.")})}dispose(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),super.dispose()}get kind(){return"ict"}ackResponse(r){const i=r.toTag;if(!i)throw new Error("To tag undefined.");const l="z9hG4bK"+Math.floor(Math.random()*1e7);r.setViaHeader(l,this.transport.protocol),this.ackRetransmissionCache.set(i,r),this.send(r.toString()).catch(f=>{this.logTransportError(f,"Failed to send ACK to 2xx response.")})}receiveResponse(r){const i=r.statusCode;if(!i||i<100||i>699)throw new Error(`Invalid status code ${i}`);switch(this.state){case pe.Calling:if(i>=100&&i<=199){this.stateTransition(pe.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(r);return}if(i>=200&&i<=299){this.ackRetransmissionCache.set(r.toTag,void 0),this.stateTransition(pe.Accepted),this.user.receiveResponse&&this.user.receiveResponse(r);return}if(i>=300&&i<=699){this.stateTransition(pe.Completed),this.ack(r),this.user.receiveResponse&&this.user.receiveResponse(r);return}break;case pe.Proceeding:if(i>=100&&i<=199){this.user.receiveResponse&&this.user.receiveResponse(r);return}if(i>=200&&i<=299){this.ackRetransmissionCache.set(r.toTag,void 0),this.stateTransition(pe.Accepted),this.user.receiveResponse&&this.user.receiveResponse(r);return}if(i>=300&&i<=699){this.stateTransition(pe.Completed),this.ack(r),this.user.receiveResponse&&this.user.receiveResponse(r);return}break;case pe.Accepted:if(i>=200&&i<=299){if(!this.ackRetransmissionCache.has(r.toTag)){this.ackRetransmissionCache.set(r.toTag,void 0),this.user.receiveResponse&&this.user.receiveResponse(r);return}const f=this.ackRetransmissionCache.get(r.toTag);if(f){this.send(f.toString()).catch(p=>{this.logTransportError(p,"Failed to send retransmission of ACK to 2xx response.")});return}return}break;case pe.Completed:if(i>=300&&i<=699){this.ack(r);return}break;case pe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const l=`Received unexpected ${i} response while in state ${this.state}.`;this.logger.warn(l)}onTransportError(r){this.user.onTransportError&&this.user.onTransportError(r),this.stateTransition(pe.Terminated,!0)}typeToString(){return"INVITE client transaction"}ack(r){const i=this.request.ruri,l=this.request.callId,f=this.request.cseq,p=this.request.getHeader("from"),v=r.getHeader("to"),S=this.request.getHeader("via"),w=this.request.getHeader("route");if(!p)throw new Error("From undefined.");if(!v)throw new Error("To undefined.");if(!S)throw new Error("Via undefined.");let C=`ACK ${i} SIP/2.0\r
393
393
  `;w&&(C+=`Route: ${w}\r
394
394
  `),C+=`Via: ${S}\r
395
395
  `,C+=`To: ${v}\r
@@ -399,7 +399,7 @@ React keys must be passed directly to JSX without using spread:
399
399
  `,C+=`Max-Forwards: 70\r
400
400
  `,C+=`Content-Length: 0\r
401
401
  \r
402
- `,this.send(C).catch(b=>{this.logTransportError(b,"Failed to send ACK to non-2xx response.")})}stateTransition(r,i=!1){const l=()=>{throw new Error(`Invalid state transition from ${this.state} to ${r}`)};switch(r){case pe.Calling:l();break;case pe.Proceeding:this.state!==pe.Calling&&l();break;case pe.Accepted:case pe.Completed:this.state!==pe.Calling&&this.state!==pe.Proceeding&&l();break;case pe.Terminated:this.state!==pe.Calling&&this.state!==pe.Accepted&&this.state!==pe.Completed&&(i||l());break;default:l()}this.B&&(clearTimeout(this.B),this.B=void 0),pe.Proceeding,r===pe.Completed&&(this.D=setTimeout(()=>this.timerD(),oi.TIMER_D)),r===pe.Accepted&&(this.M=setTimeout(()=>this.timerM(),oi.TIMER_M)),r===pe.Terminated&&this.dispose(),this.setState(r)}timerA(){}timerB(){this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`),this.state===pe.Calling&&(this.onRequestTimeout(),this.stateTransition(pe.Terminated))}timerD(){this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`),this.state===pe.Completed&&this.stateTransition(pe.Terminated)}timerM(){this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`),this.state===pe.Accepted&&this.stateTransition(pe.Terminated)}}class Bi{constructor(r,i,l,f){this.transactionConstructor=r,this.core=i,this.message=l,this.delegate=f,this.challenged=!1,this.stale=!1,this.logger=this.loggerFactory.getLogger("sip.user-agent-client"),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}cancel(r,i={}){if(!this.transaction)throw new Error("Transaction undefined.");if(!this.message.to)throw new Error("To undefined.");if(!this.message.from)throw new Error("From undefined.");const l=this.core.makeOutgoingRequestMessage(tt.CANCEL,this.message.ruri,this.message.from.uri,this.message.to.uri,{toTag:this.message.toTag,fromTag:this.message.fromTag,callId:this.message.callId,cseq:this.message.cseq},i.extraHeaders);return l.branch=this.message.branch,this.message.headers.Route&&(l.headers.Route=this.message.headers.Route),r&&l.setHeader("Reason",r),this.transaction.state===pe.Proceeding?new Bi(Pa,this.core,l):this.transaction.addStateChangeListener(()=>{this.transaction&&this.transaction.state===pe.Proceeding&&new Bi(Pa,this.core,l)},{once:!0}),l}authenticationGuard(r,i){const l=r.statusCode;if(!l)throw new Error("Response status code undefined.");if(l!==401&&l!==407)return!0;let f,p;if(l===401?(f=r.parseHeader("www-authenticate"),p="authorization"):(f=r.parseHeader("proxy-authenticate"),p="proxy-authorization"),!f)return this.logger.warn(l+" with wrong or missing challenge, cannot authenticate"),!0;if(this.challenged&&(this.stale||f.stale!==!0))return this.logger.warn(l+" apparently in authentication loop, cannot authenticate"),!0;if(!this.credentials&&(this.credentials=this.core.configuration.authenticationFactory(),!this.credentials))return this.logger.warn("Unable to obtain credentials, cannot authenticate"),!0;if(!this.credentials.authenticate(this.message,f))return!0;this.challenged=!0,f.stale&&(this.stale=!0);let v=this.message.cseq+=1;return i&&i.localSequenceNumber&&(i.incrementLocalSequenceNumber(),v=this.message.cseq=i.localSequenceNumber),this.message.setHeader("cseq",v+" "+this.message.method),this.message.setHeader(p,this.credentials.toString()),this.init(),!1}onRequestTimeout(){this.logger.warn("User agent client request timed out. Generating internal 408 Request Timeout.");const r=new vu;r.statusCode=408,r.reasonPhrase="Request Timeout",this.receiveResponse(r)}onTransportError(r){this.logger.error(r.message),this.logger.error("User agent client request transport error. Generating internal 503 Service Unavailable.");const i=new vu;i.statusCode=503,i.reasonPhrase="Service Unavailable",this.receiveResponse(i)}receiveResponse(r){if(!this.authenticationGuard(r))return;const i=r.statusCode?r.statusCode.toString():"";if(!i)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(i):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:r});break;case/^1[0-9]{2}$/.test(i):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:r});break;case/^2[0-9]{2}$/.test(i):this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:r});break;case/^3[0-9]{2}$/.test(i):this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:r});break;case/^[4-6][0-9]{2}$/.test(i):this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:r});break;default:throw new Error(`Invalid status code ${i}`)}}init(){const r={loggerFactory:this.loggerFactory,onRequestTimeout:()=>this.onRequestTimeout(),onStateChange:f=>{f===pe.Terminated&&(this.core.userAgentClients.delete(l),i===this._transaction&&this.dispose())},onTransportError:f=>this.onTransportError(f),receiveResponse:f=>this.receiveResponse(f)},i=new this.transactionConstructor(this.message,this.core.transport,r);this._transaction=i;const l=i.id+i.request.method;this.core.userAgentClients.set(l,this)}}class JR extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(tt.BYE,l);super(Pa,r.userAgentCore,f,i),r.dispose()}}class La extends X2{constructor(r,i,l){super(r,i,l,pe.Trying,"sip.transaction.nist")}dispose(){this.J&&(clearTimeout(this.J),this.J=void 0),super.dispose()}get kind(){return"nist"}receiveRequest(r){switch(this.state){case pe.Trying:break;case pe.Proceeding:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(i=>{this.logTransportError(i,"Failed to send retransmission of provisional response.")});break;case pe.Completed:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(i=>{this.logTransportError(i,"Failed to send retransmission of final response.")});break;case pe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}}receiveResponse(r,i){if(r<100||r>699)throw new Error(`Invalid status code ${r}`);if(r>100&&r<=199)throw new Error("Provisional response other than 100 not allowed.");switch(this.state){case pe.Trying:if(this.lastResponse=i,r>=100&&r<200){this.stateTransition(pe.Proceeding),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send provisional response.")});return}if(r>=200&&r<=699){this.stateTransition(pe.Completed),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send final response.")});return}break;case pe.Proceeding:if(this.lastResponse=i,r>=200&&r<=699){this.stateTransition(pe.Completed),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send final response.")});return}break;case pe.Completed:return;case pe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const l=`Non-INVITE server transaction received unexpected ${r} response from TU while in state ${this.state}.`;throw this.logger.error(l),new Error(l)}onTransportError(r){this.user.onTransportError&&this.user.onTransportError(r),this.stateTransition(pe.Terminated,!0)}typeToString(){return"non-INVITE server transaction"}stateTransition(r,i=!1){const l=()=>{throw new Error(`Invalid state transition from ${this.state} to ${r}`)};switch(r){case pe.Trying:l();break;case pe.Proceeding:this.state!==pe.Trying&&l();break;case pe.Completed:this.state!==pe.Trying&&this.state!==pe.Proceeding&&l();break;case pe.Terminated:this.state!==pe.Proceeding&&this.state!==pe.Completed&&(i||l());break;default:l()}r===pe.Completed&&(this.J=setTimeout(()=>this.timerJ(),oi.TIMER_J)),r===pe.Terminated&&this.dispose(),this.setState(r)}timerJ(){this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`),this.state===pe.Completed&&this.stateTransition(pe.Terminated)}}class So{constructor(r,i,l,f){this.transactionConstructor=r,this.core=i,this.message=l,this.delegate=f,this.logger=this.loggerFactory.getLogger("sip.user-agent-server"),this.toTag=l.toTag?l.toTag:wv(),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}accept(r={statusCode:200}){if(!this.acceptable)throw new gu(`${this.message.method} not acceptable in state ${this.transaction.state}.`);const i=r.statusCode;if(i<200||i>299)throw new TypeError(`Invalid statusCode: ${i}`);return this.reply(r)}progress(r={statusCode:180}){if(!this.progressable)throw new gu(`${this.message.method} not progressable in state ${this.transaction.state}.`);const i=r.statusCode;if(i<101||i>199)throw new TypeError(`Invalid statusCode: ${i}`);return this.reply(r)}redirect(r,i={statusCode:302}){if(!this.redirectable)throw new gu(`${this.message.method} not redirectable in state ${this.transaction.state}.`);const l=i.statusCode;if(l<300||l>399)throw new TypeError(`Invalid statusCode: ${l}`);const f=new Array;return r.forEach(v=>f.push(`Contact: ${v.toString()}`)),i.extraHeaders=(i.extraHeaders||[]).concat(f),this.reply(i)}reject(r={statusCode:480}){if(!this.rejectable)throw new gu(`${this.message.method} not rejectable in state ${this.transaction.state}.`);const i=r.statusCode;if(i<400||i>699)throw new TypeError(`Invalid statusCode: ${i}`);return this.reply(r)}trying(r){if(!this.tryingable)throw new gu(`${this.message.method} not tryingable in state ${this.transaction.state}.`);return this.reply({statusCode:100})}receiveCancel(r){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(r)}get acceptable(){if(this.transaction instanceof ya)return this.transaction.state===pe.Proceeding||this.transaction.state===pe.Accepted;if(this.transaction instanceof La)return this.transaction.state===pe.Trying||this.transaction.state===pe.Proceeding;throw new Error("Unknown transaction type.")}get progressable(){if(this.transaction instanceof ya)return this.transaction.state===pe.Proceeding;if(this.transaction instanceof La)return!1;throw new Error("Unknown transaction type.")}get redirectable(){if(this.transaction instanceof ya)return this.transaction.state===pe.Proceeding;if(this.transaction instanceof La)return this.transaction.state===pe.Trying||this.transaction.state===pe.Proceeding;throw new Error("Unknown transaction type.")}get rejectable(){if(this.transaction instanceof ya)return this.transaction.state===pe.Proceeding;if(this.transaction instanceof La)return this.transaction.state===pe.Trying||this.transaction.state===pe.Proceeding;throw new Error("Unknown transaction type.")}get tryingable(){if(this.transaction instanceof ya)return this.transaction.state===pe.Proceeding;if(this.transaction instanceof La)return this.transaction.state===pe.Trying;throw new Error("Unknown transaction type.")}reply(r){!r.toTag&&r.statusCode!==100&&(r.toTag=this.toTag),r.userAgent=r.userAgent||this.core.configuration.userAgentHeaderFieldValue,r.supported=r.supported||this.core.configuration.supportedOptionTagsResponse;const i=K2(this.message,r);return this.transaction.receiveResponse(r.statusCode,i.message),i}init(){const r={loggerFactory:this.loggerFactory,onStateChange:f=>{f===pe.Terminated&&(this.core.userAgentServers.delete(l),this.dispose())},onTransportError:f=>{this.logger.error(f.message),this.delegate&&this.delegate.onTransportError?this.delegate.onTransportError(f):this.logger.error("User agent server response transport error.")}},i=new this.transactionConstructor(this.message,this.core.transport,r);this._transaction=i;const l=i.id;this.core.userAgentServers.set(i.id,this)}}class e8 extends So{constructor(r,i,l){super(La,r.userAgentCore,i,l)}}class t8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(tt.INFO,l);super(Pa,r.userAgentCore,f,i)}}class r8 extends So{constructor(r,i,l){super(La,r.userAgentCore,i,l)}}class Z2 extends Bi{constructor(r,i,l){super(Pa,r,i,l)}}class J2 extends So{constructor(r,i,l){super(La,r,i,l)}}class n8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(tt.NOTIFY,l);super(Pa,r.userAgentCore,f,i)}}function i8(o){return o.userAgentCore!==void 0}class Tv extends So{constructor(r,i,l){const f=i8(r)?r.userAgentCore:r;super(La,f,i,l)}}class a8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(tt.PRACK,l);super(Pa,r.userAgentCore,f,i),r.signalingStateTransition(f)}}class s8 extends So{constructor(r,i,l){super(La,r.userAgentCore,i,l),r.signalingStateTransition(i),this.dialog=r}accept(r={statusCode:200}){return r.body&&this.dialog.signalingStateTransition(r.body),super.accept(r)}}class o8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(tt.INVITE,l);super(xu,r.userAgentCore,f,i),this.delegate=i,r.signalingStateTransition(f),r.reinviteUserAgentClient=this,this.dialog=r}receiveResponse(r){if(!this.authenticationGuard(r,this.dialog))return;const i=r.statusCode?r.statusCode.toString():"";if(!i)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(i):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:r});break;case/^1[0-9]{2}$/.test(i):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:r,session:this.dialog,prack:l=>{throw new Error("Unimplemented.")}});break;case/^2[0-9]{2}$/.test(i):this.dialog.signalingStateTransition(r),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:r,session:this.dialog,ack:l=>this.dialog.ack(l)});break;case/^3[0-9]{2}$/.test(i):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:r});break;case/^[4-6][0-9]{2}$/.test(i):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:r});break;default:throw new Error(`Invalid status code ${i}`)}}}class l8 extends So{constructor(r,i,l){super(ya,r.userAgentCore,i,l),r.reinviteUserAgentServer=this,this.dialog=r}accept(r={statusCode:200}){r.extraHeaders=r.extraHeaders||[],r.extraHeaders=r.extraHeaders.concat(this.dialog.routeSet.map(p=>`Record-Route: ${p}`));const i=super.accept(r),l=this.dialog,f=Object.assign(Object.assign({},i),{session:l});return r.body&&this.dialog.signalingStateTransition(r.body),this.dialog.reConfirm(),f}progress(r={statusCode:180}){const i=super.progress(r),l=this.dialog,f=Object.assign(Object.assign({},i),{session:l});return r.body&&this.dialog.signalingStateTransition(r.body),f}redirect(r,i={statusCode:302}){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,new Error("Unimplemented.")}reject(r={statusCode:488}){return this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,super.reject(r)}}class u8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(tt.REFER,l);super(Pa,r.userAgentCore,f,i)}}function c8(o){return o.userAgentCore!==void 0}class ew extends So{constructor(r,i,l){const f=c8(r)?r.userAgentCore:r;super(La,f,i,l)}}class Rv extends Zf{constructor(r,i,l,f){super(i,l),this.initialTransaction=r,this._signalingState=Ye.Initial,this.ackWait=!1,this.ackProcessing=!1,this.delegate=f,r instanceof ya&&(this.ackWait=!0),this.early||this.start2xxRetransmissionTimer(),this.signalingStateTransition(r.request),this.logger=i.loggerFactory.getLogger("sip.invite-dialog"),this.logger.log(`INVITE dialog ${this.id} constructed`)}dispose(){super.dispose(),this._signalingState=Ye.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.logger.log(`INVITE dialog ${this.id} destroyed`)}get sessionState(){return this.early?as.Early:this.ackWait?as.AckWait:this._signalingState===Ye.Closed?as.Terminated:as.Confirmed}get signalingState(){return this._signalingState}get offer(){return this._offer}get answer(){return this._answer}confirm(){this.early&&this.start2xxRetransmissionTimer(),super.confirm()}reConfirm(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()}ack(r={}){this.logger.log(`INVITE dialog ${this.id} sending ACK request`);let i;if(this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof xu))throw new Error("Transaction not instance of InviteClientTransaction.");i=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof xu))throw new Error("Initial transaction not instance of InviteClientTransaction.");i=this.initialTransaction}const l=this.createOutgoingRequestMessage(tt.ACK,{cseq:i.request.cseq,extraHeaders:r.extraHeaders,body:r.body});return i.ackResponse(l),this.signalingStateTransition(l),{message:l}}bye(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending BYE request`),this.initialTransaction instanceof ya){if(this.early)throw new Error("UAS MUST NOT send a BYE on early dialogs.");if(this.ackWait&&this.initialTransaction.state!==pe.Terminated)throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.")}return new JR(this,r,i)}info(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending INFO request`),this.early)throw new Error("Dialog not confirmed.");return new t8(this,r,i)}invite(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending INVITE request`),this.early)throw new Error("Dialog not confirmed.");if(this.reinviteUserAgentClient)throw new Error("There is an ongoing re-INVITE client transaction.");if(this.reinviteUserAgentServer)throw new Error("There is an ongoing re-INVITE server transaction.");return new o8(this,r,i)}message(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`),this.early)throw new Error("Dialog not confirmed.");const l=this.createOutgoingRequestMessage(tt.MESSAGE,i);return new Z2(this.core,l,r)}notify(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`),this.early)throw new Error("Dialog not confirmed.");return new n8(this,r,i)}prack(r,i){return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`),new a8(this,r,i)}refer(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending REFER request`),this.early)throw new Error("Dialog not confirmed.");return new u8(this,r,i)}receiveRequest(r){if(this.logger.log(`INVITE dialog ${this.id} received ${r.method} request`),r.method===tt.ACK){if(this.ackWait){if(this.initialTransaction instanceof xu){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${r.method} request, dropping.`);return}if(this.initialTransaction.request.cseq!==r.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${r.method} request, dropping.`);return}this.ackWait=!1}else{if(!this.reinviteUserAgentServer){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${r.method} request, dropping.`);return}if(this.reinviteUserAgentServer.transaction.request.cseq!==r.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${r.method} request, dropping.`);return}this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(r),this.delegate&&this.delegate.onAck){const i=this.delegate.onAck({message:r});i instanceof Promise&&(this.ackProcessing=!0,i.then(()=>this.ackProcessing=!1).catch(()=>this.ackProcessing=!1))}return}if(!this.sequenceGuard(r)){this.logger.log(`INVITE dialog ${this.id} rejected out of order ${r.method} request.`);return}if(super.receiveRequest(r),r.method===tt.INVITE){const i=()=>{const p=this.ackWait?"waiting for initial ACK":"processing initial ACK";this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${p}`);let v="RFC 5407 suggests the following to avoid this race condition... ";v+=" Note: Implementation issues are outside the scope of this document,",v+=" but the following tip is provided for avoiding race conditions of",v+=" this type. The caller can delay sending re-INVITE F6 for some period",v+=" of time (2 seconds, perhaps), after which the caller can reasonably",v+=" assume that its ACK has been received. Implementors can decouple the",v+=" actions of the user (e.g., pressing the hold button) from the actions",v+=" of the protocol (the sending of re-INVITE F6), so that the UA can",v+=" behave like this. In this case, it is the implementor's choice as to",v+=" how long to wait. In most cases, such an implementation may be",v+=" useful to prevent the type of race condition shown in this section.",v+=" This document expresses no preference about whether or not they",v+=" should wait for an ACK to be delivered. After considering the impact",v+=" on user experience, implementors should decide whether or not to wait",v+=" for a while, because the user experience depends on the",v+=" implementation and has no direct bearing on protocol behavior.",this.logger.warn(v)},f=[`Retry-After: ${Math.floor(Math.random()*10)+1}`];if(this.ackProcessing){this.core.replyStateless(r,{statusCode:500,extraHeaders:f}),i();return}if(this.ackWait&&this.signalingState!==Ye.Stable){this.core.replyStateless(r,{statusCode:500,extraHeaders:f}),i();return}if(this.reinviteUserAgentServer){this.core.replyStateless(r,{statusCode:500,extraHeaders:f});return}if(this.reinviteUserAgentClient){this.core.replyStateless(r,{statusCode:491});return}}if(r.method===tt.INVITE){const i=r.parseHeader("contact");if(!i)throw new Error("Contact undefined.");if(!(i instanceof ma))throw new Error("Contact not instance of NameAddrHeader.");this.dialogState.remoteTarget=i.uri}switch(r.method){case tt.BYE:{const i=new e8(this,r);this.delegate&&this.delegate.onBye?this.delegate.onBye(i):i.accept(),this.dispose()}break;case tt.INFO:{const i=new r8(this,r);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(i):i.reject({statusCode:469,extraHeaders:["Recv-Info:"]})}break;case tt.INVITE:{const i=new l8(this,r);this.signalingStateTransition(r),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(i):i.reject({statusCode:488})}break;case tt.MESSAGE:{const i=new J2(this.core,r);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(i):i.accept()}break;case tt.NOTIFY:{const i=new Tv(this,r);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(i):i.accept()}break;case tt.PRACK:{const i=new s8(this,r);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(i):i.accept()}break;case tt.REFER:{const i=new ew(this,r);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(i):i.reject()}break;default:this.logger.log(`INVITE dialog ${this.id} received unimplemented ${r.method} request`),this.core.replyStateless(r,{statusCode:501});break}}reliableSequenceGuard(r){const i=r.statusCode;if(!i)throw new Error("Status code undefined");if(i>100&&i<200){const l=r.getHeader("require"),f=r.getHeader("rseq"),p=l&&l.includes("100rel")&&f?Number(f):void 0;if(p){if(this.rseq&&this.rseq+1!==p)return!1;this.rseq=this.rseq?this.rseq+1:p}}return!0}signalingStateRollback(){(this._signalingState===Ye.HaveLocalOffer||this.signalingState===Ye.HaveRemoteOffer)&&this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=Ye.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)}signalingStateTransition(r){const i=t0(r);if(!(!i||i.contentDisposition!=="session")){if(this._signalingState===Ye.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),r instanceof Xf)switch(this._signalingState){case Ye.Initial:case Ye.Stable:this._signalingState=Ye.HaveRemoteOffer,this._offer=i,this._answer=void 0;break;case Ye.HaveLocalOffer:this._signalingState=Ye.Stable,this._answer=i;break;case Ye.HaveRemoteOffer:break;case Ye.Closed:break;default:throw new Error("Unexpected signaling state.")}if(r instanceof vu)switch(this._signalingState){case Ye.Initial:case Ye.Stable:this._signalingState=Ye.HaveRemoteOffer,this._offer=i,this._answer=void 0;break;case Ye.HaveLocalOffer:this._signalingState=Ye.Stable,this._answer=i;break;case Ye.HaveRemoteOffer:break;case Ye.Closed:break;default:throw new Error("Unexpected signaling state.")}if(r instanceof Dc)switch(this._signalingState){case Ye.Initial:case Ye.Stable:this._signalingState=Ye.HaveLocalOffer,this._offer=i,this._answer=void 0;break;case Ye.HaveLocalOffer:break;case Ye.HaveRemoteOffer:this._signalingState=Ye.Stable,this._answer=i;break;case Ye.Closed:break;default:throw new Error("Unexpected signaling state.")}if(q2(r))switch(this._signalingState){case Ye.Initial:case Ye.Stable:this._signalingState=Ye.HaveLocalOffer,this._offer=i,this._answer=void 0;break;case Ye.HaveLocalOffer:break;case Ye.HaveRemoteOffer:this._signalingState=Ye.Stable,this._answer=i;break;case Ye.Closed:break;default:throw new Error("Unexpected signaling state.")}}}start2xxRetransmissionTimer(){if(this.initialTransaction instanceof ya){const r=this.initialTransaction;let i=oi.T1;const l=()=>{if(!this.ackWait){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),r.retransmitAcceptedResponse(),i=Math.min(i*2,oi.T2),this.invite2xxTimer=setTimeout(l,i)};this.invite2xxTimer=setTimeout(l,i);const f=()=>{r.state===pe.Terminated&&(r.removeStateChangeListener(f),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.ackWait&&(this.delegate&&this.delegate.onAckTimeout?this.delegate.onAckTimeout():this.bye()))};r.addStateChangeListener(f)}}startReInvite2xxRetransmissionTimer(){if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof ya){const r=this.reinviteUserAgentServer.transaction;let i=oi.T1;const l=()=>{if(!this.reinviteUserAgentServer){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),r.retransmitAcceptedResponse(),i=Math.min(i*2,oi.T2),this.invite2xxTimer=setTimeout(l,i)};this.invite2xxTimer=setTimeout(l,i);const f=()=>{r.state===pe.Terminated&&(r.removeStateChangeListener(f),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.reinviteUserAgentServer)};r.addStateChangeListener(f)}}}class f8 extends Bi{constructor(r,i,l){super(xu,r,i,l),this.confirmedDialogAcks=new Map,this.confirmedDialogs=new Map,this.earlyDialogs=new Map,this.delegate=l}dispose(){this.earlyDialogs.forEach(r=>r.dispose()),this.earlyDialogs.clear(),super.dispose()}onTransportError(r){if(this.transaction.state===pe.Calling)return super.onTransportError(r);this.logger.error(r.message),this.logger.error("User agent client request transport error while sending ACK.")}receiveResponse(r){if(!this.authenticationGuard(r))return;const i=r.statusCode?r.statusCode.toString():"";if(!i)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(i):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:r});return;case/^1[0-9]{2}$/.test(i):{if(!r.toTag){this.logger.warn("Non-100 1xx INVITE response received without a to tag, dropping.");return}if(!r.parseHeader("contact")){this.logger.error("Non-100 1xx INVITE response received without a Contact header field, dropping.");return}const f=Zf.initialDialogStateForUserAgentClient(this.message,r);let p=this.earlyDialogs.get(f.id);if(!p){const S=this.transaction;if(!(S instanceof xu))throw new Error("Transaction not instance of InviteClientTransaction.");p=new Rv(S,this.core,f),this.earlyDialogs.set(p.id,p)}if(!p.reliableSequenceGuard(r)){this.logger.warn("1xx INVITE reliable response received out of order or is a retransmission, dropping.");return}(p.signalingState===Ye.Initial||p.signalingState===Ye.HaveLocalOffer)&&p.signalingStateTransition(r);const v=p;this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:r,session:v,prack:S=>v.prack(void 0,S)})}return;case/^2[0-9]{2}$/.test(i):{if(!r.toTag){this.logger.error("2xx INVITE response received without a to tag, dropping.");return}if(!r.parseHeader("contact")){this.logger.error("2xx INVITE response received without a Contact header field, dropping.");return}const f=Zf.initialDialogStateForUserAgentClient(this.message,r);let p=this.confirmedDialogs.get(f.id);if(p){const S=this.confirmedDialogAcks.get(f.id);if(S){const w=this.transaction;if(!(w instanceof xu))throw new Error("Client transaction not instance of InviteClientTransaction.");w.ackResponse(S.message)}return}if(p=this.earlyDialogs.get(f.id),p)p.confirm(),p.recomputeRouteSet(r),this.earlyDialogs.delete(p.id),this.confirmedDialogs.set(p.id,p);else{const S=this.transaction;if(!(S instanceof xu))throw new Error("Transaction not instance of InviteClientTransaction.");p=new Rv(S,this.core,f),this.confirmedDialogs.set(p.id,p)}(p.signalingState===Ye.Initial||p.signalingState===Ye.HaveLocalOffer)&&p.signalingStateTransition(r);const v=p;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:r,session:v,ack:S=>{const w=v.ack(S);return this.confirmedDialogAcks.set(v.id,w),w}});else{const S=v.ack();this.confirmedDialogAcks.set(v.id,S)}}return;case/^3[0-9]{2}$/.test(i):this.earlyDialogs.forEach(l=>l.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:r});return;case/^[4-6][0-9]{2}$/.test(i):this.earlyDialogs.forEach(l=>l.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:r});return;default:throw new Error(`Invalid status code ${i}`)}}}class Ux extends So{constructor(r,i,l){super(ya,r,i,l),this.core=r}dispose(){this.earlyDialog&&this.earlyDialog.dispose(),super.dispose()}accept(r={statusCode:200}){if(!this.acceptable)throw new gu(`${this.message.method} not acceptable in state ${this.transaction.state}.`);if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{const w=this.transaction;if(!(w instanceof ya))throw new Error("Transaction not instance of InviteClientTransaction.");const C=Zf.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new Rv(w,this.core,C)}const i=this.message.getHeaders("record-route").map(w=>`Record-Route: ${w}`),l=`Contact: ${this.core.configuration.contact.toString()}`,f="Allow: "+mu.toString();if(!r.body){if(this.confirmedDialog.signalingState===Ye.Stable)r.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===Ye.Initial||this.confirmedDialog.signalingState===Ye.HaveRemoteOffer)throw new Error("Response must have a body.")}r.statusCode=r.statusCode||200,r.extraHeaders=r.extraHeaders||[],r.extraHeaders=r.extraHeaders.concat(i),r.extraHeaders.push(f),r.extraHeaders.push(l);const p=super.accept(r),v=this.confirmedDialog,S=Object.assign(Object.assign({},p),{session:v});return r.body&&this.confirmedDialog.signalingState!==Ye.Stable&&this.confirmedDialog.signalingStateTransition(r.body),S}progress(r={statusCode:180}){if(!this.progressable)throw new gu(`${this.message.method} not progressable in state ${this.transaction.state}.`);if(!this.earlyDialog){const S=this.transaction;if(!(S instanceof ya))throw new Error("Transaction not instance of InviteClientTransaction.");const w=Zf.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new Rv(S,this.core,w)}const i=this.message.getHeaders("record-route").map(S=>`Record-Route: ${S}`),l=`Contact: ${this.core.configuration.contact}`;r.extraHeaders=r.extraHeaders||[],r.extraHeaders=r.extraHeaders.concat(i),r.extraHeaders.push(l);const f=super.progress(r),p=this.earlyDialog,v=Object.assign(Object.assign({},f),{session:p});return r.body&&this.earlyDialog.signalingState!==Ye.Stable&&this.earlyDialog.signalingStateTransition(r.body),v}redirect(r,i={statusCode:302}){return super.redirect(r,i)}reject(r={statusCode:486}){return super.reject(r)}}class d8 extends Bi{constructor(r,i,l){super(Pa,r,i,l)}}class h8 extends Bi{constructor(r,i,l){super(Pa,r,i,l)}}class p8 extends So{constructor(r,i,l){super(La,r,i,l),this.core=r}}class v8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(tt.SUBSCRIBE,l);super(Pa,r.userAgentCore,f,i),this.dialog=r}waitNotifyStop(){}receiveResponse(r){if(r.statusCode&&r.statusCode>=200&&r.statusCode<300){const i=r.getHeader("Expires");if(!i)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const l=Number(i);this.dialog.subscriptionExpires>l&&(this.dialog.subscriptionExpires=l)}}r.statusCode&&r.statusCode>=400&&r.statusCode<700&&[404,405,410,416,480,481,482,483,484,485,489,501,604].includes(r.statusCode)&&this.dialog.terminate(),super.receiveResponse(r)}}class tw extends Zf{constructor(r,i,l,f,p,v){super(f,p),this.delegate=v,this._autoRefresh=!1,this._subscriptionEvent=r,this._subscriptionExpires=i,this._subscriptionExpiresInitial=i,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this._subscriptionState=l,this.logger=f.loggerFactory.getLogger("sip.subscribe-dialog"),this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`)}static initialDialogStateForSubscription(r,i){const f=i.getHeaders("record-route"),p=i.parseHeader("contact");if(!p)throw new Error("Contact undefined.");if(!(p instanceof ma))throw new Error("Contact not instance of NameAddrHeader.");const v=p.uri,S=r.cseq,w=void 0,C=r.callId,b=r.fromTag,R=i.fromTag;if(!C)throw new Error("Call id undefined.");if(!b)throw new Error("From tag undefined.");if(!R)throw new Error("To tag undefined.");if(!r.from)throw new Error("From undefined.");if(!r.to)throw new Error("To undefined.");const T=r.from.uri,H=r.to.uri;return{id:C+b+R,early:!1,callId:C,localTag:b,remoteTag:R,localSequenceNumber:S,remoteSequenceNumber:w,localURI:T,remoteURI:H,remoteTarget:v,routeSet:f,secure:!1}}dispose(){super.dispose(),this.N&&(clearTimeout(this.N),this.N=void 0),this.refreshTimerClear(),this.logger.log(`SUBSCRIBE dialog ${this.id} destroyed`)}get autoRefresh(){return this._autoRefresh}set autoRefresh(r){this._autoRefresh=!0,this.refreshTimerSet()}get subscriptionEvent(){return this._subscriptionEvent}get subscriptionExpires(){const r=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,i=this._subscriptionExpires-r;return Math.max(i,0)}set subscriptionExpires(r){if(r<0)throw new Error("Expires must be greater than or equal to zero.");if(this._subscriptionExpires=r,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){const i=this.subscriptionRefresh;(i===void 0||i>=r)&&this.refreshTimerSet()}}get subscriptionExpiresInitial(){return this._subscriptionExpiresInitial}get subscriptionRefresh(){if(this._subscriptionRefresh===void 0||this._subscriptionRefreshLastSet===void 0)return;const r=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,i=this._subscriptionRefresh-r;return Math.max(i,0)}get subscriptionState(){return this._subscriptionState}receiveRequest(r){if(this.logger.log(`SUBSCRIBE dialog ${this.id} received ${r.method} request`),!this.sequenceGuard(r)){this.logger.log(`SUBSCRIBE dialog ${this.id} rejected out of order ${r.method} request.`);return}switch(super.receiveRequest(r),r.method){case tt.NOTIFY:this.onNotify(r);break;default:this.logger.log(`SUBSCRIBE dialog ${this.id} received unimplemented ${r.method} request`),this.core.replyStateless(r,{statusCode:501});break}}refresh(){const r="Allow: "+mu.toString(),i={};return i.extraHeaders=(i.extraHeaders||[]).slice(),i.extraHeaders.push(r),i.extraHeaders.push("Event: "+this.subscriptionEvent),i.extraHeaders.push("Expires: "+this.subscriptionExpiresInitial),i.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,i)}subscribe(r,i={}){var l;if(this.subscriptionState!==vr.Pending&&this.subscriptionState!==vr.Active)throw new Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);const f=new v8(this,r,i);return this.N&&(clearTimeout(this.N),this.N=void 0),!((l=i.extraHeaders)===null||l===void 0)&&l.includes("Expires: 0")||(this.N=setTimeout(()=>this.timerN(),oi.TIMER_N)),f}terminate(){this.stateTransition(vr.Terminated),this.onTerminated()}unsubscribe(){const r="Allow: "+mu.toString(),i={};return i.extraHeaders=(i.extraHeaders||[]).slice(),i.extraHeaders.push(r),i.extraHeaders.push("Event: "+this.subscriptionEvent),i.extraHeaders.push("Expires: 0"),i.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,i)}onNotify(r){const i=r.parseHeader("Event").event;if(!i||i!==this.subscriptionEvent){this.core.replyStateless(r,{statusCode:489});return}this.N&&(clearTimeout(this.N),this.N=void 0);const l=r.parseHeader("Subscription-State");if(!l||!l.state){this.core.replyStateless(r,{statusCode:489});return}const f=l.state,p=l.expires?Math.max(l.expires,0):void 0;switch(f){case"pending":this.stateTransition(vr.Pending,p);break;case"active":this.stateTransition(vr.Active,p);break;case"terminated":this.stateTransition(vr.Terminated,p);break;default:this.logger.warn("Unrecognized subscription state.");break}const v=new Tv(this,r);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(v):v.accept()}onRefresh(r){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(r)}onTerminated(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()}refreshTimerClear(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=void 0)}refreshTimerSet(){if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){const r=this.subscriptionExpires*900;this._subscriptionRefresh=Math.floor(r/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout(()=>{this.refreshTimer=void 0,this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this.onRefresh(this.refresh())},r)}}stateTransition(r,i){const l=()=>{this.logger.warn(`Invalid subscription state transition from ${this.subscriptionState} to ${r}`)};switch(r){case vr.Initial:l();return;case vr.NotifyWait:l();return;case vr.Pending:if(this.subscriptionState!==vr.NotifyWait&&this.subscriptionState!==vr.Pending){l();return}break;case vr.Active:if(this.subscriptionState!==vr.NotifyWait&&this.subscriptionState!==vr.Pending&&this.subscriptionState!==vr.Active){l();return}break;case vr.Terminated:if(this.subscriptionState!==vr.NotifyWait&&this.subscriptionState!==vr.Pending&&this.subscriptionState!==vr.Active){l();return}break;default:l();return}r===vr.Pending&&i&&(this.subscriptionExpires=i),r===vr.Active&&i&&(this.subscriptionExpires=i),r===vr.Terminated&&this.dispose(),this._subscriptionState=r}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."),this.subscriptionState!==vr.Terminated&&(this.stateTransition(vr.Terminated),this.onTerminated())}}class g8 extends Bi{constructor(r,i,l){const f=i.getHeader("Event");if(!f)throw new Error("Event undefined");const p=i.getHeader("Expires");if(!p)throw new Error("Expires undefined");super(Pa,r,i,l),this.delegate=l,this.subscriberId=i.callId+i.fromTag+f,this.subscriptionExpiresRequested=this.subscriptionExpires=Number(p),this.subscriptionEvent=f,this.subscriptionState=vr.NotifyWait,this.waitNotifyStart()}dispose(){super.dispose()}onNotify(r){const i=r.message.parseHeader("Event").event;if(!i||i!==this.subscriptionEvent){this.logger.warn("Failed to parse event."),r.reject({statusCode:489});return}const l=r.message.parseHeader("Subscription-State");if(!l||!l.state){this.logger.warn("Failed to parse subscription state."),r.reject({statusCode:489});return}const f=l.state;switch(f){case"pending":break;case"active":break;case"terminated":break;default:this.logger.warn(`Invalid subscription state ${f}`),r.reject({statusCode:489});return}if(f!=="terminated"&&!r.message.parseHeader("contact")){this.logger.warn("Failed to parse contact."),r.reject({statusCode:489});return}if(this.dialog)throw new Error("Dialog already created. This implementation only supports install of single subscriptions.");switch(this.waitNotifyStop(),this.subscriptionExpires=l.expires?Math.min(this.subscriptionExpires,Math.max(l.expires,0)):this.subscriptionExpires,f){case"pending":this.subscriptionState=vr.Pending;break;case"active":this.subscriptionState=vr.Active;break;case"terminated":this.subscriptionState=vr.Terminated;break;default:throw new Error(`Unrecognized state ${f}.`)}if(this.subscriptionState!==vr.Terminated){const p=tw.initialDialogStateForSubscription(this.message,r.message);this.dialog=new tw(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,p)}if(this.delegate&&this.delegate.onNotify){const p=r,v=this.dialog;this.delegate.onNotify({request:p,subscription:v})}else r.accept()}waitNotifyStart(){this.N||(this.core.subscribers.set(this.subscriberId,this),this.N=setTimeout(()=>this.timerN(),oi.TIMER_N))}waitNotifyStop(){this.N&&(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),this.N=void 0)}receiveResponse(r){if(this.authenticationGuard(r)){if(r.statusCode&&r.statusCode>=200&&r.statusCode<300){const i=r.getHeader("Expires");if(!i)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const l=Number(i);l>this.subscriptionExpiresRequested&&this.logger.warn("Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request"),l<this.subscriptionExpires&&(this.subscriptionExpires=l)}this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}r.statusCode&&r.statusCode>=300&&r.statusCode<700&&this.waitNotifyStop(),super.receiveResponse(r)}}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."),this.waitNotifyStop(),this.delegate&&this.delegate.onNotifyTimeout&&this.delegate.onNotifyTimeout()}}class m8 extends So{constructor(r,i,l){super(La,r,i,l),this.core=r}}const rw=["application/sdp","application/dtmf-relay"];class y8{constructor(r,i={}){this.userAgentClients=new Map,this.userAgentServers=new Map,this.configuration=r,this.delegate=i,this.dialogs=new Map,this.subscribers=new Map,this.logger=r.loggerFactory.getLogger("sip.user-agent-core")}dispose(){this.reset()}reset(){this.dialogs.forEach(r=>r.dispose()),this.dialogs.clear(),this.subscribers.forEach(r=>r.dispose()),this.subscribers.clear(),this.userAgentClients.forEach(r=>r.dispose()),this.userAgentClients.clear(),this.userAgentServers.forEach(r=>r.dispose()),this.userAgentServers.clear()}get loggerFactory(){return this.configuration.loggerFactory}get transport(){const r=this.configuration.transportAccessor();if(!r)throw new Error("Transport undefined.");return r}invite(r,i){return new f8(this,r,i)}message(r,i){return new Z2(this,r,i)}publish(r,i){return new d8(this,r,i)}register(r,i){return new h8(this,r,i)}subscribe(r,i){return new g8(this,r,i)}request(r,i){return new Bi(Pa,this,r,i)}makeOutgoingRequestMessage(r,i,l,f,p,v,S){const w=this.configuration.sipjsId,C=this.configuration.displayName,b=this.configuration.viaForceRport,R=this.configuration.hackViaTcp,T=this.configuration.supportedOptionTags.slice();r===tt.REGISTER&&T.push("path","gruu"),r===tt.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&T.push("gruu");const H=this.configuration.routeSet,P=this.configuration.userAgentHeaderFieldValue,j=this.configuration.viaHost,O=Object.assign(Object.assign({},{callIdPrefix:w,forceRport:b,fromDisplayName:C,hackViaTcp:R,optionTags:T,routeSet:H,userAgentString:P,viaHost:j}),p);return new Dc(r,i,l,f,O,v,S)}receiveIncomingRequestFromTransport(r){this.receiveRequestFromTransport(r)}receiveIncomingResponseFromTransport(r){this.receiveResponseFromTransport(r)}replyStateless(r,i){const l=this.configuration.userAgentHeaderFieldValue,f=this.configuration.supportedOptionTagsResponse;i=Object.assign(Object.assign({},i),{userAgent:l,supported:f});const p=K2(r,i);return this.transport.send(p.message).catch(v=>{v instanceof Error&&this.logger.error(v.message),this.logger.error(`Transport error occurred sending stateless reply to ${r.method} request.`)}),p}receiveRequestFromTransport(r){const i=r.viaBranch,l=this.userAgentServers.get(i);if(r.method===tt.ACK&&l&&l.transaction.state===pe.Accepted&&l instanceof Ux){this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${i}.`);return}if(r.method===tt.CANCEL){l?(this.replyStateless(r,{statusCode:200}),l.transaction instanceof ya&&l.transaction.state===pe.Proceeding&&l instanceof Ux&&l.receiveCancel(r)):this.replyStateless(r,{statusCode:481});return}if(l){l.transaction.receiveRequest(r);return}this.receiveRequest(r)}receiveRequest(r){if(!mu.includes(r.method)){const f="Allow: "+mu.toString();this.replyStateless(r,{statusCode:405,extraHeaders:[f]});return}if(!r.ruri)throw new Error("Request-URI undefined.");if(r.ruri.scheme!=="sip"){this.replyStateless(r,{statusCode:416});return}const i=r.ruri,l=f=>!!f&&f.user===i.user;if(!l(this.configuration.aor)&&!(l(this.configuration.contact.uri)||l(this.configuration.contact.pubGruu)||l(this.configuration.contact.tempGruu))){this.logger.warn("Request-URI does not point to us."),r.method!==tt.ACK&&this.replyStateless(r,{statusCode:404});return}if(r.method===tt.INVITE&&!r.hasHeader("Contact")){this.replyStateless(r,{statusCode:400,reasonPhrase:"Missing Contact Header"});return}if(!r.toTag){const f=r.viaBranch;if(!this.userAgentServers.has(f)&&Array.from(this.userAgentServers.values()).some(v=>v.transaction.request.fromTag===r.fromTag&&v.transaction.request.callId===r.callId&&v.transaction.request.cseq===r.cseq)){this.replyStateless(r,{statusCode:482});return}}r.toTag?this.receiveInsideDialogRequest(r):this.receiveOutsideDialogRequest(r)}receiveInsideDialogRequest(r){if(r.method===tt.NOTIFY){const f=r.parseHeader("Event");if(!f||!f.event){this.replyStateless(r,{statusCode:489});return}const p=r.callId+r.toTag+f.event,v=this.subscribers.get(p);if(v){const S=new Tv(this,r);v.onNotify(S);return}}const i=r.callId+r.toTag+r.fromTag,l=this.dialogs.get(i);if(l){if(r.method===tt.OPTIONS){const f="Allow: "+mu.toString(),p="Accept: "+rw.toString();this.replyStateless(r,{statusCode:200,extraHeaders:[f,p]});return}l.receiveRequest(r);return}r.method!==tt.ACK&&this.replyStateless(r,{statusCode:481})}receiveOutsideDialogRequest(r){switch(r.method){case tt.ACK:break;case tt.BYE:this.replyStateless(r,{statusCode:481});break;case tt.CANCEL:throw new Error(`Unexpected out of dialog request method ${r.method}.`);case tt.INFO:this.replyStateless(r,{statusCode:405});break;case tt.INVITE:{const i=new Ux(this,r);this.delegate.onInvite?this.delegate.onInvite(i):i.reject()}break;case tt.MESSAGE:{const i=new J2(this,r);this.delegate.onMessage?this.delegate.onMessage(i):i.accept()}break;case tt.NOTIFY:{const i=new Tv(this,r);this.delegate.onNotify?this.delegate.onNotify(i):i.reject({statusCode:405})}break;case tt.OPTIONS:{const i="Allow: "+mu.toString(),l="Accept: "+rw.toString();this.replyStateless(r,{statusCode:200,extraHeaders:[i,l]})}break;case tt.REFER:{const i=new ew(this,r);this.delegate.onRefer?this.delegate.onRefer(i):i.reject({statusCode:405})}break;case tt.REGISTER:{const i=new p8(this,r);this.delegate.onRegister?this.delegate.onRegister(i):i.reject({statusCode:405})}break;case tt.SUBSCRIBE:{const i=new m8(this,r);this.delegate.onSubscribe?this.delegate.onSubscribe(i):i.reject({statusCode:480})}break;default:throw new Error(`Unexpected out of dialog request method ${r.method}.`)}}receiveResponseFromTransport(r){if(r.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response, dropping");return}const i=r.viaBranch+r.method,l=this.userAgentClients.get(i);l?l.transaction.receiveResponse(r):this.logger.warn(`Discarding unmatched ${r.statusCode} response to ${r.method} ${i}.`)}}function x8(){return o=>!o.audio&&!o.video?Promise.resolve(new MediaStream):navigator.mediaDevices===void 0?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,o)}function E8(){return{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require"}}class hl{constructor(r,i,l){r.debug("SessionDescriptionHandler.constructor"),this.logger=r,this.mediaStreamFactory=i,this.sessionDescriptionHandlerConfiguration=l,this._localMediaStream=new MediaStream,this._remoteMediaStream=new MediaStream,this._peerConnection=new RTCPeerConnection(l==null?void 0:l.peerConnectionConfiguration),this.initPeerConnectionEventHandlers()}get localMediaStream(){return this._localMediaStream}get remoteMediaStream(){return this._remoteMediaStream}get dataChannel(){return this._dataChannel}get peerConnection(){return this._peerConnection}get peerConnectionDelegate(){return this._peerConnectionDelegate}set peerConnectionDelegate(r){this._peerConnectionDelegate=r}static dispatchAddTrackEvent(r,i){r.dispatchEvent(new MediaStreamTrackEvent("addtrack",{track:i}))}static dispatchRemoveTrackEvent(r,i){r.dispatchEvent(new MediaStreamTrackEvent("removetrack",{track:i}))}close(){this.logger.debug("SessionDescriptionHandler.close"),this._peerConnection!==void 0&&(this._peerConnection.getReceivers().forEach(r=>{r.track&&r.track.stop()}),this._peerConnection.getSenders().forEach(r=>{r.track&&r.track.stop()}),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)}enableReceiverTracks(r){const i=this.peerConnection;if(!i)throw new Error("Peer connection closed.");i.getReceivers().forEach(l=>{l.track&&(l.track.enabled=r)})}enableSenderTracks(r){const i=this.peerConnection;if(!i)throw new Error("Peer connection closed.");i.getSenders().forEach(l=>{l.track&&(l.track.enabled=r)})}getDescription(r,i){var l,f;if(this.logger.debug("SessionDescriptionHandler.getDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=r==null?void 0:r.onDataChannel;const p=(l=r==null?void 0:r.offerOptions)===null||l===void 0?void 0:l.iceRestart,v=(r==null?void 0:r.iceGatheringTimeout)===void 0?(f=this.sessionDescriptionHandlerConfiguration)===null||f===void 0?void 0:f.iceGatheringTimeout:r==null?void 0:r.iceGatheringTimeout;return this.getLocalMediaStream(r).then(()=>this.updateDirection(r)).then(()=>this.createDataChannel(r)).then(()=>this.createLocalOfferOrAnswer(r)).then(S=>this.applyModifiers(S,i)).then(S=>this.setLocalSessionDescription(S)).then(()=>this.waitForIceGatheringComplete(p,v)).then(()=>this.getLocalSessionDescription()).then(S=>({body:S.sdp,contentType:"application/sdp"})).catch(S=>{throw this.logger.error("SessionDescriptionHandler.getDescription failed - "+S),S})}hasDescription(r){return this.logger.debug("SessionDescriptionHandler.hasDescription"),r==="application/sdp"}iceGatheringComplete(){this.logger.debug("SessionDescriptionHandler.iceGatheringComplete"),this.iceGatheringCompleteTimeoutId!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - clearing timeout"),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),this.iceGatheringCompletePromise!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - resolving promise"),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)}sendDtmf(r,i){if(this.logger.debug("SessionDescriptionHandler.sendDtmf"),this._peerConnection===void 0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - peer connection closed"),!1;const l=this._peerConnection.getSenders();if(l.length===0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no senders"),!1;const f=l[0].dtmf;if(!f)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no DTMF sender"),!1;const p=i==null?void 0:i.duration,v=i==null?void 0:i.interToneGap;try{f.insertDTMF(r,p,v)}catch(S){return this.logger.error(S.toString()),!1}return this.logger.log("SessionDescriptionHandler.sendDtmf sent via RTP: "+r.toString()),!0}setDescription(r,i,l){if(this.logger.debug("SessionDescriptionHandler.setDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=i==null?void 0:i.onDataChannel;const f=this._peerConnection.signalingState==="have-local-offer"?"answer":"offer";return this.getLocalMediaStream(i).then(()=>this.applyModifiers({sdp:r,type:f},l)).then(p=>this.setRemoteSessionDescription(p)).catch(p=>{throw this.logger.error("SessionDescriptionHandler.setDescription failed - "+p),p})}applyModifiers(r,i){return this.logger.debug("SessionDescriptionHandler.applyModifiers"),!i||i.length===0?Promise.resolve(r):i.reduce((l,f)=>l.then(f),Promise.resolve(r)).then(l=>{if(this.logger.debug("SessionDescriptionHandler.applyModifiers - modified sdp"),!l.sdp||!l.type)throw new Error("Invalid SDP.");return{sdp:l.sdp,type:l.type}})}createDataChannel(r){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));if((r==null?void 0:r.dataChannel)!==!0||this._dataChannel)return Promise.resolve();switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.createDataChannel - creating data channel");try{return this._dataChannel=this._peerConnection.createDataChannel((r==null?void 0:r.dataChannelLabel)||"",r==null?void 0:r.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(i){return Promise.reject(i)}case"have-remote-offer":return Promise.resolve();case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}createLocalOfferOrAnswer(r){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer"),this._peerConnection.createOffer(r==null?void 0:r.offerOptions);case"have-remote-offer":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer"),this._peerConnection.createAnswer(r==null?void 0:r.answerOptions);case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}getLocalMediaStream(r){if(this.logger.debug("SessionDescriptionHandler.getLocalMediaStream"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));let i=Object.assign({},r==null?void 0:r.constraints);if(this.localMediaStreamConstraints){if(i.audio=i.audio||this.localMediaStreamConstraints.audio,i.video=i.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(i.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(i.video))return Promise.resolve()}else i.audio===void 0&&i.video===void 0&&(i={audio:!0});return this.localMediaStreamConstraints=i,this.mediaStreamFactory(i,this,r).then(l=>this.setLocalMediaStream(l))}setLocalMediaStream(r){if(this.logger.debug("SessionDescriptionHandler.setLocalMediaStream"),!this._peerConnection)throw new Error("Peer connection undefined.");const i=this._peerConnection,l=this._localMediaStream,f=[],p=w=>{const C=w.kind;if(C!=="audio"&&C!=="video")throw new Error(`Unknown new track kind ${C}.`);const b=i.getSenders().find(R=>R.track&&R.track.kind===C);b?f.push(new Promise(R=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${C} track`),R()}).then(()=>b.replaceTrack(w).then(()=>{const R=l.getTracks().find(T=>T.kind===C);R&&(R.stop(),l.removeTrack(R),hl.dispatchRemoveTrackEvent(l,R)),l.addTrack(w),hl.dispatchAddTrackEvent(l,w)}).catch(R=>{throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${C} track`),R}))):f.push(new Promise(R=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${C} track`),R()}).then(()=>{try{i.addTrack(w,l)}catch(R){throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${C} track`),R}l.addTrack(w),hl.dispatchAddTrackEvent(l,w)}))},v=r.getAudioTracks();v.length&&p(v[0]);const S=r.getVideoTracks();return S.length&&p(S[0]),f.reduce((w,C)=>w.then(()=>C),Promise.resolve())}getLocalSessionDescription(){if(this.logger.debug("SessionDescriptionHandler.getLocalSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const r=this._peerConnection.localDescription;return r?Promise.resolve(r):Promise.reject(new Error("Failed to get local session description"))}setLocalSessionDescription(r){return this.logger.debug("SessionDescriptionHandler.setLocalSessionDescription"),this._peerConnection===void 0?Promise.reject(new Error("Peer connection closed.")):this._peerConnection.setLocalDescription(r)}setRemoteSessionDescription(r){if(this.logger.debug("SessionDescriptionHandler.setRemoteSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const i=r.sdp;let l;switch(this._peerConnection.signalingState){case"stable":l="offer";break;case"have-local-offer":l="answer";break;case"have-local-pranswer":case"have-remote-offer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return i?this._peerConnection.setRemoteDescription({sdp:i,type:l}):(this.logger.error("SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp"),Promise.reject(new Error("SDP is undefined")))}setRemoteTrack(r){this.logger.debug("SessionDescriptionHandler.setRemoteTrack");const i=this._remoteMediaStream;i.getTrackById(r.id)?this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - have remote ${r.kind} track`):r.kind==="audio"?(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${r.kind} track`),i.getAudioTracks().forEach(l=>{l.stop(),i.removeTrack(l),hl.dispatchRemoveTrackEvent(i,l)}),i.addTrack(r),hl.dispatchAddTrackEvent(i,r)):r.kind==="video"&&(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${r.kind} track`),i.getVideoTracks().forEach(l=>{l.stop(),i.removeTrack(l),hl.dispatchRemoveTrackEvent(i,l)}),i.addTrack(r),hl.dispatchAddTrackEvent(i,r))}updateDirection(r){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.updateDirection - setting offer direction");{const i=l=>{switch(l){case"inactive":return r!=null&&r.hold?"inactive":"recvonly";case"recvonly":return r!=null&&r.hold?"inactive":"recvonly";case"sendonly":return r!=null&&r.hold?"sendonly":"sendrecv";case"sendrecv":return r!=null&&r.hold?"sendonly":"sendrecv";case"stopped":return"stopped";default:throw new Error("Should never happen")}};this._peerConnection.getTransceivers().forEach(l=>{if(l.direction){const f=i(l.direction);l.direction!==f&&(l.direction=f)}})}break;case"have-remote-offer":this.logger.debug("SessionDescriptionHandler.updateDirection - setting answer direction");{const i=(()=>{const f=this._peerConnection.remoteDescription;if(!f)throw new Error("Failed to read remote offer");const p=/a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(f.sdp);if(p)switch(p[0]){case`a=inactive\r
402
+ `,this.send(C).catch(b=>{this.logTransportError(b,"Failed to send ACK to non-2xx response.")})}stateTransition(r,i=!1){const l=()=>{throw new Error(`Invalid state transition from ${this.state} to ${r}`)};switch(r){case pe.Calling:l();break;case pe.Proceeding:this.state!==pe.Calling&&l();break;case pe.Accepted:case pe.Completed:this.state!==pe.Calling&&this.state!==pe.Proceeding&&l();break;case pe.Terminated:this.state!==pe.Calling&&this.state!==pe.Accepted&&this.state!==pe.Completed&&(i||l());break;default:l()}this.B&&(clearTimeout(this.B),this.B=void 0),pe.Proceeding,r===pe.Completed&&(this.D=setTimeout(()=>this.timerD(),oi.TIMER_D)),r===pe.Accepted&&(this.M=setTimeout(()=>this.timerM(),oi.TIMER_M)),r===pe.Terminated&&this.dispose(),this.setState(r)}timerA(){}timerB(){this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`),this.state===pe.Calling&&(this.onRequestTimeout(),this.stateTransition(pe.Terminated))}timerD(){this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`),this.state===pe.Completed&&this.stateTransition(pe.Terminated)}timerM(){this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`),this.state===pe.Accepted&&this.stateTransition(pe.Terminated)}}class Bi{constructor(r,i,l,f){this.transactionConstructor=r,this.core=i,this.message=l,this.delegate=f,this.challenged=!1,this.stale=!1,this.logger=this.loggerFactory.getLogger("sip.user-agent-client"),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}cancel(r,i={}){if(!this.transaction)throw new Error("Transaction undefined.");if(!this.message.to)throw new Error("To undefined.");if(!this.message.from)throw new Error("From undefined.");const l=this.core.makeOutgoingRequestMessage(rt.CANCEL,this.message.ruri,this.message.from.uri,this.message.to.uri,{toTag:this.message.toTag,fromTag:this.message.fromTag,callId:this.message.callId,cseq:this.message.cseq},i.extraHeaders);return l.branch=this.message.branch,this.message.headers.Route&&(l.headers.Route=this.message.headers.Route),r&&l.setHeader("Reason",r),this.transaction.state===pe.Proceeding?new Bi(Pa,this.core,l):this.transaction.addStateChangeListener(()=>{this.transaction&&this.transaction.state===pe.Proceeding&&new Bi(Pa,this.core,l)},{once:!0}),l}authenticationGuard(r,i){const l=r.statusCode;if(!l)throw new Error("Response status code undefined.");if(l!==401&&l!==407)return!0;let f,p;if(l===401?(f=r.parseHeader("www-authenticate"),p="authorization"):(f=r.parseHeader("proxy-authenticate"),p="proxy-authorization"),!f)return this.logger.warn(l+" with wrong or missing challenge, cannot authenticate"),!0;if(this.challenged&&(this.stale||f.stale!==!0))return this.logger.warn(l+" apparently in authentication loop, cannot authenticate"),!0;if(!this.credentials&&(this.credentials=this.core.configuration.authenticationFactory(),!this.credentials))return this.logger.warn("Unable to obtain credentials, cannot authenticate"),!0;if(!this.credentials.authenticate(this.message,f))return!0;this.challenged=!0,f.stale&&(this.stale=!0);let v=this.message.cseq+=1;return i&&i.localSequenceNumber&&(i.incrementLocalSequenceNumber(),v=this.message.cseq=i.localSequenceNumber),this.message.setHeader("cseq",v+" "+this.message.method),this.message.setHeader(p,this.credentials.toString()),this.init(),!1}onRequestTimeout(){this.logger.warn("User agent client request timed out. Generating internal 408 Request Timeout.");const r=new vu;r.statusCode=408,r.reasonPhrase="Request Timeout",this.receiveResponse(r)}onTransportError(r){this.logger.error(r.message),this.logger.error("User agent client request transport error. Generating internal 503 Service Unavailable.");const i=new vu;i.statusCode=503,i.reasonPhrase="Service Unavailable",this.receiveResponse(i)}receiveResponse(r){if(!this.authenticationGuard(r))return;const i=r.statusCode?r.statusCode.toString():"";if(!i)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(i):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:r});break;case/^1[0-9]{2}$/.test(i):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:r});break;case/^2[0-9]{2}$/.test(i):this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:r});break;case/^3[0-9]{2}$/.test(i):this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:r});break;case/^[4-6][0-9]{2}$/.test(i):this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:r});break;default:throw new Error(`Invalid status code ${i}`)}}init(){const r={loggerFactory:this.loggerFactory,onRequestTimeout:()=>this.onRequestTimeout(),onStateChange:f=>{f===pe.Terminated&&(this.core.userAgentClients.delete(l),i===this._transaction&&this.dispose())},onTransportError:f=>this.onTransportError(f),receiveResponse:f=>this.receiveResponse(f)},i=new this.transactionConstructor(this.message,this.core.transport,r);this._transaction=i;const l=i.id+i.request.method;this.core.userAgentClients.set(l,this)}}class JR extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(rt.BYE,l);super(Pa,r.userAgentCore,f,i),r.dispose()}}class La extends X2{constructor(r,i,l){super(r,i,l,pe.Trying,"sip.transaction.nist")}dispose(){this.J&&(clearTimeout(this.J),this.J=void 0),super.dispose()}get kind(){return"nist"}receiveRequest(r){switch(this.state){case pe.Trying:break;case pe.Proceeding:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(i=>{this.logTransportError(i,"Failed to send retransmission of provisional response.")});break;case pe.Completed:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(i=>{this.logTransportError(i,"Failed to send retransmission of final response.")});break;case pe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}}receiveResponse(r,i){if(r<100||r>699)throw new Error(`Invalid status code ${r}`);if(r>100&&r<=199)throw new Error("Provisional response other than 100 not allowed.");switch(this.state){case pe.Trying:if(this.lastResponse=i,r>=100&&r<200){this.stateTransition(pe.Proceeding),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send provisional response.")});return}if(r>=200&&r<=699){this.stateTransition(pe.Completed),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send final response.")});return}break;case pe.Proceeding:if(this.lastResponse=i,r>=200&&r<=699){this.stateTransition(pe.Completed),this.send(i).catch(f=>{this.logTransportError(f,"Failed to send final response.")});return}break;case pe.Completed:return;case pe.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const l=`Non-INVITE server transaction received unexpected ${r} response from TU while in state ${this.state}.`;throw this.logger.error(l),new Error(l)}onTransportError(r){this.user.onTransportError&&this.user.onTransportError(r),this.stateTransition(pe.Terminated,!0)}typeToString(){return"non-INVITE server transaction"}stateTransition(r,i=!1){const l=()=>{throw new Error(`Invalid state transition from ${this.state} to ${r}`)};switch(r){case pe.Trying:l();break;case pe.Proceeding:this.state!==pe.Trying&&l();break;case pe.Completed:this.state!==pe.Trying&&this.state!==pe.Proceeding&&l();break;case pe.Terminated:this.state!==pe.Proceeding&&this.state!==pe.Completed&&(i||l());break;default:l()}r===pe.Completed&&(this.J=setTimeout(()=>this.timerJ(),oi.TIMER_J)),r===pe.Terminated&&this.dispose(),this.setState(r)}timerJ(){this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`),this.state===pe.Completed&&this.stateTransition(pe.Terminated)}}class So{constructor(r,i,l,f){this.transactionConstructor=r,this.core=i,this.message=l,this.delegate=f,this.logger=this.loggerFactory.getLogger("sip.user-agent-server"),this.toTag=l.toTag?l.toTag:wv(),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}accept(r={statusCode:200}){if(!this.acceptable)throw new gu(`${this.message.method} not acceptable in state ${this.transaction.state}.`);const i=r.statusCode;if(i<200||i>299)throw new TypeError(`Invalid statusCode: ${i}`);return this.reply(r)}progress(r={statusCode:180}){if(!this.progressable)throw new gu(`${this.message.method} not progressable in state ${this.transaction.state}.`);const i=r.statusCode;if(i<101||i>199)throw new TypeError(`Invalid statusCode: ${i}`);return this.reply(r)}redirect(r,i={statusCode:302}){if(!this.redirectable)throw new gu(`${this.message.method} not redirectable in state ${this.transaction.state}.`);const l=i.statusCode;if(l<300||l>399)throw new TypeError(`Invalid statusCode: ${l}`);const f=new Array;return r.forEach(v=>f.push(`Contact: ${v.toString()}`)),i.extraHeaders=(i.extraHeaders||[]).concat(f),this.reply(i)}reject(r={statusCode:480}){if(!this.rejectable)throw new gu(`${this.message.method} not rejectable in state ${this.transaction.state}.`);const i=r.statusCode;if(i<400||i>699)throw new TypeError(`Invalid statusCode: ${i}`);return this.reply(r)}trying(r){if(!this.tryingable)throw new gu(`${this.message.method} not tryingable in state ${this.transaction.state}.`);return this.reply({statusCode:100})}receiveCancel(r){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(r)}get acceptable(){if(this.transaction instanceof ya)return this.transaction.state===pe.Proceeding||this.transaction.state===pe.Accepted;if(this.transaction instanceof La)return this.transaction.state===pe.Trying||this.transaction.state===pe.Proceeding;throw new Error("Unknown transaction type.")}get progressable(){if(this.transaction instanceof ya)return this.transaction.state===pe.Proceeding;if(this.transaction instanceof La)return!1;throw new Error("Unknown transaction type.")}get redirectable(){if(this.transaction instanceof ya)return this.transaction.state===pe.Proceeding;if(this.transaction instanceof La)return this.transaction.state===pe.Trying||this.transaction.state===pe.Proceeding;throw new Error("Unknown transaction type.")}get rejectable(){if(this.transaction instanceof ya)return this.transaction.state===pe.Proceeding;if(this.transaction instanceof La)return this.transaction.state===pe.Trying||this.transaction.state===pe.Proceeding;throw new Error("Unknown transaction type.")}get tryingable(){if(this.transaction instanceof ya)return this.transaction.state===pe.Proceeding;if(this.transaction instanceof La)return this.transaction.state===pe.Trying;throw new Error("Unknown transaction type.")}reply(r){!r.toTag&&r.statusCode!==100&&(r.toTag=this.toTag),r.userAgent=r.userAgent||this.core.configuration.userAgentHeaderFieldValue,r.supported=r.supported||this.core.configuration.supportedOptionTagsResponse;const i=K2(this.message,r);return this.transaction.receiveResponse(r.statusCode,i.message),i}init(){const r={loggerFactory:this.loggerFactory,onStateChange:f=>{f===pe.Terminated&&(this.core.userAgentServers.delete(l),this.dispose())},onTransportError:f=>{this.logger.error(f.message),this.delegate&&this.delegate.onTransportError?this.delegate.onTransportError(f):this.logger.error("User agent server response transport error.")}},i=new this.transactionConstructor(this.message,this.core.transport,r);this._transaction=i;const l=i.id;this.core.userAgentServers.set(i.id,this)}}class e8 extends So{constructor(r,i,l){super(La,r.userAgentCore,i,l)}}class t8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(rt.INFO,l);super(Pa,r.userAgentCore,f,i)}}class r8 extends So{constructor(r,i,l){super(La,r.userAgentCore,i,l)}}class Z2 extends Bi{constructor(r,i,l){super(Pa,r,i,l)}}class J2 extends So{constructor(r,i,l){super(La,r,i,l)}}class n8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(rt.NOTIFY,l);super(Pa,r.userAgentCore,f,i)}}function i8(o){return o.userAgentCore!==void 0}class Tv extends So{constructor(r,i,l){const f=i8(r)?r.userAgentCore:r;super(La,f,i,l)}}class a8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(rt.PRACK,l);super(Pa,r.userAgentCore,f,i),r.signalingStateTransition(f)}}class s8 extends So{constructor(r,i,l){super(La,r.userAgentCore,i,l),r.signalingStateTransition(i),this.dialog=r}accept(r={statusCode:200}){return r.body&&this.dialog.signalingStateTransition(r.body),super.accept(r)}}class o8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(rt.INVITE,l);super(xu,r.userAgentCore,f,i),this.delegate=i,r.signalingStateTransition(f),r.reinviteUserAgentClient=this,this.dialog=r}receiveResponse(r){if(!this.authenticationGuard(r,this.dialog))return;const i=r.statusCode?r.statusCode.toString():"";if(!i)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(i):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:r});break;case/^1[0-9]{2}$/.test(i):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:r,session:this.dialog,prack:l=>{throw new Error("Unimplemented.")}});break;case/^2[0-9]{2}$/.test(i):this.dialog.signalingStateTransition(r),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:r,session:this.dialog,ack:l=>this.dialog.ack(l)});break;case/^3[0-9]{2}$/.test(i):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:r});break;case/^[4-6][0-9]{2}$/.test(i):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:r});break;default:throw new Error(`Invalid status code ${i}`)}}}class l8 extends So{constructor(r,i,l){super(ya,r.userAgentCore,i,l),r.reinviteUserAgentServer=this,this.dialog=r}accept(r={statusCode:200}){r.extraHeaders=r.extraHeaders||[],r.extraHeaders=r.extraHeaders.concat(this.dialog.routeSet.map(p=>`Record-Route: ${p}`));const i=super.accept(r),l=this.dialog,f=Object.assign(Object.assign({},i),{session:l});return r.body&&this.dialog.signalingStateTransition(r.body),this.dialog.reConfirm(),f}progress(r={statusCode:180}){const i=super.progress(r),l=this.dialog,f=Object.assign(Object.assign({},i),{session:l});return r.body&&this.dialog.signalingStateTransition(r.body),f}redirect(r,i={statusCode:302}){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,new Error("Unimplemented.")}reject(r={statusCode:488}){return this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,super.reject(r)}}class u8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(rt.REFER,l);super(Pa,r.userAgentCore,f,i)}}function c8(o){return o.userAgentCore!==void 0}class ew extends So{constructor(r,i,l){const f=c8(r)?r.userAgentCore:r;super(La,f,i,l)}}class Rv extends Zf{constructor(r,i,l,f){super(i,l),this.initialTransaction=r,this._signalingState=Ye.Initial,this.ackWait=!1,this.ackProcessing=!1,this.delegate=f,r instanceof ya&&(this.ackWait=!0),this.early||this.start2xxRetransmissionTimer(),this.signalingStateTransition(r.request),this.logger=i.loggerFactory.getLogger("sip.invite-dialog"),this.logger.log(`INVITE dialog ${this.id} constructed`)}dispose(){super.dispose(),this._signalingState=Ye.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.logger.log(`INVITE dialog ${this.id} destroyed`)}get sessionState(){return this.early?as.Early:this.ackWait?as.AckWait:this._signalingState===Ye.Closed?as.Terminated:as.Confirmed}get signalingState(){return this._signalingState}get offer(){return this._offer}get answer(){return this._answer}confirm(){this.early&&this.start2xxRetransmissionTimer(),super.confirm()}reConfirm(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()}ack(r={}){this.logger.log(`INVITE dialog ${this.id} sending ACK request`);let i;if(this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof xu))throw new Error("Transaction not instance of InviteClientTransaction.");i=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof xu))throw new Error("Initial transaction not instance of InviteClientTransaction.");i=this.initialTransaction}const l=this.createOutgoingRequestMessage(rt.ACK,{cseq:i.request.cseq,extraHeaders:r.extraHeaders,body:r.body});return i.ackResponse(l),this.signalingStateTransition(l),{message:l}}bye(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending BYE request`),this.initialTransaction instanceof ya){if(this.early)throw new Error("UAS MUST NOT send a BYE on early dialogs.");if(this.ackWait&&this.initialTransaction.state!==pe.Terminated)throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.")}return new JR(this,r,i)}info(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending INFO request`),this.early)throw new Error("Dialog not confirmed.");return new t8(this,r,i)}invite(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending INVITE request`),this.early)throw new Error("Dialog not confirmed.");if(this.reinviteUserAgentClient)throw new Error("There is an ongoing re-INVITE client transaction.");if(this.reinviteUserAgentServer)throw new Error("There is an ongoing re-INVITE server transaction.");return new o8(this,r,i)}message(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`),this.early)throw new Error("Dialog not confirmed.");const l=this.createOutgoingRequestMessage(rt.MESSAGE,i);return new Z2(this.core,l,r)}notify(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`),this.early)throw new Error("Dialog not confirmed.");return new n8(this,r,i)}prack(r,i){return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`),new a8(this,r,i)}refer(r,i){if(this.logger.log(`INVITE dialog ${this.id} sending REFER request`),this.early)throw new Error("Dialog not confirmed.");return new u8(this,r,i)}receiveRequest(r){if(this.logger.log(`INVITE dialog ${this.id} received ${r.method} request`),r.method===rt.ACK){if(this.ackWait){if(this.initialTransaction instanceof xu){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${r.method} request, dropping.`);return}if(this.initialTransaction.request.cseq!==r.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${r.method} request, dropping.`);return}this.ackWait=!1}else{if(!this.reinviteUserAgentServer){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${r.method} request, dropping.`);return}if(this.reinviteUserAgentServer.transaction.request.cseq!==r.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${r.method} request, dropping.`);return}this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(r),this.delegate&&this.delegate.onAck){const i=this.delegate.onAck({message:r});i instanceof Promise&&(this.ackProcessing=!0,i.then(()=>this.ackProcessing=!1).catch(()=>this.ackProcessing=!1))}return}if(!this.sequenceGuard(r)){this.logger.log(`INVITE dialog ${this.id} rejected out of order ${r.method} request.`);return}if(super.receiveRequest(r),r.method===rt.INVITE){const i=()=>{const p=this.ackWait?"waiting for initial ACK":"processing initial ACK";this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${p}`);let v="RFC 5407 suggests the following to avoid this race condition... ";v+=" Note: Implementation issues are outside the scope of this document,",v+=" but the following tip is provided for avoiding race conditions of",v+=" this type. The caller can delay sending re-INVITE F6 for some period",v+=" of time (2 seconds, perhaps), after which the caller can reasonably",v+=" assume that its ACK has been received. Implementors can decouple the",v+=" actions of the user (e.g., pressing the hold button) from the actions",v+=" of the protocol (the sending of re-INVITE F6), so that the UA can",v+=" behave like this. In this case, it is the implementor's choice as to",v+=" how long to wait. In most cases, such an implementation may be",v+=" useful to prevent the type of race condition shown in this section.",v+=" This document expresses no preference about whether or not they",v+=" should wait for an ACK to be delivered. After considering the impact",v+=" on user experience, implementors should decide whether or not to wait",v+=" for a while, because the user experience depends on the",v+=" implementation and has no direct bearing on protocol behavior.",this.logger.warn(v)},f=[`Retry-After: ${Math.floor(Math.random()*10)+1}`];if(this.ackProcessing){this.core.replyStateless(r,{statusCode:500,extraHeaders:f}),i();return}if(this.ackWait&&this.signalingState!==Ye.Stable){this.core.replyStateless(r,{statusCode:500,extraHeaders:f}),i();return}if(this.reinviteUserAgentServer){this.core.replyStateless(r,{statusCode:500,extraHeaders:f});return}if(this.reinviteUserAgentClient){this.core.replyStateless(r,{statusCode:491});return}}if(r.method===rt.INVITE){const i=r.parseHeader("contact");if(!i)throw new Error("Contact undefined.");if(!(i instanceof ma))throw new Error("Contact not instance of NameAddrHeader.");this.dialogState.remoteTarget=i.uri}switch(r.method){case rt.BYE:{const i=new e8(this,r);this.delegate&&this.delegate.onBye?this.delegate.onBye(i):i.accept(),this.dispose()}break;case rt.INFO:{const i=new r8(this,r);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(i):i.reject({statusCode:469,extraHeaders:["Recv-Info:"]})}break;case rt.INVITE:{const i=new l8(this,r);this.signalingStateTransition(r),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(i):i.reject({statusCode:488})}break;case rt.MESSAGE:{const i=new J2(this.core,r);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(i):i.accept()}break;case rt.NOTIFY:{const i=new Tv(this,r);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(i):i.accept()}break;case rt.PRACK:{const i=new s8(this,r);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(i):i.accept()}break;case rt.REFER:{const i=new ew(this,r);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(i):i.reject()}break;default:this.logger.log(`INVITE dialog ${this.id} received unimplemented ${r.method} request`),this.core.replyStateless(r,{statusCode:501});break}}reliableSequenceGuard(r){const i=r.statusCode;if(!i)throw new Error("Status code undefined");if(i>100&&i<200){const l=r.getHeader("require"),f=r.getHeader("rseq"),p=l&&l.includes("100rel")&&f?Number(f):void 0;if(p){if(this.rseq&&this.rseq+1!==p)return!1;this.rseq=this.rseq?this.rseq+1:p}}return!0}signalingStateRollback(){(this._signalingState===Ye.HaveLocalOffer||this.signalingState===Ye.HaveRemoteOffer)&&this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=Ye.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)}signalingStateTransition(r){const i=t0(r);if(!(!i||i.contentDisposition!=="session")){if(this._signalingState===Ye.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),r instanceof Xf)switch(this._signalingState){case Ye.Initial:case Ye.Stable:this._signalingState=Ye.HaveRemoteOffer,this._offer=i,this._answer=void 0;break;case Ye.HaveLocalOffer:this._signalingState=Ye.Stable,this._answer=i;break;case Ye.HaveRemoteOffer:break;case Ye.Closed:break;default:throw new Error("Unexpected signaling state.")}if(r instanceof vu)switch(this._signalingState){case Ye.Initial:case Ye.Stable:this._signalingState=Ye.HaveRemoteOffer,this._offer=i,this._answer=void 0;break;case Ye.HaveLocalOffer:this._signalingState=Ye.Stable,this._answer=i;break;case Ye.HaveRemoteOffer:break;case Ye.Closed:break;default:throw new Error("Unexpected signaling state.")}if(r instanceof Dc)switch(this._signalingState){case Ye.Initial:case Ye.Stable:this._signalingState=Ye.HaveLocalOffer,this._offer=i,this._answer=void 0;break;case Ye.HaveLocalOffer:break;case Ye.HaveRemoteOffer:this._signalingState=Ye.Stable,this._answer=i;break;case Ye.Closed:break;default:throw new Error("Unexpected signaling state.")}if(q2(r))switch(this._signalingState){case Ye.Initial:case Ye.Stable:this._signalingState=Ye.HaveLocalOffer,this._offer=i,this._answer=void 0;break;case Ye.HaveLocalOffer:break;case Ye.HaveRemoteOffer:this._signalingState=Ye.Stable,this._answer=i;break;case Ye.Closed:break;default:throw new Error("Unexpected signaling state.")}}}start2xxRetransmissionTimer(){if(this.initialTransaction instanceof ya){const r=this.initialTransaction;let i=oi.T1;const l=()=>{if(!this.ackWait){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),r.retransmitAcceptedResponse(),i=Math.min(i*2,oi.T2),this.invite2xxTimer=setTimeout(l,i)};this.invite2xxTimer=setTimeout(l,i);const f=()=>{r.state===pe.Terminated&&(r.removeStateChangeListener(f),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.ackWait&&(this.delegate&&this.delegate.onAckTimeout?this.delegate.onAckTimeout():this.bye()))};r.addStateChangeListener(f)}}startReInvite2xxRetransmissionTimer(){if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof ya){const r=this.reinviteUserAgentServer.transaction;let i=oi.T1;const l=()=>{if(!this.reinviteUserAgentServer){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),r.retransmitAcceptedResponse(),i=Math.min(i*2,oi.T2),this.invite2xxTimer=setTimeout(l,i)};this.invite2xxTimer=setTimeout(l,i);const f=()=>{r.state===pe.Terminated&&(r.removeStateChangeListener(f),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.reinviteUserAgentServer)};r.addStateChangeListener(f)}}}class f8 extends Bi{constructor(r,i,l){super(xu,r,i,l),this.confirmedDialogAcks=new Map,this.confirmedDialogs=new Map,this.earlyDialogs=new Map,this.delegate=l}dispose(){this.earlyDialogs.forEach(r=>r.dispose()),this.earlyDialogs.clear(),super.dispose()}onTransportError(r){if(this.transaction.state===pe.Calling)return super.onTransportError(r);this.logger.error(r.message),this.logger.error("User agent client request transport error while sending ACK.")}receiveResponse(r){if(!this.authenticationGuard(r))return;const i=r.statusCode?r.statusCode.toString():"";if(!i)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(i):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:r});return;case/^1[0-9]{2}$/.test(i):{if(!r.toTag){this.logger.warn("Non-100 1xx INVITE response received without a to tag, dropping.");return}if(!r.parseHeader("contact")){this.logger.error("Non-100 1xx INVITE response received without a Contact header field, dropping.");return}const f=Zf.initialDialogStateForUserAgentClient(this.message,r);let p=this.earlyDialogs.get(f.id);if(!p){const S=this.transaction;if(!(S instanceof xu))throw new Error("Transaction not instance of InviteClientTransaction.");p=new Rv(S,this.core,f),this.earlyDialogs.set(p.id,p)}if(!p.reliableSequenceGuard(r)){this.logger.warn("1xx INVITE reliable response received out of order or is a retransmission, dropping.");return}(p.signalingState===Ye.Initial||p.signalingState===Ye.HaveLocalOffer)&&p.signalingStateTransition(r);const v=p;this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:r,session:v,prack:S=>v.prack(void 0,S)})}return;case/^2[0-9]{2}$/.test(i):{if(!r.toTag){this.logger.error("2xx INVITE response received without a to tag, dropping.");return}if(!r.parseHeader("contact")){this.logger.error("2xx INVITE response received without a Contact header field, dropping.");return}const f=Zf.initialDialogStateForUserAgentClient(this.message,r);let p=this.confirmedDialogs.get(f.id);if(p){const S=this.confirmedDialogAcks.get(f.id);if(S){const w=this.transaction;if(!(w instanceof xu))throw new Error("Client transaction not instance of InviteClientTransaction.");w.ackResponse(S.message)}return}if(p=this.earlyDialogs.get(f.id),p)p.confirm(),p.recomputeRouteSet(r),this.earlyDialogs.delete(p.id),this.confirmedDialogs.set(p.id,p);else{const S=this.transaction;if(!(S instanceof xu))throw new Error("Transaction not instance of InviteClientTransaction.");p=new Rv(S,this.core,f),this.confirmedDialogs.set(p.id,p)}(p.signalingState===Ye.Initial||p.signalingState===Ye.HaveLocalOffer)&&p.signalingStateTransition(r);const v=p;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:r,session:v,ack:S=>{const w=v.ack(S);return this.confirmedDialogAcks.set(v.id,w),w}});else{const S=v.ack();this.confirmedDialogAcks.set(v.id,S)}}return;case/^3[0-9]{2}$/.test(i):this.earlyDialogs.forEach(l=>l.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:r});return;case/^[4-6][0-9]{2}$/.test(i):this.earlyDialogs.forEach(l=>l.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:r});return;default:throw new Error(`Invalid status code ${i}`)}}}class Ux extends So{constructor(r,i,l){super(ya,r,i,l),this.core=r}dispose(){this.earlyDialog&&this.earlyDialog.dispose(),super.dispose()}accept(r={statusCode:200}){if(!this.acceptable)throw new gu(`${this.message.method} not acceptable in state ${this.transaction.state}.`);if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{const w=this.transaction;if(!(w instanceof ya))throw new Error("Transaction not instance of InviteClientTransaction.");const C=Zf.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new Rv(w,this.core,C)}const i=this.message.getHeaders("record-route").map(w=>`Record-Route: ${w}`),l=`Contact: ${this.core.configuration.contact.toString()}`,f="Allow: "+mu.toString();if(!r.body){if(this.confirmedDialog.signalingState===Ye.Stable)r.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===Ye.Initial||this.confirmedDialog.signalingState===Ye.HaveRemoteOffer)throw new Error("Response must have a body.")}r.statusCode=r.statusCode||200,r.extraHeaders=r.extraHeaders||[],r.extraHeaders=r.extraHeaders.concat(i),r.extraHeaders.push(f),r.extraHeaders.push(l);const p=super.accept(r),v=this.confirmedDialog,S=Object.assign(Object.assign({},p),{session:v});return r.body&&this.confirmedDialog.signalingState!==Ye.Stable&&this.confirmedDialog.signalingStateTransition(r.body),S}progress(r={statusCode:180}){if(!this.progressable)throw new gu(`${this.message.method} not progressable in state ${this.transaction.state}.`);if(!this.earlyDialog){const S=this.transaction;if(!(S instanceof ya))throw new Error("Transaction not instance of InviteClientTransaction.");const w=Zf.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new Rv(S,this.core,w)}const i=this.message.getHeaders("record-route").map(S=>`Record-Route: ${S}`),l=`Contact: ${this.core.configuration.contact}`;r.extraHeaders=r.extraHeaders||[],r.extraHeaders=r.extraHeaders.concat(i),r.extraHeaders.push(l);const f=super.progress(r),p=this.earlyDialog,v=Object.assign(Object.assign({},f),{session:p});return r.body&&this.earlyDialog.signalingState!==Ye.Stable&&this.earlyDialog.signalingStateTransition(r.body),v}redirect(r,i={statusCode:302}){return super.redirect(r,i)}reject(r={statusCode:486}){return super.reject(r)}}class d8 extends Bi{constructor(r,i,l){super(Pa,r,i,l)}}class h8 extends Bi{constructor(r,i,l){super(Pa,r,i,l)}}class p8 extends So{constructor(r,i,l){super(La,r,i,l),this.core=r}}class v8 extends Bi{constructor(r,i,l){const f=r.createOutgoingRequestMessage(rt.SUBSCRIBE,l);super(Pa,r.userAgentCore,f,i),this.dialog=r}waitNotifyStop(){}receiveResponse(r){if(r.statusCode&&r.statusCode>=200&&r.statusCode<300){const i=r.getHeader("Expires");if(!i)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const l=Number(i);this.dialog.subscriptionExpires>l&&(this.dialog.subscriptionExpires=l)}}r.statusCode&&r.statusCode>=400&&r.statusCode<700&&[404,405,410,416,480,481,482,483,484,485,489,501,604].includes(r.statusCode)&&this.dialog.terminate(),super.receiveResponse(r)}}class tw extends Zf{constructor(r,i,l,f,p,v){super(f,p),this.delegate=v,this._autoRefresh=!1,this._subscriptionEvent=r,this._subscriptionExpires=i,this._subscriptionExpiresInitial=i,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this._subscriptionState=l,this.logger=f.loggerFactory.getLogger("sip.subscribe-dialog"),this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`)}static initialDialogStateForSubscription(r,i){const f=i.getHeaders("record-route"),p=i.parseHeader("contact");if(!p)throw new Error("Contact undefined.");if(!(p instanceof ma))throw new Error("Contact not instance of NameAddrHeader.");const v=p.uri,S=r.cseq,w=void 0,C=r.callId,b=r.fromTag,R=i.fromTag;if(!C)throw new Error("Call id undefined.");if(!b)throw new Error("From tag undefined.");if(!R)throw new Error("To tag undefined.");if(!r.from)throw new Error("From undefined.");if(!r.to)throw new Error("To undefined.");const T=r.from.uri,H=r.to.uri;return{id:C+b+R,early:!1,callId:C,localTag:b,remoteTag:R,localSequenceNumber:S,remoteSequenceNumber:w,localURI:T,remoteURI:H,remoteTarget:v,routeSet:f,secure:!1}}dispose(){super.dispose(),this.N&&(clearTimeout(this.N),this.N=void 0),this.refreshTimerClear(),this.logger.log(`SUBSCRIBE dialog ${this.id} destroyed`)}get autoRefresh(){return this._autoRefresh}set autoRefresh(r){this._autoRefresh=!0,this.refreshTimerSet()}get subscriptionEvent(){return this._subscriptionEvent}get subscriptionExpires(){const r=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,i=this._subscriptionExpires-r;return Math.max(i,0)}set subscriptionExpires(r){if(r<0)throw new Error("Expires must be greater than or equal to zero.");if(this._subscriptionExpires=r,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){const i=this.subscriptionRefresh;(i===void 0||i>=r)&&this.refreshTimerSet()}}get subscriptionExpiresInitial(){return this._subscriptionExpiresInitial}get subscriptionRefresh(){if(this._subscriptionRefresh===void 0||this._subscriptionRefreshLastSet===void 0)return;const r=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,i=this._subscriptionRefresh-r;return Math.max(i,0)}get subscriptionState(){return this._subscriptionState}receiveRequest(r){if(this.logger.log(`SUBSCRIBE dialog ${this.id} received ${r.method} request`),!this.sequenceGuard(r)){this.logger.log(`SUBSCRIBE dialog ${this.id} rejected out of order ${r.method} request.`);return}switch(super.receiveRequest(r),r.method){case rt.NOTIFY:this.onNotify(r);break;default:this.logger.log(`SUBSCRIBE dialog ${this.id} received unimplemented ${r.method} request`),this.core.replyStateless(r,{statusCode:501});break}}refresh(){const r="Allow: "+mu.toString(),i={};return i.extraHeaders=(i.extraHeaders||[]).slice(),i.extraHeaders.push(r),i.extraHeaders.push("Event: "+this.subscriptionEvent),i.extraHeaders.push("Expires: "+this.subscriptionExpiresInitial),i.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,i)}subscribe(r,i={}){var l;if(this.subscriptionState!==vr.Pending&&this.subscriptionState!==vr.Active)throw new Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);const f=new v8(this,r,i);return this.N&&(clearTimeout(this.N),this.N=void 0),!((l=i.extraHeaders)===null||l===void 0)&&l.includes("Expires: 0")||(this.N=setTimeout(()=>this.timerN(),oi.TIMER_N)),f}terminate(){this.stateTransition(vr.Terminated),this.onTerminated()}unsubscribe(){const r="Allow: "+mu.toString(),i={};return i.extraHeaders=(i.extraHeaders||[]).slice(),i.extraHeaders.push(r),i.extraHeaders.push("Event: "+this.subscriptionEvent),i.extraHeaders.push("Expires: 0"),i.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,i)}onNotify(r){const i=r.parseHeader("Event").event;if(!i||i!==this.subscriptionEvent){this.core.replyStateless(r,{statusCode:489});return}this.N&&(clearTimeout(this.N),this.N=void 0);const l=r.parseHeader("Subscription-State");if(!l||!l.state){this.core.replyStateless(r,{statusCode:489});return}const f=l.state,p=l.expires?Math.max(l.expires,0):void 0;switch(f){case"pending":this.stateTransition(vr.Pending,p);break;case"active":this.stateTransition(vr.Active,p);break;case"terminated":this.stateTransition(vr.Terminated,p);break;default:this.logger.warn("Unrecognized subscription state.");break}const v=new Tv(this,r);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(v):v.accept()}onRefresh(r){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(r)}onTerminated(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()}refreshTimerClear(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=void 0)}refreshTimerSet(){if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){const r=this.subscriptionExpires*900;this._subscriptionRefresh=Math.floor(r/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout(()=>{this.refreshTimer=void 0,this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this.onRefresh(this.refresh())},r)}}stateTransition(r,i){const l=()=>{this.logger.warn(`Invalid subscription state transition from ${this.subscriptionState} to ${r}`)};switch(r){case vr.Initial:l();return;case vr.NotifyWait:l();return;case vr.Pending:if(this.subscriptionState!==vr.NotifyWait&&this.subscriptionState!==vr.Pending){l();return}break;case vr.Active:if(this.subscriptionState!==vr.NotifyWait&&this.subscriptionState!==vr.Pending&&this.subscriptionState!==vr.Active){l();return}break;case vr.Terminated:if(this.subscriptionState!==vr.NotifyWait&&this.subscriptionState!==vr.Pending&&this.subscriptionState!==vr.Active){l();return}break;default:l();return}r===vr.Pending&&i&&(this.subscriptionExpires=i),r===vr.Active&&i&&(this.subscriptionExpires=i),r===vr.Terminated&&this.dispose(),this._subscriptionState=r}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."),this.subscriptionState!==vr.Terminated&&(this.stateTransition(vr.Terminated),this.onTerminated())}}class g8 extends Bi{constructor(r,i,l){const f=i.getHeader("Event");if(!f)throw new Error("Event undefined");const p=i.getHeader("Expires");if(!p)throw new Error("Expires undefined");super(Pa,r,i,l),this.delegate=l,this.subscriberId=i.callId+i.fromTag+f,this.subscriptionExpiresRequested=this.subscriptionExpires=Number(p),this.subscriptionEvent=f,this.subscriptionState=vr.NotifyWait,this.waitNotifyStart()}dispose(){super.dispose()}onNotify(r){const i=r.message.parseHeader("Event").event;if(!i||i!==this.subscriptionEvent){this.logger.warn("Failed to parse event."),r.reject({statusCode:489});return}const l=r.message.parseHeader("Subscription-State");if(!l||!l.state){this.logger.warn("Failed to parse subscription state."),r.reject({statusCode:489});return}const f=l.state;switch(f){case"pending":break;case"active":break;case"terminated":break;default:this.logger.warn(`Invalid subscription state ${f}`),r.reject({statusCode:489});return}if(f!=="terminated"&&!r.message.parseHeader("contact")){this.logger.warn("Failed to parse contact."),r.reject({statusCode:489});return}if(this.dialog)throw new Error("Dialog already created. This implementation only supports install of single subscriptions.");switch(this.waitNotifyStop(),this.subscriptionExpires=l.expires?Math.min(this.subscriptionExpires,Math.max(l.expires,0)):this.subscriptionExpires,f){case"pending":this.subscriptionState=vr.Pending;break;case"active":this.subscriptionState=vr.Active;break;case"terminated":this.subscriptionState=vr.Terminated;break;default:throw new Error(`Unrecognized state ${f}.`)}if(this.subscriptionState!==vr.Terminated){const p=tw.initialDialogStateForSubscription(this.message,r.message);this.dialog=new tw(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,p)}if(this.delegate&&this.delegate.onNotify){const p=r,v=this.dialog;this.delegate.onNotify({request:p,subscription:v})}else r.accept()}waitNotifyStart(){this.N||(this.core.subscribers.set(this.subscriberId,this),this.N=setTimeout(()=>this.timerN(),oi.TIMER_N))}waitNotifyStop(){this.N&&(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),this.N=void 0)}receiveResponse(r){if(this.authenticationGuard(r)){if(r.statusCode&&r.statusCode>=200&&r.statusCode<300){const i=r.getHeader("Expires");if(!i)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const l=Number(i);l>this.subscriptionExpiresRequested&&this.logger.warn("Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request"),l<this.subscriptionExpires&&(this.subscriptionExpires=l)}this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}r.statusCode&&r.statusCode>=300&&r.statusCode<700&&this.waitNotifyStop(),super.receiveResponse(r)}}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."),this.waitNotifyStop(),this.delegate&&this.delegate.onNotifyTimeout&&this.delegate.onNotifyTimeout()}}class m8 extends So{constructor(r,i,l){super(La,r,i,l),this.core=r}}const rw=["application/sdp","application/dtmf-relay"];class y8{constructor(r,i={}){this.userAgentClients=new Map,this.userAgentServers=new Map,this.configuration=r,this.delegate=i,this.dialogs=new Map,this.subscribers=new Map,this.logger=r.loggerFactory.getLogger("sip.user-agent-core")}dispose(){this.reset()}reset(){this.dialogs.forEach(r=>r.dispose()),this.dialogs.clear(),this.subscribers.forEach(r=>r.dispose()),this.subscribers.clear(),this.userAgentClients.forEach(r=>r.dispose()),this.userAgentClients.clear(),this.userAgentServers.forEach(r=>r.dispose()),this.userAgentServers.clear()}get loggerFactory(){return this.configuration.loggerFactory}get transport(){const r=this.configuration.transportAccessor();if(!r)throw new Error("Transport undefined.");return r}invite(r,i){return new f8(this,r,i)}message(r,i){return new Z2(this,r,i)}publish(r,i){return new d8(this,r,i)}register(r,i){return new h8(this,r,i)}subscribe(r,i){return new g8(this,r,i)}request(r,i){return new Bi(Pa,this,r,i)}makeOutgoingRequestMessage(r,i,l,f,p,v,S){const w=this.configuration.sipjsId,C=this.configuration.displayName,b=this.configuration.viaForceRport,R=this.configuration.hackViaTcp,T=this.configuration.supportedOptionTags.slice();r===rt.REGISTER&&T.push("path","gruu"),r===rt.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&T.push("gruu");const H=this.configuration.routeSet,P=this.configuration.userAgentHeaderFieldValue,j=this.configuration.viaHost,O=Object.assign(Object.assign({},{callIdPrefix:w,forceRport:b,fromDisplayName:C,hackViaTcp:R,optionTags:T,routeSet:H,userAgentString:P,viaHost:j}),p);return new Dc(r,i,l,f,O,v,S)}receiveIncomingRequestFromTransport(r){this.receiveRequestFromTransport(r)}receiveIncomingResponseFromTransport(r){this.receiveResponseFromTransport(r)}replyStateless(r,i){const l=this.configuration.userAgentHeaderFieldValue,f=this.configuration.supportedOptionTagsResponse;i=Object.assign(Object.assign({},i),{userAgent:l,supported:f});const p=K2(r,i);return this.transport.send(p.message).catch(v=>{v instanceof Error&&this.logger.error(v.message),this.logger.error(`Transport error occurred sending stateless reply to ${r.method} request.`)}),p}receiveRequestFromTransport(r){const i=r.viaBranch,l=this.userAgentServers.get(i);if(r.method===rt.ACK&&l&&l.transaction.state===pe.Accepted&&l instanceof Ux){this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${i}.`);return}if(r.method===rt.CANCEL){l?(this.replyStateless(r,{statusCode:200}),l.transaction instanceof ya&&l.transaction.state===pe.Proceeding&&l instanceof Ux&&l.receiveCancel(r)):this.replyStateless(r,{statusCode:481});return}if(l){l.transaction.receiveRequest(r);return}this.receiveRequest(r)}receiveRequest(r){if(!mu.includes(r.method)){const f="Allow: "+mu.toString();this.replyStateless(r,{statusCode:405,extraHeaders:[f]});return}if(!r.ruri)throw new Error("Request-URI undefined.");if(r.ruri.scheme!=="sip"){this.replyStateless(r,{statusCode:416});return}const i=r.ruri,l=f=>!!f&&f.user===i.user;if(!l(this.configuration.aor)&&!(l(this.configuration.contact.uri)||l(this.configuration.contact.pubGruu)||l(this.configuration.contact.tempGruu))){this.logger.warn("Request-URI does not point to us."),r.method!==rt.ACK&&this.replyStateless(r,{statusCode:404});return}if(r.method===rt.INVITE&&!r.hasHeader("Contact")){this.replyStateless(r,{statusCode:400,reasonPhrase:"Missing Contact Header"});return}if(!r.toTag){const f=r.viaBranch;if(!this.userAgentServers.has(f)&&Array.from(this.userAgentServers.values()).some(v=>v.transaction.request.fromTag===r.fromTag&&v.transaction.request.callId===r.callId&&v.transaction.request.cseq===r.cseq)){this.replyStateless(r,{statusCode:482});return}}r.toTag?this.receiveInsideDialogRequest(r):this.receiveOutsideDialogRequest(r)}receiveInsideDialogRequest(r){if(r.method===rt.NOTIFY){const f=r.parseHeader("Event");if(!f||!f.event){this.replyStateless(r,{statusCode:489});return}const p=r.callId+r.toTag+f.event,v=this.subscribers.get(p);if(v){const S=new Tv(this,r);v.onNotify(S);return}}const i=r.callId+r.toTag+r.fromTag,l=this.dialogs.get(i);if(l){if(r.method===rt.OPTIONS){const f="Allow: "+mu.toString(),p="Accept: "+rw.toString();this.replyStateless(r,{statusCode:200,extraHeaders:[f,p]});return}l.receiveRequest(r);return}r.method!==rt.ACK&&this.replyStateless(r,{statusCode:481})}receiveOutsideDialogRequest(r){switch(r.method){case rt.ACK:break;case rt.BYE:this.replyStateless(r,{statusCode:481});break;case rt.CANCEL:throw new Error(`Unexpected out of dialog request method ${r.method}.`);case rt.INFO:this.replyStateless(r,{statusCode:405});break;case rt.INVITE:{const i=new Ux(this,r);this.delegate.onInvite?this.delegate.onInvite(i):i.reject()}break;case rt.MESSAGE:{const i=new J2(this,r);this.delegate.onMessage?this.delegate.onMessage(i):i.accept()}break;case rt.NOTIFY:{const i=new Tv(this,r);this.delegate.onNotify?this.delegate.onNotify(i):i.reject({statusCode:405})}break;case rt.OPTIONS:{const i="Allow: "+mu.toString(),l="Accept: "+rw.toString();this.replyStateless(r,{statusCode:200,extraHeaders:[i,l]})}break;case rt.REFER:{const i=new ew(this,r);this.delegate.onRefer?this.delegate.onRefer(i):i.reject({statusCode:405})}break;case rt.REGISTER:{const i=new p8(this,r);this.delegate.onRegister?this.delegate.onRegister(i):i.reject({statusCode:405})}break;case rt.SUBSCRIBE:{const i=new m8(this,r);this.delegate.onSubscribe?this.delegate.onSubscribe(i):i.reject({statusCode:480})}break;default:throw new Error(`Unexpected out of dialog request method ${r.method}.`)}}receiveResponseFromTransport(r){if(r.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response, dropping");return}const i=r.viaBranch+r.method,l=this.userAgentClients.get(i);l?l.transaction.receiveResponse(r):this.logger.warn(`Discarding unmatched ${r.statusCode} response to ${r.method} ${i}.`)}}function x8(){return o=>!o.audio&&!o.video?Promise.resolve(new MediaStream):navigator.mediaDevices===void 0?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,o)}function E8(){return{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require"}}class hl{constructor(r,i,l){r.debug("SessionDescriptionHandler.constructor"),this.logger=r,this.mediaStreamFactory=i,this.sessionDescriptionHandlerConfiguration=l,this._localMediaStream=new MediaStream,this._remoteMediaStream=new MediaStream,this._peerConnection=new RTCPeerConnection(l==null?void 0:l.peerConnectionConfiguration),this.initPeerConnectionEventHandlers()}get localMediaStream(){return this._localMediaStream}get remoteMediaStream(){return this._remoteMediaStream}get dataChannel(){return this._dataChannel}get peerConnection(){return this._peerConnection}get peerConnectionDelegate(){return this._peerConnectionDelegate}set peerConnectionDelegate(r){this._peerConnectionDelegate=r}static dispatchAddTrackEvent(r,i){r.dispatchEvent(new MediaStreamTrackEvent("addtrack",{track:i}))}static dispatchRemoveTrackEvent(r,i){r.dispatchEvent(new MediaStreamTrackEvent("removetrack",{track:i}))}close(){this.logger.debug("SessionDescriptionHandler.close"),this._peerConnection!==void 0&&(this._peerConnection.getReceivers().forEach(r=>{r.track&&r.track.stop()}),this._peerConnection.getSenders().forEach(r=>{r.track&&r.track.stop()}),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)}enableReceiverTracks(r){const i=this.peerConnection;if(!i)throw new Error("Peer connection closed.");i.getReceivers().forEach(l=>{l.track&&(l.track.enabled=r)})}enableSenderTracks(r){const i=this.peerConnection;if(!i)throw new Error("Peer connection closed.");i.getSenders().forEach(l=>{l.track&&(l.track.enabled=r)})}getDescription(r,i){var l,f;if(this.logger.debug("SessionDescriptionHandler.getDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=r==null?void 0:r.onDataChannel;const p=(l=r==null?void 0:r.offerOptions)===null||l===void 0?void 0:l.iceRestart,v=(r==null?void 0:r.iceGatheringTimeout)===void 0?(f=this.sessionDescriptionHandlerConfiguration)===null||f===void 0?void 0:f.iceGatheringTimeout:r==null?void 0:r.iceGatheringTimeout;return this.getLocalMediaStream(r).then(()=>this.updateDirection(r)).then(()=>this.createDataChannel(r)).then(()=>this.createLocalOfferOrAnswer(r)).then(S=>this.applyModifiers(S,i)).then(S=>this.setLocalSessionDescription(S)).then(()=>this.waitForIceGatheringComplete(p,v)).then(()=>this.getLocalSessionDescription()).then(S=>({body:S.sdp,contentType:"application/sdp"})).catch(S=>{throw this.logger.error("SessionDescriptionHandler.getDescription failed - "+S),S})}hasDescription(r){return this.logger.debug("SessionDescriptionHandler.hasDescription"),r==="application/sdp"}iceGatheringComplete(){this.logger.debug("SessionDescriptionHandler.iceGatheringComplete"),this.iceGatheringCompleteTimeoutId!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - clearing timeout"),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),this.iceGatheringCompletePromise!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - resolving promise"),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)}sendDtmf(r,i){if(this.logger.debug("SessionDescriptionHandler.sendDtmf"),this._peerConnection===void 0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - peer connection closed"),!1;const l=this._peerConnection.getSenders();if(l.length===0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no senders"),!1;const f=l[0].dtmf;if(!f)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no DTMF sender"),!1;const p=i==null?void 0:i.duration,v=i==null?void 0:i.interToneGap;try{f.insertDTMF(r,p,v)}catch(S){return this.logger.error(S.toString()),!1}return this.logger.log("SessionDescriptionHandler.sendDtmf sent via RTP: "+r.toString()),!0}setDescription(r,i,l){if(this.logger.debug("SessionDescriptionHandler.setDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=i==null?void 0:i.onDataChannel;const f=this._peerConnection.signalingState==="have-local-offer"?"answer":"offer";return this.getLocalMediaStream(i).then(()=>this.applyModifiers({sdp:r,type:f},l)).then(p=>this.setRemoteSessionDescription(p)).catch(p=>{throw this.logger.error("SessionDescriptionHandler.setDescription failed - "+p),p})}applyModifiers(r,i){return this.logger.debug("SessionDescriptionHandler.applyModifiers"),!i||i.length===0?Promise.resolve(r):i.reduce((l,f)=>l.then(f),Promise.resolve(r)).then(l=>{if(this.logger.debug("SessionDescriptionHandler.applyModifiers - modified sdp"),!l.sdp||!l.type)throw new Error("Invalid SDP.");return{sdp:l.sdp,type:l.type}})}createDataChannel(r){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));if((r==null?void 0:r.dataChannel)!==!0||this._dataChannel)return Promise.resolve();switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.createDataChannel - creating data channel");try{return this._dataChannel=this._peerConnection.createDataChannel((r==null?void 0:r.dataChannelLabel)||"",r==null?void 0:r.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(i){return Promise.reject(i)}case"have-remote-offer":return Promise.resolve();case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}createLocalOfferOrAnswer(r){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer"),this._peerConnection.createOffer(r==null?void 0:r.offerOptions);case"have-remote-offer":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer"),this._peerConnection.createAnswer(r==null?void 0:r.answerOptions);case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}getLocalMediaStream(r){if(this.logger.debug("SessionDescriptionHandler.getLocalMediaStream"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));let i=Object.assign({},r==null?void 0:r.constraints);if(this.localMediaStreamConstraints){if(i.audio=i.audio||this.localMediaStreamConstraints.audio,i.video=i.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(i.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(i.video))return Promise.resolve()}else i.audio===void 0&&i.video===void 0&&(i={audio:!0});return this.localMediaStreamConstraints=i,this.mediaStreamFactory(i,this,r).then(l=>this.setLocalMediaStream(l))}setLocalMediaStream(r){if(this.logger.debug("SessionDescriptionHandler.setLocalMediaStream"),!this._peerConnection)throw new Error("Peer connection undefined.");const i=this._peerConnection,l=this._localMediaStream,f=[],p=w=>{const C=w.kind;if(C!=="audio"&&C!=="video")throw new Error(`Unknown new track kind ${C}.`);const b=i.getSenders().find(R=>R.track&&R.track.kind===C);b?f.push(new Promise(R=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${C} track`),R()}).then(()=>b.replaceTrack(w).then(()=>{const R=l.getTracks().find(T=>T.kind===C);R&&(R.stop(),l.removeTrack(R),hl.dispatchRemoveTrackEvent(l,R)),l.addTrack(w),hl.dispatchAddTrackEvent(l,w)}).catch(R=>{throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${C} track`),R}))):f.push(new Promise(R=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${C} track`),R()}).then(()=>{try{i.addTrack(w,l)}catch(R){throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${C} track`),R}l.addTrack(w),hl.dispatchAddTrackEvent(l,w)}))},v=r.getAudioTracks();v.length&&p(v[0]);const S=r.getVideoTracks();return S.length&&p(S[0]),f.reduce((w,C)=>w.then(()=>C),Promise.resolve())}getLocalSessionDescription(){if(this.logger.debug("SessionDescriptionHandler.getLocalSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const r=this._peerConnection.localDescription;return r?Promise.resolve(r):Promise.reject(new Error("Failed to get local session description"))}setLocalSessionDescription(r){return this.logger.debug("SessionDescriptionHandler.setLocalSessionDescription"),this._peerConnection===void 0?Promise.reject(new Error("Peer connection closed.")):this._peerConnection.setLocalDescription(r)}setRemoteSessionDescription(r){if(this.logger.debug("SessionDescriptionHandler.setRemoteSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const i=r.sdp;let l;switch(this._peerConnection.signalingState){case"stable":l="offer";break;case"have-local-offer":l="answer";break;case"have-local-pranswer":case"have-remote-offer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return i?this._peerConnection.setRemoteDescription({sdp:i,type:l}):(this.logger.error("SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp"),Promise.reject(new Error("SDP is undefined")))}setRemoteTrack(r){this.logger.debug("SessionDescriptionHandler.setRemoteTrack");const i=this._remoteMediaStream;i.getTrackById(r.id)?this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - have remote ${r.kind} track`):r.kind==="audio"?(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${r.kind} track`),i.getAudioTracks().forEach(l=>{l.stop(),i.removeTrack(l),hl.dispatchRemoveTrackEvent(i,l)}),i.addTrack(r),hl.dispatchAddTrackEvent(i,r)):r.kind==="video"&&(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${r.kind} track`),i.getVideoTracks().forEach(l=>{l.stop(),i.removeTrack(l),hl.dispatchRemoveTrackEvent(i,l)}),i.addTrack(r),hl.dispatchAddTrackEvent(i,r))}updateDirection(r){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.updateDirection - setting offer direction");{const i=l=>{switch(l){case"inactive":return r!=null&&r.hold?"inactive":"recvonly";case"recvonly":return r!=null&&r.hold?"inactive":"recvonly";case"sendonly":return r!=null&&r.hold?"sendonly":"sendrecv";case"sendrecv":return r!=null&&r.hold?"sendonly":"sendrecv";case"stopped":return"stopped";default:throw new Error("Should never happen")}};this._peerConnection.getTransceivers().forEach(l=>{if(l.direction){const f=i(l.direction);l.direction!==f&&(l.direction=f)}})}break;case"have-remote-offer":this.logger.debug("SessionDescriptionHandler.updateDirection - setting answer direction");{const i=(()=>{const f=this._peerConnection.remoteDescription;if(!f)throw new Error("Failed to read remote offer");const p=/a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(f.sdp);if(p)switch(p[0]){case`a=inactive\r
403
403
  `:return"inactive";case`a=recvonly\r
404
404
  `:return"recvonly";case`a=sendonly\r
405
405
  `:return"sendonly";case`a=sendrecv\r
@@ -426,4 +426,4 @@ Arguments: `+Array.prototype.slice.call(l).join("")+`
426
426
  Ve.version="2.30.1",S8(Gr),Ve.fn=Me,Ve.min=c6,Ve.max=f6,Ve.now=d6,Ve.utc=wo,Ve.unix=LA,Ve.months=jA,Ve.isDate=n0,Ve.locale=Cu,Ve.invalid=kv,Ve.duration=zs,Ve.isMoment=Us,Ve.weekdays=qA,Ve.parseZone=UA,Ve.localeData=xl,Ve.isDuration=qv,Ve.monthsShort=zA,Ve.weekdaysMin=VA,Ve.defineLocale=o1,Ve.updateLocale=U4,Ve.locales=j4,Ve.weekdaysShort=YA,Ve.normalizeUnits=os,Ve.relativeTimeRounding=xk,Ve.relativeTimeThreshold=Ek,Ve.calendarFormat=I6,Ve.prototype=Me,Ve.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};let Xv=null,on=null,eb=null,To=null;function Sk(o,r){if(!o||!o.sessionDescriptionHandler)return;const i=o.sessionDescriptionHandler.peerConnection;i&&i.getSenders().forEach(l=>{l.track&&l.track.kind==="audio"&&(l.track.enabled=r)})}function tb(o){To||(To=document.createElement("audio"),To.id="voxnix-remote-audio",To.autoplay=!0,document.body.appendChild(To));const r=new MediaStream;if(o.sessionDescriptionHandler&&o.sessionDescriptionHandler.peerConnection){o.sessionDescriptionHandler.peerConnection.getReceivers().forEach(l=>{l.track&&r.addTrack(l.track)});const i=o.sessionDescriptionHandler.peerConnection;if(!i._isSetRemoteDescPatched){const l=i.setRemoteDescription.bind(i);i.setRemoteDescription=function(f){if(f&&f.sdp&&f.type==="answer"){const v=(((i.localDescription||{}).sdp||"").match(/^m=/gm)||[]).length,S=(f.sdp.match(/^m=/gm)||[]).length;if(console.log("[RTC Patch] local offer m-lines:",v,"| remote answer m-lines:",S),v>0&&S>v){const w=f.sdp.split(/\r?\n/);let C=0,b=!1;const R=[];for(const H of w)H.startsWith("m=")&&(C++,b=C>v),b||R.push(H);let T=R.join(`\r
427
427
  `);T.endsWith(`\r
428
428
  `)||(T+=`\r
429
- `),console.log("[RTC Patch] filtered to",(T.match(/^m=/gm)||[]).length,"m-lines. Applying to Chrome."),f={type:"answer",sdp:T}}}return l(f)},i._isSetRemoteDescPatched=!0}}To.srcObject=r,To.play().catch(i=>console.error("Error playing media:",i))}function rb(){To&&(To.srcObject=null,To.pause())}const wk=()=>{nt.on("incoming_call",()=>{Ni.pushSound()}),nt.on("local_dial",({number:o})=>{if(Xv){const r=Tc.makeURI(`sip:${o}@${Xv.configuration.uri.domain}`),i=new W2(Xv,r);i.stateChange.addListener(l=>{l===xe.Establishing?nt.emitLocal("call_status","Calling..."):l===xe.Established?(tb(i),on=i,nt.emitLocal("call_status","InCall")):l===xe.Terminated&&(rb(),nt.emitLocal("call_status","Idle"),on=null)}),i.invite()}}),nt.on("local_hangup",()=>{Ni.stopSound(),on&&(on.state===xe.Established?on.bye():typeof on.reject=="function"?on.reject():on.cancel()),nt.emitLocal("call_status","Idle"),nt.emitLocal("call_duration","00:00"),nt.emitToParent("sync_call_ended")}),nt.on("local_reject",()=>{Ni.stopSound(),on&&(typeof on.reject=="function"?on.reject():on.cancel()),nt.emitLocal("call_status","Idle"),nt.emitLocal("call_duration","00:00"),nt.emitToParent("sync_call_ended")}),nt.on("local_answer",()=>{Ni.stopSound();const o={sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}}};on&&on.accept(o)}),nt.on("local_toggle_mute",({muted:o})=>{on&&Sk(on,!o)}),nt.on("local_toggle_hold",({isOnHold:o,setIsOnHold:r})=>{if(on)try{const i=!o,l={sessionDescriptionHandlerOptions:{hold:i}};on.invite(l).then(()=>{r(i),console.log(i?"Call successfully put on hold":"Call successfully resumed")}).catch(f=>{console.error("Hold/Unhold failed",f)})}catch(i){console.error("Gagal mengubah status hold:",i)}}),nt.on("local_dtmf",({key:o})=>{on&&on.sessionDescriptionHandler&&on.sessionDescriptionHandler.sendDtmf(o)})},bk=async o=>{var v,S;window.__sipjsEventsBound||(wk(),window.__sipjsEventsBound=!0);const{auth:r}=o;if(!r)return;const i=r.user_pbx||r.username,l=r.pwd_pbx||r.secret,f=((S=(v=r.pabx_host)==null?void 0:v.replace("http://",""))==null?void 0:S.replace("https://",""))||r.pbxurl,p=r.port||8089;if(!(!i||!f))try{const w=Tc.makeURI(`sip:${i}@${f}`);if(!w)throw new Error("Failed to create SIP URI");const C=`wss://${f}:${p}`,b=new Tc({uri:w,transportOptions:{server:C,useSSL:!0},authorizationUsername:i,authorizationPassword:l,sessionDescriptionHandlerFactoryOptions:{peerConnectionConfiguration:{iceServers:[]},constraints:{audio:!0,video:!1}},logLevel:"warn",contactParams:{transport:"tls"}});Xv=b;const R=new Co(b);R.stateChange.addListener(async T=>{var H;if(T===Cr.Registered)if(((H=Ni.getConfig())==null?void 0:H.autoReady)!==!1)await Ni.updateExtensionStatus(i,"Ready","ready")?(nt.emitLocal("register_status","REGISTERED"),nt.emitLocal("agent_status","READY")):nt.emitLocal("register_status",{status:"FAILED",reason:"Failed to hit extension ready API"});else{const j=await Ni.fetchExtensionStatus(i),z=j==null?void 0:j.extension_status;let O="NOT_READY";z==="Ready"?O="READY":typeof z=="string"&&z.toLowerCase().startsWith("aux")&&(O="AUX"),nt.emitLocal("register_status","SIP_CONNECTED"),nt.emitLocal("agent_status",O)}else(T===Cr.Unregistered||T===Cr.Terminated)&&nt.emitLocal("register_status",{status:"FAILED",reason:"SIP Unregistered or Terminated"})}),b.delegate={onInvite(T){let H=!1;on=T,nt.emitLocal("sipjsSession",T),Ni.pushSound(),Ni.pushNotification(`New incoming call from ${T.remoteIdentity.uri.user}`),nt.emitLocal("incoming_call",T),nt.emitToParent("sync_incoming_call",T),T.stateChange.addListener(P=>{if(P===xe.Established){tb(T),H=!0,nt.emitLocal("call_status","InCall"),nt.emitToParent("sync_call_answered",T);const j=Ve();eb=setInterval(()=>{const z=Ve.duration(Ve().diff(j));nt.emitLocal("call_duration",Ni.toHHMMSS(z.asSeconds()))},1e3)}else P===xe.Terminated&&(rb(),clearInterval(eb),Ni.stopSound(),nt.emitLocal("call_duration","00:00"),nt.emitLocal("call_status","Idle"),H?nt.emitToParent("sync_call_ended",T):nt.emitToParent("sync_call_unanswered"),on=null)})}},await b.start(),await R.register()}catch(w){console.error("SipJS init error:",w),nt.emitLocal("register_status",{status:"FAILED",reason:w.message||"Failed to connect to SIP server"})}},nb={"bottom-left":"bottom-6 left-3 items-start","bottom-right":"bottom-6 right-3 items-end","top-left":"top-6 left-3 items-start","top-right":"top-6 right-3 items-end"};function _k({config:o,placement:r="bottom-left",offset:i,onIncomingCall:l,onCallAnswered:f,onCallEnded:p,onCallUnanswered:v,onRegisterStatus:S,onAgentStatus:w}){const[C,b]=qt.useState(!1),[R,T]=qt.useState("CONNECTING"),[H,P]=qt.useState("NOT_READY"),[j,z]=qt.useState(!1),O=qt.useRef(!1),B=qt.useRef({}),U=(o==null?void 0:o.autoReady)!==!1,q=(o==null?void 0:o.showAuxButton)===!0,K=(o==null?void 0:o.auxOptions)||[];qt.useEffect(()=>{B.current={onIncomingCall:l,onCallAnswered:f,onCallEnded:p,onCallUnanswered:v,onRegisterStatus:S,onAgentStatus:w}}),qt.useEffect(()=>{var F;o&&Ni.setConfig(o);const X=(o==null?void 0:o.auth)||((F=o==null?void 0:o.pabxConfig)==null?void 0:F.auth)||{};!O.current&&(X.username||X.user_pbx)&&(X.pwd_pbx||X.secret)&&(X.pabx_host||X.pbxurl||X.host)&&(O.current=!0,bk({auth:X}))},[o]),qt.useEffect(()=>{const X=[nt.on("register_status",F=>{var M,_e;const L=typeof F=="string"?F:(F==null?void 0:F.status)??"FAILED";T(L),(L==="REGISTERED"||L==="SIP_CONNECTED")&&b(!0),L!=="SIP_CONNECTED"&&((_e=(M=B.current).onRegisterStatus)==null||_e.call(M,L==="FAILED"?F:L))}),nt.on("agent_status",F=>{var L,M;P(F),(M=(L=B.current).onAgentStatus)==null||M.call(L,F)}),nt.on("sync_incoming_call",F=>{var L,M;z(!0),b(!0),(M=(L=B.current).onIncomingCall)==null||M.call(L,F)}),nt.on("sync_call_answered",F=>{var L,M;z(!1),(M=(L=B.current).onCallAnswered)==null||M.call(L,F)}),nt.on("sync_call_ended",F=>{var L,M;z(!1),(M=(L=B.current).onCallEnded)==null||M.call(L,F)}),nt.on("sync_call_unanswered",F=>{var L,M;z(!1),(M=(L=B.current).onCallUnanswered)==null||M.call(L,F)})];return()=>X.forEach(F=>F())},[]);const Z=nb[r]||nb["bottom-left"],ee=R!=="REGISTERED"?R==="FAILED"?"bg-red-500":"bg-blue-400":H==="READY"?"bg-green-500":H==="AUX"?"bg-amber-400":"bg-gray-400",A=i?{position:"fixed",zIndex:9999,...i}:void 0,Ce=r!=null&&r.includes("right")?"origin-bottom-right":"origin-bottom-left";return ie.jsxs("div",{className:i?void 0:`fixed ${Z} z-[9999] flex flex-col gap-3`,style:A,children:[ie.jsxs("div",{className:`w-[360px] bg-white rounded-3xl overflow-hidden ${Ce} shadow-[0_20px_60px_rgba(0,0,0,0.18),0_4px_16px_rgba(0,0,0,0.08)] ${C?"animate-slideUp":"hidden"}`,children:[ie.jsxs("div",{className:"flex items-center justify-between px-4 py-3.5 bg-gradient-to-r from-[#3f3192] to-[#5240c2]",children:[ie.jsx("div",{className:"flex items-center gap-2.5",children:ie.jsx("span",{className:"text-white font-semibold text-sm tracking-wide",children:"Voice Widget"})}),ie.jsx("button",{onClick:()=>b(!1),className:"text-white/50 hover:text-white transition-colors p-1 rounded-lg",title:"Minimize",children:ie.jsx(XT,{className:"w-4 h-4"})})]}),ie.jsx(HR,{initialRegisterStatus:R,autoReady:U,showAuxButton:q,auxOptions:K})]}),ie.jsxs("button",{onClick:()=>b(X=>!X),className:"w-12 h-12 rounded-full bg-primary hover:bg-primary-hover text-white shadow-lg shadow-primary/30 flex items-center justify-center transition-all active:scale-95 relative",title:"Voice Widget",children:[ie.jsx(Xh,{className:"w-5 h-5"}),j&&ie.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-green-500 border-2 border-white animate-ping"}),ie.jsx("span",{className:`absolute -top-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-white ${ee}`})]})]})}let wu=null,us=null;function Dk(o,r){if(Gh.createRoot){const i=Gh.createRoot(r);return i.render(o),{render:l=>i.render(l),unmount:()=>i.unmount()}}return Gh.render(o,r),{render:i=>Gh.render(i,r),unmount:()=>Gh.unmountComponentAtNode(r)}}const Tk={init(o={}){const{container:r,placement:i="bottom-left",offset:l,platform:f="sipjs",auth:p,pabxConfig:v,autoReady:S=!0,showAuxButton:w=!1,auxOptions:C=[],onIncomingCall:b,onCallAnswered:R,onCallEnded:T,onCallUnanswered:H,onRegisterStatus:P,onAgentStatus:j,...z}=o;typeof r=="string"?us=document.querySelector(r):r instanceof HTMLElement&&(us=r),us||(us=document.createElement("div"),us.id="omnix-widget-root",document.body.appendChild(us)),wu&&(wu.unmount(),wu=null);const O=UT.createElement(_k,{config:{platform:f,auth:p,pabxConfig:v,autoReady:S,showAuxButton:w,auxOptions:C,...z},placement:i,offset:l,onIncomingCall:b,onCallAnswered:R,onCallEnded:T,onCallUnanswered:H,onRegisterStatus:P,onAgentStatus:j});return wu=Dk(O,us),{answer:()=>nt.emitLocal("local_answer"),hangup:()=>nt.emitLocal("local_hangup"),reject:()=>nt.emitLocal("local_reject"),mute:B=>nt.emitLocal("local_toggle_mute",{muted:B}),hold:B=>nt.emitLocal("local_toggle_hold",{isOnHold:B,setIsOnHold:()=>{}}),dial:B=>nt.emitLocal("local_dial",{number:B}),destroy:()=>{wu==null||wu.unmount(),wu=null,(us==null?void 0:us.id)==="omnix-widget-root"&&us.remove(),us=null}}}};return zy.OmnixWidget=Tk,Object.defineProperty(zy,Symbol.toStringTag,{value:"Module"}),zy}({});
429
+ `),console.log("[RTC Patch] filtered to",(T.match(/^m=/gm)||[]).length,"m-lines. Applying to Chrome."),f={type:"answer",sdp:T}}}return l(f)},i._isSetRemoteDescPatched=!0}}To.srcObject=r,To.play().catch(i=>console.error("Error playing media:",i))}function rb(){To&&(To.srcObject=null,To.pause())}const wk=()=>{tt.on("incoming_call",()=>{Ni.pushSound()}),tt.on("local_dial",({number:o})=>{if(Xv){const r=Tc.makeURI(`sip:${o}@${Xv.configuration.uri.domain}`),i=new W2(Xv,r);i.stateChange.addListener(l=>{l===xe.Establishing?tt.emitLocal("call_status","Calling..."):l===xe.Established?(tb(i),on=i,tt.emitLocal("call_status","InCall")):l===xe.Terminated&&(rb(),tt.emitLocal("call_status","Idle"),on=null)}),i.invite()}}),tt.on("local_hangup",()=>{Ni.stopSound(),on&&(on.state===xe.Established?on.bye():typeof on.reject=="function"?on.reject():on.cancel()),tt.emitLocal("call_status","Idle"),tt.emitLocal("call_duration","00:00"),tt.emitToParent("sync_call_ended")}),tt.on("local_reject",()=>{Ni.stopSound(),on&&(typeof on.reject=="function"?on.reject():on.cancel()),tt.emitLocal("call_status","Idle"),tt.emitLocal("call_duration","00:00"),tt.emitToParent("sync_call_ended")}),tt.on("local_answer",()=>{Ni.stopSound();const o={sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}}};on&&on.accept(o)}),tt.on("local_toggle_mute",({muted:o})=>{on&&Sk(on,!o)}),tt.on("local_toggle_hold",({isOnHold:o,setIsOnHold:r})=>{if(on)try{const i=!o,l={sessionDescriptionHandlerOptions:{hold:i}};on.invite(l).then(()=>{r(i),console.log(i?"Call successfully put on hold":"Call successfully resumed")}).catch(f=>{console.error("Hold/Unhold failed",f)})}catch(i){console.error("Gagal mengubah status hold:",i)}}),tt.on("local_dtmf",({key:o})=>{on&&on.sessionDescriptionHandler&&on.sessionDescriptionHandler.sendDtmf(o)})},bk=async o=>{var v,S;window.__sipjsEventsBound||(wk(),window.__sipjsEventsBound=!0);const{auth:r}=o;if(!r)return;const i=r.user_pbx||r.username,l=r.pwd_pbx||r.secret,f=((S=(v=r.pabx_host)==null?void 0:v.replace("http://",""))==null?void 0:S.replace("https://",""))||r.pbxurl,p=r.port||8089;if(!(!i||!f))try{const w=Tc.makeURI(`sip:${i}@${f}`);if(!w)throw new Error("Failed to create SIP URI");const C=`wss://${f}:${p}`,b=new Tc({uri:w,transportOptions:{server:C,useSSL:!0},authorizationUsername:i,authorizationPassword:l,sessionDescriptionHandlerFactoryOptions:{peerConnectionConfiguration:{iceServers:[]},constraints:{audio:!0,video:!1}},logLevel:"warn",contactParams:{transport:"tls"}});Xv=b;const R=new Co(b);R.stateChange.addListener(async T=>{var H;if(T===Cr.Registered)if(((H=Ni.getConfig())==null?void 0:H.autoReady)!==!1)await Ni.updateExtensionStatus(i,"Ready","ready")?(tt.emitLocal("register_status","REGISTERED"),tt.emitLocal("agent_status","READY")):tt.emitLocal("register_status",{status:"FAILED",reason:"Failed to hit extension ready API"});else{const j=await Ni.fetchExtensionStatus(i),z=j==null?void 0:j.extension_status;let O="NOT_READY";z==="Ready"?O="READY":typeof z=="string"&&z.toLowerCase().startsWith("aux")&&(O="AUX"),tt.emitLocal("register_status","SIP_CONNECTED"),tt.emitLocal("agent_status",O)}else(T===Cr.Unregistered||T===Cr.Terminated)&&tt.emitLocal("register_status",{status:"FAILED",reason:"SIP Unregistered or Terminated"})}),b.delegate={onInvite(T){let H=!1;on=T,tt.emitLocal("sipjsSession",T),Ni.pushSound(),Ni.pushNotification(`New incoming call from ${T.remoteIdentity.uri.user}`),tt.emitLocal("incoming_call",T),tt.emitToParent("sync_incoming_call",T),T.stateChange.addListener(P=>{if(P===xe.Established){tb(T),H=!0,tt.emitLocal("call_status","InCall"),tt.emitToParent("sync_call_answered",T);const j=Ve();eb=setInterval(()=>{const z=Ve.duration(Ve().diff(j));tt.emitLocal("call_duration",Ni.toHHMMSS(z.asSeconds()))},1e3)}else P===xe.Terminated&&(rb(),clearInterval(eb),Ni.stopSound(),tt.emitLocal("call_duration","00:00"),tt.emitLocal("call_status","Idle"),H?tt.emitToParent("sync_call_ended",T):tt.emitToParent("sync_call_unanswered"),on=null)})}},await b.start(),await R.register()}catch(w){console.error("SipJS init error:",w),tt.emitLocal("register_status",{status:"FAILED",reason:w.message||"Failed to connect to SIP server"})}},nb={"bottom-left":"bottom-6 left-3 items-start","bottom-right":"bottom-6 right-3 items-end","top-left":"top-6 left-3 items-start","top-right":"top-6 right-3 items-end"};function _k({config:o,placement:r="bottom-left",offset:i,onIncomingCall:l,onCallAnswered:f,onCallEnded:p,onCallUnanswered:v,onRegisterStatus:S,onAgentStatus:w}){const[C,b]=qt.useState(!1),[R,T]=qt.useState("CONNECTING"),[H,P]=qt.useState("NOT_READY"),[j,z]=qt.useState(!1),O=qt.useRef(!1),B=qt.useRef({}),U=(o==null?void 0:o.autoReady)!==!1,q=(o==null?void 0:o.showAuxButton)===!0,K=(o==null?void 0:o.auxOptions)||[];qt.useEffect(()=>{B.current={onIncomingCall:l,onCallAnswered:f,onCallEnded:p,onCallUnanswered:v,onRegisterStatus:S,onAgentStatus:w}}),qt.useEffect(()=>{var F;o&&Ni.setConfig(o);const X=(o==null?void 0:o.auth)||((F=o==null?void 0:o.pabxConfig)==null?void 0:F.auth)||{};!O.current&&(X.username||X.user_pbx)&&(X.pwd_pbx||X.secret)&&(X.pabx_host||X.pbxurl||X.host)&&(O.current=!0,bk({auth:X}))},[o]),qt.useEffect(()=>{const X=[tt.on("register_status",F=>{var M,_e;const L=typeof F=="string"?F:(F==null?void 0:F.status)??"FAILED";T(L),(L==="REGISTERED"||L==="SIP_CONNECTED")&&b(!0),L!=="SIP_CONNECTED"&&((_e=(M=B.current).onRegisterStatus)==null||_e.call(M,L==="FAILED"?F:L))}),tt.on("agent_status",F=>{var L,M;P(F),(M=(L=B.current).onAgentStatus)==null||M.call(L,F)}),tt.on("sync_incoming_call",F=>{var L,M;z(!0),b(!0),(M=(L=B.current).onIncomingCall)==null||M.call(L,F)}),tt.on("sync_call_answered",F=>{var L,M;z(!1),(M=(L=B.current).onCallAnswered)==null||M.call(L,F)}),tt.on("sync_call_ended",F=>{var L,M;z(!1),(M=(L=B.current).onCallEnded)==null||M.call(L,F)}),tt.on("sync_call_unanswered",F=>{var L,M;z(!1),(M=(L=B.current).onCallUnanswered)==null||M.call(L,F)})];return()=>X.forEach(F=>F())},[]);const Z=nb[r]||nb["bottom-left"],ee=R!=="REGISTERED"?R==="FAILED"?"bg-red-500":"bg-blue-400":H==="READY"?"bg-green-500":H==="AUX"?"bg-amber-400":"bg-gray-400",A=i?{position:"fixed",zIndex:9999,...i}:void 0,Ce=r!=null&&r.includes("right")?"origin-bottom-right":"origin-bottom-left";return ie.jsxs("div",{className:i?void 0:`fixed ${Z} z-[9999] flex flex-col gap-3`,style:A,children:[ie.jsxs("div",{className:`w-[360px] bg-white rounded-3xl overflow-hidden ${Ce} shadow-[0_20px_60px_rgba(0,0,0,0.18),0_4px_16px_rgba(0,0,0,0.08)] ${C?"animate-slideUp":"hidden"}`,children:[ie.jsxs("div",{className:"flex items-center justify-between px-4 py-3.5 bg-gradient-to-r from-[#3f3192] to-[#5240c2]",children:[ie.jsx("div",{className:"flex items-center gap-2.5",children:ie.jsx("span",{className:"text-white font-semibold text-sm tracking-wide",children:"Voice Widget"})}),ie.jsx("button",{onClick:()=>b(!1),className:"text-white/50 hover:text-white transition-colors p-1 rounded-lg",title:"Minimize",children:ie.jsx(XT,{className:"w-4 h-4"})})]}),ie.jsx(HR,{initialRegisterStatus:R,autoReady:U,showAuxButton:q,auxOptions:K})]}),ie.jsxs("button",{onClick:()=>b(X=>!X),className:"w-12 h-12 rounded-full bg-primary hover:bg-primary-hover text-white shadow-lg shadow-primary/30 flex items-center justify-center transition-all active:scale-95 relative",title:"Voice Widget",children:[ie.jsx(Xh,{className:"w-5 h-5"}),j&&ie.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-green-500 border-2 border-white animate-ping"}),ie.jsx("span",{className:`absolute -top-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-white ${ee}`})]})]})}let wu=null,us=null;function Dk(o,r){if(Gh.createRoot){const i=Gh.createRoot(r);return i.render(o),{render:l=>i.render(l),unmount:()=>i.unmount()}}return Gh.render(o,r),{render:i=>Gh.render(i,r),unmount:()=>Gh.unmountComponentAtNode(r)}}const Tk={init(o={}){const{container:r,placement:i="bottom-left",offset:l,platform:f="sipjs",auth:p,pabxConfig:v,autoReady:S=!0,showAuxButton:w=!1,auxOptions:C=[],onIncomingCall:b,onCallAnswered:R,onCallEnded:T,onCallUnanswered:H,onRegisterStatus:P,onAgentStatus:j,...z}=o;typeof r=="string"?us=document.querySelector(r):r instanceof HTMLElement&&(us=r),us||(us=document.createElement("div"),us.id="omnix-widget-root",document.body.appendChild(us)),wu&&(wu.unmount(),wu=null);const O=UT.createElement(_k,{config:{platform:f,auth:p,pabxConfig:v,autoReady:S,showAuxButton:w,auxOptions:C,...z},placement:i,offset:l,onIncomingCall:b,onCallAnswered:R,onCallEnded:T,onCallUnanswered:H,onRegisterStatus:P,onAgentStatus:j});return wu=Dk(O,us),{answer:()=>tt.emitLocal("local_answer"),hangup:()=>tt.emitLocal("local_hangup"),reject:()=>tt.emitLocal("local_reject"),mute:B=>tt.emitLocal("local_toggle_mute",{muted:B}),hold:B=>tt.emitLocal("local_toggle_hold",{isOnHold:B,setIsOnHold:()=>{}}),dial:B=>tt.emitLocal("local_dial",{number:B}),destroy:()=>{wu==null||wu.unmount(),wu=null,(us==null?void 0:us.id)==="omnix-widget-root"&&us.remove(),us=null}}}};return zy.OmnixWidget=Tk,Object.defineProperty(zy,Symbol.toStringTag,{value:"Module"}),zy}({});