@memori.ai/memori-webcomponent 1.0.3 → 1.0.4
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.
|
@@ -58,7 +58,7 @@ var n=o("bqBrJ"),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(
|
|
|
58
58
|
* This source code is licensed under the MIT license found in the
|
|
59
59
|
* LICENSE file in the root directory of this source tree.
|
|
60
60
|
*/
|
|
61
|
-
e.exports=function(t){var n={},r=o("kyWRD"),i=o("85Hg2"),a=o("kMsGZ");function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,c=60103,u=60106,d=60107,h=60108,f=60114,p=60109,m=60110,g=60112,v=60113,b=60120,y=60115,w=60116,S=60121,x=60129,M=60130,_=60131;if("function"==typeof Symbol&&Symbol.for){var A=Symbol.for;c=A("react.element"),u=A("react.portal"),d=A("react.fragment"),h=A("react.strict_mode"),f=A("react.profiler"),p=A("react.provider"),m=A("react.context"),g=A("react.forward_ref"),v=A("react.suspense"),b=A("react.suspense_list"),y=A("react.memo"),w=A("react.lazy"),S=A("react.block"),A("react.scope"),x=A("react.debug_trace_mode"),M=A("react.offscreen"),_=A("react.legacy_hidden")}var E="function"==typeof Symbol&&Symbol.iterator;function C(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=E&&e[E]||e["@@iterator"])?e:null}function T(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case d:return"Fragment";case u:return"Portal";case f:return"Profiler";case h:return"StrictMode";case v:return"Suspense";case b:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case m:return(e.displayName||"Context")+".Consumer";case p:return(e._context.displayName||"Context")+".Provider";case g:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case y:return T(e.type);case S:return T(e._render);case w:t=e._payload,e=e._init;try{return T(e(t))}catch(e){}}return null}function I(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function k(e){if(I(e)!==e)throw Error(s(188))}function R(e){var t=e.alternate;if(!t){if(null===(t=I(e)))throw Error(s(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return k(i),e;if(o===r)return k(i),t;o=o.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,l=i.child;l;){if(l===n){a=!0,n=i,r=o;break}if(l===r){a=!0,r=i,n=o;break}l=l.sibling}if(!a){for(l=o.child;l;){if(l===n){a=!0,n=o,r=i;break}if(l===r){a=!0,r=o,n=i;break}l=l.sibling}if(!a)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(3!==n.tag)throw Error(s(188));return n.stateNode.current===n?e:t}function O(e){if(!(e=R(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function P(e,t){for(var n=e.alternate;null!==t;){if(t===e||t===n)return!0;t=t.return}return!1}var N,B=t.getPublicInstance,L=t.getRootHostContext,D=t.getChildHostContext,U=t.prepareForCommit,F=t.resetAfterCommit,z=t.createInstance,j=t.appendInitialChild,H=t.finalizeInitialChildren,G=t.prepareUpdate,V=t.shouldSetTextContent,W=t.createTextInstance,q=t.scheduleTimeout,K=t.cancelTimeout,J=t.noTimeout,Q=t.isPrimaryRenderer,X=t.supportsMutation,Y=t.supportsPersistence,Z=t.supportsHydration,$=t.getInstanceFromNode,ee=t.makeOpaqueHydratingObject,te=t.makeClientId,ne=t.beforeActiveInstanceBlur,re=t.afterActiveInstanceBlur,ie=t.preparePortalMount,oe=t.supportsTestSelectors,ae=t.findFiberRoot,se=t.getBoundingRect,le=t.getTextContent,ce=t.isHiddenSubtree,ue=t.matchAccessibilityRole,de=t.setFocusIfFocusable,he=t.setupIntersectionObserver,fe=t.appendChild,pe=t.appendChildToContainer,me=t.commitTextUpdate,ge=t.commitMount,ve=t.commitUpdate,be=t.insertBefore,ye=t.insertInContainerBefore,we=t.removeChild,Se=t.removeChildFromContainer,xe=t.resetTextContent,Me=t.hideInstance,_e=t.hideTextInstance,Ae=t.unhideInstance,Ee=t.unhideTextInstance,Ce=t.clearContainer,Te=t.cloneInstance,Ie=t.createContainerChildSet,ke=t.appendChildToContainerChildSet,Re=t.finalizeContainerChildren,Oe=t.replaceContainerChildren,Pe=t.cloneHiddenInstance,Ne=t.cloneHiddenTextInstance,Be=t.canHydrateInstance,Le=t.canHydrateTextInstance,De=t.isSuspenseInstancePending,Ue=t.isSuspenseInstanceFallback,Fe=t.getNextHydratableSibling,ze=t.getFirstHydratableChild,je=t.hydrateInstance,He=t.hydrateTextInstance,Ge=t.getNextHydratableInstanceAfterSuspenseInstance,Ve=t.commitHydratedContainer,We=t.commitHydratedSuspenseInstance;function qe(e){if(void 0===N)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);N=t&&t[1]||""}return"\n"+N+e}var Ke=!1;function Je(e,t){if(!e||Ke)return"";Ke=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(e){if(e&&r&&"string"==typeof e.stack){for(var i=e.stack.split("\n"),o=r.stack.split("\n"),a=i.length-1,s=o.length-1;1<=a&&0<=s&&i[a]!==o[s];)s--;for(;1<=a&&0<=s;a--,s--)if(i[a]!==o[s]){if(1!==a||1!==s)do{if(a--,0>--s||i[a]!==o[s])return"\n"+i[a].replace(" at new "," at ")}while(1<=a&&0<=s);break}}}finally{Ke=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?qe(e):""}var Qe=[],Xe=-1;function Ye(e){return{current:e}}function Ze(e){0>Xe||(e.current=Qe[Xe],Qe[Xe]=null,Xe--)}function $e(e,t){Xe++,Qe[Xe]=e.current,e.current=t}var et={},tt=Ye(et),nt=Ye(!1),rt=et;function it(e,t){var n=e.type.contextTypes;if(!n)return et;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ot(e){return null!=(e=e.childContextTypes)}function at(){Ze(nt),Ze(tt)}function st(e,t,n){if(tt.current!==et)throw Error(s(168));$e(tt,t),$e(nt,n)}function lt(e,t,n){var i=e.stateNode;if(e=t.childContextTypes,"function"!=typeof i.getChildContext)return n;for(var o in i=i.getChildContext())if(!(o in e))throw Error(s(108,T(t)||"Unknown",o));return r({},n,i)}function ct(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||et,rt=tt.current,$e(tt,e),$e(nt,nt.current),!0}function ut(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=lt(e,t,rt),r.__reactInternalMemoizedMergedChildContext=e,Ze(nt),Ze(tt),$e(tt,e)):Ze(nt),$e(nt,n)}var dt=null,ht=null;(0,a.unstable_now)();var ft=0,pt=8;function mt(e){if(0!=(1&e))return pt=15,1;if(0!=(2&e))return pt=14,2;if(0!=(4&e))return pt=13,4;var t=24&e;return 0!==t?(pt=12,t):0!=(32&e)?(pt=11,32):0!==(t=192&e)?(pt=10,t):0!=(256&e)?(pt=9,256):0!==(t=3584&e)?(pt=8,t):0!=(4096&e)?(pt=7,4096):0!==(t=4186112&e)?(pt=6,t):0!==(t=62914560&e)?(pt=5,t):67108864&e?(pt=4,67108864):0!=(134217728&e)?(pt=3,134217728):0!==(t=805306368&e)?(pt=2,t):0!=(1073741824&e)?(pt=1,1073741824):(pt=8,e)}function gt(e,t){var n=e.pendingLanes;if(0===n)return pt=0;var r=0,i=0,o=e.expiredLanes,a=e.suspendedLanes,s=e.pingedLanes;if(0!==o)r=o,i=pt=15;else if(0!==(o=134217727&n)){var l=o&~a;0!==l?(r=mt(l),i=pt):0!==(s&=o)&&(r=mt(s),i=pt)}else 0!==(o=n&~a)?(r=mt(o),i=pt):0!==s&&(r=mt(s),i=pt);if(0===r)return 0;if(r=n&((0>(r=31-xt(r))?0:1<<r)<<1)-1,0!==t&&t!==r&&0==(t&a)){if(mt(t),i<=pt)return t;pt=i}if(0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)i=1<<(n=31-xt(t)),r|=e[n],t&=~i;return r}function vt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function bt(e,t){switch(e){case 15:return 1;case 14:return 2;case 12:return 0===(e=yt(24&~t))?bt(10,t):e;case 10:return 0===(e=yt(192&~t))?bt(8,t):e;case 8:return 0===(e=yt(3584&~t))&&(0===(e=yt(4186112&~t))&&(e=512)),e;case 2:return 0===(t=yt(805306368&~t))&&(t=268435456),t}throw Error(s(358,e))}function yt(e){return e&-e}function wt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function St(e,t,n){e.pendingLanes|=t;var r=t-1;e.suspendedLanes&=r,e.pingedLanes&=r,(e=e.eventTimes)[t=31-xt(t)]=n}var xt=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(Mt(e)/_t|0)|0},Mt=Math.log,_t=Math.LN2;var At=a.unstable_runWithPriority,Et=a.unstable_scheduleCallback,Ct=a.unstable_cancelCallback,Tt=a.unstable_shouldYield,It=a.unstable_requestPaint,kt=a.unstable_now,Rt=a.unstable_getCurrentPriorityLevel,Ot=a.unstable_ImmediatePriority,Pt=a.unstable_UserBlockingPriority,Nt=a.unstable_NormalPriority,Bt=a.unstable_LowPriority,Lt=a.unstable_IdlePriority,Dt={},Ut=void 0!==It?It:function(){},Ft=null,zt=null,jt=!1,Ht=kt(),Gt=1e4>Ht?kt:function(){return kt()-Ht};function Vt(){switch(Rt()){case Ot:return 99;case Pt:return 98;case Nt:return 97;case Bt:return 96;case Lt:return 95;default:throw Error(s(332))}}function Wt(e){switch(e){case 99:return Ot;case 98:return Pt;case 97:return Nt;case 96:return Bt;case 95:return Lt;default:throw Error(s(332))}}function qt(e,t){return e=Wt(e),At(e,t)}function Kt(e,t,n){return e=Wt(e),Et(e,t,n)}function Jt(){if(null!==zt){var e=zt;zt=null,Ct(e)}Qt()}function Qt(){if(!jt&&null!==Ft){jt=!0;var e=0;try{var t=Ft;qt(99,(function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}})),Ft=null}catch(t){throw null!==Ft&&(Ft=Ft.slice(e+1)),Et(Ot,Jt),t}finally{jt=!1}}}var Xt=l.ReactCurrentBatchConfig;var Yt="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Zt=Object.prototype.hasOwnProperty;function $t(e,t){if(Yt(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!Zt.call(t,n[r])||!Yt(e[n[r]],t[n[r]]))return!1;return!0}function en(e){switch(e.tag){case 5:return qe(e.type);case 16:return qe("Lazy");case 13:return qe("Suspense");case 19:return qe("SuspenseList");case 0:case 2:case 15:return e=Je(e.type,!1);case 11:return e=Je(e.type.render,!1);case 22:return e=Je(e.type._render,!1);case 1:return e=Je(e.type,!0);default:return""}}function tn(e,t){if(e&&e.defaultProps){for(var n in t=r({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var nn=Ye(null),rn=null,on=null,an=null;function sn(){an=on=rn=null}function ln(e,t){e=e.type._context,Q?($e(nn,e._currentValue),e._currentValue=t):($e(nn,e._currentValue2),e._currentValue2=t)}function cn(e){var t=nn.current;Ze(nn),e=e.type._context,Q?e._currentValue=t:e._currentValue2=t}function un(e,t){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)===t){if(null===n||(n.childLanes&t)===t)break;n.childLanes|=t}else e.childLanes|=t,null!==n&&(n.childLanes|=t);e=e.return}}function dn(e,t){rn=e,an=on=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(Hr=!0),e.firstContext=null)}function hn(e,t){if(an!==e&&!1!==t&&0!==t)if("number"==typeof t&&1073741823!==t||(an=e,t=1073741823),t={context:e,observedBits:t,next:null},null===on){if(null===rn)throw Error(s(308));on=t,rn.dependencies={lanes:0,firstContext:t,responders:null}}else on=on.next=t;return Q?e._currentValue:e._currentValue2}var fn=!1;function pn(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function mn(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function gn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function vn(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function bn(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?i=o=a:o=o.next=a,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function yn(e,t,n,i){var o=e.updateQueue;fn=!1;var a=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(null!==l){o.shared.pending=null;var c=l,u=c.next;c.next=null,null===s?a=u:s.next=u,s=c;var d=e.alternate;if(null!==d){var h=(d=d.updateQueue).lastBaseUpdate;h!==s&&(null===h?d.firstBaseUpdate=u:h.next=u,d.lastBaseUpdate=c)}}if(null!==a){for(h=o.baseState,s=0,d=u=c=null;;){l=a.lane;var f=a.eventTime;if((i&l)===l){null!==d&&(d=d.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,m=a;switch(l=t,f=n,m.tag){case 1:if("function"==typeof(p=m.payload)){h=p.call(f,h,l);break e}h=p;break e;case 3:p.flags=-4097&p.flags|64;case 0:if(null==(l="function"==typeof(p=m.payload)?p.call(f,h,l):p))break e;h=r({},h,l);break e;case 2:fn=!0}}null!==a.callback&&(e.flags|=32,null===(l=o.effects)?o.effects=[a]:l.push(a))}else f={eventTime:f,lane:l,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===d?(u=d=f,c=h):d=d.next=f,s|=l;if(null===(a=a.next)){if(null===(l=o.shared.pending))break;a=l.next,l.next=null,o.lastBaseUpdate=l,o.shared.pending=null}}null===d&&(c=h),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=d,ho|=s,e.lanes=s,e.memoizedState=h}}function wn(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(null!==i){if(r.callback=null,r=n,"function"!=typeof i)throw Error(s(191,i));i.call(r)}}}var Sn=(new i.Component).refs;function xn(e,t,n,i){n=null==(n=n(i,t=e.memoizedState))?t:r({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var Mn={isMounted:function(e){return!!(e=e._reactInternals)&&I(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Do(),i=Uo(e),o=gn(r,i);o.payload=t,null!=n&&(o.callback=n),vn(e,o),Fo(e,i,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Do(),i=Uo(e),o=gn(r,i);o.tag=1,o.payload=t,null!=n&&(o.callback=n),vn(e,o),Fo(e,i,r)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Do(),r=Uo(e),i=gn(n,r);i.tag=2,null!=t&&(i.callback=t),vn(e,i),Fo(e,r,n)}};function _n(e,t,n,r,i,o,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,a):!t.prototype||!t.prototype.isPureReactComponent||(!$t(n,r)||!$t(i,o))}function An(e,t,n){var r=!1,i=et,o=t.contextType;return"object"==typeof o&&null!==o?o=hn(o):(i=ot(t)?rt:tt.current,o=(r=null!=(r=t.contextTypes))?it(e,i):et),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Mn,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function En(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Mn.enqueueReplaceState(t,t.state,null)}function Cn(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs=Sn,pn(e);var o=t.contextType;"object"==typeof o&&null!==o?i.context=hn(o):(o=ot(t)?rt:tt.current,i.context=it(e,o)),yn(e,n,i,r),i.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(xn(e,t,o,n),i.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(t=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&Mn.enqueueReplaceState(i,i.state,null),yn(e,n,i,r),i.state=e.memoizedState),"function"==typeof i.componentDidMount&&(e.flags|=4)}var Tn=Array.isArray;function In(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(s(309));var r=n.stateNode}if(!r)throw Error(s(147,e));var i=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===i?t.ref:(t=function(e){var t=r.refs;t===Sn&&(t=r.refs={}),null===e?delete t[i]:t[i]=e},t._stringRef=i,t)}if("string"!=typeof e)throw Error(s(284));if(!n._owner)throw Error(s(290,e))}return e}function kn(e,t){if("textarea"!==e.type)throw Error(s(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t))}function Rn(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.flags=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=_a(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags=2,n):r:(t.flags=2,n):n}function a(t){return e&&null===t.alternate&&(t.flags=2),t}function l(e,t,n,r){return null===t||6!==t.tag?((t=Ta(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function h(e,t,n,r){return null!==t&&t.elementType===n.type?((r=i(t,n.props)).ref=In(e,t,n),r.return=e,r):((r=Aa(n.type,n.key,n.props,null,e.mode,r)).ref=In(e,t,n),r.return=e,r)}function f(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Ia(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function p(e,t,n,r,o){return null===t||7!==t.tag?((t=Ea(n,e.mode,r,o)).return=e,t):((t=i(t,n)).return=e,t)}function m(e,t,n){if("string"==typeof t||"number"==typeof t)return(t=Ta(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case c:return(n=Aa(t.type,t.key,t.props,null,e.mode,n)).ref=In(e,null,t),n.return=e,n;case u:return(t=Ia(t,e.mode,n)).return=e,t}if(Tn(t)||C(t))return(t=Ea(t,e.mode,n,null)).return=e,t;kn(e,t)}return null}function g(e,t,n,r){var i=null!==t?t.key:null;if("string"==typeof n||"number"==typeof n)return null!==i?null:l(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case c:return n.key===i?n.type===d?p(e,t,n.props.children,r,i):h(e,t,n,r):null;case u:return n.key===i?f(e,t,n,r):null}if(Tn(n)||C(n))return null!==i?null:p(e,t,n,r,null);kn(e,n)}return null}function v(e,t,n,r,i){if("string"==typeof r||"number"==typeof r)return l(t,e=e.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case c:return e=e.get(null===r.key?n:r.key)||null,r.type===d?p(t,e,r.props.children,i,r.key):h(t,e,r,i);case u:return f(t,e=e.get(null===r.key?n:r.key)||null,r,i)}if(Tn(r)||C(r))return p(t,e=e.get(n)||null,r,i,null);kn(t,r)}return null}function b(i,a,s,l){for(var c=null,u=null,d=a,h=a=0,f=null;null!==d&&h<s.length;h++){d.index>h?(f=d,d=null):f=d.sibling;var p=g(i,d,s[h],l);if(null===p){null===d&&(d=f);break}e&&d&&null===p.alternate&&t(i,d),a=o(p,a,h),null===u?c=p:u.sibling=p,u=p,d=f}if(h===s.length)return n(i,d),c;if(null===d){for(;h<s.length;h++)null!==(d=m(i,s[h],l))&&(a=o(d,a,h),null===u?c=d:u.sibling=d,u=d);return c}for(d=r(i,d);h<s.length;h++)null!==(f=v(d,i,h,s[h],l))&&(e&&null!==f.alternate&&d.delete(null===f.key?h:f.key),a=o(f,a,h),null===u?c=f:u.sibling=f,u=f);return e&&d.forEach((function(e){return t(i,e)})),c}function y(i,a,l,c){var u=C(l);if("function"!=typeof u)throw Error(s(150));if(null==(l=u.call(l)))throw Error(s(151));for(var d=u=null,h=a,f=a=0,p=null,b=l.next();null!==h&&!b.done;f++,b=l.next()){h.index>f?(p=h,h=null):p=h.sibling;var y=g(i,h,b.value,c);if(null===y){null===h&&(h=p);break}e&&h&&null===y.alternate&&t(i,h),a=o(y,a,f),null===d?u=y:d.sibling=y,d=y,h=p}if(b.done)return n(i,h),u;if(null===h){for(;!b.done;f++,b=l.next())null!==(b=m(i,b.value,c))&&(a=o(b,a,f),null===d?u=b:d.sibling=b,d=b);return u}for(h=r(i,h);!b.done;f++,b=l.next())null!==(b=v(h,i,f,b.value,c))&&(e&&null!==b.alternate&&h.delete(null===b.key?f:b.key),a=o(b,a,f),null===d?u=b:d.sibling=b,d=b);return e&&h.forEach((function(e){return t(i,e)})),u}return function(e,r,o,l){var h="object"==typeof o&&null!==o&&o.type===d&&null===o.key;h&&(o=o.props.children);var f="object"==typeof o&&null!==o;if(f)switch(o.$$typeof){case c:e:{for(f=o.key,h=r;null!==h;){if(h.key===f){if(7===h.tag){if(o.type===d){n(e,h.sibling),(r=i(h,o.props.children)).return=e,e=r;break e}}else if(h.elementType===o.type){n(e,h.sibling),(r=i(h,o.props)).ref=In(e,h,o),r.return=e,e=r;break e}n(e,h);break}t(e,h),h=h.sibling}o.type===d?((r=Ea(o.props.children,e.mode,l,o.key)).return=e,e=r):((l=Aa(o.type,o.key,o.props,null,e.mode,l)).ref=In(e,r,o),l.return=e,e=l)}return a(e);case u:e:{for(h=o.key;null!==r;){if(r.key===h){if(4===r.tag&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),(r=i(r,o.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Ia(o,e.mode,l)).return=e,e=r}return a(e)}if("string"==typeof o||"number"==typeof o)return o=""+o,null!==r&&6===r.tag?(n(e,r.sibling),(r=i(r,o)).return=e,e=r):(n(e,r),(r=Ta(o,e.mode,l)).return=e,e=r),a(e);if(Tn(o))return b(e,r,o,l);if(C(o))return y(e,r,o,l);if(f&&kn(e,o),void 0===o&&!h)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(s(152,T(e.type)||"Component"))}return n(e,r)}}var On=Rn(!0),Pn=Rn(!1),Nn={},Bn=Ye(Nn),Ln=Ye(Nn),Dn=Ye(Nn);function Un(e){if(e===Nn)throw Error(s(174));return e}function Fn(e,t){$e(Dn,t),$e(Ln,e),$e(Bn,Nn),e=L(t),Ze(Bn),$e(Bn,e)}function zn(){Ze(Bn),Ze(Ln),Ze(Dn)}function jn(e){var t=Un(Dn.current),n=Un(Bn.current);n!==(t=D(n,e.type,t))&&($e(Ln,e),$e(Bn,t))}function Hn(e){Ln.current===e&&(Ze(Bn),Ze(Ln))}var Gn=Ye(0);function Vn(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||De(n)||Ue(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Wn=null,qn=null,Kn=!1;function Jn(e,t){var n=xa(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function Qn(e,t){switch(e.tag){case 5:return null!==(t=Be(t,e.type,e.pendingProps))&&(e.stateNode=t,!0);case 6:return null!==(t=Le(t,e.pendingProps))&&(e.stateNode=t,!0);default:return!1}}function Xn(e){if(Kn){var t=qn;if(t){var n=t;if(!Qn(e,t)){if(!(t=Fe(n))||!Qn(e,t))return e.flags=-1025&e.flags|2,Kn=!1,void(Wn=e);Jn(Wn,n)}Wn=e,qn=ze(t)}else e.flags=-1025&e.flags|2,Kn=!1,Wn=e}}function Yn(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Wn=e}function Zn(e){if(!Z||e!==Wn)return!1;if(!Kn)return Yn(e),Kn=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!V(t,e.memoizedProps))for(t=qn;t;)Jn(e,t),t=Fe(t);if(Yn(e),13===e.tag){if(!Z)throw Error(s(316));if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(s(317));qn=Ge(e)}else qn=Wn?Fe(e.stateNode):null;return!0}function $n(){Z&&(qn=Wn=null,Kn=!1)}var er=[];function tr(){for(var e=0;e<er.length;e++){var t=er[e];Q?t._workInProgressVersionPrimary=null:t._workInProgressVersionSecondary=null}er.length=0}var nr=l.ReactCurrentDispatcher,rr=l.ReactCurrentBatchConfig,ir=0,or=null,ar=null,sr=null,lr=!1,cr=!1;function ur(){throw Error(s(321))}function dr(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Yt(e[n],t[n]))return!1;return!0}function hr(e,t,n,r,i,o){if(ir=o,or=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,nr.current=null===e||null===e.memoizedState?Ur:Fr,e=n(r,i),cr){o=0;do{if(cr=!1,!(25>o))throw Error(s(301));o+=1,sr=ar=null,t.updateQueue=null,nr.current=zr,e=n(r,i)}while(cr)}if(nr.current=Dr,t=null!==ar&&null!==ar.next,ir=0,sr=ar=or=null,lr=!1,t)throw Error(s(300));return e}function fr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===sr?or.memoizedState=sr=e:sr=sr.next=e,sr}function pr(){if(null===ar){var e=or.alternate;e=null!==e?e.memoizedState:null}else e=ar.next;var t=null===sr?or.memoizedState:sr.next;if(null!==t)sr=t,ar=e;else{if(null===e)throw Error(s(310));e={memoizedState:(ar=e).memoizedState,baseState:ar.baseState,baseQueue:ar.baseQueue,queue:ar.queue,next:null},null===sr?or.memoizedState=sr=e:sr=sr.next=e}return sr}function mr(e,t){return"function"==typeof t?t(e):t}function gr(e){var t=pr(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=ar,i=r.baseQueue,o=n.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var l=a=o=null,c=i;do{var u=c.lane;if((ir&u)===u)null!==l&&(l=l.next={lane:0,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null}),r=c.eagerReducer===e?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null};null===l?(a=l=d,o=r):l=l.next=d,or.lanes|=u,ho|=u}c=c.next}while(null!==c&&c!==i);null===l?o=r:l.next=a,Yt(r,t.memoizedState)||(Hr=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function vr(e){var t=pr(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);Yt(o,t.memoizedState)||(Hr=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function br(e,t,n){var r=t._getVersion;r=r(t._source);var i=Q?t._workInProgressVersionPrimary:t._workInProgressVersionSecondary;if(null!==i?e=i===r:(e=e.mutableReadLanes,(e=(ir&e)===e)&&(Q?t._workInProgressVersionPrimary=r:t._workInProgressVersionSecondary=r,er.push(t))),e)return n(t._source);throw er.push(t),Error(s(350))}function yr(e,t,n,r){var i=ro;if(null===i)throw Error(s(349));var o=t._getVersion,a=o(t._source),l=nr.current,c=l.useState((function(){return br(i,t,n)})),u=c[1],d=c[0];c=sr;var h=e.memoizedState,f=h.refs,p=f.getSnapshot,m=h.source;h=h.subscribe;var g=or;return e.memoizedState={refs:f,source:t,subscribe:r},l.useEffect((function(){f.getSnapshot=n,f.setSnapshot=u;var e=o(t._source);if(!Yt(a,e)){e=n(t._source),Yt(d,e)||(u(e),e=Uo(g),i.mutableReadLanes|=e&i.pendingLanes),e=i.mutableReadLanes,i.entangledLanes|=e;for(var r=i.entanglements,s=e;0<s;){var l=31-xt(s),c=1<<l;r[l]|=e,s&=~c}}}),[n,t,r]),l.useEffect((function(){return r(t._source,(function(){var e=f.getSnapshot,n=f.setSnapshot;try{n(e(t._source));var r=Uo(g);i.mutableReadLanes|=r&i.pendingLanes}catch(e){n((function(){throw e}))}}))}),[t,r]),Yt(p,n)&&Yt(m,t)&&Yt(h,r)||((e={pending:null,dispatch:null,lastRenderedReducer:mr,lastRenderedState:d}).dispatch=u=Lr.bind(null,or,e),c.queue=e,c.baseQueue=null,d=br(i,t,n),c.memoizedState=c.baseState=d),d}function wr(e,t,n){return yr(pr(),e,t,n)}function Sr(e){var t=fr();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:mr,lastRenderedState:e}).dispatch=Lr.bind(null,or,e),[t.memoizedState,e]}function xr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=or.updateQueue)?(t={lastEffect:null},or.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Mr(e){return e={current:e},fr().memoizedState=e}function _r(){return pr().memoizedState}function Ar(e,t,n,r){var i=fr();or.flags|=e,i.memoizedState=xr(1|t,n,void 0,void 0===r?null:r)}function Er(e,t,n,r){var i=pr();r=void 0===r?null:r;var o=void 0;if(null!==ar){var a=ar.memoizedState;if(o=a.destroy,null!==r&&dr(r,a.deps))return void xr(t,n,o,r)}or.flags|=e,i.memoizedState=xr(1|t,n,o,r)}function Cr(e,t){return Ar(516,4,e,t)}function Tr(e,t){return Er(516,4,e,t)}function Ir(e,t){return Er(4,2,e,t)}function kr(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Rr(e,t,n){return n=null!=n?n.concat([e]):null,Er(4,2,kr.bind(null,t,e),n)}function Or(){}function Pr(e,t){var n=pr();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&dr(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Nr(e,t){var n=pr();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&dr(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Br(e,t){var n=Vt();qt(98>n?98:n,(function(){e(!0)})),qt(97<n?97:n,(function(){var n=rr.transition;rr.transition=1;try{e(!1),t()}finally{rr.transition=n}}))}function Lr(e,t,n){var r=Do(),i=Uo(e),o={lane:i,action:n,eagerReducer:null,eagerState:null,next:null},a=t.pending;if(null===a?o.next=o:(o.next=a.next,a.next=o),t.pending=o,a=e.alternate,e===or||null!==a&&a===or)cr=lr=!0;else{if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var s=t.lastRenderedState,l=a(s,n);if(o.eagerReducer=a,o.eagerState=l,Yt(l,s))return}catch(e){}Fo(e,i,r)}}var Dr={readContext:hn,useCallback:ur,useContext:ur,useEffect:ur,useImperativeHandle:ur,useLayoutEffect:ur,useMemo:ur,useReducer:ur,useRef:ur,useState:ur,useDebugValue:ur,useDeferredValue:ur,useTransition:ur,useMutableSource:ur,useOpaqueIdentifier:ur,unstable_isNewReconciler:!1},Ur={readContext:hn,useCallback:function(e,t){return fr().memoizedState=[e,void 0===t?null:t],e},useContext:hn,useEffect:Cr,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Ar(4,2,kr.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ar(4,2,e,t)},useMemo:function(e,t){var n=fr();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=fr();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=Lr.bind(null,or,e),[r.memoizedState,e]},useRef:Mr,useState:Sr,useDebugValue:Or,useDeferredValue:function(e){var t=Sr(e),n=t[0],r=t[1];return Cr((function(){var t=rr.transition;rr.transition=1;try{r(e)}finally{rr.transition=t}}),[e]),n},useTransition:function(){var e=Sr(!1),t=e[0];return Mr(e=Br.bind(null,e[1])),[e,t]},useMutableSource:function(e,t,n){var r=fr();return r.memoizedState={refs:{getSnapshot:t,setSnapshot:null},source:e,subscribe:n},yr(r,e,t,n)},useOpaqueIdentifier:function(){if(Kn){var e=!1,t=ee((function(){throw e||(e=!0,n(te())),Error(s(355))})),n=Sr(t)[1];return 0==(2&or.mode)&&(or.flags|=516,xr(5,(function(){n(te())}),void 0,null)),t}return Sr(t=te()),t},unstable_isNewReconciler:!1},Fr={readContext:hn,useCallback:Pr,useContext:hn,useEffect:Tr,useImperativeHandle:Rr,useLayoutEffect:Ir,useMemo:Nr,useReducer:gr,useRef:_r,useState:function(){return gr(mr)},useDebugValue:Or,useDeferredValue:function(e){var t=gr(mr),n=t[0],r=t[1];return Tr((function(){var t=rr.transition;rr.transition=1;try{r(e)}finally{rr.transition=t}}),[e]),n},useTransition:function(){var e=gr(mr)[0];return[_r().current,e]},useMutableSource:wr,useOpaqueIdentifier:function(){return gr(mr)[0]},unstable_isNewReconciler:!1},zr={readContext:hn,useCallback:Pr,useContext:hn,useEffect:Tr,useImperativeHandle:Rr,useLayoutEffect:Ir,useMemo:Nr,useReducer:vr,useRef:_r,useState:function(){return vr(mr)},useDebugValue:Or,useDeferredValue:function(e){var t=vr(mr),n=t[0],r=t[1];return Tr((function(){var t=rr.transition;rr.transition=1;try{r(e)}finally{rr.transition=t}}),[e]),n},useTransition:function(){var e=vr(mr)[0];return[_r().current,e]},useMutableSource:wr,useOpaqueIdentifier:function(){return vr(mr)[0]},unstable_isNewReconciler:!1},jr=l.ReactCurrentOwner,Hr=!1;function Gr(e,t,n,r){t.child=null===e?Pn(t,null,n,r):On(t,e.child,n,r)}function Vr(e,t,n,r,i){n=n.render;var o=t.ref;return dn(t,i),r=hr(e,t,n,r,o,i),null===e||Hr?(t.flags|=1,Gr(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~i,di(e,t,i))}function Wr(e,t,n,r,i,o){if(null===e){var a=n.type;return"function"!=typeof a||Ma(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Aa(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,qr(e,t,a,r,i,o))}return a=e.child,0==(i&o)&&(i=a.memoizedProps,(n=null!==(n=n.compare)?n:$t)(i,r)&&e.ref===t.ref)?di(e,t,o):(t.flags|=1,(e=_a(a,r)).ref=t.ref,e.return=t,t.child=e)}function qr(e,t,n,r,i,o){if(null!==e&&$t(e.memoizedProps,r)&&e.ref===t.ref){if(Hr=!1,0==(o&i))return t.lanes=e.lanes,di(e,t,o);0!=(16384&e.flags)&&(Hr=!0)}return Qr(e,t,n,r,o)}function Kr(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode||"unstable-defer-without-hiding"===r.mode)if(0==(4&t.mode))t.memoizedState={baseLanes:0},Ko(t,n);else{if(0==(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e},Ko(t,e),null;t.memoizedState={baseLanes:0},Ko(t,null!==o?o.baseLanes:n)}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,Ko(t,r);return Gr(e,t,i,n),t.child}function Jr(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=128)}function Qr(e,t,n,r,i){var o=ot(n)?rt:tt.current;return o=it(t,o),dn(t,i),n=hr(e,t,n,r,o,i),null===e||Hr?(t.flags|=1,Gr(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~i,di(e,t,i))}function Xr(e,t,n,r,i){if(ot(n)){var o=!0;ct(t)}else o=!1;if(dn(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),An(t,n,r),Cn(t,n,r,i),r=!0;else if(null===e){var a=t.stateNode,s=t.memoizedProps;a.props=s;var l=a.context,c=n.contextType;"object"==typeof c&&null!==c?c=hn(c):c=it(t,c=ot(n)?rt:tt.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof a.getSnapshotBeforeUpdate;d||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==r||l!==c)&&En(t,a,r,c),fn=!1;var h=t.memoizedState;a.state=h,yn(t,r,a,i),l=t.memoizedState,s!==r||h!==l||nt.current||fn?("function"==typeof u&&(xn(t,n,u,r),l=t.memoizedState),(s=fn||_n(t,n,s,r,h,l,c))?(d||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4)):("function"==typeof a.componentDidMount&&(t.flags|=4),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=c,r=s):("function"==typeof a.componentDidMount&&(t.flags|=4),r=!1)}else{a=t.stateNode,mn(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:tn(t.type,s),a.props=c,d=t.pendingProps,h=a.context,"object"==typeof(l=n.contextType)&&null!==l?l=hn(l):l=it(t,l=ot(n)?rt:tt.current);var f=n.getDerivedStateFromProps;(u="function"==typeof f||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==d||h!==l)&&En(t,a,r,l),fn=!1,h=t.memoizedState,a.state=h,yn(t,r,a,i);var p=t.memoizedState;s!==d||h!==p||nt.current||fn?("function"==typeof f&&(xn(t,n,f,r),p=t.memoizedState),(c=fn||_n(t,n,c,r,h,p,l))?(u||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,p,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=256)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=256),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=l,r=c):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=256),r=!1)}return Yr(e,t,n,r,o,i)}function Yr(e,t,n,r,i,o){Jr(e,t);var a=0!=(64&t.flags);if(!r&&!a)return i&&ut(t,n,!1),di(e,t,o);r=t.stateNode,jr.current=t;var s=a&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&a?(t.child=On(t,e.child,null,o),t.child=On(t,null,s,o)):Gr(e,t,s,o),t.memoizedState=r.state,i&&ut(t,n,!0),t.child}function Zr(e){var t=e.stateNode;t.pendingContext?st(0,t.pendingContext,t.pendingContext!==t.context):t.context&&st(0,t.context,!1),Fn(e,t.containerInfo)}var $r,ei,ti,ni,ri={dehydrated:null,retryLane:0};function ii(e,t,n){var r,i=t.pendingProps,o=Gn.current,a=!1;return(r=0!=(64&t.flags))||(r=(null===e||null!==e.memoizedState)&&0!=(2&o)),r?(a=!0,t.flags&=-65):null!==e&&null===e.memoizedState||void 0===i.fallback||!0===i.unstable_avoidThisFallback||(o|=1),$e(Gn,1&o),null===e?(void 0!==i.fallback&&Xn(t),e=i.children,o=i.fallback,a?(e=oi(t,e,o,n),t.child.memoizedState={baseLanes:n},t.memoizedState=ri,e):"number"==typeof i.unstable_expectedLoadTime?(e=oi(t,e,o,n),t.child.memoizedState={baseLanes:n},t.memoizedState=ri,t.lanes=33554432,e):((n=Ca({mode:"visible",children:e},t.mode,n,null)).return=t,t.child=n)):(e.memoizedState,a?(i=si(e,t,i.children,i.fallback,n),a=t.child,o=e.child.memoizedState,a.memoizedState=null===o?{baseLanes:n}:{baseLanes:o.baseLanes|n},a.childLanes=e.childLanes&~n,t.memoizedState=ri,i):(n=ai(e,t,i.children,n),t.memoizedState=null,n))}function oi(e,t,n,r){var i=e.mode,o=e.child;return t={mode:"hidden",children:t},0==(2&i)&&null!==o?(o.childLanes=0,o.pendingProps=t):o=Ca(t,i,0,null),n=Ea(n,i,r,null),o.return=e,n.return=e,o.sibling=n,e.child=o,n}function ai(e,t,n,r){var i=e.child;return e=i.sibling,n=_a(i,{mode:"visible",children:n}),0==(2&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(e.nextEffect=null,e.flags=8,t.firstEffect=t.lastEffect=e),t.child=n}function si(e,t,n,r,i){var o=t.mode,a=e.child;e=a.sibling;var s={mode:"hidden",children:n};return 0==(2&o)&&t.child!==a?((n=t.child).childLanes=0,n.pendingProps=s,null!==(a=n.lastEffect)?(t.firstEffect=n.firstEffect,t.lastEffect=a,a.nextEffect=null):t.firstEffect=t.lastEffect=null):n=_a(a,s),null!==e?r=_a(e,r):(r=Ea(r,o,i,null)).flags|=2,r.return=t,n.return=t,n.sibling=r,t.child=n,r}function li(e,t){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),un(e.return,t)}function ci(e,t,n,r,i,o){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,lastEffect:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i,a.lastEffect=o)}function ui(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Gr(e,t,r.children,n),0!=(2&(r=Gn.current)))r=1&r|2,t.flags|=64;else{if(null!==e&&0!=(64&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&li(e,n);else if(19===e.tag)li(e,n);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if($e(Gn,r),0==(2&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===Vn(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ci(t,!1,i,n,o,t.lastEffect);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===Vn(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ci(t,!0,n,null,o,t.lastEffect);break;case"together":ci(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function di(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),ho|=t.lanes,0!=(n&t.childLanes)){if(null!==e&&t.child!==e.child)throw Error(s(153));if(null!==t.child){for(n=_a(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=_a(e,e.pendingProps)).return=t;n.sibling=null}return t.child}return null}function hi(e){e.flags|=4}if(X)$r=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)j(e,n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ei=function(){},ti=function(e,t,n,r,i){if((e=e.memoizedProps)!==r){var o=t.stateNode,a=Un(Bn.current);n=G(o,n,e,r,i,a),(t.updateQueue=n)&&hi(t)}},ni=function(e,t,n,r){n!==r&&hi(t)};else if(Y){$r=function(e,t,n,r){for(var i=t.child;null!==i;){if(5===i.tag){var o=i.stateNode;n&&r&&(o=Pe(o,i.type,i.memoizedProps,i)),j(e,o)}else if(6===i.tag)o=i.stateNode,n&&r&&(o=Ne(o,i.memoizedProps,i)),j(e,o);else if(4!==i.tag){if(13===i.tag&&0!=(4&i.flags)&&(o=null!==i.memoizedState)){var a=i.child;if(null!==a&&(null!==a.child&&(a.child.return=a,$r(e,a,!0,o)),null!==(o=a.sibling))){o.return=i,i=o;continue}}if(null!==i.child){i.child.return=i,i=i.child;continue}}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};var fi=function(e,t,n,r){for(var i=t.child;null!==i;){if(5===i.tag){var o=i.stateNode;n&&r&&(o=Pe(o,i.type,i.memoizedProps,i)),ke(e,o)}else if(6===i.tag)o=i.stateNode,n&&r&&(o=Ne(o,i.memoizedProps,i)),ke(e,o);else if(4!==i.tag){if(13===i.tag&&0!=(4&i.flags)&&(o=null!==i.memoizedState)){var a=i.child;if(null!==a&&(null!==a.child&&(a.child.return=a,fi(e,a,!0,o)),null!==(o=a.sibling))){o.return=i,i=o;continue}}if(null!==i.child){i.child.return=i,i=i.child;continue}}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};ei=function(e){var t=e.stateNode;if(null!==e.firstEffect){var n=t.containerInfo,r=Ie(n);fi(r,e,!1,!1),t.pendingChildren=r,hi(e),Re(n,r)}},ti=function(e,t,n,r,i){var o=e.stateNode,a=e.memoizedProps;if((e=null===t.firstEffect)&&a===r)t.stateNode=o;else{var s=t.stateNode,l=Un(Bn.current),c=null;a!==r&&(c=G(s,n,a,r,i,l)),e&&null===c?t.stateNode=o:(o=Te(o,c,n,a,r,t,e,s),H(o,n,r,i,l)&&hi(t),t.stateNode=o,e?hi(t):$r(o,t,!1,!1))}},ni=function(e,t,n,r){n!==r?(e=Un(Dn.current),n=Un(Bn.current),t.stateNode=W(r,e,n,t),hi(t)):t.stateNode=e.stateNode}}else ei=function(){},ti=function(){},ni=function(){};function pi(e,t){if(!Kn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function mi(e,t,n){var r=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:case 17:return ot(t.type)&&at(),null;case 3:return zn(),Ze(nt),Ze(tt),tr(),(r=t.stateNode).pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(Zn(t)?hi(t):r.hydrate||(t.flags|=256)),ei(t),null;case 5:Hn(t);var i=Un(Dn.current);if(n=t.type,null!==e&&null!=t.stateNode)ti(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=128);else{if(!r){if(null===t.stateNode)throw Error(s(166));return null}if(e=Un(Bn.current),Zn(t)){if(!Z)throw Error(s(175));e=je(t.stateNode,t.type,t.memoizedProps,i,e,t),t.updateQueue=e,null!==e&&hi(t)}else{var o=z(n,r,i,e,t);$r(o,t,!1,!1),t.stateNode=o,H(o,n,r,i,e)&&hi(t)}null!==t.ref&&(t.flags|=128)}return null;case 6:if(e&&null!=t.stateNode)ni(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(s(166));if(e=Un(Dn.current),i=Un(Bn.current),Zn(t)){if(!Z)throw Error(s(176));He(t.stateNode,t.memoizedProps,t)&&hi(t)}else t.stateNode=W(r,e,i,t)}return null;case 13:return Ze(Gn),r=t.memoizedState,0!=(64&t.flags)?(t.lanes=n,t):(r=null!==r,i=!1,null===e?void 0!==t.memoizedProps.fallback&&Zn(t):i=null!==e.memoizedState,r&&!i&&0!=(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!=(1&Gn.current)?0===lo&&(lo=3):(0!==lo&&3!==lo||(lo=4),null===ro||0==(134217727&ho)&&0==(134217727&fo)||Go(ro,oo))),Y&&r&&(t.flags|=4),X&&(r||i)&&(t.flags|=4),null);case 4:return zn(),ei(t),null===e&&ie(t.stateNode.containerInfo),null;case 10:return cn(t),null;case 19:if(Ze(Gn),null===(r=t.memoizedState))return null;if(i=0!=(64&t.flags),null===(o=r.rendering))if(i)pi(r,!1);else{if(0!==lo||null!==e&&0!=(64&e.flags))for(e=t.child;null!==e;){if(null!==(o=Vn(e))){for(t.flags|=64,pi(r,!1),null!==(e=o.updateQueue)&&(t.updateQueue=e,t.flags|=4),null===r.lastEffect&&(t.firstEffect=null),t.lastEffect=r.lastEffect,e=n,r=t.child;null!==r;)n=e,(i=r).flags&=2,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null,null===(o=i.alternate)?(i.childLanes=0,i.lanes=n,i.child=null,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,n=o.dependencies,i.dependencies=null===n?null:{lanes:n.lanes,firstContext:n.firstContext}),r=r.sibling;return $e(Gn,1&Gn.current|2),t.child}e=e.sibling}null!==r.tail&&Gt()>vo&&(t.flags|=64,i=!0,pi(r,!1),t.lanes=33554432)}else{if(!i)if(null!==(e=Vn(o))){if(t.flags|=64,i=!0,null!==(e=e.updateQueue)&&(t.updateQueue=e,t.flags|=4),pi(r,!0),null===r.tail&&"hidden"===r.tailMode&&!o.alternate&&!Kn)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*Gt()-r.renderingStartTime>vo&&1073741824!==n&&(t.flags|=64,i=!0,pi(r,!1),t.lanes=33554432);r.isBackwards?(o.sibling=t.child,t.child=o):(null!==(e=r.last)?e.sibling=o:t.child=o,r.last=o)}return null!==r.tail?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=Gt(),e.sibling=null,t=Gn.current,$e(Gn,i?1&t|2:1&t),e):null;case 23:case 24:return Jo(),null!==e&&null!==e.memoizedState!=(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==r.mode&&(t.flags|=4),null}throw Error(s(156,t.tag))}function gi(e){switch(e.tag){case 1:ot(e.type)&&at();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(zn(),Ze(nt),Ze(tt),tr(),0!=(64&(t=e.flags)))throw Error(s(285));return e.flags=-4097&t|64,e;case 5:return Hn(e),null;case 13:return Ze(Gn),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return Ze(Gn),null;case 4:return zn(),null;case 10:return cn(e),null;case 23:case 24:return Jo(),null;default:return null}}function vi(e,t){try{var n="",r=t;do{n+=en(r),r=r.return}while(r);var i=n}catch(e){i="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:i}}function bi(e,t){try{console.error(t.value)}catch(e){setTimeout((function(){throw e}))}}var yi="function"==typeof WeakMap?WeakMap:Map;function wi(e,t,n){(n=gn(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){So||(So=!0,xo=r),bi(0,t)},n}function Si(e,t,n){(n=gn(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return bi(0,t),r(i)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){"function"!=typeof r&&(null===Mo?Mo=new Set([this]):Mo.add(this),bi(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}var xi="function"==typeof WeakSet?WeakSet:Set;function Mi(e){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(t){da(e,t)}else t.current=null}function _i(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 5:case 6:case 4:case 17:return;case 1:if(256&t.flags&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:tn(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(X&&256&t.flags&&Ce(t.stateNode.containerInfo))}throw Error(s(163))}function Ai(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.destroy;n.destroy=void 0,void 0!==r&&r()}n=n.next}while(n!==t)}}function Ei(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3==(3&e.tag)){var r=e.create;e.destroy=r()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var i=e;r=i.next,0!=(4&(i=i.tag))&&0!=(1&i)&&(la(n,e),sa(n,e)),e=r}while(e!==t)}return;case 1:return e=n.stateNode,4&n.flags&&(null===t?e.componentDidMount():(r=n.elementType===n.type?t.memoizedProps:tn(n.type,t.memoizedProps),e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=n.updateQueue)&&wn(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:e=B(n.child.stateNode);break;case 1:e=n.child.stateNode}wn(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.flags&&ge(e,n.type,n.memoizedProps,n));case 6:case 4:case 12:case 19:case 17:case 20:case 21:case 23:case 24:return;case 13:return void(Z&&null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&We(n)))))}throw Error(s(163))}function Ci(e,t){if(X)for(var n=e;;){if(5===n.tag){var r=n.stateNode;t?Me(r):Ae(n.stateNode,n.memoizedProps)}else if(6===n.tag)r=n.stateNode,t?_e(r):Ee(r,n.memoizedProps);else if((23!==n.tag&&24!==n.tag||null===n.memoizedState||n===e)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function Ti(e,t){if(ht&&"function"==typeof ht.onCommitFiberUnmount)try{ht.onCommitFiberUnmount(dt,t)}catch(e){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var n=e=e.next;do{var r=n,i=r.destroy;if(r=r.tag,void 0!==i)if(0!=(4&r))la(t,n);else{r=t;try{i()}catch(e){da(r,e)}}n=n.next}while(n!==e)}break;case 1:if(Mi(t),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(e){da(t,e)}break;case 5:Mi(t);break;case 4:X?Bi(e,t):Y&&Y&&(t=t.stateNode.containerInfo,e=Ie(t),Oe(t,e))}}function Ii(e,t){for(var n=t;;)if(Ti(e,n),null===n.child||X&&4===n.tag){if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}else n.child.return=n,n=n.child}function ki(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function Ri(e){return 5===e.tag||3===e.tag||4===e.tag}function Oi(e){if(X){e:{for(var t=e.return;null!==t;){if(Ri(t))break e;t=t.return}throw Error(s(160))}var n=t;switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(s(161))}16&n.flags&&(xe(t),n.flags&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||Ri(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.flags)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.flags)){n=n.stateNode;break e}}r?Pi(e,n,t):Ni(e,n,t)}}function Pi(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?ye(n,e,t):pe(n,e);else if(4!==r&&null!==(e=e.child))for(Pi(e,t,n),e=e.sibling;null!==e;)Pi(e,t,n),e=e.sibling}function Ni(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?be(n,e,t):fe(n,e);else if(4!==r&&null!==(e=e.child))for(Ni(e,t,n),e=e.sibling;null!==e;)Ni(e,t,n),e=e.sibling}function Bi(e,t){for(var n,r,i=t,o=!1;;){if(!o){o=i.return;e:for(;;){if(null===o)throw Error(s(160));switch(n=o.stateNode,o.tag){case 5:r=!1;break e;case 3:case 4:n=n.containerInfo,r=!0;break e}o=o.return}o=!0}if(5===i.tag||6===i.tag)Ii(e,i),r?Se(n,i.stateNode):we(n,i.stateNode);else if(4===i.tag){if(null!==i.child){n=i.stateNode.containerInfo,r=!0,i.child.return=i,i=i.child;continue}}else if(Ti(e,i),null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;4===(i=i.return).tag&&(o=!1)}i.sibling.return=i.return,i=i.sibling}}function Li(e,t){if(X){switch(t.tag){case 0:case 11:case 14:case 15:case 22:return void Ai(3,t);case 1:case 12:case 17:return;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps;e=null!==e?e.memoizedProps:r;var i=t.type,o=t.updateQueue;t.updateQueue=null,null!==o&&ve(n,o,i,e,r,t)}return;case 6:if(null===t.stateNode)throw Error(s(162));return n=t.memoizedProps,void me(t.stateNode,null!==e?e.memoizedProps:n,n);case 3:return void(Z&&(t=t.stateNode,t.hydrate&&(t.hydrate=!1,Ve(t.containerInfo))));case 13:return Di(t),void Ui(t);case 19:return void Ui(t);case 23:case 24:return void Ci(t,null!==t.memoizedState)}throw Error(s(163))}switch(t.tag){case 0:case 11:case 14:case 15:case 22:return void Ai(3,t);case 12:case 23:case 24:return;case 13:return Di(t),void Ui(t);case 19:return void Ui(t);case 3:Z&&((n=t.stateNode).hydrate&&(n.hydrate=!1,Ve(n.containerInfo)))}e:if(Y){switch(t.tag){case 1:case 5:case 6:case 20:break e;case 3:case 4:t=t.stateNode,Oe(t.containerInfo,t.pendingChildren);break e}throw Error(s(163))}}function Di(e){null!==e.memoizedState&&(go=Gt(),X&&Ci(e.child,!0))}function Ui(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new xi),t.forEach((function(t){var r=fa.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function Fi(e,t){return null!==e&&(null===(e=e.memoizedState)||null!==e.dehydrated)&&(null!==(t=t.memoizedState)&&null===t.dehydrated)}var zi=0,ji=1,Hi=2,Gi=3,Vi=4;if("function"==typeof Symbol&&Symbol.for){var Wi=Symbol.for;zi=Wi("selector.component"),ji=Wi("selector.has_pseudo_class"),Hi=Wi("selector.role"),Gi=Wi("selector.test_id"),Vi=Wi("selector.text")}function qi(e){var t=$(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(s(364));return t}if(null===(e=ae(e)))throw Error(s(362));return e.stateNode.current}function Ki(e,t){switch(t.$$typeof){case zi:if(e.type===t.value)return!0;break;case ji:e:{t=t.value,e=[e,0];for(var n=0;n<e.length;){var r=e[n++],i=e[n++],o=t[i];if(5!==r.tag||!ce(r)){for(;null!=o&&Ki(r,o);)o=t[++i];if(i===t.length){t=!0;break e}for(r=r.child;null!==r;)e.push(r,i),r=r.sibling}}t=!1}return t;case Hi:if(5===e.tag&&ue(e.stateNode,t.value))return!0;break;case Vi:if((5===e.tag||6===e.tag)&&null!==(e=le(e))&&0<=e.indexOf(t.value))return!0;break;case Gi:if(5===e.tag&&("string"==typeof(e=e.memoizedProps["data-testname"])&&e.toLowerCase()===t.value.toLowerCase()))return!0;break;default:throw Error(s(365,t))}return!1}function Ji(e){switch(e.$$typeof){case zi:return"<"+(T(e.value)||"Unknown")+">";case ji:return":has("+(Ji(e)||"")+")";case Hi:return'[role="'+e.value+'"]';case Vi:return'"'+e.value+'"';case Gi:return'[data-testname="'+e.value+'"]';default:throw Error(s(365,e))}}function Qi(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var i=e[r++],o=e[r++],a=t[o];if(5!==i.tag||!ce(i)){for(;null!=a&&Ki(i,a);)a=t[++o];if(o===t.length)n.push(i);else for(i=i.child;null!==i;)e.push(i,o),i=i.sibling}}return n}function Xi(e,t){if(!oe)throw Error(s(363));e=Qi(e=qi(e),t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var r=e[n++];if(5===r.tag)ce(r)||t.push(r.stateNode);else for(r=r.child;null!==r;)e.push(r),r=r.sibling}return t}var Yi=null;var Zi=Math.ceil,$i=l.ReactCurrentDispatcher,eo=l.ReactCurrentOwner,to=l.IsSomeRendererActing,no=0,ro=null,io=null,oo=0,ao=0,so=Ye(0),lo=0,co=null,uo=0,ho=0,fo=0,po=0,mo=null,go=0,vo=1/0;function bo(){vo=Gt()+500}var yo,wo=null,So=!1,xo=null,Mo=null,_o=!1,Ao=null,Eo=90,Co=[],To=[],Io=null,ko=0,Ro=null,Oo=-1,Po=0,No=0,Bo=null,Lo=!1;function Do(){return 0!=(48&no)?Gt():-1!==Oo?Oo:Oo=Gt()}function Uo(e){if(0==(2&(e=e.mode)))return 1;if(0==(4&e))return 99===Vt()?1:2;if(0===Po&&(Po=uo),0!==Xt.transition){0!==No&&(No=null!==mo?mo.pendingLanes:0),e=Po;var t=4186112&~No;return 0===(t&=-t)&&(0===(t=(e=4186112&~e)&-e)&&(t=8192)),t}return e=Vt(),0!=(4&no)&&98===e?e=bt(12,Po):e=bt(e=function(e){switch(e){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}(e),Po),e}function Fo(e,t,n){if(50<ko)throw ko=0,Ro=null,Error(s(185));if(null===(e=zo(e,t)))return null;St(e,t,n),e===ro&&(fo|=t,4===lo&&Go(e,oo));var r=Vt();1===t?0!=(8&no)&&0==(48&no)?Vo(e):(jo(e,n),0===no&&(bo(),Jt())):(0==(4&no)||98!==r&&99!==r||(null===Io?Io=new Set([e]):Io.add(e)),jo(e,n)),mo=e}function zo(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}function jo(e,t){for(var n=e.callbackNode,r=e.suspendedLanes,i=e.pingedLanes,o=e.expirationTimes,a=e.pendingLanes;0<a;){var l=31-xt(a),c=1<<l,u=o[l];if(-1===u){if(0==(c&r)||0!=(c&i)){u=t,mt(c);var d=pt;o[l]=10<=d?u+250:6<=d?u+5e3:-1}}else u<=t&&(e.expiredLanes|=c);a&=~c}if(r=gt(e,e===ro?oo:0),t=pt,0===r)null!==n&&(n!==Dt&&Ct(n),e.callbackNode=null,e.callbackPriority=0);else{if(null!==n){if(e.callbackPriority===t)return;n!==Dt&&Ct(n)}15===t?(n=Vo.bind(null,e),null===Ft?(Ft=[n],zt=Et(Ot,Qt)):Ft.push(n),n=Dt):14===t?n=Kt(99,Vo.bind(null,e)):(n=function(e){switch(e){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(s(358,e))}}(t),n=Kt(n,Ho.bind(null,e))),e.callbackPriority=t,e.callbackNode=n}}function Ho(e){if(Oo=-1,No=Po=0,0!=(48&no))throw Error(s(327));var t=e.callbackNode;if(aa()&&e.callbackNode!==t)return null;var n=gt(e,e===ro?oo:0);if(0===n)return null;var r=n,i=no;no|=16;var o=Yo();for(ro===e&&oo===r||(bo(),Qo(e,r));;)try{ea();break}catch(t){Xo(e,t)}if(sn(),$i.current=o,no=i,null!==io?r=0:(ro=null,oo=0,r=lo),0!=(uo&fo))Qo(e,0);else if(0!==r){if(2===r&&(no|=64,e.hydrate&&(e.hydrate=!1,Ce(e.containerInfo)),0!==(n=vt(e))&&(r=Zo(e,n))),1===r)throw t=co,Qo(e,0),Go(e,n),jo(e,Gt()),t;switch(e.finishedWork=e.current.alternate,e.finishedLanes=n,r){case 0:case 1:throw Error(s(345));case 2:case 5:ra(e);break;case 3:if(Go(e,n),(62914560&n)===n&&10<(r=go+500-Gt())){if(0!==gt(e,0))break;if(((i=e.suspendedLanes)&n)!==n){Do(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=q(ra.bind(null,e),r);break}ra(e);break;case 4:if(Go(e,n),(4186112&n)===n)break;for(r=e.eventTimes,i=-1;0<n;){var a=31-xt(n);o=1<<a,(a=r[a])>i&&(i=a),n&=~o}if(n=i,10<(n=(120>(n=Gt()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Zi(n/1960))-n)){e.timeoutHandle=q(ra.bind(null,e),n);break}ra(e);break;default:throw Error(s(329))}}return jo(e,Gt()),e.callbackNode===t?Ho.bind(null,e):null}function Go(e,t){for(t&=~po,t&=~fo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-xt(t),r=1<<n;e[n]=-1,t&=~r}}function Vo(e){if(0!=(48&no))throw Error(s(327));if(aa(),e===ro&&0!=(e.expiredLanes&oo)){var t=oo,n=Zo(e,t);0!=(uo&fo)&&(n=Zo(e,t=gt(e,t)))}else n=Zo(e,t=gt(e,0));if(0!==e.tag&&2===n&&(no|=64,e.hydrate&&(e.hydrate=!1,Ce(e.containerInfo)),0!==(t=vt(e))&&(n=Zo(e,t))),1===n)throw n=co,Qo(e,0),Go(e,t),jo(e,Gt()),n;return e.finishedWork=e.current.alternate,e.finishedLanes=t,ra(e),jo(e,Gt()),null}function Wo(e,t){var n=no;no|=1;try{return e(t)}finally{0===(no=n)&&(bo(),Jt())}}function qo(e,t){var n=no;if(0!=(48&n))return e(t);no|=1;try{if(e)return qt(99,e.bind(null,t))}finally{no=n,Jt()}}function Ko(e,t){$e(so,ao),ao|=t,uo|=t}function Jo(){ao=so.current,Ze(so)}function Qo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==J&&(e.timeoutHandle=J,K(n)),null!==io)for(n=io.return;null!==n;){var r=n;switch(r.tag){case 1:null!=(r=r.type.childContextTypes)&&at();break;case 3:zn(),Ze(nt),Ze(tt),tr();break;case 5:Hn(r);break;case 4:zn();break;case 13:case 19:Ze(Gn);break;case 10:cn(r);break;case 23:case 24:Jo()}n=n.return}ro=e,io=_a(e.current,null),oo=ao=uo=t,lo=0,co=null,po=fo=ho=0}function Xo(e,t){for(;;){var n=io;try{if(sn(),nr.current=Dr,lr){for(var r=or.memoizedState;null!==r;){var i=r.queue;null!==i&&(i.pending=null),r=r.next}lr=!1}if(ir=0,sr=ar=or=null,cr=!1,eo.current=null,null===n||null===n.return){lo=1,co=t,io=null;break}e:{var o=e,a=n.return,s=n,l=t;if(t=oo,s.flags|=2048,s.firstEffect=s.lastEffect=null,null!==l&&"object"==typeof l&&"function"==typeof l.then){var c=l;if(0==(2&s.mode)){var u=s.alternate;u?(s.updateQueue=u.updateQueue,s.memoizedState=u.memoizedState,s.lanes=u.lanes):(s.updateQueue=null,s.memoizedState=null)}var d=0!=(1&Gn.current),h=a;do{var f;if(f=13===h.tag){var p=h.memoizedState;if(null!==p)f=null!==p.dehydrated;else{var m=h.memoizedProps;f=void 0!==m.fallback&&(!0!==m.unstable_avoidThisFallback||!d)}}if(f){var g=h.updateQueue;if(null===g){var v=new Set;v.add(c),h.updateQueue=v}else g.add(c);if(0==(2&h.mode)){if(h.flags|=64,s.flags|=16384,s.flags&=-2981,1===s.tag)if(null===s.alternate)s.tag=17;else{var b=gn(-1,1);b.tag=2,vn(s,b)}s.lanes|=1;break e}l=void 0,s=t;var y=o.pingCache;if(null===y?(y=o.pingCache=new yi,l=new Set,y.set(c,l)):void 0===(l=y.get(c))&&(l=new Set,y.set(c,l)),!l.has(s)){l.add(s);var w=ha.bind(null,o,c,s);c.then(w,w)}h.flags|=4096,h.lanes=t;break e}h=h.return}while(null!==h);l=Error((T(s.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.")}5!==lo&&(lo=2),l=vi(l,s),h=a;do{switch(h.tag){case 3:o=l,h.flags|=4096,t&=-t,h.lanes|=t,bn(h,wi(0,o,t));break e;case 1:o=l;var S=h.type,x=h.stateNode;if(0==(64&h.flags)&&("function"==typeof S.getDerivedStateFromError||null!==x&&"function"==typeof x.componentDidCatch&&(null===Mo||!Mo.has(x)))){h.flags|=4096,t&=-t,h.lanes|=t,bn(h,Si(h,o,t));break e}}h=h.return}while(null!==h)}na(n)}catch(e){t=e,io===n&&null!==n&&(io=n=n.return);continue}break}}function Yo(){var e=$i.current;return $i.current=Dr,null===e?Dr:e}function Zo(e,t){var n=no;no|=16;var r=Yo();for(ro===e&&oo===t||Qo(e,t);;)try{$o();break}catch(t){Xo(e,t)}if(sn(),no=n,$i.current=r,null!==io)throw Error(s(261));return ro=null,oo=0,lo}function $o(){for(;null!==io;)ta(io)}function ea(){for(;null!==io&&!Tt();)ta(io)}function ta(e){var t=yo(e.alternate,e,ao);e.memoizedProps=e.pendingProps,null===t?na(e):io=t,eo.current=null}function na(e){var t=e;do{var n=t.alternate;if(e=t.return,0==(2048&t.flags)){if(null!==(n=mi(n,t,ao)))return void(io=n);if(24!==(n=t).tag&&23!==n.tag||null===n.memoizedState||0!=(1073741824&ao)||0==(4&n.mode)){for(var r=0,i=n.child;null!==i;)r|=i.lanes|i.childLanes,i=i.sibling;n.childLanes=r}null!==e&&0==(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1<t.flags&&(null!==e.lastEffect?e.lastEffect.nextEffect=t:e.firstEffect=t,e.lastEffect=t))}else{if(null!==(n=gi(t)))return n.flags&=2047,void(io=n);null!==e&&(e.firstEffect=e.lastEffect=null,e.flags|=2048)}if(null!==(t=t.sibling))return void(io=t);io=t=e}while(null!==t);0===lo&&(lo=5)}function ra(e){var t=Vt();return qt(99,ia.bind(null,e,t)),null}function ia(e,t){do{aa()}while(null!==Ao);if(0!=(48&no))throw Error(s(327));var n=e.finishedWork;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(s(177));e.callbackNode=null;var r=n.lanes|n.childLanes,i=r,o=e.pendingLanes&~i;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=i,e.mutableReadLanes&=i,e.entangledLanes&=i,i=e.entanglements;for(var a=e.eventTimes,l=e.expirationTimes;0<o;){var c=31-xt(o),u=1<<c;i[c]=0,a[c]=-1,l[c]=-1,o&=~u}if(null!==Io&&0==(24&r)&&Io.has(e)&&Io.delete(e),e===ro&&(io=ro=null,oo=0),1<n.flags?null!==n.lastEffect?(n.lastEffect.nextEffect=n,r=n.firstEffect):r=n:r=n.firstEffect,null!==r){i=no,no|=32,eo.current=null,Bo=U(e.containerInfo),Lo=!1,wo=r;do{try{oa()}catch(e){if(null===wo)throw Error(s(330));da(wo,e),wo=wo.nextEffect}}while(null!==wo);Bo=null,wo=r;do{try{for(a=e;null!==wo;){var d=wo.flags;if(16&d&&X&&xe(wo.stateNode),128&d){var h=wo.alternate;if(null!==h){var f=h.ref;null!==f&&("function"==typeof f?f(null):f.current=null)}}switch(1038&d){case 2:Oi(wo),wo.flags&=-3;break;case 6:Oi(wo),wo.flags&=-3,Li(wo.alternate,wo);break;case 1024:wo.flags&=-1025;break;case 1028:wo.flags&=-1025,Li(wo.alternate,wo);break;case 4:Li(wo.alternate,wo);break;case 8:l=a,o=wo,X?Bi(l,o):Ii(l,o);var p=o.alternate;ki(o),null!==p&&ki(p)}wo=wo.nextEffect}}catch(e){if(null===wo)throw Error(s(330));da(wo,e),wo=wo.nextEffect}}while(null!==wo);Lo&&re(),F(e.containerInfo),e.current=n,wo=r;do{try{for(d=e;null!==wo;){var m=wo.flags;if(36&m&&Ei(d,wo.alternate,wo),128&m){h=void 0;var g=wo.ref;if(null!==g){var v=wo.stateNode;if(5===wo.tag)h=B(v);else h=v;"function"==typeof g?g(h):g.current=h}}wo=wo.nextEffect}}catch(e){if(null===wo)throw Error(s(330));da(wo,e),wo=wo.nextEffect}}while(null!==wo);wo=null,Ut(),no=i}else e.current=n;if(_o)_o=!1,Ao=e,Eo=t;else for(wo=r;null!==wo;)t=wo.nextEffect,wo.nextEffect=null,8&wo.flags&&((m=wo).sibling=null,m.stateNode=null),wo=t;if(0===(r=e.pendingLanes)&&(Mo=null),1===r?e===Ro?ko++:(ko=0,Ro=e):ko=0,n=n.stateNode,ht&&"function"==typeof ht.onCommitFiberRoot)try{ht.onCommitFiberRoot(dt,n,void 0,64==(64&n.current.flags))}catch(e){}if(jo(e,Gt()),So)throw So=!1,e=xo,xo=null,e;return 0!=(8&no)||Jt(),null}function oa(){for(;null!==wo;){var e=wo.alternate;Lo||null===Bo||(0!=(8&wo.flags)?P(wo,Bo)&&(Lo=!0,ne()):13===wo.tag&&Fi(e,wo)&&P(wo,Bo)&&(Lo=!0,ne()));var t=wo.flags;0!=(256&t)&&_i(e,wo),0==(512&t)||_o||(_o=!0,Kt(97,(function(){return aa(),null}))),wo=wo.nextEffect}}function aa(){if(90!==Eo){var e=97<Eo?97:Eo;return Eo=90,qt(e,ca)}return!1}function sa(e,t){Co.push(t,e),_o||(_o=!0,Kt(97,(function(){return aa(),null})))}function la(e,t){To.push(t,e),_o||(_o=!0,Kt(97,(function(){return aa(),null})))}function ca(){if(null===Ao)return!1;var e=Ao;if(Ao=null,0!=(48&no))throw Error(s(331));var t=no;no|=32;var n=To;To=[];for(var r=0;r<n.length;r+=2){var i=n[r],o=n[r+1],a=i.destroy;if(i.destroy=void 0,"function"==typeof a)try{a()}catch(e){if(null===o)throw Error(s(330));da(o,e)}}for(n=Co,Co=[],r=0;r<n.length;r+=2){i=n[r],o=n[r+1];try{var l=i.create;i.destroy=l()}catch(e){if(null===o)throw Error(s(330));da(o,e)}}for(l=e.current.firstEffect;null!==l;)e=l.nextEffect,l.nextEffect=null,8&l.flags&&(l.sibling=null,l.stateNode=null),l=e;return no=t,Jt(),!0}function ua(e,t,n){vn(e,t=wi(0,t=vi(n,t),1)),t=Do(),null!==(e=zo(e,1))&&(St(e,1,t),jo(e,t))}function da(e,t){if(3===e.tag)ua(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){ua(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Mo||!Mo.has(r))){var i=Si(n,e=vi(t,e),1);if(vn(n,i),i=Do(),null!==(n=zo(n,1)))St(n,1,i),jo(n,i);else if("function"==typeof r.componentDidCatch&&(null===Mo||!Mo.has(r)))try{r.componentDidCatch(t,e)}catch(e){}break}}n=n.return}}function ha(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=Do(),e.pingedLanes|=e.suspendedLanes&n,ro===e&&(oo&n)===n&&(4===lo||3===lo&&(62914560&oo)===oo&&500>Gt()-go?Qo(e,0):po|=n),jo(e,t)}function fa(e,t){var n=e.stateNode;null!==n&&n.delete(t),0===(t=0)&&(0==(2&(t=e.mode))?t=1:0==(4&t)?t=99===Vt()?1:2:(0===Po&&(Po=uo),0===(t=yt(62914560&~Po))&&(t=4194304))),n=Do(),null!==(e=zo(e,t))&&(St(e,t,n),jo(e,n))}yo=function(e,t,n){var r=t.lanes;if(null!==e)if(e.memoizedProps!==t.pendingProps||nt.current)Hr=!0;else{if(0==(n&r)){switch(Hr=!1,t.tag){case 3:Zr(t),$n();break;case 5:jn(t);break;case 1:ot(t.type)&&ct(t);break;case 4:Fn(t,t.stateNode.containerInfo);break;case 10:ln(t,t.memoizedProps.value);break;case 13:if(null!==t.memoizedState)return 0!=(n&t.child.childLanes)?ii(e,t,n):($e(Gn,1&Gn.current),null!==(t=di(e,t,n))?t.sibling:null);$e(Gn,1&Gn.current);break;case 19:if(r=0!=(n&t.childLanes),0!=(64&e.flags)){if(r)return ui(e,t,n);t.flags|=64}var i=t.memoizedState;if(null!==i&&(i.rendering=null,i.tail=null,i.lastEffect=null),$e(Gn,Gn.current),r)break;return null;case 23:case 24:return t.lanes=0,Kr(e,t,n)}return di(e,t,n)}Hr=0!=(16384&e.flags)}else Hr=!1;switch(t.lanes=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=it(t,tt.current),dn(t,n),i=hr(null,t,r,e,i,n),t.flags|=1,"object"==typeof i&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,ot(r)){var o=!0;ct(t)}else o=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,pn(t);var a=r.getDerivedStateFromProps;"function"==typeof a&&xn(t,r,a,e),i.updater=Mn,t.stateNode=i,i._reactInternals=t,Cn(t,r,e,n),t=Yr(null,t,r,!0,o,n)}else t.tag=0,Gr(null,t,i,n),t=t.child;return t;case 16:i=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=(o=i._init)(i._payload),t.type=i,o=t.tag=function(e){if("function"==typeof e)return Ma(e)?1:0;if(null!=e){if((e=e.$$typeof)===g)return 11;if(e===y)return 14}return 2}(i),e=tn(i,e),o){case 0:t=Qr(null,t,i,e,n);break e;case 1:t=Xr(null,t,i,e,n);break e;case 11:t=Vr(null,t,i,e,n);break e;case 14:t=Wr(null,t,i,tn(i.type,e),r,n);break e}throw Error(s(306,i,""))}return t;case 0:return r=t.type,i=t.pendingProps,Qr(e,t,r,i=t.elementType===r?i:tn(r,i),n);case 1:return r=t.type,i=t.pendingProps,Xr(e,t,r,i=t.elementType===r?i:tn(r,i),n);case 3:if(Zr(t),r=t.updateQueue,null===e||null===r)throw Error(s(282));if(r=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,mn(e,t),yn(t,r,null,n),(r=t.memoizedState.element)===i)$n(),t=di(e,t,n);else{if((o=(i=t.stateNode).hydrate)&&(Z?(qn=ze(t.stateNode.containerInfo),Wn=t,o=Kn=!0):o=!1),o){if(Z&&null!=(e=i.mutableSourceEagerHydrationData))for(i=0;i<e.length;i+=2)o=e[i],a=e[i+1],Q?o._workInProgressVersionPrimary=a:o._workInProgressVersionSecondary=a,er.push(o);for(n=Pn(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|1024,n=n.sibling}else Gr(e,t,r,n),$n();t=t.child}return t;case 5:return jn(t),null===e&&Xn(t),r=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,a=i.children,V(r,i)?a=null:null!==o&&V(r,o)&&(t.flags|=16),Jr(e,t),Gr(e,t,a,n),t.child;case 6:return null===e&&Xn(t),null;case 13:return ii(e,t,n);case 4:return Fn(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=On(t,null,r,n):Gr(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,Vr(e,t,r,i=t.elementType===r?i:tn(r,i),n);case 7:return Gr(e,t,t.pendingProps,n),t.child;case 8:case 12:return Gr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,ln(t,o=i.value),null!==a){var l=a.value;if(0===(o=Yt(l,o)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(l,o):1073741823))){if(a.children===i.children&&!nt.current){t=di(e,t,n);break e}}else for(null!==(l=t.child)&&(l.return=t);null!==l;){var c=l.dependencies;if(null!==c){a=l.child;for(var u=c.firstContext;null!==u;){if(u.context===r&&0!=(u.observedBits&o)){1===l.tag&&((u=gn(-1,n&-n)).tag=2,vn(l,u)),l.lanes|=n,null!==(u=l.alternate)&&(u.lanes|=n),un(l.return,n),c.lanes|=n;break}u=u.next}}else a=10===l.tag&&l.type===t.type?null:l.child;if(null!==a)a.return=l;else for(a=l;null!==a;){if(a===t){a=null;break}if(null!==(l=a.sibling)){l.return=a.return,a=l;break}a=a.return}l=a}}Gr(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=(o=t.pendingProps).children,dn(t,n),r=r(i=hn(i,o.unstable_observedBits)),t.flags|=1,Gr(e,t,r,n),t.child;case 14:return o=tn(i=t.type,t.pendingProps),Wr(e,t,i,o=tn(i.type,o),r,n);case 15:return qr(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:tn(r,i),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,ot(r)?(e=!0,ct(t)):e=!1,dn(t,n),An(t,r,i),Cn(t,r,i,n),Yr(null,t,r,!0,e,n);case 19:return ui(e,t,n);case 23:case 24:return Kr(e,t,n)}throw Error(s(156,t.tag))};var pa={current:!1},ma=a.unstable_flushAllWithoutAsserting,ga="function"==typeof ma;function va(){if(void 0!==ma)return ma();for(var e=!1;aa();)e=!0;return e}function ba(t){try{va(),function(t){if(null===Yi)try{var n=("require"+Math.random()).slice(0,7);Yi=(e&&e[n]).call(e,"timers").setImmediate}catch(e){Yi=function(e){var t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(void 0)}}Yi(t)}((function(){va()?ba(t):t()}))}catch(e){t(e)}}var ya=0,wa=!1;function Sa(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function xa(e,t,n,r){return new Sa(e,t,n,r)}function Ma(e){return!(!(e=e.prototype)||!e.isReactComponent)}function _a(e,t){var n=e.alternate;return null===n?((n=xa(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Aa(e,t,n,r,i,o){var a=2;if(r=e,"function"==typeof e)Ma(e)&&(a=1);else if("string"==typeof e)a=5;else e:switch(e){case d:return Ea(n.children,i,o,t);case x:a=8,i|=16;break;case h:a=8,i|=1;break;case f:return(e=xa(12,n,t,8|i)).elementType=f,e.type=f,e.lanes=o,e;case v:return(e=xa(13,n,t,i)).type=v,e.elementType=v,e.lanes=o,e;case b:return(e=xa(19,n,t,i)).elementType=b,e.lanes=o,e;case M:return Ca(n,i,o,t);case _:return(e=xa(24,n,t,i)).elementType=_,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case p:a=10;break e;case m:a=9;break e;case g:a=11;break e;case y:a=14;break e;case w:a=16,r=null;break e;case S:a=22;break e}throw Error(s(130,null==e?e:typeof e,""))}return(t=xa(a,n,t,i)).elementType=e,t.type=r,t.lanes=o,t}function Ea(e,t,n,r){return(e=xa(7,e,r,t)).lanes=n,e}function Ca(e,t,n,r){return(e=xa(23,e,r,t)).elementType=M,e.lanes=n,e}function Ta(e,t,n){return(e=xa(6,e,null,t)).lanes=n,e}function Ia(e,t,n){return(t=xa(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ka(e,t,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=J,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=wt(0),this.expirationTimes=wt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wt(0),Z&&(this.mutableSourceEagerHydrationData=null)}function Ra(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(s(188));throw Error(s(268,Object.keys(e)))}return null===(e=O(t))?null:e.stateNode}function Oa(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Pa(e,t){Oa(e,t),(e=e.alternate)&&Oa(e,t)}function Na(e){return null===(e=O(e))?null:e.stateNode}function Ba(){return null}return n.IsThisRendererActing=pa,n.act=function(e){function t(){ya--,to.current=n,pa.current=r}!1===wa&&(wa=!0,console.error("act(...) is not supported in production builds of React, and might not behave as expected.")),ya++;var n=to.current,r=pa.current;to.current=!0,pa.current=!0;try{var i=Wo(e)}catch(e){throw t(),e}if(null!==i&&"object"==typeof i&&"function"==typeof i.then)return{then:function(e,r){i.then((function(){1<ya||!0===ga&&!0===n?(t(),e()):ba((function(n){t(),n?r(n):e()}))}),(function(e){t(),r(e)}))}};try{1!==ya||!1!==ga&&!1!==n||va(),t()}catch(e){throw t(),e}return{then:function(e){e()}}},n.attemptContinuousHydration=function(e){13===e.tag&&(Fo(e,67108864,Do()),Pa(e,67108864))},n.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var t=Do(),n=Uo(e);Fo(e,n,t),Pa(e,n)}},n.attemptSynchronousHydration=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.hydrate){var n=mt(t.pendingLanes);t.expiredLanes|=n&t.pendingLanes,jo(t,Gt()),0==(48&no)&&(bo(),Jt())}break;case 13:var r=Do();qo((function(){return Fo(e,1,r)})),Pa(e,4)}},n.attemptUserBlockingHydration=function(e){13===e.tag&&(Fo(e,4,Do()),Pa(e,4))},n.batchedEventUpdates=function(e,t){var n=no;no|=2;try{return e(t)}finally{0===(no=n)&&(bo(),Jt())}},n.batchedUpdates=Wo,n.createComponentSelector=function(e){return{$$typeof:zi,value:e}},n.createContainer=function(e,t,n){return e=new ka(e,t,n),t=xa(3,null,null,2===t?7:1===t?3:0),e.current=t,t.stateNode=e,pn(t),e},n.createHasPsuedoClassSelector=function(e){return{$$typeof:ji,value:e}},n.createPortal=function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:u,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}},n.createRoleSelector=function(e){return{$$typeof:Hi,value:e}},n.createTestNameSelector=function(e){return{$$typeof:Gi,value:e}},n.createTextSelector=function(e){return{$$typeof:Vi,value:e}},n.deferredUpdates=function(e){return qt(97,e)},n.discreteUpdates=function(e,t,n,r,i){var o=no;no|=4;try{return qt(98,e.bind(null,t,n,r,i))}finally{0===(no=o)&&(bo(),Jt())}},n.findAllNodes=Xi,n.findBoundingRects=function(e,t){if(!oe)throw Error(s(363));t=Xi(e,t),e=[];for(var n=0;n<t.length;n++)e.push(se(t[n]));for(t=e.length-1;0<t;t--)for(var r=(n=e[t]).x,i=r+n.width,o=n.y,a=o+n.height,l=t-1;0<=l;l--)if(t!==l){var c=e[l],u=c.x,d=u+c.width,h=c.y,f=h+c.height;if(r>=u&&o>=h&&i<=d&&a<=f){e.splice(t,1);break}if(!(r!==u||n.width!==c.width||f<o||h>a)){h>o&&(c.height+=h-o,c.y=o),f<a&&(c.height=a-h),e.splice(t,1);break}if(!(o!==h||n.height!==c.height||d<r||u>i)){u>r&&(c.width+=u-r,c.x=r),d<i&&(c.width=i-u),e.splice(t,1);break}}return e},n.findHostInstance=Ra,n.findHostInstanceWithNoPortals=function(e){return null===(e=function(e){if(!(e=R(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child&&4!==t.tag)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}(e))?null:20===e.tag?e.stateNode.instance:e.stateNode},n.findHostInstanceWithWarning=function(e){return Ra(e)},n.flushControlled=function(e){var t=no;no|=1;try{qt(99,e)}finally{0===(no=t)&&(bo(),Jt())}},n.flushDiscreteUpdates=function(){0==(49&no)&&(function(){if(null!==Io){var e=Io;Io=null,e.forEach((function(e){e.expiredLanes|=24&e.pendingLanes,jo(e,Gt())}))}Jt()}(),aa())},n.flushPassiveEffects=aa,n.flushSync=qo,n.focusWithin=function(e,t){if(!oe)throw Error(s(363));for(t=Qi(e=qi(e),t),t=Array.from(t),e=0;e<t.length;){var n=t[e++];if(!ce(n)){if(5===n.tag&&de(n.stateNode))return!0;for(n=n.child;null!==n;)t.push(n),n=n.sibling}}return!1},n.getCurrentUpdateLanePriority=function(){return ft},n.getFindAllNodesFailureDescription=function(e,t){if(!oe)throw Error(s(363));var n=0,r=[];e=[qi(e),0];for(var i=0;i<e.length;){var o=e[i++],a=e[i++],l=t[a];if((5!==o.tag||!ce(o))&&(Ki(o,l)&&(r.push(Ji(l)),++a>n&&(n=a)),a<t.length))for(o=o.child;null!==o;)e.push(o,a),o=o.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(Ji(t[n]));return"findAllNodes was able to match part of the selector:\n "+r.join(" > ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},n.getPublicRootInstance=function(e){return(e=e.current).child?5===e.child.tag?B(e.child.stateNode):e.child.stateNode:null},n.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:Na,findFiberByHostInstance:e.findFiberByHostInstance||Ba,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null},"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t.isDisabled&&t.supportsFiber)try{dt=t.inject(e),ht=t}catch(e){}e=!0}return e},n.observeVisibleRects=function(e,t,n,r){if(!oe)throw Error(s(363));e=Xi(e,t);var i=he(e,n,r).disconnect;return{disconnect:function(){i()}}},n.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),null==e.mutableSourceEagerHydrationData?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},n.runWithPriority=function(e,t){var n=ft;try{return ft=e,t()}finally{ft=n}},n.shouldSuspend=function(){return!1},n.unbatchedUpdates=function(e,t){var n=no;no&=-2,no|=8;try{return e(t)}finally{0===(no=n)&&(bo(),Jt())}},n.updateContainer=function(e,t,n,r){var i=t.current,o=Do(),a=Uo(i);e:if(n){t:{if(I(n=n._reactInternals)!==n||1!==n.tag)throw Error(s(170));var l=n;do{switch(l.tag){case 3:l=l.stateNode.context;break t;case 1:if(ot(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break t}}l=l.return}while(null!==l);throw Error(s(171))}if(1===n.tag){var c=n.type;if(ot(c)){n=lt(n,c,l);break e}}n=l}else n=et;return null===t.context?t.context=n:t.pendingContext=n,(t=gn(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),vn(i,t),Fo(i,a,o),a},n}})),o("juxiN").register(JSON.parse('{"adfgW":"index.js","cmazm":"abap.bc6c1a94.js","jPTA1":"abnf.a3fdbafa.js","jdWNC":"actionscript.59d9b9ea.js","2CBqg":"ada.7ae8a3a8.js","3wHhO":"agda.c22a72e2.js","kFVdl":"al.43edf93f.js","3V4RR":"antlr4.fab93bd9.js","ksX9L":"apacheconf.1ea6f6bc.js","3N81M":"apex.5f5d0b00.js","lBh32":"apl.f0e0255a.js","1cOI2":"applescript.f8873ad2.js","hwV5I":"aql.0596cd74.js","cxQUy":"arduino.8a10351d.js","h8XDs":"arff.b6eba224.js","1glOK":"asciidoc.3591554e.js","5YI5Q":"asm6502.eb3baf93.js","5aM2c":"asmatmel.93b67168.js","aKcNk":"aspnet.a154be94.js","bYGuI":"csharp.60bc2788.js","4ffJ6":"autohotkey.dc99c6b5.js","6o8gr":"autoit.7bd54007.js","d0QlI":"avisynth.506bbdad.js","1vpfH":"avro-idl.ab78e3d7.js","d78C2":"basic.09310972.js","1V5ou":"batch.5c48c918.js","h9qnw":"bbcode.4e0cb2f2.js","eluAn":"bicep.e394696d.js","jD2Yh":"birb.54766d79.js","3ligT":"bison.2c2552ab.js","cSnAi":"bnf.ec556d42.js","gmloY":"brainfuck.4e81eb1d.js","77rtQ":"brightscript.3c7cc723.js","hfFki":"bro.8db28f8a.js","8SYqo":"bsl.260fabfb.js","i4HkI":"cfscript.92c90b90.js","1rBYK":"chaiscript.76481f4b.js","gQYEz":"cil.622792d1.js","bq2uf":"clike.36346267.js","h7tza":"clojure.9da4900e.js","aK2oY":"cmake.234b57e3.js","3V5TZ":"cobol.2e8bd2ea.js","72v5N":"coffeescript.261b318a.js","lNJYg":"concurnas.9d189a8c.js","cHo4f":"coq.917e2a53.js","7GKmU":"crystal.d23925f3.js","a5f4n":"cshtml.92086949.js","2nOzn":"csp.9b5dd573.js","iZH8k":"css-extras.7f3088a6.js","3V9km":"css.fb6f00e3.js","7TCh4":"csv.06af3522.js","8MqYl":"cypher.6af6e534.js","6Oo3A":"d.303192e5.js","6ks0D":"dart.6fb62874.js","huqsT":"dataweave.e97ef31d.js","YtcLG":"dax.013d5e9a.js","1s9Hz":"dhall.d5ee83ba.js","b677V":"diff.9ef56ea8.js","ak2pO":"django.13b0bb49.js","8LDFZ":"dns-zone-file.189b08c5.js","1awLf":"docker.1da9769e.js","9dPYr":"dot.8dca92f3.js","e2ZjS":"ebnf.58c0fa63.js","9h8KW":"editorconfig.9c7b63a5.js","4SWgd":"eiffel.090bab86.js","6HmuU":"ejs.0ee535c3.js","2KAkF":"elixir.dc192ee6.js","jPV3v":"elm.c88782bd.js","agNrQ":"erb.55ec7cf0.js","9BmS2":"erlang.956455fa.js","fqf1c":"etlua.79f6dba5.js","cgMSr":"lua.88c0a077.js","92McF":"excel-formula.d0dd1424.js","juFxG":"factor.e311ca38.js","1dWPh":"false.a93fe44c.js","2k0b2":"firestore-security-rules.4ea155d7.js","dvL1Q":"flow.96e0f48a.js","5oumN":"fortran.0811bc79.js","fP8jO":"fsharp.0119d0fd.js","7L6sP":"ftl.c5671dbe.js","2ujce":"gap.b0574953.js","hzgIA":"gcode.29260c31.js","5MUDD":"gdscript.545f127b.js","ghckm":"gedcom.d53f8a81.js","ian9z":"gherkin.0c5a099f.js","dsuH3":"git.2d89a25c.js","dvV8S":"glsl.0bf837a6.js","6BDWE":"gml.04204c1b.js","btSYt":"gn.cbb4c3be.js","j94Lr":"go-module.2bebc9b8.js","207xG":"go.cc49e5b2.js","iQ4Nh":"graphql.3d658adb.js","9E9pJ":"groovy.3e5836cd.js","hLXUt":"haml.9a056759.js","5ob5h":"handlebars.8c13dfe6.js","1nDhS":"haskell.3c80aa72.js","kQehe":"haxe.40a1dc98.js","1sziu":"hcl.84488f47.js","28Tam":"hlsl.323b0c17.js","awNOU":"hoon.df16cb45.js","eeLMI":"hpkp.9c950797.js","gjEKw":"hsts.0440ab7b.js","3bCJ7":"http.96d5f1c1.js","id4YZ":"ichigojam.c0bd16f5.js","5TKHe":"icon.439feb9f.js","eijPh":"icu-message-format.e96f6551.js","lv8gR":"idris.d3811412.js","bW8K3":"iecst.3fdbbc52.js","b8EBv":"ignore.00726ce9.js","jOS96":"inform7.65978ef5.js","dn3Yf":"ini.1cbb0515.js","iUSU6":"io.e628fd7e.js","6wbwo":"j.b959d174.js","5qA0j":"java.0ffd8069.js","hdx4d":"javadoc.b99752ae.js","jRMSs":"javadoclike.8cc3d825.js","l2DRD":"javascript.fe729813.js","cpOeo":"javastacktrace.cc22fb4b.js","fSVrK":"jexl.2cce5cc0.js","03mi8":"jolie.d8f352cd.js","j6YjP":"jq.65b95777.js","6JQIv":"js-extras.7d041902.js","5nVrm":"js-templates.a3463d0b.js","9gPZY":"jsdoc.0c5cc4d3.js","8q0xA":"json5.b9de5531.js","fIx8j":"jsonp.eefdc553.js","a3ur7":"jsstacktrace.8d3a2b71.js","bKtxi":"julia.679e1c74.js","9vqI0":"keepalived.e694c167.js","lDUCl":"keyman.d1406200.js","gcEXq":"kotlin.fd040b34.js","cxxOt":"kumir.b2072cfc.js","b8NIc":"kusto.98546fcc.js","iXz7U":"latex.ecc17a0d.js","9nRbn":"latte.18295a4f.js","lWxq2":"less.a8a986ab.js","7dEcL":"lilypond.0423d709.js","ck7Ll":"scheme.4039466f.js","hI3m3":"liquid.533f073c.js","7qpQZ":"lisp.b075bd53.js","8Cm1D":"livescript.2b19fb05.js","9sT8D":"llvm.6b74465d.js","gQkTU":"log.b74346d6.js","86y52":"lolcode.0fbc730a.js","6bXdx":"magma.bbb66246.js","hDIxO":"makefile.bf1a7653.js","4wRUQ":"markdown.4a5510a8.js","66rgq":"markup.973a8c4c.js","iAx9A":"matlab.caaa1e9f.js","5SXMq":"maxscript.58a0bf4d.js","gnQ55":"mel.c5da9d2e.js","8G54S":"mermaid.ced53190.js","gfXsu":"mizar.4e6d6035.js","7nZsb":"mongodb.5c4e0cf9.js","hUs37":"monkey.9be800f3.js","fKqwA":"moonscript.fc782589.js","luHXo":"n1ql.7f05115f.js","j0sqX":"n4js.318f41b7.js","avS2d":"nand2tetris-hdl.be3bb656.js","8fNUI":"naniscript.ec3afc9a.js","6PKtR":"nasm.1ee2623a.js","2LUGi":"neon.1d5a4ec8.js","esMLb":"nevod.6908715c.js","jQ8dR":"nginx.404fbeb4.js","1kuW2":"nim.36bf497b.js","7YxPR":"nix.3af3b6b2.js","b1EPY":"nsis.94e1fb71.js","j169M":"objectivec.49a6b342.js","1b4qw":"ocaml.c5fca1eb.js","c0JxA":"opencl.4194613a.js","54ivl":"openqasm.4b589cb3.js","kYO5l":"oz.498e9cbd.js","811Qi":"parigp.ed6a3789.js","gXO52":"parser.3329b2ab.js","4SQCy":"pascal.82aebbcf.js","9KuwN":"pascaligo.4bbd3a85.js","eM7TR":"pcaxis.e636466e.js","6w6GH":"peoplecode.32e124c6.js","eQPpI":"perl.7d72d7fd.js","b83gb":"php-extras.9606406b.js","l8BPM":"phpdoc.617f8af6.js","2cVRv":"plsql.482f8da9.js","gOyA3":"powerquery.486ee359.js","1BYb4":"powershell.856a4dd0.js","lIwm5":"processing.2c7d4403.js","cHCln":"prolog.812b5c86.js","d460J":"promql.8e6b9da4.js","lAnQP":"properties.40afd4d0.js","dG8OA":"protobuf.84963e3e.js","eRbDh":"psl.9c32166c.js","27W0o":"pug.54462c11.js","75Y4h":"puppet.2646aef5.js","kgGGG":"pure.a10bd6b4.js","hFuIq":"purebasic.629b75cd.js","db2yj":"purescript.216751ba.js","8ZppB":"q.b46a94a4.js","iFM89":"qml.bd71f711.js","7FNJV":"qore.d7e006f8.js","6AsUF":"qsharp.7bab07d1.js","7Xrsp":"r.3036c5c0.js","dh9BI":"racket.b867dd29.js","8pRTf":"reason.405183ad.js","kUbHD":"regex.aa4684b4.js","bNx4l":"rego.61da6b5d.js","jbksA":"renpy.ff0ce389.js","gP26j":"rest.91bee177.js","6FCYh":"rip.33f479a4.js","lEjxk":"roboconf.0ba2e9bf.js","c8BOJ":"robotframework.72ccad61.js","elAoE":"rust.9a35cb62.js","eDL1o":"sas.b3b3be64.js","gIQMB":"sass.165275f3.js","i7Y8T":"scala.a51a6234.js","OzRer":"shell-session.c47a7880.js","hZA2W":"smali.46e3f703.js","gT51y":"smalltalk.fb31e155.js","2OoIP":"smarty.abd6973e.js","33hrk":"sml.6d8c2545.js","3uuqi":"solidity.80562c5b.js","kHJvD":"solution-file.30e00f5f.js","6iiDq":"soy.46a7ec1f.js","2TkEp":"sparql.dbb56be0.js","eirDq":"turtle.b8836781.js","jmDes":"splunk-spl.149146f6.js","81dr7":"sqf.ea070acb.js","i4XqC":"squirrel.1efaf6f3.js","1zw3p":"stan.6efb4565.js","kfIG2":"stylus.d4d41ca4.js","dksml":"swift.ea86fdd0.js","4w3mZ":"systemd.df819c28.js","6b6p1":"t4-cs.b3eaa646.js","budu0":"t4-templating.db399052.js","7RUUk":"t4-vb.082c208c.js","2cwdT":"vbnet.ac572fcc.js","fBA7X":"tap.82e5520b.js","gqbYu":"yaml.3d0bf472.js","lCVk7":"tcl.fffb53bb.js","aKXaK":"textile.20ae1d45.js","ks7hU":"toml.69754057.js","kCJbl":"tremor.262b95d4.js","iZ71n":"tt2.f07906cb.js","5mLLA":"twig.a95c4964.js","i9AIa":"typoscript.3dbd38d9.js","iHNMy":"unrealscript.e5c3fc1d.js","bKWLJ":"uorazor.cf3ed6dc.js","2XcAn":"uri.59c4e10c.js","enDcg":"v.fe8e0874.js","db4Ta":"vala.386e6270.js","cmaSk":"velocity.9a0ffb21.js","29RKO":"verilog.4308f028.js","4aBVG":"vhdl.ca8ee4c0.js","6Jrfy":"vim.897929a5.js","kNyzl":"visual-basic.bc36aaac.js","4LJ5s":"warpscript.6d00b50f.js","6Ocza":"wasm.029f651e.js","hvPGO":"web-idl.97fc763d.js","lS90V":"wiki.1179d7f8.js","9LY8Y":"wolfram.7017e6a0.js","bFBdJ":"wren.d4121438.js","iskNq":"xeora.cce693be.js","ek7X7":"xml-doc.025d4193.js","hwA94":"xojo.843f212e.js","f8rnQ":"xquery.50701bd4.js","3Q9qv":"yang.2c70775f.js","a0Oht":"zig.e33efe11.js","dnGOp":"core.ade097c7.js","9u7s7":"index.css"}'));var a;a=o("9Hk4c"),o("85Hg2");var s={};!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),s=o("bU6y3");var l,c=o("85Hg2");l=o("bG9xl")();var u,d=o("dCyaf"),h=o("1DJXa"),f=new Uint8Array(16);function p(){if(!u&&!(u="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return u(f)}var m=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var g=function(e){return"string"==typeof e&&m.test(e)},v=[],b=0;b<256;++b)v.push((b+256).toString(16).substr(1));var y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(v[e[t+0]]+v[e[t+1]]+v[e[t+2]]+v[e[t+3]]+"-"+v[e[t+4]]+v[e[t+5]]+"-"+v[e[t+6]]+v[e[t+7]]+"-"+v[e[t+8]]+v[e[t+9]]+"-"+v[e[t+10]]+v[e[t+11]]+v[e[t+12]]+v[e[t+13]]+v[e[t+14]]+v[e[t+15]]).toLowerCase();if(!g(n))throw TypeError("Stringified UUID is invalid");return n};var w=function(e,t,n){var r=(e=e||{}).random||(e.rng||p)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return y(r)};const S=()=>w(),x=()=>S().replace(new RegExp("-","g"),"").toUpperCase();var M,_,A,E,C,T,I,k;(_=M||(M={}))[_.Debug=0]="Debug",_[_.Info=1]="Info",_[_.Warning=2]="Warning",_[_.Error=3]="Error",_[_.None=4]="None";class R{constructor(e,t){this.privName=e,this.privEventId=x(),this.privEventTime=(new Date).toISOString(),this.privEventType=t,this.privMetadata={}}get name(){return this.privName}get eventId(){return this.privEventId}get eventTime(){return this.privEventTime}get eventType(){return this.privEventType}get metadata(){return this.privMetadata}}class O extends R{constructor(e,t,n=M.Info){super(e,n),this.privAudioSourceId=t}get audioSourceId(){return this.privAudioSourceId}}class P extends O{constructor(e){super("AudioSourceInitializingEvent",e)}}class N extends O{constructor(e){super("AudioSourceReadyEvent",e)}}class B extends O{constructor(e){super("AudioSourceOffEvent",e)}}class L extends O{constructor(e,t){super("AudioSourceErrorEvent",e,M.Error),this.privError=t}get error(){return this.privError}}class D extends O{constructor(e,t,n){super(e,t),this.privAudioNodeId=n}get audioNodeId(){return this.privAudioNodeId}}class U extends D{constructor(e,t){super("AudioStreamNodeAttachingEvent",e,t)}}class F extends D{constructor(e,t){super("AudioStreamNodeAttachedEvent",e,t)}}class z extends D{constructor(e,t){super("AudioStreamNodeDetachedEvent",e,t)}}class j extends D{constructor(e,t,n){super("AudioStreamNodeErrorEvent",e,t),this.privError=n}get error(){return this.privError}}class H extends R{constructor(e,t,n=M.Info){super(e,n),this.privJsonResult=t}get jsonString(){return this.privJsonResult}}class G extends R{constructor(e,t,n=M.Info){super(e,n),this.privConnectionId=t}get connectionId(){return this.privConnectionId}}class V extends G{constructor(e,t,n){super("ConnectionStartEvent",e),this.privUri=t,this.privHeaders=n}get uri(){return this.privUri}get headers(){return this.privHeaders}}class W extends G{constructor(e){super("ConnectionEstablishedEvent",e)}}class q extends G{constructor(e,t,n){super("ConnectionClosedEvent",e,M.Debug),this.privReason=n,this.privStatusCode=t}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class K extends G{constructor(e,t,n){super("ConnectionErrorEvent",e,M.Debug),this.privMessage=t,this.privType=n}get message(){return this.privMessage}get type(){return this.privType}}class J extends G{constructor(e,t,n){super("ConnectionEstablishErrorEvent",e,M.Error),this.privStatusCode=t,this.privReason=n}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class Q extends G{constructor(e,t,n){super("ConnectionMessageReceivedEvent",e),this.privNetworkReceivedTime=t,this.privMessage=n}get networkReceivedTime(){return this.privNetworkReceivedTime}get message(){return this.privMessage}}class X extends G{constructor(e,t,n){super("ConnectionMessageSentEvent",e),this.privNetworkSentTime=t,this.privMessage=n}get networkSentTime(){return this.privNetworkSentTime}get message(){return this.privMessage}}class Y extends Error{constructor(e){super(e),this.name="ArgumentNull",this.message=e}}class Z extends Error{constructor(e){super(e),this.name="InvalidOperation",this.message=e}}class $ extends Error{constructor(e,t){super(t),this.name=e+"ObjectDisposed",this.message=t}}(E=A||(A={}))[E.Text=0]="Text",E[E.Binary=1]="Binary";class ee{constructor(e,t,n,r){if(this.privBody=null,e===A.Text&&t&&"string"!=typeof t)throw new Z("Payload must be a string");if(e===A.Binary&&t&&!(t instanceof ArrayBuffer))throw new Z("Payload must be ArrayBuffer");switch(this.privMessageType=e,this.privBody=t,this.privHeaders=n||{},this.privId=r||x(),this.messageType){case A.Binary:this.privSize=null!==this.binaryBody?this.binaryBody.byteLength:0;break;case A.Text:this.privSize=this.textBody.length}}get messageType(){return this.privMessageType}get headers(){return this.privHeaders}get body(){return this.privBody}get textBody(){if(this.privMessageType===A.Binary)throw new Z("Not supported for binary message");return this.privBody}get binaryBody(){if(this.privMessageType===A.Text)throw new Z("Not supported for text message");return this.privBody}get id(){return this.privId}}class te{constructor(e,t){this.privStatusCode=e,this.privReason=t}get statusCode(){return this.privStatusCode}get reason(){return this.privReason}}class ne{constructor(e){this.privEventListeners={},this.privIsDisposed=!1,this.privConsoleListener=void 0,this.privMetadata=e}onEvent(e){if(this.isDisposed())throw new $("EventSource");if(this.metadata)for(const t in this.metadata)t&&e.metadata&&(e.metadata[t]||(e.metadata[t]=this.metadata[t]));for(const t in this.privEventListeners)t&&this.privEventListeners[t]&&this.privEventListeners[t](e)}attach(e){const t=x();return this.privEventListeners[t]=e,{detach:()=>(delete this.privEventListeners[t],Promise.resolve())}}attachListener(e){return this.attach((t=>e.onEvent(t)))}attachConsoleListener(e){return this.privConsoleListener&&this.privConsoleListener.detach(),this.privConsoleListener=this.attach((t=>e.onEvent(t))),this.privConsoleListener}isDisposed(){return this.privIsDisposed}dispose(){this.privEventListeners=null,this.privIsDisposed=!0}get metadata(){return this.privMetadata}}class re{static setEventSource(e){if(!e)throw new Y("eventSource");re.privInstance=e}static get instance(){return re.privInstance}}re.privInstance=new ne,(T=C||(C={}))[T.None=0]="None",T[T.Connected=1]="Connected",T[T.Connecting=2]="Connecting",T[T.Disconnected=3]="Disconnected",(k=I||(I={}))[k.None=0]="None",k[k.Resolved=1]="Resolved",k[k.Rejected=2]="Rejected";class ie{constructor(){this.resolve=e=>(this.privResolve(e),this),this.reject=e=>(this.privReject(e),this),this.privPromise=new Promise(((e,t)=>{this.privResolve=e,this.privReject=t}))}get promise(){return this.privPromise}}function oe(e,t,n){e.then((e=>{try{t&&t(e)}catch(e){if(n)try{if(e instanceof Error){const t=e;n(t.name+": "+t.message)}else n(e)}catch(e){}}}),(e=>{if(n)try{if(e instanceof Error){const t=e;n(t.name+": "+t.message)}else n(e)}catch(e){}}))}var ae={};e(ae,"Queue",(()=>de),(e=>de=e));class se{constructor(e){if(this.privSubscriptionIdCounter=0,this.privAddSubscriptions={},this.privRemoveSubscriptions={},this.privDisposedSubscriptions={},this.privDisposeReason=null,this.privList=[],e)for(const t of e)this.privList.push(t)}get(e){return this.throwIfDisposed(),this.privList[e]}first(){return this.get(0)}last(){return this.get(this.length()-1)}add(e){this.throwIfDisposed(),this.insertAt(this.privList.length,e)}insertAt(e,t){this.throwIfDisposed(),0===e?this.privList.unshift(t):e===this.privList.length?this.privList.push(t):this.privList.splice(e,0,t),this.triggerSubscriptions(this.privAddSubscriptions)}removeFirst(){return this.throwIfDisposed(),this.removeAt(0)}removeLast(){return this.throwIfDisposed(),this.removeAt(this.length()-1)}removeAt(e){return this.throwIfDisposed(),this.remove(e,1)[0]}remove(e,t){this.throwIfDisposed();const n=this.privList.splice(e,t);return this.triggerSubscriptions(this.privRemoveSubscriptions),n}clear(){this.throwIfDisposed(),this.remove(0,this.length())}length(){return this.throwIfDisposed(),this.privList.length}onAdded(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privAddSubscriptions[t]=e,{detach:()=>(delete this.privAddSubscriptions[t],Promise.resolve())}}onRemoved(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privRemoveSubscriptions[t]=e,{detach:()=>(delete this.privRemoveSubscriptions[t],Promise.resolve())}}onDisposed(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privDisposedSubscriptions[t]=e,{detach:()=>(delete this.privDisposedSubscriptions[t],Promise.resolve())}}join(e){return this.throwIfDisposed(),this.privList.join(e)}toArray(){const e=Array();return this.privList.forEach((t=>{e.push(t)})),e}any(e){return this.throwIfDisposed(),e?this.where(e).length()>0:this.length()>0}all(e){return this.throwIfDisposed(),this.where(e).length()===this.length()}forEach(e){this.throwIfDisposed();for(let t=0;t<this.length();t++)e(this.privList[t],t)}select(e){this.throwIfDisposed();const t=[];for(let n=0;n<this.privList.length;n++)t.push(e(this.privList[n],n));return new se(t)}where(e){this.throwIfDisposed();const t=new se;for(let n=0;n<this.privList.length;n++)e(this.privList[n],n)&&t.add(this.privList[n]);return t}orderBy(e){this.throwIfDisposed();const t=this.toArray().sort(e);return new se(t)}orderByDesc(e){return this.throwIfDisposed(),this.orderBy(((t,n)=>e(n,t)))}clone(){return this.throwIfDisposed(),new se(this.toArray())}concat(e){return this.throwIfDisposed(),new se(this.privList.concat(e.toArray()))}concatArray(e){return this.throwIfDisposed(),new se(this.privList.concat(e))}isDisposed(){return null==this.privList}dispose(e){this.isDisposed()||(this.privDisposeReason=e,this.privList=null,this.privAddSubscriptions=null,this.privRemoveSubscriptions=null,this.triggerSubscriptions(this.privDisposedSubscriptions))}throwIfDisposed(){if(this.isDisposed())throw new $("List",this.privDisposeReason)}triggerSubscriptions(e){if(e)for(const t in e)t&&e[t]()}}var le,ce,ue=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};(ce=le||(le={}))[ce.Dequeue=0]="Dequeue",ce[ce.Peek=1]="Peek";class de{constructor(e){this.privPromiseStore=new se,this.privIsDrainInProgress=!1,this.privIsDisposing=!1,this.privDisposeReason=null,this.privList=e||new se,this.privDetachables=[],this.privSubscribers=new se,this.privDetachables.push(this.privList.onAdded((()=>this.drain())))}enqueue(e){this.throwIfDispose(),this.enqueueFromPromise(new Promise((t=>t(e))))}enqueueFromPromise(e){this.throwIfDispose(),e.then((e=>{this.privList.add(e)}),(()=>{}))}dequeue(){this.throwIfDispose();const e=new ie;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:le.Dequeue}),this.drain()),e.promise}peek(){this.throwIfDispose();const e=new ie;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:le.Peek}),this.drain()),e.promise}length(){return this.throwIfDispose(),this.privList.length()}isDisposed(){return null==this.privSubscribers}drainAndDispose(e,t){return ue(this,void 0,void 0,(function*(){if(!this.isDisposed()&&!this.privIsDisposing){this.privDisposeReason=t,this.privIsDisposing=!0;const n=this.privSubscribers;if(n){for(;n.length()>0;){n.removeFirst().deferral.resolve(void 0)}this.privSubscribers===n&&(this.privSubscribers=n)}for(const e of this.privDetachables)yield e.detach();if(this.privPromiseStore.length()>0&&e){const t=[];return this.privPromiseStore.toArray().forEach((e=>{t.push(e)})),Promise.all(t).finally((()=>{this.privSubscribers=null,this.privList.forEach((t=>{e(t)})),this.privList=null})).then()}this.privSubscribers=null,this.privList=null}}))}dispose(e){return ue(this,void 0,void 0,(function*(){yield this.drainAndDispose(null,e)}))}drain(){if(!this.privIsDrainInProgress&&!this.privIsDisposing){this.privIsDrainInProgress=!0;const e=this.privSubscribers,t=this.privList;if(e&&t){for(;t.length()>0&&e.length()>0&&!this.privIsDisposing;){const n=e.removeFirst();if(n.type===le.Peek)n.deferral.resolve(t.first());else{const e=t.removeFirst();n.deferral.resolve(e)}}this.privSubscribers===e&&(this.privSubscribers=e),this.privList===t&&(this.privList=t)}this.privIsDrainInProgress=!1}}throwIfDispose(){if(this.isDisposed()){if(this.privDisposeReason)throw new Z(this.privDisposeReason);throw new $("Queue")}if(this.privIsDisposing)throw new Z("Queue disposing")}}class he{constructor(e,t,n){if(this.privPayload=null,!t)throw new Y("payload");if(e===A.Binary&&"ArrayBuffer"!==t.__proto__.constructor.name)throw new Z("Payload must be ArrayBuffer");if(e===A.Text&&"string"!=typeof t)throw new Z("Payload must be a string");this.privMessageType=e,this.privPayload=t,this.privId=n||x()}get messageType(){return this.privMessageType}get payload(){return this.privPayload}get textContent(){if(this.privMessageType===A.Binary)throw new Z("Not supported for binary message");return this.privPayload}get binaryContent(){if(this.privMessageType===A.Text)throw new Z("Not supported for text message");return this.privPayload}get id(){return this.privId}}class fe{constructor(e,t){this.privActualSampleRate=e,this.privDesiredSampleRate=t}encode(e){const t=this.downSampleAudioFrame(e,this.privActualSampleRate,this.privDesiredSampleRate);if(!t)return null;const n=2*t.length,r=new ArrayBuffer(n),i=new DataView(r);return this.floatTo16BitPCM(i,0,t),r}setString(e,t,n){for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))}floatTo16BitPCM(e,t,n){for(let r=0;r<n.length;r++,t+=2){const i=Math.max(-1,Math.min(1,n[r]));e.setInt16(t,i<0?32768*i:32767*i,!0)}}downSampleAudioFrame(e,t,n){if(!e)return null;if(n===t||n>t)return e;const r=t/n,i=Math.round(e.length/r),o=new Float32Array(i);let a=0,s=0;for(;s<i;){const t=Math.round((s+1)*r);let n=0,i=0;for(;a<t&&a<e.length;)n+=e[a++],i++;o[s++]=n/i}return o}}var pe={};e(pe,"Stream",(()=>be),(e=>be=e));var me,ge,ve=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class be{constructor(e){this.privIsWriteEnded=!1,this.privIsReadEnded=!1,this.privId=e||x(),this.privReaderQueue=new(0,ae.Queue)}get isClosed(){return this.privIsWriteEnded}get isReadEnded(){return this.privIsReadEnded}get id(){return this.privId}close(){this.privIsWriteEnded||(this.writeStreamChunk({buffer:null,isEnd:!0,timeReceived:Date.now()}),this.privIsWriteEnded=!0)}writeStreamChunk(e){if(this.throwIfClosed(),!this.privReaderQueue.isDisposed())try{this.privReaderQueue.enqueue(e)}catch(e){}}read(){if(this.privIsReadEnded)throw new Z("Stream read has already finished");return this.privReaderQueue.dequeue().then((e=>ve(this,void 0,void 0,(function*(){return(void 0===e||e.isEnd)&&(yield this.privReaderQueue.dispose("End of stream reached")),e}))))}readEnded(){this.privIsReadEnded||(this.privIsReadEnded=!0,this.privReaderQueue=new(0,ae.Queue))}throwIfClosed(){if(this.privIsWriteEnded)throw new Z("Stream closed")}}(ge=me||(me={}))[ge.Success=0]="Success",ge[ge.Error=1]="Error";class ye extends pe.Stream{constructor(e,t){super(t),this.privTargetChunkSize=e,this.privNextBufferReadyBytes=0}writeStreamChunk(e){if(e.isEnd||0===this.privNextBufferReadyBytes&&e.buffer.byteLength===this.privTargetChunkSize)return void super.writeStreamChunk(e);let t=0;for(;t<e.buffer.byteLength;){void 0===this.privNextBufferToWrite&&(this.privNextBufferToWrite=new ArrayBuffer(this.privTargetChunkSize),this.privNextBufferStartTime=e.timeReceived);const n=Math.min(e.buffer.byteLength-t,this.privTargetChunkSize-this.privNextBufferReadyBytes),r=new Uint8Array(this.privNextBufferToWrite),i=new Uint8Array(e.buffer.slice(t,n+t));r.set(i,this.privNextBufferReadyBytes),this.privNextBufferReadyBytes+=n,t+=n,this.privNextBufferReadyBytes===this.privTargetChunkSize&&(super.writeStreamChunk({buffer:this.privNextBufferToWrite,isEnd:!1,timeReceived:this.privNextBufferStartTime}),this.privNextBufferReadyBytes=0,this.privNextBufferToWrite=void 0)}}close(){0===this.privNextBufferReadyBytes||this.isClosed||super.writeStreamChunk({buffer:this.privNextBufferToWrite.slice(0,this.privNextBufferReadyBytes),isEnd:!1,timeReceived:this.privNextBufferStartTime}),super.close()}}class we{static load(e){const t=new Map([[0,()=>{}]]),n=new Map,r=new Worker(e);r.addEventListener("message",(({data:e})=>{if(we.isCallNotification(e)){const{params:{timerId:r}}=e,i=t.get(r);if("number"==typeof i){const e=n.get(i);if(void 0===e||e!==r)throw new Error("The timer is in an undefined state.")}else{if(void 0===i)throw new Error("The timer is in an undefined state.");i(),t.delete(r)}}else{if(!we.isClearResponse(e)){const{error:{message:t}}=e;throw new Error(t)}{const{id:r}=e,i=n.get(r);if(void 0===i)throw new Error("The timer is in an undefined state.");n.delete(r),t.delete(i)}}}));return{clearTimeout:e=>{const i=Math.random();n.set(i,e),t.set(e,i),r.postMessage({id:i,method:"clear",params:{timerId:e}})},setTimeout:(e,n)=>{const i=Math.random();return t.set(i,e),r.postMessage({id:null,method:"set",params:{delay:n,now:performance.now(),timerId:i}}),i}}}static loadWorkerTimers(){return()=>{if(null!==we.workerTimers)return we.workerTimers;const e=new Blob(['!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return d}));const r=new Map,o=new Map,i=e=>{const t=r.get(e);if(void 0===t)throw new Error(\'There is no interval scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(t),r.delete(e)},u=e=>{const t=o.get(e);if(void 0===t)throw new Error(\'There is no timeout scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(t),o.delete(e)},f=(e,t)=>{let n,r;if("performance"in self){const o=performance.now();n=o,r=e-Math.max(0,o-t)}else n=Date.now(),r=e;return{expected:n+r,remainingDelay:r}},c=(e,t,n,r)=>{const o="performance"in self?performance.now():Date.now();o>n?postMessage({id:null,method:"call",params:{timerId:t}}):e.set(t,setTimeout(c,n-o,e,t,n))},a=(e,t,n)=>{const{expected:o,remainingDelay:i}=f(e,n);r.set(t,setTimeout(c,i,r,t,o))},d=(e,t,n)=>{const{expected:r,remainingDelay:i}=f(e,n);o.set(t,setTimeout(c,i,o,t,r))}},function(e,t,n){"use strict";n.r(t);var r=n(2);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(3);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(4);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o);var f=n(5);for(var o in f)"default"!==o&&function(e){n.d(t,e,(function(){return f[e]}))}(o);var c=n(6);for(var o in c)"default"!==o&&function(e){n.d(t,e,(function(){return c[e]}))}(o);var a=n(7);for(var o in a)"default"!==o&&function(e){n.d(t,e,(function(){return a[e]}))}(o);var d=n(8);for(var o in d)"default"!==o&&function(e){n.d(t,e,(function(){return d[e]}))}(o);var s=n(9);for(var o in s)"default"!==o&&function(e){n.d(t,e,(function(){return s[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(11);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(12);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(13);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(1);for(var i in o)"default"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);var u=n(10);for(var i in u)"default"!==i&&function(e){n.d(t,e,(function(){return u[e]}))}(i);addEventListener("message",({data:e})=>{try{if("clear"===e.method){const{id:t,params:{timerId:n}}=e;Object(r.b)(n),postMessage({error:null,id:t})}else{if("set"!==e.method)throw new Error(\'The given method "\'.concat(e.method,\'" is not supported\'));{const{params:{delay:t,now:n,timerId:o}}=e;Object(r.d)(t,o,n)}}}catch(t){postMessage({error:{message:t.message},id:e.id,result:null})}})}]);'],{type:"application/javascript; charset=utf-8"}),t=URL.createObjectURL(e);return we.workerTimers=we.load(t),we.workerTimers.setTimeout((()=>URL.revokeObjectURL(t)),0),we.workerTimers}}static isCallNotification(e){return void 0!==e.method&&"call"===e.method}static isClearResponse(e){return null===e.error&&"number"==typeof e.id}}we.workerTimers=null,we.clearTimeout=e=>we.timers().clearTimeout(e),we.setTimeout=(e,t)=>we.timers().setTimeout(e,t),we.timers=we.loadWorkerTimers();class Se extends R{constructor(e,t,n){super(e,t),this.privSignature=n}}class xe extends Se{constructor(e){super("OCSPMemoryCacheHitEvent",M.Debug,e)}}class Me extends Se{constructor(e){super("OCSPCacheMissEvent",M.Debug,e)}}class _e extends Se{constructor(e){super("OCSPDiskCacheHitEvent",M.Debug,e)}}class Ae extends Se{constructor(e){super("OCSPCacheUpdateNeededEvent",M.Debug,e)}}class Ee extends Se{constructor(e){super("OCSPMemoryCacheStoreEvent",M.Debug,e)}}class Ce extends Se{constructor(e){super("OCSPDiskCacheStoreEvent",M.Debug,e)}}class Te extends Se{constructor(e){super("OCSPCacheUpdateCompleteEvent",M.Debug,e)}}class Ie extends Se{constructor(){super("OCSPStapleReceivedEvent",M.Debug,"")}}class ke extends Se{constructor(e,t){super("OCSPCacheEntryExpiredEvent",M.Debug,e),this.privExpireTime=t}}class Re extends Se{constructor(e,t,n){super("OCSPCacheEntryNeedsRefreshEvent",M.Debug,e),this.privExpireTime=n,this.privStartTime=t}}class Oe extends Se{constructor(e,t,n){super("OCSPCacheHitEvent",M.Debug,e),this.privExpireTime=n,this.privExpireTimeString=new Date(n).toLocaleDateString(),this.privStartTime=t,this.privStartTimeString=new Date(t).toLocaleTimeString()}}class Pe extends Se{constructor(e,t){super("OCSPVerificationFailedEvent",M.Debug,e),this.privError=t}}class Ne extends Se{constructor(e,t){super("OCSPCacheFetchErrorEvent",M.Debug,e),this.privError=t}}class Be extends Se{constructor(e){super("OCSPResponseRetrievedEvent",M.Debug,e)}}class Le extends Se{constructor(e,t){super("OCSPCacheUpdateErrorEvent",M.Debug,e),this.privError=t}}class De extends R{constructor(e){super("BackgroundEvent",M.Error),this.privError=e}get error(){return this.privError}}class Ue{static throwIfNullOrUndefined(e,t){if(null==e)throw new Error("throwIfNullOrUndefined:"+t)}static throwIfNull(e,t){if(null===e)throw new Error("throwIfNull:"+t)}static throwIfNullOrWhitespace(e,t){if(Ue.throwIfNullOrUndefined(e,t),(""+e).trim().length<1)throw new Error("throwIfNullOrWhitespace:"+t)}static throwIfDisposed(e){if(e)throw new Error("the object is already disposed")}static throwIfArrayEmptyOrWhitespace(e,t){if(Ue.throwIfNullOrUndefined(e,t),0===e.length)throw new Error("throwIfArrayEmptyOrWhitespace:"+t);for(const n of e)Ue.throwIfNullOrWhitespace(n,t)}static throwIfFileDoesNotExist(e,t){Ue.throwIfNullOrWhitespace(e,t)}static throwIfNotUndefined(e,t){if(void 0!==e)throw new Error("throwIfNotUndefined:"+t)}}var Fe={};e(Fe,"MicAudioSource",(()=>tr),(e=>tr=e));class ze{}ze.AuthKey="Ocp-Apim-Subscription-Key",ze.ConnectionId="X-ConnectionId",ze.ContentType="Content-Type",ze.CustomCommandsAppId="X-CommandsAppId",ze.Path="Path",ze.RequestId="X-RequestId",ze.RequestStreamId="X-StreamId",ze.RequestTimestamp="X-Timestamp";class je{constructor(e,t){this.privHeaderName=e,this.privToken=t}get headerName(){return this.privHeaderName}get token(){return this.privToken}}class He{constructor(e){if(!e)throw new Y("subscriptionKey");this.privAuthInfo=new je(ze.AuthKey,e)}fetch(e){return Promise.resolve(this.privAuthInfo)}fetchOnExpiry(e){return Promise.resolve(this.privAuthInfo)}}const Ge="Authorization";class Ve{constructor(e,t){if(!e)throw new Y("fetchCallback");if(!t)throw new Y("fetchOnExpiryCallback");this.privFetchCallback=e,this.privFetchOnExpiryCallback=t}fetch(e){return this.privFetchCallback(e).then((e=>new je(Ge,Ve.privTokenPrefix+e)))}fetchOnExpiry(e){return this.privFetchOnExpiryCallback(e).then((e=>new je(Ge,Ve.privTokenPrefix+e)))}}Ve.privTokenPrefix="bearer ";var We,qe,Ke,Je,Qe,Xe,Ye={};e(Ye,"ServiceRecognizerBase",(()=>ut),(e=>ut=e)),(qe=We||(We={}))[qe.NoError=0]="NoError",qe[qe.AuthenticationFailure=1]="AuthenticationFailure",qe[qe.BadRequestParameters=2]="BadRequestParameters",qe[qe.TooManyRequests=3]="TooManyRequests",qe[qe.ConnectionFailure=4]="ConnectionFailure",qe[qe.ServiceTimeout=5]="ServiceTimeout",qe[qe.ServiceError=6]="ServiceError",qe[qe.RuntimeError=7]="RuntimeError",qe[qe.Forbidden=8]="Forbidden",(Je=Ke||(Ke={}))[Je.Error=0]="Error",Je[Je.EndOfStream=1]="EndOfStream",(Xe=Qe||(Qe={}))[Xe.SpeechServiceConnection_Key=0]="SpeechServiceConnection_Key",Xe[Xe.SpeechServiceConnection_Endpoint=1]="SpeechServiceConnection_Endpoint",Xe[Xe.SpeechServiceConnection_Region=2]="SpeechServiceConnection_Region",Xe[Xe.SpeechServiceAuthorization_Token=3]="SpeechServiceAuthorization_Token",Xe[Xe.SpeechServiceAuthorization_Type=4]="SpeechServiceAuthorization_Type",Xe[Xe.SpeechServiceConnection_EndpointId=5]="SpeechServiceConnection_EndpointId",Xe[Xe.SpeechServiceConnection_TranslationToLanguages=6]="SpeechServiceConnection_TranslationToLanguages",Xe[Xe.SpeechServiceConnection_TranslationVoice=7]="SpeechServiceConnection_TranslationVoice",Xe[Xe.SpeechServiceConnection_TranslationFeatures=8]="SpeechServiceConnection_TranslationFeatures",Xe[Xe.SpeechServiceConnection_IntentRegion=9]="SpeechServiceConnection_IntentRegion",Xe[Xe.SpeechServiceConnection_ProxyHostName=10]="SpeechServiceConnection_ProxyHostName",Xe[Xe.SpeechServiceConnection_ProxyPort=11]="SpeechServiceConnection_ProxyPort",Xe[Xe.SpeechServiceConnection_ProxyUserName=12]="SpeechServiceConnection_ProxyUserName",Xe[Xe.SpeechServiceConnection_ProxyPassword=13]="SpeechServiceConnection_ProxyPassword",Xe[Xe.SpeechServiceConnection_RecoMode=14]="SpeechServiceConnection_RecoMode",Xe[Xe.SpeechServiceConnection_RecoLanguage=15]="SpeechServiceConnection_RecoLanguage",Xe[Xe.Speech_SessionId=16]="Speech_SessionId",Xe[Xe.SpeechServiceConnection_SynthLanguage=17]="SpeechServiceConnection_SynthLanguage",Xe[Xe.SpeechServiceConnection_SynthVoice=18]="SpeechServiceConnection_SynthVoice",Xe[Xe.SpeechServiceConnection_SynthOutputFormat=19]="SpeechServiceConnection_SynthOutputFormat",Xe[Xe.SpeechServiceConnection_AutoDetectSourceLanguages=20]="SpeechServiceConnection_AutoDetectSourceLanguages",Xe[Xe.SpeechServiceResponse_RequestDetailedResultTrueFalse=21]="SpeechServiceResponse_RequestDetailedResultTrueFalse",Xe[Xe.SpeechServiceResponse_RequestProfanityFilterTrueFalse=22]="SpeechServiceResponse_RequestProfanityFilterTrueFalse",Xe[Xe.SpeechServiceResponse_JsonResult=23]="SpeechServiceResponse_JsonResult",Xe[Xe.SpeechServiceResponse_JsonErrorDetails=24]="SpeechServiceResponse_JsonErrorDetails",Xe[Xe.CancellationDetails_Reason=25]="CancellationDetails_Reason",Xe[Xe.CancellationDetails_ReasonText=26]="CancellationDetails_ReasonText",Xe[Xe.CancellationDetails_ReasonDetailedText=27]="CancellationDetails_ReasonDetailedText",Xe[Xe.LanguageUnderstandingServiceResponse_JsonResult=28]="LanguageUnderstandingServiceResponse_JsonResult",Xe[Xe.SpeechServiceConnection_Url=29]="SpeechServiceConnection_Url",Xe[Xe.SpeechServiceConnection_InitialSilenceTimeoutMs=30]="SpeechServiceConnection_InitialSilenceTimeoutMs",Xe[Xe.SpeechServiceConnection_EndSilenceTimeoutMs=31]="SpeechServiceConnection_EndSilenceTimeoutMs",Xe[Xe.Speech_SegmentationSilenceTimeoutMs=32]="Speech_SegmentationSilenceTimeoutMs",Xe[Xe.SpeechServiceConnection_EnableAudioLogging=33]="SpeechServiceConnection_EnableAudioLogging",Xe[Xe.SpeechServiceConnection_AtStartLanguageIdPriority=34]="SpeechServiceConnection_AtStartLanguageIdPriority",Xe[Xe.SpeechServiceConnection_ContinuousLanguageIdPriority=35]="SpeechServiceConnection_ContinuousLanguageIdPriority",Xe[Xe.SpeechServiceConnection_RecognitionEndpointVersion=36]="SpeechServiceConnection_RecognitionEndpointVersion",Xe[Xe.SpeechServiceResponse_ProfanityOption=37]="SpeechServiceResponse_ProfanityOption",Xe[Xe.SpeechServiceResponse_PostProcessingOption=38]="SpeechServiceResponse_PostProcessingOption",Xe[Xe.SpeechServiceResponse_RequestWordLevelTimestamps=39]="SpeechServiceResponse_RequestWordLevelTimestamps",Xe[Xe.SpeechServiceResponse_StablePartialResultThreshold=40]="SpeechServiceResponse_StablePartialResultThreshold",Xe[Xe.SpeechServiceResponse_OutputFormatOption=41]="SpeechServiceResponse_OutputFormatOption",Xe[Xe.SpeechServiceResponse_TranslationRequestStablePartialResult=42]="SpeechServiceResponse_TranslationRequestStablePartialResult",Xe[Xe.SpeechServiceResponse_RequestWordBoundary=43]="SpeechServiceResponse_RequestWordBoundary",Xe[Xe.SpeechServiceResponse_RequestPunctuationBoundary=44]="SpeechServiceResponse_RequestPunctuationBoundary",Xe[Xe.SpeechServiceResponse_RequestSentenceBoundary=45]="SpeechServiceResponse_RequestSentenceBoundary",Xe[Xe.Conversation_ApplicationId=46]="Conversation_ApplicationId",Xe[Xe.Conversation_DialogType=47]="Conversation_DialogType",Xe[Xe.Conversation_Initial_Silence_Timeout=48]="Conversation_Initial_Silence_Timeout",Xe[Xe.Conversation_From_Id=49]="Conversation_From_Id",Xe[Xe.Conversation_Conversation_Id=50]="Conversation_Conversation_Id",Xe[Xe.Conversation_Custom_Voice_Deployment_Ids=51]="Conversation_Custom_Voice_Deployment_Ids",Xe[Xe.Conversation_Speech_Activity_Template=52]="Conversation_Speech_Activity_Template",Xe[Xe.Conversation_Request_Bot_Status_Messages=53]="Conversation_Request_Bot_Status_Messages",Xe[Xe.Conversation_Agent_Connection_Id=54]="Conversation_Agent_Connection_Id",Xe[Xe.SpeechServiceConnection_Host=55]="SpeechServiceConnection_Host",Xe[Xe.ConversationTranslator_Host=56]="ConversationTranslator_Host",Xe[Xe.ConversationTranslator_Name=57]="ConversationTranslator_Name",Xe[Xe.ConversationTranslator_CorrelationId=58]="ConversationTranslator_CorrelationId",Xe[Xe.ConversationTranslator_Token=59]="ConversationTranslator_Token",Xe[Xe.PronunciationAssessment_ReferenceText=60]="PronunciationAssessment_ReferenceText",Xe[Xe.PronunciationAssessment_GradingSystem=61]="PronunciationAssessment_GradingSystem",Xe[Xe.PronunciationAssessment_Granularity=62]="PronunciationAssessment_Granularity",Xe[Xe.PronunciationAssessment_EnableMiscue=63]="PronunciationAssessment_EnableMiscue",Xe[Xe.PronunciationAssessment_Json=64]="PronunciationAssessment_Json",Xe[Xe.PronunciationAssessment_Params=65]="PronunciationAssessment_Params",Xe[Xe.SpeakerRecognition_Api_Version=66]="SpeakerRecognition_Api_Version";class Ze{constructor(e){this.privSessionId=e}get sessionId(){return this.privSessionId}}class $e extends Ze{constructor(e,t){super(t),this.privOffset=e}get offset(){return this.privOffset}}class et extends ee{constructor(e,t,n,r,i,o,a,s){if(!t)throw new Y("path");if(!n)throw new Y("requestId");const l={};if(l[ze.Path]=t,l[ze.RequestId]=n,l[ze.RequestTimestamp]=(new Date).toISOString(),r&&(l[ze.ContentType]=r),o&&(l[ze.RequestStreamId]=o),a)for(const e in a)e&&(l[e]=a[e]);s?super(e,i,l,s):super(e,i,l),this.privPath=t,this.privRequestId=n,this.privContentType=r,this.privStreamId=o,this.privAdditionalHeaders=a}get path(){return this.privPath}get requestId(){return this.privRequestId}get contentType(){return this.privContentType}get streamId(){return this.privStreamId}get additionalHeaders(){return this.privAdditionalHeaders}static fromConnectionMessage(e){let t=null,n=null,r=null,i=null;const o={};if(e.headers)for(const a in e.headers)a&&(a.toLowerCase()===ze.Path.toLowerCase()?t=e.headers[a]:a.toLowerCase()===ze.RequestId.toLowerCase()?n=e.headers[a]:a.toLowerCase()===ze.ContentType.toLowerCase()?r=e.headers[a]:a.toLowerCase()===ze.RequestStreamId.toLowerCase()?i=e.headers[a]:o[a]=e.headers[a]);return new et(e.messageType,t,n,r,e.body,i,o,e.id)}}var tt,nt,rt,it,ot,at,st,lt,ct=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class ut{constructor(e,t,n,r,i){if(this.privConnectionConfigurationPromise=void 0,this.privConnectionPromise=void 0,this.privSetTimeout=setTimeout,this.privIsLiveAudio=!1,this.recognizeOverride=void 0,this.disconnectOverride=void 0,this.receiveMessageOverride=void 0,this.sendPrePayloadJSONOverride=void 0,this.postConnectImplOverride=void 0,this.configConnectionOverride=void 0,!e)throw new Y("authentication");if(!t)throw new Y("connectionFactory");if(!n)throw new Y("audioSource");if(!r)throw new Y("recognizerConfig");this.privMustReportEndOfStream=!1,this.privAuthentication=e,this.privConnectionFactory=t,this.privAudioSource=n,this.privRecognizerConfig=r,this.privIsDisposed=!1,this.privRecognizer=i,this.privRequestSession=new(0,Wt.RequestSession)(this.privAudioSource.id()),this.privConnectionEvents=new ne,this.privServiceEvents=new ne,this.privDynamicGrammar=new ln,this.privSpeechContext=new sn(this.privDynamicGrammar),this.privAgentConfig=new An,"undefined"!=typeof Blob&&"undefined"!=typeof Worker&&(this.privSetTimeout=we.setTimeout),this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;(1003===t.statusCode||1007===t.statusCode||1002===t.statusCode||4e3===t.statusCode||this.privRequestSession.numConnectionAttempts>this.privRecognizerConfig.maxRetryCount)&&this.cancelRecognitionLocal(Ke.Error,1007===t.statusCode?We.BadRequestParameters:We.ConnectionFailure,`${t.reason} websocket error code: ${t.statusCode}`)}}))}get audioSource(){return this.privAudioSource}get speechContext(){return this.privSpeechContext}get dynamicGrammar(){return this.privDynamicGrammar}get agentConfig(){return this.privAgentConfig}set conversationTranslatorToken(e){this.privRecognizerConfig.parameters.setProperty(Qe.ConversationTranslator_Token,e)}set authentication(e){this.privAuthentication=this.authentication}isDisposed(){return this.privIsDisposed}dispose(e){return ct(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,void 0!==this.privConnectionConfigurationPromise)try{const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}catch(e){return}}))}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}get recognitionMode(){return this.privRecognizerConfig.recognitionMode}recognize(e,t,n){return ct(this,void 0,void 0,(function*(){if(void 0!==this.recognizeOverride)return void(yield this.recognizeOverride(e,t,n));this.privConnectionConfigurationPromise=void 0,this.privRecognizerConfig.recognitionMode=e,this.privSuccessCallback=t,this.privErrorCallback=n,this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);const r=this.connectImpl();let i;try{const e=yield this.audioSource.attach(this.privRequestSession.audioNodeId),t=yield this.audioSource.format,n=yield this.audioSource.deviceInfo;this.privIsLiveAudio=n.type&&n.type===st.Microphones,i=new br(e,t.avgBytesPerSec),yield this.privRequestSession.onAudioSourceAttachCompleted(i,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:n}}catch(e){throw yield this.privRequestSession.onStopRecognizing(),e}try{yield r}catch(e){return void(yield this.cancelRecognitionLocal(Ke.Error,We.ConnectionFailure,e))}const o=new Ze(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,o),this.receiveMessage();this.sendAudio(i).catch((e=>ct(this,void 0,void 0,(function*(){yield this.cancelRecognitionLocal(Ke.Error,We.RuntimeError,e)}))))}))}stopRecognizing(){return ct(this,void 0,void 0,(function*(){if(this.privRequestSession.isRecognizing)try{yield this.audioSource.turnOff(),yield this.sendFinalAudio(),yield this.privRequestSession.onStopRecognizing(),yield this.privRequestSession.turnCompletionPromise}finally{yield this.privRequestSession.dispose()}}))}connect(){return ct(this,void 0,void 0,(function*(){return yield this.connectImpl(),Promise.resolve()}))}connectAsync(e,t){this.connectImpl().then((()=>{try{e&&e()}catch(e){t&&t(e)}}),(e=>{try{t&&t(e)}catch(e){}}))}disconnect(){return ct(this,void 0,void 0,(function*(){if(yield this.cancelRecognitionLocal(Ke.Error,We.NoError,"Disconnecting"),void 0!==this.disconnectOverride&&(yield this.disconnectOverride()),void 0!==this.privConnectionPromise)try{yield(yield this.privConnectionPromise).dispose()}catch(e){}this.privConnectionPromise=void 0}))}sendMessage(e){}sendNetworkMessage(e,t){return ct(this,void 0,void 0,(function*(){const n="string"==typeof t?A.Text:A.Binary,r="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new et(n,e,this.privRequestSession.requestId,r,t))}))}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}sendTelemetryData(){return ct(this,void 0,void 0,(function*(){const e=this.privRequestSession.getTelemetry();if(!0!==ut.telemetryDataEnabled||this.privIsDisposed||null===e)return;if(ut.telemetryData)try{ut.telemetryData(e)}catch(e){}const t=yield this.fetchConnection();yield t.send(new et(A.Text,"telemetry",this.privRequestSession.requestId,"application/json",e))}))}cancelRecognitionLocal(e,t,n){return ct(this,void 0,void 0,(function*(){this.privRequestSession.isRecognizing&&(yield this.privRequestSession.onStopRecognizing(),this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,e,t,n))}))}receiveMessage(){return ct(this,void 0,void 0,(function*(){try{if(this.privIsDisposed)return;let e=yield this.fetchConnection();const t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(!t)return this.privRequestSession.isRecognizing?this.receiveMessage():void 0;this.privServiceHasSentMessage=!0;const n=et.fromConnectionMessage(t);if(n.requestId.toLowerCase()===this.privRequestSession.requestId.toLowerCase())switch(n.path.toLowerCase()){case"turn.start":this.privMustReportEndOfStream=!0,this.privRequestSession.onServiceTurnStartResponse();break;case"speech.startdetected":const t=Pt.fromJSON(n.textBody),r=new $e(t.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechStartDetected&&this.privRecognizer.speechStartDetected(this.privRecognizer,r);break;case"speech.enddetected":let i;i=n.textBody.length>0?n.textBody:"{ Offset: 0 }";const o=Pt.fromJSON(i);this.privRecognizerConfig.isContinuousRecognition&&this.privRequestSession.onServiceRecognized(o.Offset+this.privRequestSession.currentTurnAudioOffset);const a=new $e(o.Offset+this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId);this.privRecognizer.speechEndDetected&&this.privRecognizer.speechEndDetected(this.privRecognizer,a);break;case"turn.end":yield this.sendTelemetryData(),this.privRequestSession.isSpeechEnded&&this.privMustReportEndOfStream&&(this.privMustReportEndOfStream=!1,yield this.cancelRecognitionLocal(Ke.EndOfStream,We.NoError,void 0));const s=new Ze(this.privRequestSession.sessionId);if(yield this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition),!this.privRecognizerConfig.isContinuousRecognition||this.privRequestSession.isSpeechEnded||!this.privRequestSession.isRecognizing)return void(this.privRecognizer.sessionStopped&&this.privRecognizer.sessionStopped(this.privRecognizer,s));e=yield this.fetchConnection(),yield this.sendPrePayloadJSON(e);break;default:(yield this.processTypeSpecificMessages(n))||this.privServiceEvents&&this.serviceEvents.onEvent(new H(n.path.toLowerCase(),n.textBody))}return this.receiveMessage()}catch(e){return null}}))}sendSpeechContext(e,t){const n=this.speechContext.toJSON();if(t&&this.privRequestSession.onSpeechContext(),n)return e.send(new et(A.Text,"speech.context",this.privRequestSession.requestId,"application/json",n))}sendPrePayloadJSON(e,t=!0){return ct(this,void 0,void 0,(function*(){if(void 0!==this.sendPrePayloadJSONOverride)return this.sendPrePayloadJSONOverride(e);yield this.sendSpeechContext(e,t),yield this.sendWaveHeader(e)}))}sendWaveHeader(e){return ct(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;return e.send(new et(A.Binary,"audio",this.privRequestSession.requestId,"audio/x-wav",t.header))}))}connectImpl(){return void 0!==this.privConnectionPromise?this.privConnectionPromise.then((e=>e.state()===C.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=void 0,this.privServiceHasSentMessage=!1,this.connectImpl()):this.privConnectionPromise),(()=>(this.privConnectionId=null,this.privConnectionPromise=void 0,this.privServiceHasSentMessage=!1,this.connectImpl()))):(this.privConnectionPromise=this.retryableConnect(),this.privConnectionPromise.catch((()=>{})),void 0!==this.postConnectImplOverride?this.postConnectImplOverride(this.privConnectionPromise):this.privConnectionPromise)}sendSpeechServiceConfig(e,t,n){if(t.onSpeechContext(),!0!==ut.telemetryDataEnabled){const e={context:{system:JSON.parse(n).context.system}};n=JSON.stringify(e)}if("true"===this.privRecognizerConfig.parameters.getProperty("TranscriptionService_SingleChannel","false").toLowerCase()){const e=JSON.parse(n);e.context.DisableReferenceChannel="True",e.context.MicSpec="1_0_0",n=JSON.stringify(e)}if(n)return e.send(new et(A.Text,"speech.config",t.requestId,"application/json",n))}fetchConnection(){return ct(this,void 0,void 0,(function*(){return void 0!==this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===C.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.privServiceHasSentMessage=!1,this.fetchConnection()):this.privConnectionConfigurationPromise),(()=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.privServiceHasSentMessage=!1,this.fetchConnection()))):(this.privConnectionConfigurationPromise=this.configureConnection(),yield this.privConnectionConfigurationPromise)}))}sendAudio(e){return ct(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;let n=Date.now();const r=this.privRecognizerConfig.parameters.getProperty("SPEECH-TransmitLengthBeforThrottleMs","5000"),i=t.avgBytesPerSec/1e3*parseInt(r,10),o=this.privRequestSession.recogNumber,a=()=>ct(this,void 0,void 0,(function*(){if(!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===o){const r=yield this.fetchConnection(),s=yield e.read();if(this.privRequestSession.isSpeechEnded)return;let l,c;if(!s||s.isEnd?(l=null,c=0):(l=s.buffer,this.privRequestSession.onAudioSent(l.byteLength),c=i>=this.privRequestSession.bytesSent?0:Math.max(0,n-Date.now())),0!==c&&(yield this.delay(c)),null!==l&&(n=Date.now()+1e3*l.byteLength/(2*t.avgBytesPerSec)),!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===o){if(r.send(new et(A.Binary,"audio",this.privRequestSession.requestId,null,l)).catch((()=>{this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch((()=>{}))})),!(null==s?void 0:s.isEnd))return a();this.privIsLiveAudio||this.privRequestSession.onSpeechEnded()}}}));return a()}))}retryableConnect(){return ct(this,void 0,void 0,(function*(){let e=!1;this.privAuthFetchEventId=x();const t=this.privRequestSession.sessionId;this.privConnectionId=void 0!==t?t:x(),this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId,this.privConnectionId);let n=0,r="";for(;this.privRequestSession.numConnectionAttempts<=this.privRecognizerConfig.maxRetryCount;){const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId),i=yield t;yield this.privRequestSession.onAuthCompleted(!1);const o=this.privConnectionFactory.create(this.privRecognizerConfig,i,this.privConnectionId);this.privRequestSession.listenForServiceTelemetry(o.events),o.events.attach((e=>{this.connectionEvents.onEvent(e)}));const a=yield o.open();if(200===a.statusCode)return yield this.privRequestSession.onConnectionEstablishCompleted(a.statusCode),Promise.resolve(o);1006===a.statusCode&&(e=!0),n=a.statusCode,r=a.reason,this.privRequestSession.onRetryConnection()}return yield this.privRequestSession.onConnectionEstablishCompleted(n,r),Promise.reject(`Unable to contact server. StatusCode: ${n}, ${this.privRecognizerConfig.parameters.getProperty(Qe.SpeechServiceConnection_Endpoint)} Reason: ${r}`)}))}delay(e){return new Promise((t=>this.privSetTimeout(t,e)))}writeBufferToConsole(e){let t="Buffer Size: ";if(null===e)t+="null";else{const n=new Uint8Array(e);t+=`${e.byteLength}\r\n`;for(let r=0;r<e.byteLength;r++)t+=n[r].toString(16).padStart(2,"0")+" "}console.info(t)}sendFinalAudio(){return ct(this,void 0,void 0,(function*(){const e=yield this.fetchConnection();yield e.send(new et(A.Binary,"audio",this.privRequestSession.requestId,null,null))}))}configureConnection(){return ct(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privRequestSession,this.privRecognizerConfig.SpeechServiceConfig.serialize()),yield this.sendPrePayloadJSON(e,!1),e)}))}}ut.telemetryDataEnabled=!0,(nt=tt||(tt={}))[nt.Interactive=0]="Interactive",nt[nt.Conversation=1]="Conversation",nt[nt.Dictation=2]="Dictation",(it=rt||(rt={}))[it.Simple=0]="Simple",it[it.Detailed=1]="Detailed";class dt{constructor(e,t){this.privSpeechServiceConfig=e||new ht(new ft(null)),this.privParameters=t,this.privMaxRetryCount=parseInt(t.getProperty("SPEECH-Error-MaxRetryCount","4"),10),this.privLanguageIdPriority=t.getProperty(Qe.SpeechServiceConnection_ContinuousLanguageIdPriority,void 0),this.privLanguageIdMode="Latency"===this.privLanguageIdPriority?"DetectContinuous":"DetectAtAudioStart","DetectAtAudioStart"===this.privLanguageIdMode&&(this.privLanguageIdPriority=t.getProperty(Qe.SpeechServiceConnection_AtStartLanguageIdPriority,void 0))}get parameters(){return this.privParameters}get recognitionMode(){return this.privRecognitionMode}set recognitionMode(e){this.privRecognitionMode=e,this.privRecognitionActivityTimeout=e===tt.Interactive?8e3:25e3,this.privSpeechServiceConfig.Recognition=tt[e]}get SpeechServiceConfig(){return this.privSpeechServiceConfig}get recognitionActivityTimeout(){return this.privRecognitionActivityTimeout}get isContinuousRecognition(){return this.privRecognitionMode!==tt.Interactive}get languageIdPriority(){return this.privLanguageIdPriority?`Prioritize${this.privLanguageIdPriority}`:""}get languageIdMode(){return this.privLanguageIdMode}get autoDetectSourceLanguages(){return this.parameters.getProperty(Qe.SpeechServiceConnection_AutoDetectSourceLanguages,void 0)}get recognitionEndpointVersion(){return this.parameters.getProperty(Qe.SpeechServiceConnection_RecognitionEndpointVersion,void 0)}get sourceLanguageModels(){const e=[];let t=!1;if(void 0!==this.autoDetectSourceLanguages)for(const n of this.autoDetectSourceLanguages.split(",")){const r=n+Qe.SpeechServiceConnection_EndpointId.toString(),i=this.parameters.getProperty(r,void 0);void 0!==i?(e.push({language:n,endpoint:i}),t=!0):e.push({language:n,endpoint:""})}return t?e:void 0}get maxRetryCount(){return this.privMaxRetryCount}}class ht{constructor(e){this.context=e}serialize(){return JSON.stringify(this,((e,t)=>{if(t&&"object"==typeof t){const e={};for(const n in t)Object.hasOwnProperty.call(t,n)&&(e[n&&n.charAt(0).toLowerCase()+n.substring(1)]=t[n]);return e}return t}))}get Context(){return this.context}get Recognition(){return this.recognition}set Recognition(e){this.recognition=e.toLowerCase()}}class ft{constructor(e){this.system=new pt,this.os=e}}class pt{constructor(){this.name="SpeechSDK",this.version="1.22.0",this.build="JavaScript",this.lang="JavaScript"}}class mt{constructor(e,t,n){this.platform=e,this.name=t,this.version=n}}(at=ot||(ot={})).Bluetooth="Bluetooth",at.Wired="Wired",at.WiFi="WiFi",at.Cellular="Cellular",at.InBuilt="InBuilt",at.Unknown="Unknown",(lt=st||(st={})).Phone="Phone",lt.Speaker="Speaker",lt.Car="Car",lt.Headset="Headset",lt.Thermostat="Thermostat",lt.Microphones="Microphones",lt.Deskphone="Deskphone",lt.RemoteControl="RemoteControl",lt.Unknown="Unknown",lt.File="File",lt.Stream="Stream";class gt{toConnectionMessage(e){const t=new ie;try{if(e.messageType===A.Text){const n=e.textContent;let r={},i=null;if(n){const e=n.split("\r\n\r\n");e&&e.length>0&&(r=this.parseHeaders(e[0]),e.length>1&&(i=e[1]))}t.resolve(new ee(e.messageType,i,r,e.id))}else if(e.messageType===A.Binary){const n=e.binaryContent;let r={},i=null;if(!n||n.byteLength<2)throw new Error("Invalid binary message format. Header length missing.");const o=new DataView(n),a=o.getInt16(0);if(n.byteLength<a+2)throw new Error("Invalid binary message format. Header content missing.");let s="";for(let e=0;e<a;e++)s+=String.fromCharCode(o.getInt8(e+2));r=this.parseHeaders(s),n.byteLength>a+2&&(i=n.slice(2+a)),t.resolve(new ee(e.messageType,i,r,e.id))}}catch(e){t.reject(`Error formatting the message. Error: ${e}`)}return t.promise}fromConnectionMessage(e){const t=new ie;try{if(e.messageType===A.Text){const n=`${this.makeHeaders(e)}\r\n${e.textBody?e.textBody:""}`;t.resolve(new he(A.Text,n,e.id))}else if(e.messageType===A.Binary){const n=this.makeHeaders(e),r=e.binaryBody,i=this.stringToArrayBuffer(n),o=new Int8Array(i),a=o.byteLength,s=new Int8Array(2+a+(r?r.byteLength:0));if(s[0]=a>>8&255,s[1]=255&a,s.set(o,2),r){const e=new Int8Array(r);s.set(e,2+a)}const l=s.buffer;t.resolve(new he(A.Binary,l,e.id))}}catch(e){t.reject(`Error formatting the message. ${e}`)}return t.promise}makeHeaders(e){let t="";if(e.headers)for(const n in e.headers)n&&(t+=`${n}: ${e.headers[n]}\r\n`);return t}parseHeaders(e){const t={};if(e){const n=e.match(/[^\r\n]+/g);if(t)for(const e of n)if(e){const n=e.indexOf(":"),r=n>0?e.substr(0,n).trim().toLowerCase():e,i=n>0&&e.length>n+1?e.substr(n+1).trim():"";t[r]=i}}return t}stringToArrayBuffer(e){const t=new ArrayBuffer(e.length),n=new DataView(t);for(let t=0;t<e.length;t++)n.setUint8(t,e.charCodeAt(t));return t}}var vt,bt,yt,wt,St,xt,Mt,_t;(bt=vt||(vt={}))[bt.Simple=0]="Simple",bt[bt.Detailed=1]="Detailed";class At{}At.BotId="botid",At.CustomSpeechDeploymentId="cid",At.CustomVoiceDeploymentId="deploymentId",At.EnableAudioLogging="storeAudio",At.EnableLanguageId="lidEnabled",At.EnableWordLevelTimestamps="wordLevelTimestamps",At.EndSilenceTimeoutMs="endSilenceTimeoutMs",At.SegmentationSilenceTimeoutMs="segmentationSilenceTimeoutMs",At.Format="format",At.InitialSilenceTimeoutMs="initialSilenceTimeoutMs",At.Language="language",At.Profanity="profanity",At.RequestBotStatusMessages="enableBotMessageStatus",At.StableIntermediateThreshold="stableIntermediateThreshold",At.StableTranslation="stableTranslation",At.TestHooks="testhooks",At.Postprocessing="postprocessing";class Et{static getHostSuffix(e){if(e){if(e.toLowerCase().startsWith("china"))return".azure.cn";if(e.toLowerCase().startsWith("usgov"))return".azure.us"}return".microsoft.com"}setCommonUrlParams(e,t,n){new Map([[Qe.Speech_SegmentationSilenceTimeoutMs,At.SegmentationSilenceTimeoutMs],[Qe.SpeechServiceConnection_EnableAudioLogging,At.EnableAudioLogging],[Qe.SpeechServiceConnection_EndSilenceTimeoutMs,At.EndSilenceTimeoutMs],[Qe.SpeechServiceConnection_InitialSilenceTimeoutMs,At.InitialSilenceTimeoutMs],[Qe.SpeechServiceResponse_PostProcessingOption,At.Postprocessing],[Qe.SpeechServiceResponse_ProfanityOption,At.Profanity],[Qe.SpeechServiceResponse_RequestWordLevelTimestamps,At.EnableWordLevelTimestamps],[Qe.SpeechServiceResponse_StablePartialResultThreshold,At.StableIntermediateThreshold]]).forEach(((r,i)=>{this.setUrlParameter(i,r,e,t,n)}));const r=JSON.parse(e.parameters.getProperty(Zn,"{}"));Object.keys(r).forEach((e=>{t[e]=r[e]}))}setUrlParameter(e,t,n,r,i){const o=n.parameters.getProperty(e,void 0);!o||i&&-1!==i.search(t)||(r[t]=o.toLocaleLowerCase())}}class Ct extends Et{constructor(){super(...arguments),this.interactiveRelativeUri="/speech/recognition/interactive/cognitiveservices/v1",this.conversationRelativeUri="/speech/recognition/conversation/cognitiveservices/v1",this.dictationRelativeUri="/speech/recognition/dictation/cognitiveservices/v1",this.universalUri="/speech/universal/v"}create(e,t,n){let r=e.parameters.getProperty(Qe.SpeechServiceConnection_Endpoint,void 0);const i=e.parameters.getProperty(Qe.SpeechServiceConnection_Region,void 0),o=Et.getHostSuffix(i),a=e.parameters.getProperty(Qe.SpeechServiceConnection_Host,"wss://"+i+".stt.speech"+o),s={},l=e.parameters.getProperty(Qe.SpeechServiceConnection_EndpointId,void 0),c=e.parameters.getProperty(Qe.SpeechServiceConnection_RecoLanguage,void 0);if(l?r&&-1!==r.search(At.CustomSpeechDeploymentId)||(s[At.CustomSpeechDeploymentId]=l):c&&(r&&-1!==r.search(At.Language)||(s[At.Language]=c)),r&&-1!==r.search(At.Format)||(s[At.Format]=e.parameters.getProperty(Xn,vt[vt.Simple]).toLowerCase()),void 0!==e.autoDetectSourceLanguages&&(s[At.EnableLanguageId]="true"),this.setCommonUrlParams(e,s,r),!r)switch(e.recognitionMode){case tt.Conversation:r="true"===e.parameters.getProperty($n,"false")?a+this.dictationRelativeUri:void 0!==e.recognitionEndpointVersion&&parseInt(e.recognitionEndpointVersion,10)>1?`${a}${this.universalUri}${e.recognitionEndpointVersion}`:a+this.conversationRelativeUri;break;case tt.Dictation:r=a+this.dictationRelativeUri;break;default:r=void 0!==e.recognitionEndpointVersion&&parseInt(e.recognitionEndpointVersion,10)>1?`${a}${this.universalUri}${e.recognitionEndpointVersion}`:a+this.interactiveRelativeUri}const u={};void 0!==t.token&&""!==t.token&&(u[t.headerName]=t.token),u[ze.ConnectionId]=n,e.parameters.setProperty(Qe.SpeechServiceConnection_Url,r);const d="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false");return new(0,ar.WebsocketConnection)(r,s,u,new gt,wr.fromRecognizerConfig(e),d,n)}}class Tt{constructor(){this.synthesisUri="/cognitiveservices/websocket/v1"}create(e,t,n){let r=e.parameters.getProperty(Qe.SpeechServiceConnection_Endpoint,void 0);const i=e.parameters.getProperty(Qe.SpeechServiceConnection_Region,void 0),o=Et.getHostSuffix(i),a=e.parameters.getProperty(Qe.SpeechServiceConnection_EndpointId,void 0),s=void 0===a?"tts":"voice",l=e.parameters.getProperty(Qe.SpeechServiceConnection_Host,"wss://"+i+"."+s+".speech"+o);r||(r=l+this.synthesisUri);const c={};void 0!==t.token&&""!==t.token&&(c[t.headerName]=t.token),c[ze.ConnectionId]=n,void 0!==a&&(c[At.CustomVoiceDeploymentId]=a),e.parameters.setProperty(Qe.SpeechServiceConnection_Url,r);const u="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false");return new(0,ar.WebsocketConnection)(r,{},c,new gt,wr.fromParameters(e.parameters),u,n)}}(wt=yt||(yt={}))[wt.NoMatch=0]="NoMatch",wt[wt.Canceled=1]="Canceled",wt[wt.RecognizingSpeech=2]="RecognizingSpeech",wt[wt.RecognizedSpeech=3]="RecognizedSpeech",wt[wt.RecognizedKeyword=4]="RecognizedKeyword",wt[wt.RecognizingIntent=5]="RecognizingIntent",wt[wt.RecognizedIntent=6]="RecognizedIntent",wt[wt.TranslatingSpeech=7]="TranslatingSpeech",wt[wt.TranslatedSpeech=8]="TranslatedSpeech",wt[wt.SynthesizingAudio=9]="SynthesizingAudio",wt[wt.SynthesizingAudioCompleted=10]="SynthesizingAudioCompleted",wt[wt.SynthesizingAudioStarted=11]="SynthesizingAudioStarted",wt[wt.EnrollingVoiceProfile=12]="EnrollingVoiceProfile",wt[wt.EnrolledVoiceProfile=13]="EnrolledVoiceProfile",wt[wt.RecognizedSpeakers=14]="RecognizedSpeakers",wt[wt.RecognizedSpeaker=15]="RecognizedSpeaker",wt[wt.ResetVoiceProfile=16]="ResetVoiceProfile",wt[wt.DeletedVoiceProfile=17]="DeletedVoiceProfile",wt[wt.VoicesListRetrieved=18]="VoicesListRetrieved";class It{static implTranslateRecognitionResult(e){let t=yt.Canceled;switch(e){case Mt.Success:t=yt.RecognizedSpeech;break;case Mt.NoMatch:case Mt.InitialSilenceTimeout:case Mt.BabbleTimeout:case Mt.EndOfDictation:t=yt.NoMatch;break;case Mt.Error:case Mt.BadRequest:case Mt.Forbidden:default:t=yt.Canceled}return t}static implTranslateCancelResult(e){let t=Ke.EndOfStream;switch(e){case Mt.Success:case Mt.EndOfDictation:case Mt.NoMatch:t=Ke.EndOfStream;break;case Mt.InitialSilenceTimeout:case Mt.BabbleTimeout:case Mt.Error:case Mt.BadRequest:case Mt.Forbidden:default:t=Ke.Error}return t}static implTranslateCancelErrorCode(e){let t=We.NoError;switch(e){case Mt.Error:t=We.ServiceError;break;case Mt.TooManyRequests:t=We.TooManyRequests;break;case Mt.BadRequest:t=We.BadRequestParameters;break;case Mt.Forbidden:t=We.Forbidden;break;default:t=We.NoError}return t}static implTranslateErrorDetails(e){let t="The speech service encountered an internal error and could not continue.";switch(e){case We.Forbidden:t="The recognizer is using a free subscription that ran out of quota.";break;case We.BadRequestParameters:t="Invalid parameter or unsupported audio format in the request.";break;case We.TooManyRequests:t="The number of parallel requests exceeded the number of allowed concurrent transcriptions."}return t}}(xt=St||(St={}))[xt.Success=0]="Success",xt[xt.SynthesisEnd=1]="SynthesisEnd",xt[xt.Error=2]="Error",(_t=Mt||(Mt={}))[_t.Success=0]="Success",_t[_t.NoMatch=1]="NoMatch",_t[_t.InitialSilenceTimeout=2]="InitialSilenceTimeout",_t[_t.BabbleTimeout=3]="BabbleTimeout",_t[_t.Error=4]="Error",_t[_t.EndOfDictation=5]="EndOfDictation",_t[_t.TooManyRequests=6]="TooManyRequests",_t[_t.BadRequest=7]="BadRequest",_t[_t.Forbidden=8]="Forbidden";class kt{constructor(){this.privKeys=[],this.privValues=[]}getProperty(e,t){let n;n="string"==typeof e?e:Qe[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===n)return this.privValues[e];if(void 0!==t)return String(t)}setProperty(e,t){let n;n="string"==typeof e?e:Qe[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===n)return void(this.privValues[e]=t);this.privKeys.push(n),this.privValues.push(t)}clone(){const e=new kt;for(let t=0;t<this.privKeys.length;t++)e.privKeys.push(this.privKeys[t]),e.privValues.push(this.privValues[t]);return e}mergeTo(e){this.privKeys.forEach((t=>{if(void 0===e.getProperty(t,void 0)){const n=this.getProperty(t);e.setProperty(t,n)}}))}get keys(){return this.privKeys}}class Rt{constructor(e,t,n,r,i,o,a,s,l,c){this.privResultId=e,this.privReason=t,this.privText=n,this.privDuration=r,this.privOffset=i,this.privLanguage=o,this.privLanguageDetectionConfidence=a,this.privErrorDetails=s,this.privJson=l,this.privProperties=c}get resultId(){return this.privResultId}get reason(){return this.privReason}get text(){return this.privText}get duration(){return this.privDuration}get offset(){return this.privOffset}get language(){return this.privLanguage}get languageDetectionConfidence(){return this.privLanguageDetectionConfidence}get errorDetails(){return this.privErrorDetails}get json(){return this.privJson}get properties(){return this.privProperties}}class Ot extends Rt{constructor(e,t,n,r,i,o,a,s,l,c,u){super(e,t,n,r,i,o,a,l,c,u),this.privSpeakerId=s}get speakerId(){return this.privSpeakerId}}class Pt{constructor(e){this.privSpeechStartDetected=JSON.parse(e)}static fromJSON(e){return new Pt(e)}get Offset(){return this.privSpeechStartDetected.Offset}}class Nt{constructor(e){this.privSpeechHypothesis=JSON.parse(e)}static fromJSON(e){return new Nt(e)}get Text(){return this.privSpeechHypothesis.Text}get Offset(){return this.privSpeechHypothesis.Offset}get Duration(){return this.privSpeechHypothesis.Duration}get Language(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSpeechHypothesis.SpeakerId}}var Bt={};e(Bt,"SpeechServiceRecognizer",(()=>zt),(e=>zt=e));class Lt extends $e{constructor(e,t,n,r,i){super(r,i),this.privReason=e,this.privErrorDetails=t,this.privErrorCode=n}get reason(){return this.privReason}get errorCode(){return this.privErrorCode}get errorDetails(){return this.privErrorDetails}}class Dt extends Lt{}class Ut extends $e{constructor(e,t,n){super(t,n),this.privResult=e}get result(){return this.privResult}}var Ft=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class zt extends Ye.ServiceRecognizerBase{constructor(e,t,n,r,i){if(super(e,t,n,r,i),this.privSpeechRecognizer=i,void 0!==r.autoDetectSourceLanguages){const e=r.autoDetectSourceLanguages.split(",");this.privSpeechContext.setSection("languageId",{Priority:r.languageIdPriority,languages:e,mode:r.languageIdMode,onSuccess:{action:"Recognize"},onUnknown:{action:"None"}}),this.privSpeechContext.setSection("phraseOutput",{interimResults:{resultType:"Auto"},phraseResults:{resultType:"Always"}});const t=r.sourceLanguageModels;void 0!==t&&this.privSpeechContext.setSection("phraseDetection",{customModels:t,onInterim:{action:"None"},onSuccess:{action:"None"}})}}processTypeSpecificMessages(e){return Ft(this,void 0,void 0,(function*(){let t;const n=new kt;n.setProperty(Qe.SpeechServiceResponse_JsonResult,e.textBody);let r=!1;switch(e.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const i=Nt.fromJSON(e.textBody),o=i.Offset+this.privRequestSession.currentTurnAudioOffset;t=new Ot(this.privRequestSession.requestId,yt.RecognizingSpeech,i.Text,i.Duration,o,i.Language,i.LanguageDetectionConfidence,void 0,void 0,e.textBody,n),this.privRequestSession.onHypothesis(o);const a=new Ut(t,i.Duration,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognizing)try{this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer,a)}catch(e){}r=!0;break;case"speech.phrase":const s=Ht.fromJSON(e.textBody),l=It.implTranslateRecognitionResult(s.RecognitionStatus);if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+s.Offset+s.Duration),yt.Canceled===l){const e=It.implTranslateCancelResult(s.RecognitionStatus),t=It.implTranslateCancelErrorCode(s.RecognitionStatus);yield this.cancelRecognitionLocal(e,t,It.implTranslateErrorDetails(t))}else{if(!this.privRequestSession.isSpeechEnded||l!==yt.NoMatch||s.RecognitionStatus===Mt.InitialSilenceTimeout){if(this.privRecognizerConfig.parameters.getProperty(Xn)===vt[vt.Simple])t=new Ot(this.privRequestSession.requestId,l,s.DisplayText,s.Duration,s.Offset+this.privRequestSession.currentTurnAudioOffset,s.Language,s.LanguageDetectionConfidence,void 0,void 0,e.textBody,n);else{const r=jt.fromJSON(e.textBody),i=r.Offset+this.privRequestSession.currentTurnAudioOffset,o=r.getJsonWithCorrectedOffsets(i);t=new Ot(this.privRequestSession.requestId,l,r.RecognitionStatus===Mt.Success?r.NBest[0].Display:void 0,r.Duration,i,r.Language,r.LanguageDetectionConfidence,void 0,void 0,o,n)}const r=new Ut(t,t.offset,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognized)try{this.privSpeechRecognizer.recognized(this.privSpeechRecognizer,r)}catch(e){}}if(this.privSuccessCallback){try{this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}r=!0}return r}))}cancelRecognition(e,t,n,r,i){const o=new kt;if(o.setProperty(Yn,We[r]),this.privSpeechRecognizer.canceled){const t=new Dt(n,i,r,void 0,e);try{this.privSpeechRecognizer.canceled(this.privSpeechRecognizer,t)}catch(e){}}if(this.privSuccessCallback){const e=new Ot(t,yt.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,i,void 0,o);try{this.privSuccessCallback(e),this.privSuccessCallback=void 0}catch(e){}}}}class jt{constructor(e){this.privDetailedSpeechPhrase=JSON.parse(e),this.privDetailedSpeechPhrase.RecognitionStatus=Mt[this.privDetailedSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new jt(e)}getJsonWithCorrectedOffsets(e){if(this.privDetailedSpeechPhrase.NBest){let t;for(const e of this.privDetailedSpeechPhrase.NBest)if(e.Words&&e.Words[0]){t=e.Words[0].Offset;break}if(t&&t<e){const n=e-t;for(const e of this.privDetailedSpeechPhrase.NBest)if(e.Words)for(const t of e.Words)t.Offset+=n}}return JSON.stringify(this.privDetailedSpeechPhrase)}get RecognitionStatus(){return this.privDetailedSpeechPhrase.RecognitionStatus}get NBest(){return this.privDetailedSpeechPhrase.NBest}get Duration(){return this.privDetailedSpeechPhrase.Duration}get Offset(){return this.privDetailedSpeechPhrase.Offset}get Language(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence}get Text(){return this.privDetailedSpeechPhrase.NBest&&this.privDetailedSpeechPhrase.NBest[0]?this.privDetailedSpeechPhrase.NBest[0].Display||this.privDetailedSpeechPhrase.NBest[0].DisplayText:this.privDetailedSpeechPhrase.DisplayText}get SpeakerId(){return this.privDetailedSpeechPhrase.SpeakerId}}class Ht{constructor(e){this.privSimpleSpeechPhrase=JSON.parse(e),this.privSimpleSpeechPhrase.RecognitionStatus=Mt[this.privSimpleSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new Ht(e)}get RecognitionStatus(){return this.privSimpleSpeechPhrase.RecognitionStatus}get DisplayText(){return this.privSimpleSpeechPhrase.DisplayText}get Offset(){return this.privSimpleSpeechPhrase.Offset}get Duration(){return this.privSimpleSpeechPhrase.Duration}get Language(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSimpleSpeechPhrase.SpeakerId}}var Gt,Vt,Wt={};e(Wt,"RequestSession",(()=>an),(e=>an=e));class qt extends R{constructor(e,t,n,r=M.Info){super(e,r),this.privRequestId=t,this.privSessionId=n}get requestId(){return this.privRequestId}get sessionId(){return this.privSessionId}}class Kt extends qt{constructor(e,t,n,r){super("RecognitionTriggeredEvent",e,t),this.privAudioSourceId=n,this.privAudioNodeId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class Jt extends qt{constructor(e,t,n,r){super("ListeningStartedEvent",e,t),this.privAudioSourceId=n,this.privAudioNodeId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class Qt extends qt{constructor(e,t,n){super("ConnectingToServiceEvent",e,n),this.privAuthFetchEventid=t}get authFetchEventid(){return this.privAuthFetchEventid}}class Xt extends qt{constructor(e,t,n,r,i){super("RecognitionStartedEvent",e,i),this.privAudioSourceId=t,this.privAudioNodeId=n,this.privAuthFetchEventId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}get authFetchEventId(){return this.privAuthFetchEventId}}(Vt=Gt||(Gt={}))[Vt.Success=0]="Success",Vt[Vt.AudioSourceError=1]="AudioSourceError",Vt[Vt.AudioSourceTimeout=2]="AudioSourceTimeout",Vt[Vt.AuthTokenFetchError=3]="AuthTokenFetchError",Vt[Vt.AuthTokenFetchTimeout=4]="AuthTokenFetchTimeout",Vt[Vt.UnAuthorized=5]="UnAuthorized",Vt[Vt.ConnectTimeout=6]="ConnectTimeout",Vt[Vt.ConnectError=7]="ConnectError",Vt[Vt.ClientRecognitionActivityTimeout=8]="ClientRecognitionActivityTimeout",Vt[Vt.UnknownError=9]="UnknownError";class Yt{constructor(e,t,n){this.privIsDisposed=!1,this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privRequestId=e,this.privAudioSourceId=t,this.privAudioNodeId=n,this.privReceivedMessages={},this.privPhraseLatencies=[],this.privHypothesisLatencies=[]}phraseReceived(e){e>0&&this.privPhraseLatencies.push(Date.now()-e)}hypothesisReceived(e){e>0&&this.privHypothesisLatencies.push(Date.now()-e)}onEvent(e){if(!this.privIsDisposed&&(e instanceof Kt&&e.requestId===this.privRequestId&&(this.privListeningTriggerMetric={End:e.eventTime,Name:"ListeningTrigger",Start:e.eventTime}),e instanceof U&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof F&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof L&&e.audioSourceId===this.privAudioSourceId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof j&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof z&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Name:"Microphone",Start:this.privMicStartTime})),e instanceof Qt&&e.requestId===this.privRequestId&&(this.privConnectionId=e.sessionId),e instanceof V&&e.connectionId===this.privConnectionId&&(this.privConnectionStartTime=e.eventTime),e instanceof W&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof J&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Error:this.getConnectionError(e.statusCode),Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof Q&&e.connectionId===this.privConnectionId&&e.message&&e.message.headers&&e.message.headers.path)){this.privReceivedMessages[e.message.headers.path]||(this.privReceivedMessages[e.message.headers.path]=new Array);const t=50;this.privReceivedMessages[e.message.headers.path].length<t&&this.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime)}}getTelemetry(){const e=new Array;this.privListeningTriggerMetric&&e.push(this.privListeningTriggerMetric),this.privMicMetric&&e.push(this.privMicMetric),this.privConnectionEstablishMetric&&e.push(this.privConnectionEstablishMetric),this.privPhraseLatencies.length>0&&e.push({PhraseLatencyMs:this.privPhraseLatencies}),this.privHypothesisLatencies.length>0&&e.push({FirstHypothesisLatencyMs:this.privHypothesisLatencies});const t={Metrics:e,ReceivedMessages:this.privReceivedMessages},n=JSON.stringify(t);return this.privReceivedMessages={},this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privPhraseLatencies=[],this.privHypothesisLatencies=[],n}get hasTelemetry(){return 0!==Object.keys(this.privReceivedMessages).length||null!==this.privListeningTriggerMetric||null!==this.privMicMetric||null!==this.privConnectionEstablishMetric||0!==this.privPhraseLatencies.length||0!==this.privHypothesisLatencies.length}dispose(){this.privIsDisposed=!0}getConnectionError(e){switch(e){case 400:case 1002:case 1003:case 1005:case 1007:case 1008:case 1009:return"BadRequest";case 401:return"Unauthorized";case 403:return"Forbidden";case 503:case 1001:return"ServerUnavailable";case 500:case 1011:return"ServerError";case 408:case 504:return"Timeout";default:return"statuscode:"+e.toString()}}}var Zt,$t,en,tn,nn,rn,on=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class an{constructor(e){this.privIsDisposed=!1,this.privDetachables=new Array,this.privIsAudioNodeDetached=!1,this.privIsRecognizing=!1,this.privIsSpeechEnded=!1,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privHypothesisReceived=!1,this.privBytesSent=0,this.privRecogNumber=0,this.privInTurn=!1,this.privConnectionAttempts=0,this.privAudioSourceId=e,this.privRequestId=x(),this.privAudioNodeId=x(),this.privTurnDeferral=new ie,this.privTurnDeferral.resolve()}get sessionId(){return this.privSessionId}get requestId(){return this.privRequestId}get audioNodeId(){return this.privAudioNodeId}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSpeechEnded(){return this.privIsSpeechEnded}get isRecognizing(){return this.privIsRecognizing}get currentTurnAudioOffset(){return this.privTurnStartAudioOffset}get recogNumber(){return this.privRecogNumber}get numConnectionAttempts(){return this.privConnectionAttempts}get bytesSent(){return this.privBytesSent}listenForServiceTelemetry(e){this.privServiceTelemetryListener&&this.privDetachables.push(e.attachListener(this.privServiceTelemetryListener))}startNewRecognition(){this.privIsSpeechEnded=!1,this.privIsRecognizing=!0,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privRecogNumber++,this.privServiceTelemetryListener=new Yt(this.privRequestId,this.privAudioSourceId,this.privAudioNodeId),this.onEvent(new Kt(this.requestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}onAudioSourceAttachCompleted(e,t){return on(this,void 0,void 0,(function*(){this.privAudioNode=e,this.privIsAudioNodeDetached=!1,t?yield this.onComplete():this.onEvent(new Jt(this.privRequestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}))}onPreConnectionStart(e,t){this.privAuthFetchEventId=e,this.privSessionId=t,this.onEvent(new Qt(this.privRequestId,this.privAuthFetchEventId,this.privSessionId))}onAuthCompleted(e){return on(this,void 0,void 0,(function*(){e&&(yield this.onComplete())}))}onConnectionEstablishCompleted(e,t){return on(this,void 0,void 0,(function*(){if(200===e)return this.onEvent(new Xt(this.requestId,this.privAudioSourceId,this.privAudioNodeId,this.privAuthFetchEventId,this.privSessionId)),this.privAudioNode&&this.privAudioNode.replay(),this.privTurnStartAudioOffset=this.privLastRecoOffset,void(this.privBytesSent=0);403===e&&(yield this.onComplete())}))}onServiceTurnEndResponse(e){return on(this,void 0,void 0,(function*(){this.privTurnDeferral.resolve(),!e||this.isSpeechEnded?(yield this.onComplete(),this.privInTurn=!1):(this.privTurnStartAudioOffset=this.privLastRecoOffset,this.privAudioNode.replay())}))}onSpeechContext(){this.privRequestId=x()}onServiceTurnStartResponse(){this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch((()=>{}))),this.privInTurn=!0,this.privTurnDeferral=new ie}onHypothesis(e){this.privHypothesisReceived||(this.privHypothesisReceived=!0,this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(e)))}onPhraseRecognized(e){this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(e)),this.onServiceRecognized(e)}onServiceRecognized(e){this.privLastRecoOffset=e,this.privHypothesisReceived=!1,this.privAudioNode.shrinkBuffers(e),this.privConnectionAttempts=0}onAudioSent(e){this.privBytesSent+=e}onRetryConnection(){this.privConnectionAttempts++}dispose(){return on(this,void 0,void 0,(function*(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const e of this.privDetachables)yield e.detach();this.privServiceTelemetryListener&&this.privServiceTelemetryListener.dispose(),this.privIsRecognizing=!1}}))}getTelemetry(){return this.privServiceTelemetryListener.hasTelemetry?this.privServiceTelemetryListener.getTelemetry():null}onStopRecognizing(){return on(this,void 0,void 0,(function*(){yield this.onComplete()}))}onSpeechEnded(){this.privIsSpeechEnded=!0}onEvent(e){this.privServiceTelemetryListener&&this.privServiceTelemetryListener.onEvent(e),re.instance.onEvent(e)}onComplete(){return on(this,void 0,void 0,(function*(){this.privIsRecognizing&&(this.privIsRecognizing=!1,yield this.detachAudioNode())}))}detachAudioNode(){return on(this,void 0,void 0,(function*(){this.privIsAudioNodeDetached||(this.privIsAudioNodeDetached=!0,this.privAudioNode&&(yield this.privAudioNode.detach()))}))}}class sn{constructor(e){this.privContext={},this.privDynamicGrammar=e}setSection(e,t){this.privContext[e]=t}setPronunciationAssessmentParams(e){void 0===this.privContext.phraseDetection&&(this.privContext.phraseDetection={enrichment:{pronunciationAssessment:{}}}),this.privContext.phraseDetection.enrichment.pronunciationAssessment=JSON.parse(e),this.setWordLevelTimings(),this.privContext.phraseOutput.detailed.options.push("PronunciationAssessment"),-1===this.privContext.phraseOutput.detailed.options.indexOf("SNR")&&this.privContext.phraseOutput.detailed.options.push("SNR")}setWordLevelTimings(){void 0===this.privContext.phraseOutput&&(this.privContext.phraseOutput={detailed:{options:[]},format:{}}),void 0===this.privContext.phraseOutput.detailed&&(this.privContext.phraseOutput.detailed={options:[]}),this.privContext.phraseOutput.format="Detailed",-1===this.privContext.phraseOutput.detailed.options.indexOf("WordTimings")&&this.privContext.phraseOutput.detailed.options.push("WordTimings")}toJSON(){const e=this.privDynamicGrammar.generateGrammarObject();this.setSection("dgi",e);return JSON.stringify(this.privContext)}}class ln{addPhrase(e){this.privPhrases||(this.privPhrases=[]),e instanceof Array?this.privPhrases=this.privPhrases.concat(e):this.privPhrases.push(e)}clearPhrases(){this.privPhrases=void 0}addReferenceGrammar(e){this.privGrammars||(this.privGrammars=[]),e instanceof Array?this.privGrammars=this.privGrammars.concat(e):this.privGrammars.push(e)}clearGrammars(){this.privGrammars=void 0}generateGrammarObject(){if(void 0===this.privGrammars&&void 0===this.privPhrases)return;const e={};if(e.ReferenceGrammars=this.privGrammars,void 0!==this.privPhrases&&0!==this.privPhrases.length){const t=[];this.privPhrases.forEach((e=>{t.push({Text:e})})),e.Groups=[{Type:"Generic",Items:t}]}return e}}($t=Zt||(Zt={}))[$t.Raw8Khz8BitMonoMULaw=0]="Raw8Khz8BitMonoMULaw",$t[$t.Riff16Khz16KbpsMonoSiren=1]="Riff16Khz16KbpsMonoSiren",$t[$t.Audio16Khz16KbpsMonoSiren=2]="Audio16Khz16KbpsMonoSiren",$t[$t.Audio16Khz32KBitRateMonoMp3=3]="Audio16Khz32KBitRateMonoMp3",$t[$t.Audio16Khz128KBitRateMonoMp3=4]="Audio16Khz128KBitRateMonoMp3",$t[$t.Audio16Khz64KBitRateMonoMp3=5]="Audio16Khz64KBitRateMonoMp3",$t[$t.Audio24Khz48KBitRateMonoMp3=6]="Audio24Khz48KBitRateMonoMp3",$t[$t.Audio24Khz96KBitRateMonoMp3=7]="Audio24Khz96KBitRateMonoMp3",$t[$t.Audio24Khz160KBitRateMonoMp3=8]="Audio24Khz160KBitRateMonoMp3",$t[$t.Raw16Khz16BitMonoTrueSilk=9]="Raw16Khz16BitMonoTrueSilk",$t[$t.Riff16Khz16BitMonoPcm=10]="Riff16Khz16BitMonoPcm",$t[$t.Riff8Khz16BitMonoPcm=11]="Riff8Khz16BitMonoPcm",$t[$t.Riff24Khz16BitMonoPcm=12]="Riff24Khz16BitMonoPcm",$t[$t.Riff8Khz8BitMonoMULaw=13]="Riff8Khz8BitMonoMULaw",$t[$t.Raw16Khz16BitMonoPcm=14]="Raw16Khz16BitMonoPcm",$t[$t.Raw24Khz16BitMonoPcm=15]="Raw24Khz16BitMonoPcm",$t[$t.Raw8Khz16BitMonoPcm=16]="Raw8Khz16BitMonoPcm",$t[$t.Ogg16Khz16BitMonoOpus=17]="Ogg16Khz16BitMonoOpus",$t[$t.Ogg24Khz16BitMonoOpus=18]="Ogg24Khz16BitMonoOpus",$t[$t.Raw48Khz16BitMonoPcm=19]="Raw48Khz16BitMonoPcm",$t[$t.Riff48Khz16BitMonoPcm=20]="Riff48Khz16BitMonoPcm",$t[$t.Audio48Khz96KBitRateMonoMp3=21]="Audio48Khz96KBitRateMonoMp3",$t[$t.Audio48Khz192KBitRateMonoMp3=22]="Audio48Khz192KBitRateMonoMp3",$t[$t.Ogg48Khz16BitMonoOpus=23]="Ogg48Khz16BitMonoOpus",$t[$t.Webm16Khz16BitMonoOpus=24]="Webm16Khz16BitMonoOpus",$t[$t.Webm24Khz16BitMonoOpus=25]="Webm24Khz16BitMonoOpus",$t[$t.Raw24Khz16BitMonoTrueSilk=26]="Raw24Khz16BitMonoTrueSilk",$t[$t.Raw8Khz8BitMonoALaw=27]="Raw8Khz8BitMonoALaw",$t[$t.Riff8Khz8BitMonoALaw=28]="Riff8Khz8BitMonoALaw",$t[$t.Webm24Khz16Bit24KbpsMonoOpus=29]="Webm24Khz16Bit24KbpsMonoOpus",$t[$t.Audio16Khz16Bit32KbpsMonoOpus=30]="Audio16Khz16Bit32KbpsMonoOpus",$t[$t.Audio24Khz16Bit48KbpsMonoOpus=31]="Audio24Khz16Bit48KbpsMonoOpus",$t[$t.Audio24Khz16Bit24KbpsMonoOpus=32]="Audio24Khz16Bit24KbpsMonoOpus",$t[$t.Raw22050Hz16BitMonoPcm=33]="Raw22050Hz16BitMonoPcm",$t[$t.Riff22050Hz16BitMonoPcm=34]="Riff22050Hz16BitMonoPcm",$t[$t.Raw44100Hz16BitMonoPcm=35]="Raw44100Hz16BitMonoPcm",$t[$t.Riff44100Hz16BitMonoPcm=36]="Riff44100Hz16BitMonoPcm",(tn=en||(en={}))[tn.PCM=1]="PCM",tn[tn.MuLaw=2]="MuLaw",tn[tn.Siren=3]="Siren",tn[tn.MP3=4]="MP3",tn[tn.SILKSkype=5]="SILKSkype",tn[tn.OGG_OPUS=6]="OGG_OPUS",tn[tn.WEBM_OPUS=7]="WEBM_OPUS",tn[tn.ALaw=8]="ALaw",tn[tn.FLAC=9]="FLAC",tn[tn.OPUS=10]="OPUS";class cn{static getDefaultInputFormat(){return un.getDefaultInputFormat()}static getWaveFormat(e,t,n,r){return new un(e,t,n,r)}static getWaveFormatPCM(e,t,n){return new un(e,t,n)}}class un extends cn{constructor(e=16e3,t=16,n=1,r=en.PCM){super();let i=!0;switch(r){case en.PCM:this.formatTag=1;break;case en.ALaw:this.formatTag=6;break;case en.MuLaw:this.formatTag=7;break;default:i=!1}if(this.bitsPerSample=t,this.samplesPerSec=e,this.channels=n,this.avgBytesPerSec=this.samplesPerSec*this.channels*(this.bitsPerSample/8),this.blockAlign=this.channels*Math.max(this.bitsPerSample,8),i){this.privHeader=new ArrayBuffer(44);const e=new DataView(this.privHeader);this.setString(e,0,"RIFF"),e.setUint32(4,0,!0),this.setString(e,8,"WAVEfmt "),e.setUint32(16,16,!0),e.setUint16(20,this.formatTag,!0),e.setUint16(22,this.channels,!0),e.setUint32(24,this.samplesPerSec,!0),e.setUint32(28,this.avgBytesPerSec,!0),e.setUint16(32,this.channels*(this.bitsPerSample/8),!0),e.setUint16(34,this.bitsPerSample,!0),this.setString(e,36,"data"),e.setUint32(40,0,!0)}}static getDefaultInputFormat(){return new un}static getAudioContext(e){const t=window.AudioContext||window.webkitAudioContext||!1;if(t)return void 0!==e&&navigator.mediaDevices.getSupportedConstraints().sampleRate?new t({sampleRate:e}):new t;throw new Error("Browser does not support Web Audio API (AudioContext is not available).")}close(){}get header(){return this.privHeader}setString(e,t,n){for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))}}class dn extends un{constructor(e,t,n,r,i,o,a,s,l){super(n,o,t,e),this.formatTag=e,this.avgBytesPerSec=r,this.blockAlign=i,this.priAudioFormatString=a,this.priRequestAudioFormatString=s,this.priHasHeader=l}static fromSpeechSynthesisOutputFormat(e){return void 0===e?dn.getDefaultOutputFormat():dn.fromSpeechSynthesisOutputFormatString(dn.SpeechSynthesisOutputFormatToString[e])}static fromSpeechSynthesisOutputFormatString(e){switch(e){case"raw-8khz-8bit-mono-mulaw":return new dn(en.MuLaw,1,8e3,8e3,1,8,e,e,!1);case"riff-16khz-16kbps-mono-siren":return new dn(en.Siren,1,16e3,2e3,40,0,e,"audio-16khz-16kbps-mono-siren",!0);case"audio-16khz-16kbps-mono-siren":return new dn(en.Siren,1,16e3,2e3,40,0,e,e,!1);case"audio-16khz-32kbitrate-mono-mp3":return new dn(en.MP3,1,16e3,4096,2,16,e,e,!1);case"audio-16khz-128kbitrate-mono-mp3":return new dn(en.MP3,1,16e3,16384,2,16,e,e,!1);case"audio-16khz-64kbitrate-mono-mp3":return new dn(en.MP3,1,16e3,8192,2,16,e,e,!1);case"audio-24khz-48kbitrate-mono-mp3":return new dn(en.MP3,1,24e3,6144,2,16,e,e,!1);case"audio-24khz-96kbitrate-mono-mp3":return new dn(en.MP3,1,24e3,12288,2,16,e,e,!1);case"audio-24khz-160kbitrate-mono-mp3":return new dn(en.MP3,1,24e3,20480,2,16,e,e,!1);case"raw-16khz-16bit-mono-truesilk":return new dn(en.SILKSkype,1,16e3,32e3,2,16,e,e,!1);case"riff-8khz-16bit-mono-pcm":return new dn(en.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!0);case"riff-24khz-16bit-mono-pcm":return new dn(en.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!0);case"riff-8khz-8bit-mono-mulaw":return new dn(en.MuLaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-mulaw",!0);case"raw-16khz-16bit-mono-pcm":return new dn(en.PCM,1,16e3,32e3,2,16,e,"raw-16khz-16bit-mono-pcm",!1);case"raw-24khz-16bit-mono-pcm":return new dn(en.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!1);case"raw-8khz-16bit-mono-pcm":return new dn(en.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!1);case"ogg-16khz-16bit-mono-opus":return new dn(en.OGG_OPUS,1,16e3,8192,2,16,e,e,!1);case"ogg-24khz-16bit-mono-opus":return new dn(en.OGG_OPUS,1,24e3,8192,2,16,e,e,!1);case"raw-48khz-16bit-mono-pcm":return new dn(en.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!1);case"riff-48khz-16bit-mono-pcm":return new dn(en.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!0);case"audio-48khz-96kbitrate-mono-mp3":return new dn(en.MP3,1,48e3,12288,2,16,e,e,!1);case"audio-48khz-192kbitrate-mono-mp3":return new dn(en.MP3,1,48e3,24576,2,16,e,e,!1);case"ogg-48khz-16bit-mono-opus":return new dn(en.OGG_OPUS,1,48e3,12e3,2,16,e,e,!1);case"webm-16khz-16bit-mono-opus":return new dn(en.WEBM_OPUS,1,16e3,4e3,2,16,e,e,!1);case"webm-24khz-16bit-mono-opus":return new dn(en.WEBM_OPUS,1,24e3,6e3,2,16,e,e,!1);case"webm-24khz-16bit-24kbps-mono-opus":return new dn(en.WEBM_OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-16khz-16bit-32kbps-mono-opus":return new dn(en.OPUS,1,16e3,4e3,2,16,e,e,!1);case"audio-24khz-16bit-48kbps-mono-opus":return new dn(en.OPUS,1,24e3,6e3,2,16,e,e,!1);case"audio-24khz-16bit-24kbps-mono-opus":return new dn(en.OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-24khz-16bit-mono-flac":return new dn(en.FLAC,1,24e3,24e3,2,16,e,e,!1);case"audio-48khz-16bit-mono-flac":return new dn(en.FLAC,1,48e3,3e4,2,16,e,e,!1);case"raw-24khz-16bit-mono-truesilk":return new dn(en.SILKSkype,1,24e3,48e3,2,16,e,e,!1);case"raw-8khz-8bit-mono-alaw":return new dn(en.ALaw,1,8e3,8e3,1,8,e,e,!1);case"riff-8khz-8bit-mono-alaw":return new dn(en.ALaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-alaw",!0);case"raw-22050hz-16bit-mono-pcm":return new dn(en.PCM,1,22050,44100,2,16,e,e,!1);case"riff-22050hz-16bit-mono-pcm":return new dn(en.PCM,1,22050,44100,2,16,e,"raw-22050hz-16bit-mono-pcm",!0);case"raw-44100hz-16bit-mono-pcm":return new dn(en.PCM,1,44100,88200,2,16,e,e,!1);case"riff-44100hz-16bit-mono-pcm":return new dn(en.PCM,1,44100,88200,2,16,e,"raw-44100hz-16bit-mono-pcm",!0);default:return new dn(en.PCM,1,16e3,32e3,2,16,"riff-16khz-16bit-mono-pcm","raw-16khz-16bit-mono-pcm",!0)}}static getDefaultOutputFormat(){return dn.fromSpeechSynthesisOutputFormatString("undefined"!=typeof window?"audio-24khz-48kbitrate-mono-mp3":"riff-16khz-16bit-mono-pcm")}get hasHeader(){return this.priHasHeader}get header(){if(this.hasHeader)return this.privHeader}updateHeader(e){if(this.priHasHeader){const t=new DataView(this.privHeader);t.setUint32(4,e+this.privHeader.byteLength-8,!0),t.setUint32(40,e,!0)}}get requestAudioFormatString(){return this.priRequestAudioFormatString}}dn.SpeechSynthesisOutputFormatToString={[Zt.Raw8Khz8BitMonoMULaw]:"raw-8khz-8bit-mono-mulaw",[Zt.Riff16Khz16KbpsMonoSiren]:"riff-16khz-16kbps-mono-siren",[Zt.Audio16Khz16KbpsMonoSiren]:"audio-16khz-16kbps-mono-siren",[Zt.Audio16Khz32KBitRateMonoMp3]:"audio-16khz-32kbitrate-mono-mp3",[Zt.Audio16Khz128KBitRateMonoMp3]:"audio-16khz-128kbitrate-mono-mp3",[Zt.Audio16Khz64KBitRateMonoMp3]:"audio-16khz-64kbitrate-mono-mp3",[Zt.Audio24Khz48KBitRateMonoMp3]:"audio-24khz-48kbitrate-mono-mp3",[Zt.Audio24Khz96KBitRateMonoMp3]:"audio-24khz-96kbitrate-mono-mp3",[Zt.Audio24Khz160KBitRateMonoMp3]:"audio-24khz-160kbitrate-mono-mp3",[Zt.Raw16Khz16BitMonoTrueSilk]:"raw-16khz-16bit-mono-truesilk",[Zt.Riff16Khz16BitMonoPcm]:"riff-16khz-16bit-mono-pcm",[Zt.Riff8Khz16BitMonoPcm]:"riff-8khz-16bit-mono-pcm",[Zt.Riff24Khz16BitMonoPcm]:"riff-24khz-16bit-mono-pcm",[Zt.Riff8Khz8BitMonoMULaw]:"riff-8khz-8bit-mono-mulaw",[Zt.Raw16Khz16BitMonoPcm]:"raw-16khz-16bit-mono-pcm",[Zt.Raw24Khz16BitMonoPcm]:"raw-24khz-16bit-mono-pcm",[Zt.Raw8Khz16BitMonoPcm]:"raw-8khz-16bit-mono-pcm",[Zt.Ogg16Khz16BitMonoOpus]:"ogg-16khz-16bit-mono-opus",[Zt.Ogg24Khz16BitMonoOpus]:"ogg-24khz-16bit-mono-opus",[Zt.Raw48Khz16BitMonoPcm]:"raw-48khz-16bit-mono-pcm",[Zt.Riff48Khz16BitMonoPcm]:"riff-48khz-16bit-mono-pcm",[Zt.Audio48Khz96KBitRateMonoMp3]:"audio-48khz-96kbitrate-mono-mp3",[Zt.Audio48Khz192KBitRateMonoMp3]:"audio-48khz-192kbitrate-mono-mp3",[Zt.Ogg48Khz16BitMonoOpus]:"ogg-48khz-16bit-mono-opus",[Zt.Webm16Khz16BitMonoOpus]:"webm-16khz-16bit-mono-opus",[Zt.Webm24Khz16BitMonoOpus]:"webm-24khz-16bit-mono-opus",[Zt.Webm24Khz16Bit24KbpsMonoOpus]:"webm-24khz-16bit-24kbps-mono-opus",[Zt.Raw24Khz16BitMonoTrueSilk]:"raw-24khz-16bit-mono-truesilk",[Zt.Raw8Khz8BitMonoALaw]:"raw-8khz-8bit-mono-alaw",[Zt.Riff8Khz8BitMonoALaw]:"riff-8khz-8bit-mono-alaw",[Zt.Audio16Khz16Bit32KbpsMonoOpus]:"audio-16khz-16bit-32kbps-mono-opus",[Zt.Audio24Khz16Bit48KbpsMonoOpus]:"audio-24khz-16bit-48kbps-mono-opus",[Zt.Audio24Khz16Bit24KbpsMonoOpus]:"audio-24khz-16bit-24kbps-mono-opus",[Zt.Raw22050Hz16BitMonoPcm]:"raw-22050hz-16bit-mono-pcm",[Zt.Riff22050Hz16BitMonoPcm]:"riff-22050hz-16bit-mono-pcm",[Zt.Raw44100Hz16BitMonoPcm]:"raw-44100hz-16bit-mono-pcm",[Zt.Riff44100Hz16BitMonoPcm]:"riff-44100hz-16bit-mono-pcm"};(rn=nn||(nn={}))[rn.Masked=0]="Masked",rn[rn.Removed=1]="Removed",rn[rn.Raw=2]="Raw";class hn{constructor(){}static fromSubscription(e,t){Ue.throwIfNullOrWhitespace(e,"subscriptionKey"),Ue.throwIfNullOrWhitespace(t,"region");const n=new fn;return n.setProperty(Qe.SpeechServiceConnection_Region,t),n.setProperty(Qe.SpeechServiceConnection_IntentRegion,t),n.setProperty(Qe.SpeechServiceConnection_Key,e),n}static fromEndpoint(e,t){Ue.throwIfNull(e,"endpoint");const n=new fn;return n.setProperty(Qe.SpeechServiceConnection_Endpoint,e.href),void 0!==t&&n.setProperty(Qe.SpeechServiceConnection_Key,t),n}static fromHost(e,t){Ue.throwIfNull(e,"hostName");const n=new fn;return n.setProperty(Qe.SpeechServiceConnection_Host,e.protocol+"//"+e.hostname+(""===e.port?"":":"+e.port)),void 0!==t&&n.setProperty(Qe.SpeechServiceConnection_Key,t),n}static fromAuthorizationToken(e,t){Ue.throwIfNull(e,"authorizationToken"),Ue.throwIfNullOrWhitespace(t,"region");const n=new fn;return n.setProperty(Qe.SpeechServiceConnection_Region,t),n.setProperty(Qe.SpeechServiceConnection_IntentRegion,t),n.authorizationToken=e,n}close(){}}class fn extends hn{constructor(){super(),this.privProperties=new kt,this.speechRecognitionLanguage="en-US",this.outputFormat=vt.Simple}get properties(){return this.privProperties}get endPoint(){return new URL(this.privProperties.getProperty(Qe.SpeechServiceConnection_Endpoint))}get subscriptionKey(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_Key)}get region(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_Region)}get authorizationToken(){return this.privProperties.getProperty(Qe.SpeechServiceAuthorization_Token)}set authorizationToken(e){this.privProperties.setProperty(Qe.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_RecoLanguage)}set speechRecognitionLanguage(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_RecoLanguage,e)}get autoDetectSourceLanguages(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_AutoDetectSourceLanguages)}set autoDetectSourceLanguages(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_AutoDetectSourceLanguages,e)}get outputFormat(){return vt[this.privProperties.getProperty(Xn,void 0)]}set outputFormat(e){this.privProperties.setProperty(Xn,vt[e])}get endpointId(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_EndpointId)}set endpointId(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_EndpointId,e)}setProperty(e,t){Ue.throwIfNull(t,"value"),this.privProperties.setProperty(e,t)}getProperty(e,t){return this.privProperties.getProperty(e,t)}setProxy(e,t,n,r){this.setProperty(Qe[Qe.SpeechServiceConnection_ProxyHostName],e),this.setProperty(Qe[Qe.SpeechServiceConnection_ProxyPort],t),this.setProperty(Qe[Qe.SpeechServiceConnection_ProxyUserName],n),this.setProperty(Qe[Qe.SpeechServiceConnection_ProxyPassword],r)}setServiceProperty(e,t){const n=JSON.parse(this.privProperties.getProperty(Zn,"{}"));n[e]=t,this.privProperties.setProperty(Zn,JSON.stringify(n))}setProfanity(e){this.privProperties.setProperty(Qe.SpeechServiceResponse_ProfanityOption,nn[e])}enableAudioLogging(){this.privProperties.setProperty(Qe.SpeechServiceConnection_EnableAudioLogging,"true")}requestWordLevelTimestamps(){this.privProperties.setProperty(Qe.SpeechServiceResponse_RequestWordLevelTimestamps,"true")}enableDictation(){this.privProperties.setProperty($n,"true")}clone(){const e=new fn;return e.privProperties=this.privProperties.clone(),e}get speechSynthesisLanguage(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_SynthLanguage)}set speechSynthesisLanguage(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_SynthLanguage,e)}get speechSynthesisVoiceName(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_SynthVoice)}set speechSynthesisVoiceName(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_SynthVoice,e)}get speechSynthesisOutputFormat(){return Zt[this.privProperties.getProperty(Qe.SpeechServiceConnection_SynthOutputFormat,void 0)]}set speechSynthesisOutputFormat(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_SynthOutputFormat,Zt[e])}}var pn={};e(pn,"AudioOutputStream",(()=>bn),(e=>bn=e)),e(pn,"PullAudioOutputStream",(()=>yn),(e=>yn=e)),e(pn,"PullAudioOutputStreamImpl",(()=>wn),(e=>wn=e)),e(pn,"PushAudioOutputStream",(()=>Sn),(e=>Sn=e)),e(pn,"PushAudioOutputStreamImpl",(()=>xn),(e=>xn=e));var mn,gn,vn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class bn{constructor(){}static createPullStream(){return yn.create()}}class yn extends bn{static create(){return new wn}}class wn extends yn{constructor(){super(),this.privId=x(),this.privStream=new(0,pe.Stream)}set format(e){null==e&&(this.privFormat=dn.getDefaultOutputFormat()),this.privFormat=e}get format(){return this.privFormat}get isClosed(){return this.privStream.isClosed}id(){return this.privId}read(e){return vn(this,void 0,void 0,(function*(){const t=new Int8Array(e);let n=0;if(void 0!==this.privLastChunkView){if(this.privLastChunkView.length>e.byteLength)return t.set(this.privLastChunkView.slice(0,e.byteLength)),this.privLastChunkView=this.privLastChunkView.slice(e.byteLength),Promise.resolve(e.byteLength);t.set(this.privLastChunkView),n=this.privLastChunkView.length,this.privLastChunkView=void 0}for(;n<e.byteLength&&!this.privStream.isReadEnded;){const r=yield this.privStream.read();if(void 0===r||r.isEnd)this.privStream.readEnded();else{let i;r.buffer.byteLength>e.byteLength-n?(i=r.buffer.slice(0,e.byteLength-n),this.privLastChunkView=new Int8Array(r.buffer.slice(e.byteLength-n))):i=r.buffer,t.set(new Int8Array(i),n),n+=i.byteLength}}return n}))}write(e){Ue.throwIfNullOrUndefined(this.privStream,"must set format before writing"),this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}}class Sn extends bn{constructor(){super()}static create(e){return new xn(e)}}class xn extends Sn{constructor(e){super(),this.privId=x(),this.privCallback=e}set format(e){}write(e){this.privCallback.write&&this.privCallback.write(e)}close(){this.privCallback.close&&this.privCallback.close()}id(){return this.privId}}(gn=mn||(mn={}))[gn.None=0]="None",gn[gn.TextToSpeechAudio=1]="TextToSpeechAudio";var Mn,_n;class An{toJsonString(){return JSON.stringify(this.iPrivConfig)}get(){return this.iPrivConfig}set(e){this.iPrivConfig=e}}(_n=Mn||(Mn={})).WordBoundary="WordBoundary",_n.Bookmark="Bookmark",_n.Viseme="Viseme",_n.SentenceBoundary="SentenceBoundary",_n.SessionEnd="SessionEnd";class En{constructor(e){this.privSynthesisAudioMetadata=JSON.parse(e)}static fromJSON(e){return new En(e)}get Metadata(){return this.privSynthesisAudioMetadata.Metadata}}var Cn={};e(Cn,"SynthesisTurn",(()=>qn),(e=>qn=e));var Tn={};e(Tn,"SynthesisAdapterBase",(()=>Ln),(e=>Ln=e));class In{constructor(e,t){this.privAudioOffset=e,this.privText=t}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}}class kn{constructor(e){this.privResult=e}get result(){return this.privResult}}class Rn{constructor(e,t,n,r){this.privResultId=e,this.privReason=t,this.privErrorDetails=n,this.privProperties=r}get resultId(){return this.privResultId}get reason(){return this.privReason}get errorDetails(){return this.privErrorDetails}get properties(){return this.privProperties}}class On extends Rn{constructor(e,t,n,r,i,o){super(e,t,r,i),this.privAudioData=n,this.privAudioDuration=o}get audioData(){return this.privAudioData}get audioDuration(){return this.privAudioDuration}}class Pn{constructor(e,t,n){this.privAudioOffset=e,this.privVisemeId=t,this.privAnimation=n}get audioOffset(){return this.privAudioOffset}get visemeId(){return this.privVisemeId}get animation(){return this.privAnimation}}class Nn{constructor(e,t,n,r,i,o){this.privAudioOffset=e,this.privDuration=t,this.privText=n,this.privWordLength=r,this.privTextOffset=i,this.privBoundaryType=o}get audioOffset(){return this.privAudioOffset}get duration(){return this.privDuration}get text(){return this.privText}get wordLength(){return this.privWordLength}get textOffset(){return this.privTextOffset}get boundaryType(){return this.privBoundaryType}}var Bn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Ln{constructor(e,t,n,r,i){if(this.speakOverride=void 0,this.receiveMessageOverride=void 0,this.connectImplOverride=void 0,this.configConnectionOverride=void 0,this.privConnectionConfigurationPromise=void 0,!e)throw new Y("authentication");if(!t)throw new Y("connectionFactory");if(!n)throw new Y("synthesizerConfig");this.privAuthentication=e,this.privConnectionFactory=t,this.privSynthesizerConfig=n,this.privIsDisposed=!1,this.privSpeechSynthesizer=r,this.privSessionAudioDestination=i,this.privSynthesisTurn=new(0,Cn.SynthesisTurn),this.privConnectionEvents=new ne,this.privServiceEvents=new ne,this.privSynthesisContext=new Qn(this.privSpeechSynthesizer),this.privAgentConfig=new An,this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;1e3!==t.statusCode&&this.cancelSynthesisLocal(Ke.Error,1007===t.statusCode?We.BadRequestParameters:We.ConnectionFailure,`${t.reason} websocket error code: ${t.statusCode}`)}}))}get synthesisContext(){return this.privSynthesisContext}get agentConfig(){return this.privAgentConfig}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}set audioOutputFormat(e){this.privAudioOutputFormat=e,this.privSynthesisTurn.audioOutputFormat=e,void 0!==this.privSessionAudioDestination&&(this.privSessionAudioDestination.format=e),void 0!==this.synthesisContext&&(this.synthesisContext.audioOutputFormat=e)}static addHeader(e,t){if(!t.hasHeader)return e;t.updateHeader(e.byteLength);const n=new Uint8Array(e.byteLength+t.header.byteLength);return n.set(new Uint8Array(t.header),0),n.set(new Uint8Array(e),t.header.byteLength),n.buffer}isDisposed(){return this.privIsDisposed}dispose(e){return Bn(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.close(),void 0!==this.privConnectionConfigurationPromise){const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}}))}connect(){return Bn(this,void 0,void 0,(function*(){yield this.connectImpl()}))}sendNetworkMessage(e,t){return Bn(this,void 0,void 0,(function*(){const n="string"==typeof t?A.Text:A.Binary,r="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new et(n,e,this.privSynthesisTurn.requestId,r,t))}))}Speak(e,t,n,r,i,o){return Bn(this,void 0,void 0,(function*(){let a;if(a=t?e:this.privSpeechSynthesizer.buildSsml(e),void 0!==this.speakOverride)return this.speakOverride(a,n,r,i);this.privSuccessCallback=r,this.privErrorCallback=i,this.privSynthesisTurn.startNewSynthesis(n,e,t,o);try{yield this.connectImpl();const e=yield this.fetchConnection();yield this.sendSynthesisContext(e),yield this.sendSsmlMessage(e,a,n);const t=new kn(new On(n,yt.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,t),this.receiveMessage()}catch(e){return this.cancelSynthesisLocal(Ke.Error,We.ConnectionFailure,e),Promise.reject(e)}}))}cancelSynthesis(e,t,n,r){const i=new kt;i.setProperty(Yn,We[n]);const o=new On(e,yt.Canceled,void 0,r,i);if(this.privSpeechSynthesizer.SynthesisCanceled){const e=new kn(o);try{this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer,e)}catch(e){}}if(this.privSuccessCallback)try{this.privSuccessCallback(o)}catch(e){}}cancelSynthesisLocal(e,t,n){this.privSynthesisTurn.isSynthesizing&&(this.privSynthesisTurn.onStopSynthesizing(),this.cancelSynthesis(this.privSynthesisTurn.requestId,e,t,n))}processTypeSpecificMessages(e){return!0}receiveMessage(){return Bn(this,void 0,void 0,(function*(){try{const e=yield this.fetchConnection(),t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(this.privIsDisposed)return;if(!t)return this.privSynthesisTurn.isSynthesizing?this.receiveMessage():void 0;const n=et.fromConnectionMessage(t);if(n.requestId.toLowerCase()===this.privSynthesisTurn.requestId.toLowerCase())switch(n.path.toLowerCase()){case"turn.start":this.privSynthesisTurn.onServiceTurnStartResponse();break;case"response":this.privSynthesisTurn.onServiceResponseMessage(n.textBody);break;case"audio":if(this.privSynthesisTurn.streamId.toLowerCase()===n.streamId.toLowerCase()&&n.binaryBody){if(this.privSynthesisTurn.onAudioChunkReceived(n.binaryBody),this.privSpeechSynthesizer.synthesizing)try{const e=Ln.addHeader(n.binaryBody,this.privSynthesisTurn.audioOutputFormat),t=new kn(new On(this.privSynthesisTurn.requestId,yt.SynthesizingAudio,e));this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer,t)}catch(e){}void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.write(n.binaryBody)}break;case"audio.metadata":const e=En.fromJSON(n.textBody).Metadata;for(const t of e)switch(t.Type){case Mn.WordBoundary:case Mn.SentenceBoundary:this.privSynthesisTurn.onTextBoundaryEvent(t);const e=new Nn(t.Data.Offset,t.Data.Duration,t.Data.text.Text,t.Data.text.Length,t.Type===Mn.WordBoundary?this.privSynthesisTurn.currentTextOffset:this.privSynthesisTurn.currentSentenceOffset,t.Data.text.BoundaryType);if(this.privSpeechSynthesizer.wordBoundary)try{this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer,e)}catch(e){}break;case Mn.Bookmark:const n=new In(t.Data.Offset,t.Data.Bookmark);if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,n)}catch(e){}break;case Mn.Viseme:if(this.privSynthesisTurn.onVisemeMetadataReceived(t),t.Data.IsLastAnimation){const e=new Pn(t.Data.Offset,t.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation());if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,e)}catch(e){}}break;case Mn.SessionEnd:this.privSynthesisTurn.onSessionEnd(t)}break;case"turn.end":let t;this.privSynthesisTurn.onServiceTurnEndResponse();try{const e=yield this.privSynthesisTurn.getAllReceivedAudioWithHeader();t=new On(this.privSynthesisTurn.requestId,yt.SynthesizingAudioCompleted,e,void 0,void 0,this.privSynthesisTurn.audioDuration),this.privSuccessCallback&&this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}if(this.privSpeechSynthesizer.synthesisCompleted)try{this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer,new kn(t))}catch(e){}break;default:this.processTypeSpecificMessages(n)||this.privServiceEvents&&this.serviceEvents.onEvent(new H(n.path.toLowerCase(),n.textBody))}return this.receiveMessage()}catch(e){}}))}sendSynthesisContext(e){const t=this.synthesisContext.toJSON();if(t)return e.send(new et(A.Text,"synthesis.context",this.privSynthesisTurn.requestId,"application/json",t))}connectImpl(e=!1){if(null!=this.privConnectionPromise)return this.privConnectionPromise.then((e=>e.state()===C.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl()):this.privConnectionPromise),(()=>(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl())));this.privAuthFetchEventId=x(),this.privConnectionId=x(),this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId);const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId);return this.privConnectionPromise=t.then((t=>Bn(this,void 0,void 0,(function*(){this.privSynthesisTurn.onAuthCompleted(!1);const n=this.privConnectionFactory.create(this.privSynthesizerConfig,t,this.privConnectionId);n.events.attach((e=>{this.connectionEvents.onEvent(e)}));const r=yield n.open();return 200===r.statusCode?(this.privSynthesisTurn.onConnectionEstablishCompleted(r.statusCode),Promise.resolve(n)):403!==r.statusCode||e?(this.privSynthesisTurn.onConnectionEstablishCompleted(r.statusCode),Promise.reject(`Unable to contact server. StatusCode: ${r.statusCode}, ${this.privSynthesizerConfig.parameters.getProperty(Qe.SpeechServiceConnection_Endpoint)} Reason: ${r.reason}`)):this.connectImpl(!0)}))),(e=>{throw this.privSynthesisTurn.onAuthCompleted(!0),new Error(e)})),this.privConnectionPromise.catch((()=>{})),this.privConnectionPromise}sendSpeechServiceConfig(e,t){if(t)return e.send(new et(A.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",t))}sendSsmlMessage(e,t,n){return e.send(new et(A.Text,"ssml",n,"application/ssml+xml",t))}fetchConnection(){return Bn(this,void 0,void 0,(function*(){return void 0!==this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===C.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.fetchConnection()):this.privConnectionConfigurationPromise),(()=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.fetchConnection()))):(this.privConnectionConfigurationPromise=this.configureConnection(),yield this.privConnectionConfigurationPromise)}))}configureConnection(){return Bn(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privSynthesizerConfig.SpeechServiceConfig.serialize()),e)}))}}Ln.telemetryDataEnabled=!0;class Dn extends R{constructor(e,t,n=M.Info){super(e,n),this.privRequestId=t}get requestId(){return this.privRequestId}}class Un extends Dn{constructor(e,t,n){super("SynthesisTriggeredEvent",e),this.privSessionAudioDestinationId=t,this.privTurnAudioDestinationId=n}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}class Fn extends Dn{constructor(e,t){super("ConnectingToSynthesisServiceEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}class zn extends Dn{constructor(e,t){super("SynthesisStartedEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}var jn,Hn,Gn,Vn,Wn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class qn{constructor(){this.privIsDisposed=!1,this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!1,this.privBytesReceived=0,this.privInTurn=!1,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.privSentenceOffset=0,this.privNextSearchSentenceIndex=0,this.privRequestId=x(),this.privTurnDeferral=new ie,this.privTurnDeferral.resolve()}get requestId(){return this.privRequestId}get streamId(){return this.privStreamId}set streamId(e){this.privStreamId=e}get audioOutputFormat(){return this.privAudioOutputFormat}set audioOutputFormat(e){this.privAudioOutputFormat=e}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSynthesisEnded(){return this.privIsSynthesisEnded}get isSynthesizing(){return this.privIsSynthesizing}get currentTextOffset(){return this.privTextOffset}get currentSentenceOffset(){return this.privSentenceOffset}get bytesReceived(){return this.privBytesReceived}get audioDuration(){return this.privAudioDuration}getAllReceivedAudio(){return Wn(this,void 0,void 0,(function*(){return this.privReceivedAudio?Promise.resolve(this.privReceivedAudio):this.privIsSynthesisEnded?(yield this.readAllAudioFromStream(),Promise.resolve(this.privReceivedAudio)):null}))}getAllReceivedAudioWithHeader(){return Wn(this,void 0,void 0,(function*(){if(this.privReceivedAudioWithHeader)return this.privReceivedAudioWithHeader;if(!this.privIsSynthesisEnded)return null;if(this.audioOutputFormat.hasHeader){const e=yield this.getAllReceivedAudio();return this.privReceivedAudioWithHeader=Tn.SynthesisAdapterBase.addHeader(e,this.audioOutputFormat),this.privReceivedAudioWithHeader}return this.getAllReceivedAudio()}))}startNewSynthesis(e,t,n,r){this.privIsSynthesisEnded=!1,this.privIsSynthesizing=!0,this.privRequestId=e,this.privRawText=t,this.privIsSSML=n,this.privAudioOutputStream=new(0,pn.PullAudioOutputStreamImpl),this.privAudioOutputStream.format=this.privAudioOutputFormat,this.privReceivedAudio=null,this.privReceivedAudioWithHeader=null,this.privBytesReceived=0,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.privSentenceOffset=0,this.privNextSearchSentenceIndex=0,this.privPartialVisemeAnimation="",void 0!==r&&(this.privTurnAudioDestination=r,this.privTurnAudioDestination.format=this.privAudioOutputFormat),this.onEvent(new Un(this.requestId,void 0,void 0===r?void 0:r.id()))}onPreConnectionStart(e){this.privAuthFetchEventId=e,this.onEvent(new Fn(this.privRequestId,this.privAuthFetchEventId))}onAuthCompleted(e){e&&this.onComplete()}onConnectionEstablishCompleted(e){if(200===e)return this.onEvent(new zn(this.requestId,this.privAuthFetchEventId)),void(this.privBytesReceived=0);403===e&&this.onComplete()}onServiceResponseMessage(e){const t=JSON.parse(e);this.streamId=t.audio.streamId}onServiceTurnEndResponse(){this.privInTurn=!1,this.privTurnDeferral.resolve(),this.onComplete()}onServiceTurnStartResponse(){this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch((()=>{}))),this.privInTurn=!0,this.privTurnDeferral=new ie}onAudioChunkReceived(e){this.isSynthesizing&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength,void 0!==this.privTurnAudioDestination&&this.privTurnAudioDestination.write(e))}onTextBoundaryEvent(e){this.updateTextOffset(e.Data.text.Text,e.Type)}onVisemeMetadataReceived(e){void 0!==e.Data.AnimationChunk&&(this.privPartialVisemeAnimation+=e.Data.AnimationChunk)}onSessionEnd(e){this.privAudioDuration=e.Data.Offset}dispose(){this.privIsDisposed||(this.privIsDisposed=!0)}onStopSynthesizing(){this.onComplete()}getAndClearVisemeAnimation(){const e=this.privPartialVisemeAnimation;return this.privPartialVisemeAnimation="",e}onEvent(e){re.instance.onEvent(e)}static isXmlTag(e){return e.length>=2&&"<"===e[0]&&">"===e[e.length-1]}updateTextOffset(e,t){t===Mn.WordBoundary?(this.privTextOffset=this.privRawText.indexOf(e,this.privNextSearchTextIndex),this.privTextOffset>=0&&(this.privNextSearchTextIndex=this.privTextOffset+e.length,this.privIsSSML&&this.withinXmlTag(this.privTextOffset)&&!qn.isXmlTag(e)&&this.updateTextOffset(e,t))):(this.privSentenceOffset=this.privRawText.indexOf(e,this.privNextSearchSentenceIndex),this.privSentenceOffset>=0&&(this.privNextSearchSentenceIndex=this.privSentenceOffset+e.length,this.privIsSSML&&this.withinXmlTag(this.privSentenceOffset)&&!qn.isXmlTag(e)&&this.updateTextOffset(e,t)))}onComplete(){this.privIsSynthesizing&&(this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!0,this.privAudioOutputStream.close(),this.privInTurn=!1,void 0!==this.privTurnAudioDestination&&(this.privTurnAudioDestination.close(),this.privTurnAudioDestination=void 0))}readAllAudioFromStream(){return Wn(this,void 0,void 0,(function*(){if(this.privIsSynthesisEnded){this.privReceivedAudio=new ArrayBuffer(this.bytesReceived);try{yield this.privAudioOutputStream.read(this.privReceivedAudio)}catch(e){this.privReceivedAudio=new ArrayBuffer(0)}}}))}withinXmlTag(e){return this.privRawText.indexOf("<",e+1)>this.privRawText.indexOf(">",e+1)}}class Kn{constructor(e){let t=e.parameters.getProperty(Qe.SpeechServiceConnection_Endpoint,void 0);if(!t){const n=e.parameters.getProperty(Qe.SpeechServiceConnection_Region,"westus"),r=Et.getHostSuffix(n);t=e.parameters.getProperty(Qe.SpeechServiceConnection_Host,`https://${n}.tts.speech${r}`)}this.privUri=`${t}/cognitiveservices/voices/list`;const n=kr.requestOptions;n.headers[kr.configParams.subscriptionKey]=e.parameters.getProperty(Qe.SpeechServiceConnection_Key,void 0),this.privRestAdapter=new(0,Sr.RestMessageAdapter)(n)}getVoicesList(e){return this.privRestAdapter.setHeaders(ze.ConnectionId,e),this.privRestAdapter.request(Sr.RestRequestType.Get,this.privUri)}}(Hn=jn||(jn={}))[Hn.Standard=0]="Standard",Hn[Hn.Custom=1]="Custom";class Jn{constructor(e,t){this.privSynthesisServiceType=jn.Standard,this.privSpeechServiceConfig=e||new ht(new ft(null)),this.privParameters=t}get parameters(){return this.privParameters}get synthesisServiceType(){return this.privSynthesisServiceType}set synthesisServiceType(e){this.privSynthesisServiceType=e}get SpeechServiceConfig(){return this.privSpeechServiceConfig}}class Qn{constructor(e){this.privContext={},this.privSpeechSynthesizer=e}setSection(e,t){this.privContext[e]=t}set audioOutputFormat(e){this.privAudioOutputFormat=e}toJSON(){const e=this.buildSynthesisContext();return this.setSection("synthesis",e),JSON.stringify(this.privContext)}buildSynthesisContext(){return{audio:{metadataOptions:{bookmarkEnabled:!!this.privSpeechSynthesizer.bookmarkReached,punctuationBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(Qe.SpeechServiceResponse_RequestPunctuationBoundary,!!this.privSpeechSynthesizer.wordBoundary),sentenceBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(Qe.SpeechServiceResponse_RequestSentenceBoundary,!1),sessionEndEnabled:!0,visemeEnabled:!!this.privSpeechSynthesizer.visemeReceived,wordBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(Qe.SpeechServiceResponse_RequestWordBoundary,!!this.privSpeechSynthesizer.wordBoundary)},outputFormat:this.privAudioOutputFormat.requestAudioFormatString},language:{autoDetection:this.privSpeechSynthesizer.autoDetectSourceLanguage}}}}(Vn=Gn||(Gn={}))[Vn.TextIndependentIdentification=0]="TextIndependentIdentification",Vn[Vn.TextDependentVerification=1]="TextDependentVerification",Vn[Vn.TextIndependentVerification=2]="TextIndependentVerification";const Xn="OutputFormat",Yn="CancellationErrorCode",Zn="ServiceProperties",$n="ForceDictation";var er=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class tr{constructor(e,t,n,r){this.privRecorder=e,this.deviceId=t,this.privStreams={},this.privOutputChunkSize=tr.AUDIOFORMAT.avgBytesPerSec/10,this.privId=n||x(),this.privEvents=new ne,this.privMediaStream=r||null,this.privIsClosing=!1}get format(){return Promise.resolve(tr.AUDIOFORMAT)}get blob(){return Promise.reject("Not implemented for Mic input")}turnOn(){if(this.privInitializeDeferral)return this.privInitializeDeferral.promise;this.privInitializeDeferral=new ie;try{this.createAudioContext()}catch(e){if(e instanceof Error){const t=e;this.privInitializeDeferral.reject(t.name+": "+t.message)}else this.privInitializeDeferral.reject(e);return this.privInitializeDeferral.promise}const e=window.navigator;let t=e.getUserMedia||e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia;if(e.mediaDevices&&(t=(t,n,r)=>{e.mediaDevices.getUserMedia(t).then(n).catch(r)}),t){const e=()=>{this.onEvent(new P(this.privId)),this.privMediaStream&&this.privMediaStream.active?(this.onEvent(new N(this.privId)),this.privInitializeDeferral.resolve()):t({audio:!this.deviceId||{deviceId:this.deviceId},video:!1},(e=>{this.privMediaStream=e,this.onEvent(new N(this.privId)),this.privInitializeDeferral.resolve()}),(e=>{const t=`Error occurred during microphone initialization: ${e}`;this.privInitializeDeferral.reject(t),this.onEvent(new L(this.privId,t))}))};"suspended"===this.privContext.state?this.privContext.resume().then(e).catch((e=>{this.privInitializeDeferral.reject(`Failed to initialize audio context: ${e}`)})):e()}else{const e="Browser does not support getUserMedia.";this.privInitializeDeferral.reject(e),this.onEvent(new L(e,""))}return this.privInitializeDeferral.promise}id(){return this.privId}attach(e){return this.onEvent(new U(this.privId,e)),this.listen(e).then((t=>(this.onEvent(new F(this.privId,e)),{detach:()=>er(this,void 0,void 0,(function*(){return t.readEnded(),delete this.privStreams[e],this.onEvent(new z(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()})))}detach(e){e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new z(this.privId,e)))}turnOff(){return er(this,void 0,void 0,(function*(){for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&t.close()}this.onEvent(new B(this.privId)),this.privInitializeDeferral&&(yield this.privInitializeDeferral,this.privInitializeDeferral=null),yield this.destroyAudioContext()}))}get events(){return this.privEvents}get deviceInfo(){return this.getMicrophoneLabel().then((e=>({bitspersample:tr.AUDIOFORMAT.bitsPerSample,channelcount:tr.AUDIOFORMAT.channels,connectivity:ot.Unknown,manufacturer:"Speech SDK",model:e,samplerate:tr.AUDIOFORMAT.samplesPerSec,type:st.Microphones})))}setProperty(e,t){if("MICROPHONE-WorkletSourceUrl"!==e)throw new Error("Property '"+e+"' is not supported on Microphone.");this.privRecorder.setWorkletUrl(t)}getMicrophoneLabel(){const e="microphone";if(void 0!==this.privMicrophoneLabel)return Promise.resolve(this.privMicrophoneLabel);if(void 0===this.privMediaStream||!this.privMediaStream.active)return Promise.resolve(e);this.privMicrophoneLabel=e;const t=this.privMediaStream.getTracks()[0].getSettings().deviceId;if(void 0===t)return Promise.resolve(this.privMicrophoneLabel);const n=new ie;return navigator.mediaDevices.enumerateDevices().then((e=>{for(const n of e)if(n.deviceId===t){this.privMicrophoneLabel=n.label;break}n.resolve(this.privMicrophoneLabel)}),(()=>n.resolve(this.privMicrophoneLabel))),n.promise}listen(e){return er(this,void 0,void 0,(function*(){yield this.turnOn();const t=new ye(this.privOutputChunkSize,e);this.privStreams[e]=t;try{this.privRecorder.record(this.privContext,this.privMediaStream,t)}catch(t){throw this.onEvent(new j(this.privId,e,t)),t}return t}))}onEvent(e){this.privEvents.onEvent(e),re.instance.onEvent(e)}createAudioContext(){this.privContext||(this.privContext=un.getAudioContext(tr.AUDIOFORMAT.samplesPerSec))}destroyAudioContext(){return er(this,void 0,void 0,(function*(){if(!this.privContext)return;this.privRecorder.releaseMediaResources(this.privContext);let e=!1;"close"in this.privContext&&(e=!0),e?this.privIsClosing||(this.privIsClosing=!0,yield this.privContext.close(),this.privContext=null,this.privIsClosing=!1):null!==this.privContext&&"running"===this.privContext.state&&(yield this.privContext.suspend())}))}}tr.AUDIOFORMAT=cn.getDefaultInputFormat();var nr={};e(nr,"FileAudioSource",(()=>ir),(e=>ir=e));var rr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class ir{constructor(e,t,n){this.privStreams={},this.privHeaderEnd=44,this.privId=n||x(),this.privEvents=new ne,this.privSource=e,"undefined"!=typeof window&&"undefined"!=typeof Blob&&this.privSource instanceof Blob?this.privFilename=e.name:this.privFilename=t||"unknown.wav",this.privAudioFormatPromise=this.readHeader()}get format(){return this.privAudioFormatPromise}get blob(){return Promise.resolve(this.privSource)}turnOn(){if(this.privFilename.lastIndexOf(".wav")!==this.privFilename.length-4){const e=this.privFilename+" is not supported. Only WAVE files are allowed at the moment.";return this.onEvent(new L(e,"")),Promise.reject(e)}this.onEvent(new P(this.privId)),this.onEvent(new N(this.privId))}id(){return this.privId}attach(e){return rr(this,void 0,void 0,(function*(){this.onEvent(new U(this.privId,e));const t=yield this.upload(e);return this.onEvent(new F(this.privId,e)),Promise.resolve({detach:()=>rr(this,void 0,void 0,(function*(){t.readEnded(),delete this.privStreams[e],this.onEvent(new z(this.privId,e)),yield this.turnOff()})),id:()=>e,read:()=>t.read()})}))}detach(e){e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new z(this.privId,e)))}turnOff(){for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&!t.isClosed&&t.close()}return this.onEvent(new B(this.privId)),Promise.resolve()}get events(){return this.privEvents}get deviceInfo(){return this.privAudioFormatPromise.then((e=>Promise.resolve({bitspersample:e.bitsPerSample,channelcount:e.channels,connectivity:ot.Unknown,manufacturer:"Speech SDK",model:"File",samplerate:e.samplesPerSec,type:st.File})))}readHeader(){const e=this.privSource.slice(0,512),t=new ie,n=e=>{const n=new DataView(e),r=e=>String.fromCharCode(n.getUint8(e),n.getUint8(e+1),n.getUint8(e+2),n.getUint8(e+3));if("RIFF"!==r(0))return void t.reject("Invalid WAV header in file, RIFF was not found");if("WAVE"!==r(8)||"fmt "!==r(12))return void t.reject("Invalid WAV header in file, WAVEfmt was not found");const i=n.getInt32(16,!0),o=n.getUint16(22,!0),a=n.getUint32(24,!0),s=n.getUint16(34,!0);let l=36+Math.max(i-16,0);for(;"data"!==r(l);l+=2)if(l>504)return void t.reject("Invalid WAV header in file, data block was not found");this.privHeaderEnd=l+8,t.resolve(cn.getWaveFormatPCM(a,s,o))};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&e instanceof Blob){const t=new FileReader;t.onload=e=>{const t=e.target.result;n(t)},t.readAsArrayBuffer(e)}else{const t=e;n(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}return t.promise}upload(e){return rr(this,void 0,void 0,(function*(){const t=t=>{const n=`Error occurred while processing '${this.privFilename}'. ${t}`;throw this.onEvent(new j(this.privId,e,n)),new Error(n)};try{yield this.turnOn();const n=yield this.privAudioFormatPromise,r=new ye(n.avgBytesPerSec/10,e);this.privStreams[e]=r;const i=this.privSource.slice(this.privHeaderEnd),o=e=>{r.isClosed||(r.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()}),r.close())};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&i instanceof Blob){const e=new FileReader;e.onerror=e=>t(e.toString()),e.onload=e=>{const t=e.target.result;o(t)},e.readAsArrayBuffer(i)}else{const e=i;o(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}return r}catch(e){t(e)}}))}onEvent(e){this.privEvents.onEvent(e),re.instance.onEvent(e)}}class or{constructor(e){this.privStopInputOnRelease=e}record(e,t,n){const r=new fe(e.sampleRate,16e3),i=e.createMediaStreamSource(t);if(!this.privSpeechProcessorScript){const e=new Blob(["class SP extends AudioWorkletProcessor {\n constructor(options) {\n super(options);\n }\n process(inputs, outputs) {\n const input = inputs[0];\n const output = [];\n for (let channel = 0; channel < input.length; channel += 1) {\n output[channel] = input[channel];\n }\n this.port.postMessage(output[0]);\n return true;\n }\n }\n registerProcessor('speech-processor', SP);"],{type:"application/javascript; charset=utf-8"});this.privSpeechProcessorScript=URL.createObjectURL(e)}const o=()=>{const o=(()=>{let t=0;try{return e.createScriptProcessor(t,1,1)}catch(n){t=2048;let r=e.sampleRate;for(;t<16384&&r>=32e3;)t<<=1,r>>=1;return e.createScriptProcessor(t,1,1)}})();o.onaudioprocess=e=>{const t=e.inputBuffer.getChannelData(0);if(n&&!n.isClosed){const e=r.encode(t);e&&n.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}},i.connect(o),o.connect(e.destination),this.privMediaResources={scriptProcessorNode:o,source:i,stream:t}};if(this.privSpeechProcessorScript&&e.audioWorklet)e.audioWorklet.addModule(this.privSpeechProcessorScript).then((()=>{const o=new AudioWorkletNode(e,"speech-processor");o.port.onmessage=e=>{const t=e.data;if(n&&!n.isClosed){const e=r.encode(t);e&&n.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}},i.connect(o),o.connect(e.destination),this.privMediaResources={scriptProcessorNode:o,source:i,stream:t}})).catch((()=>{o()}));else try{o()}catch(e){throw new Error(`Unable to start audio worklet node for PCMRecorder: ${e}`)}}releaseMediaResources(e){this.privMediaResources&&(this.privMediaResources.scriptProcessorNode&&(this.privMediaResources.scriptProcessorNode.disconnect(e.destination),this.privMediaResources.scriptProcessorNode=null),this.privMediaResources.source&&(this.privMediaResources.source.disconnect(),this.privStopInputOnRelease&&this.privMediaResources.stream.getTracks().forEach((e=>e.stop())),this.privMediaResources.source=null))}setWorkletUrl(e){this.privSpeechProcessorScript=e}}var ar={};e(ar,"WebsocketConnection",(()=>vr),(e=>vr=e));var sr={};e(sr,"WebsocketMessageAdapter",(()=>mr),(e=>mr=e));h=o("1DJXa");var lr={};e(lr,"CertCheckAgent",(()=>fr),(e=>fr=e));h=o("1DJXa");var cr=o("5U18c"),ur=(h=o("1DJXa"),h=o("1DJXa"),h=o("1DJXa"),h=o("1DJXa"),o("bqBrJ").Buffer),dr=o("ePtPP"),hr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class fr{constructor(e){e&&(this.privProxyInfo=e),fr.privDiskCache||(fr.privDiskCache=new(n(h))("microsoft-cognitiveservices-speech-sdk-cache",{supportBuffer:!0,location:void 0}))}static forceReinitDiskCache(){fr.privDiskCache=void 0,fr.privMemCache={}}GetAgent(e){const t=new(n(h).Agent)(this.CreateConnection);if(void 0!==this.privProxyInfo&&void 0!==this.privProxyInfo.HostName&&this.privProxyInfo.Port>0){t["privProxyInfo"]=this.privProxyInfo}return t}static GetProxyAgent(e){const t={host:e.HostName,port:e.Port};e.UserName?t.headers={"Proxy-Authentication":"Basic "+new ur(`${e.UserName}:${void 0===e.Password?"":e.Password}`).toString("base64")}:t.headers={},t.headers.requestOCSP="true";return new(n(h))(t)}static OCSPCheck(e,t){return hr(this,void 0,void 0,(function*(){let n,r,i=!1;const o=yield e;o.cork();const a=o;return new Promise(((e,s)=>{o.on("OCSPResponse",(e=>{e&&(this.onEvent(new Ie),r=e)})),o.on("error",(e=>{i||(i=!0,o.destroy(),s(e))})),a.on("secure",(()=>hr(this,void 0,void 0,(function*(){const l=a.getPeerCertificate(!0);try{const a=yield this.GetIssuer(l);n=cr.request.generate(l.raw,a.raw);const s=n.id.toString("hex");if(!r){const e=yield fr.GetResponseFromCache(s,n,t);r=e}yield this.VerifyOCSPResponse(r,n,t),o.uncork(),i=!0,e(o)}catch(e){o.destroy(),i=!0,s(e)}}))))}))}))}static GetIssuer(e){return e.issuerCertificate?Promise.resolve(e.issuerCertificate):new Promise(((t,n)=>{new cr.Agent({}).fetchIssuer(e,null,((e,r)=>{e?n(e):t(r)}))}))}static GetResponseFromCache(e,t,n){return hr(this,void 0,void 0,(function*(){let r=fr.privMemCache[e];if(r&&this.onEvent(new xe(e)),!r)try{const t=yield fr.privDiskCache.get(e);t.isCached&&(fr.onEvent(new _e(e)),fr.StoreMemoryCacheEntry(e,t.value),r=t.value)}catch(e){r=null}if(!r)return r;try{const i=cr.utils.parseResponse(r),o=i.value.tbsResponseData;if(o.responses.length<1)return void this.onEvent(new Ne(e,"Not enough data in cached response"));const a=o.responses[0].thisUpdate,s=o.responses[0].nextUpdate;if(s<Date.now()+this.testTimeOffset-6e4)this.onEvent(new ke(e,s)),r=null;else{const r=Math.min(864e5,(s-a)/2);s-(Date.now()+this.testTimeOffset)<r?(this.onEvent(new Re(e,a,s)),this.UpdateCache(t,n).catch((t=>{this.onEvent(new Le(e,t.toString()))}))):this.onEvent(new Oe(e,a,s))}}catch(t){this.onEvent(new Ne(e,t)),r=null}return r||this.onEvent(new Me(e)),r}))}static VerifyOCSPResponse(e,t,n){return hr(this,void 0,void 0,(function*(){let r=e;return r||(r=yield fr.GetOCSPResponse(t,n)),new Promise(((i,o)=>{cr.verify({request:t,response:r},(a=>{a?(fr.onEvent(new Pe(t.id.toString("hex"),a)),e?this.VerifyOCSPResponse(null,t,n).then((()=>{i()}),(e=>{o(e)})):o(a)):(e||fr.StoreCacheEntry(t.id.toString("hex"),r),i())}))}))}))}static UpdateCache(e,t){return hr(this,void 0,void 0,(function*(){const n=e.id.toString("hex");this.onEvent(new Ae(n));const r=yield this.GetOCSPResponse(e,t);this.StoreCacheEntry(n,r),this.onEvent(new Te(e.id.toString("hex")))}))}static StoreCacheEntry(e,t){this.StoreMemoryCacheEntry(e,t),this.StoreDiskCacheEntry(e,t)}static StoreMemoryCacheEntry(e,t){this.privMemCache[e]=t,this.onEvent(new Ee(e))}static StoreDiskCacheEntry(e,t){this.privDiskCache.set(e,t).then((()=>{this.onEvent(new Ce(e))}))}static GetOCSPResponse(e,t){let n={};if(t){const e=fr.GetProxyAgent(t);n.agent=e}return new Promise(((t,r)=>{cr.utils.getAuthorityInfo(e.cert,"1.3.6.1.5.5.7.48.1",((i,o)=>{if(i)return void r(i);const a=new URL(o);n=Object.assign(Object.assign({},n),{host:a.host,protocol:a.protocol,port:a.port,path:a.pathname,hostname:a.host}),cr.utils.getResponse(n,e.data,((n,i)=>{if(n)return void r(n);const o=e.certID;this.onEvent(new Be(o.toString("hex"))),t(i)}))}))}))}static onEvent(e){re.instance.onEvent(e)}CreateConnection(e,t){const n=void 0!==dr&&t.secureEndpoint;let r;if(t=Object.assign(Object.assign({},t),{requestOCSP:!fr.forceDisableOCSPStapling,servername:t.host}),this.privProxyInfo){const n=fr.GetProxyAgent(this.privProxyInfo);r=new Promise(((r,i)=>{n.callback(e,t,((e,t)=>{e?i(e):r(t)}))}))}else r=(t.secureEndpoint,Promise.resolve(h.connect(t)));return n?fr.OCSPCheck(r,this.privProxyInfo):r}}fr.testTimeOffset=0,fr.forceDisableOCSPStapling=!1,fr.privMemCache={};var pr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class mr{constructor(e,t,n,r,i,o){if(!e)throw new Y("uri");if(!n)throw new Y("messageFormatter");this.proxyInfo=r,this.privConnectionEvents=new ne,this.privConnectionId=t,this.privMessageFormatter=n,this.privConnectionState=C.None,this.privUri=e,this.privHeaders=i,this.privEnableCompression=o,this.privHeaders[ze.ConnectionId]=this.privConnectionId,this.privLastErrorReceived=""}get state(){return this.privConnectionState}open(){if(this.privConnectionState===C.Disconnected)return Promise.reject(`Cannot open a connection that is in ${this.privConnectionState} state`);if(this.privConnectionEstablishDeferral)return this.privConnectionEstablishDeferral.promise;this.privConnectionEstablishDeferral=new ie,this.privCertificateValidatedDeferral=new ie,this.privConnectionState=C.Connecting;try{if("undefined"==typeof WebSocket||mr.forceNpmWebSocket){const e={headers:this.privHeaders,perMessageDeflate:this.privEnableCompression};this.privCertificateValidatedDeferral.resolve();const t=new(0,lr.CertCheckAgent)(this.proxyInfo);e.agent=t.GetAgent();let r=new URL(this.privUri).protocol;"wss:"===(null==r?void 0:r.toLocaleLowerCase())?r="https:":"ws:"===(null==r?void 0:r.toLocaleLowerCase())&&(r="http:"),e.agent.protocol=r,this.privWebsocketClient=new(n(h))(this.privUri,e)}else this.privCertificateValidatedDeferral.resolve(),this.privWebsocketClient=new WebSocket(this.privUri);this.privWebsocketClient.binaryType="arraybuffer",this.privReceivingMessageQueue=new(0,ae.Queue),this.privDisconnectDeferral=new ie,this.privSendMessageQueue=new(0,ae.Queue),this.processSendQueue().catch((e=>{re.instance.onEvent(new De(e))}))}catch(e){return this.privConnectionEstablishDeferral.resolve(new te(500,e)),this.privConnectionEstablishDeferral.promise}return this.onEvent(new V(this.privConnectionId,this.privUri)),this.privWebsocketClient.onopen=()=>{this.privCertificateValidatedDeferral.promise.then((()=>{this.privConnectionState=C.Connected,this.onEvent(new W(this.privConnectionId)),this.privConnectionEstablishDeferral.resolve(new te(200,""))}),(e=>{this.privConnectionEstablishDeferral.reject(e)}))},this.privWebsocketClient.onerror=e=>{this.onEvent(new K(this.privConnectionId,e.message,e.type)),this.privLastErrorReceived=e.message},this.privWebsocketClient.onclose=e=>{this.privConnectionState===C.Connecting?(this.privConnectionState=C.Disconnected,this.privConnectionEstablishDeferral.resolve(new te(e.code,e.reason+" "+this.privLastErrorReceived))):(this.privConnectionState=C.Disconnected,this.privWebsocketClient=null,this.onEvent(new q(this.privConnectionId,e.code,e.reason))),this.onClose(e.code,e.reason).catch((e=>{re.instance.onEvent(new De(e))}))},this.privWebsocketClient.onmessage=e=>{const t=(new Date).toISOString();if(this.privConnectionState===C.Connected){const n=new ie;if(this.privReceivingMessageQueue.enqueueFromPromise(n.promise),e.data instanceof ArrayBuffer){const r=new he(A.Binary,e.data);this.privMessageFormatter.toConnectionMessage(r).then((e=>{this.onEvent(new Q(this.privConnectionId,t,e)),n.resolve(e)}),(e=>{n.reject(`Invalid binary message format. Error: ${e}`)}))}else{const r=new he(A.Text,e.data);this.privMessageFormatter.toConnectionMessage(r).then((e=>{this.onEvent(new Q(this.privConnectionId,t,e)),n.resolve(e)}),(e=>{n.reject(`Invalid text message format. Error: ${e}`)}))}}},this.privConnectionEstablishDeferral.promise}send(e){if(this.privConnectionState!==C.Connected)return Promise.reject(`Cannot send on connection that is in ${C[this.privConnectionState]} state`);const t=new ie,n=new ie;return this.privSendMessageQueue.enqueueFromPromise(n.promise),this.privMessageFormatter.fromConnectionMessage(e).then((r=>{n.resolve({Message:e,RawWebsocketMessage:r,sendStatusDeferral:t})}),(e=>{n.reject(`Error formatting the message. ${e}`)})),t.promise}read(){return this.privConnectionState!==C.Connected?Promise.reject(`Cannot read on connection that is in ${this.privConnectionState} state`):this.privReceivingMessageQueue.dequeue()}close(e){return this.privWebsocketClient?(this.privConnectionState!==C.Disconnected&&this.privWebsocketClient.close(1e3,e||"Normal closure by client"),this.privDisconnectDeferral.promise):Promise.resolve()}get events(){return this.privConnectionEvents}sendRawMessage(e){try{return e?(this.onEvent(new X(this.privConnectionId,(new Date).toISOString(),e.Message)),this.isWebsocketOpen?(this.privWebsocketClient.send(e.RawWebsocketMessage.payload),Promise.resolve()):Promise.reject("websocket send error: Websocket not ready "+this.privConnectionId+" "+e.Message.id+" "+(new Error).stack)):Promise.resolve()}catch(e){return Promise.reject(`websocket send error: ${e}`)}}onClose(e,t){return pr(this,void 0,void 0,(function*(){const n=`Connection closed. ${e}: ${t}`;this.privConnectionState=C.Disconnected,this.privDisconnectDeferral.resolve(),yield this.privReceivingMessageQueue.drainAndDispose((()=>{}),n),yield this.privSendMessageQueue.drainAndDispose((e=>{e.sendStatusDeferral.reject(n)}),n)}))}processSendQueue(){return pr(this,void 0,void 0,(function*(){for(;;){const e=this.privSendMessageQueue.dequeue(),t=yield e;if(!t)return;try{yield this.sendRawMessage(t),t.sendStatusDeferral.resolve()}catch(e){t.sendStatusDeferral.reject(e)}}}))}onEvent(e){this.privConnectionEvents.onEvent(e),re.instance.onEvent(e)}get isWebsocketOpen(){return this.privWebsocketClient&&this.privWebsocketClient.readyState===this.privWebsocketClient.OPEN}}mr.forceNpmWebSocket=!1;var gr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class vr{constructor(e,t,n,r,i,o=!1,a){if(this.privIsDisposed=!1,!e)throw new Y("uri");if(!r)throw new Y("messageFormatter");this.privMessageFormatter=r;let s="",l=0;if(t)for(const n in t)if(n){s+=0===l&&-1===e.indexOf("?")?"?":"&";s+=`${n}=${encodeURIComponent(t[n])}`,l++}if(n)for(const t in n)if(t){s+=0===l&&-1===e.indexOf("?")?"?":"&";s+=`${t}=${encodeURIComponent(n[t])}`,l++}this.privUri=e+s,this.privId=a||x(),this.privConnectionMessageAdapter=new(0,sr.WebsocketMessageAdapter)(this.privUri,this.id,this.privMessageFormatter,i,n,o)}dispose(){return gr(this,void 0,void 0,(function*(){this.privIsDisposed=!0,this.privConnectionMessageAdapter&&(yield this.privConnectionMessageAdapter.close())}))}isDisposed(){return this.privIsDisposed}get id(){return this.privId}state(){return this.privConnectionMessageAdapter.state}open(){return this.privConnectionMessageAdapter.open()}send(e){return this.privConnectionMessageAdapter.send(e)}read(){return this.privConnectionMessageAdapter.read()}get events(){return this.privConnectionMessageAdapter.events}}class br{constructor(e,t){this.privBuffers=[],this.privReplayOffset=0,this.privLastShrinkOffset=0,this.privBufferStartOffset=0,this.privBufferSerial=0,this.privBufferedBytes=0,this.privReplay=!1,this.privLastChunkAcquiredTime=0,this.privAudioNode=e,this.privBytesPerSecond=t}id(){return this.privAudioNode.id()}read(){if(this.privReplay&&0!==this.privBuffers.length){const e=this.privReplayOffset-this.privBufferStartOffset;let t=Math.round(e*this.privBytesPerSecond*1e-7);0!=t%2&&t++;let n=0;for(;n<this.privBuffers.length&&t>=this.privBuffers[n].chunk.buffer.byteLength;)t-=this.privBuffers[n++].chunk.buffer.byteLength;if(n<this.privBuffers.length){const e=this.privBuffers[n].chunk.buffer.slice(t);return this.privReplayOffset+=e.byteLength/this.privBytesPerSecond*1e7,n===this.privBuffers.length-1&&(this.privReplay=!1),Promise.resolve({buffer:e,isEnd:!1,timeReceived:this.privBuffers[n].chunk.timeReceived})}}return this.privAudioNode.read().then((e=>(e&&e.buffer&&(this.privBuffers.push(new yr(e,this.privBufferSerial++,this.privBufferedBytes)),this.privBufferedBytes+=e.buffer.byteLength),e)))}detach(){return this.privBuffers=void 0,this.privAudioNode.detach()}replay(){this.privBuffers&&0!==this.privBuffers.length&&(this.privReplay=!0,this.privReplayOffset=this.privLastShrinkOffset)}shrinkBuffers(e){if(void 0===this.privBuffers||0===this.privBuffers.length)return;this.privLastShrinkOffset=e;const t=e-this.privBufferStartOffset;let n=Math.round(t*this.privBytesPerSecond*1e-7),r=0;for(;r<this.privBuffers.length&&n>=this.privBuffers[r].chunk.buffer.byteLength;)n-=this.privBuffers[r++].chunk.buffer.byteLength;this.privBufferStartOffset=Math.round(e-n/this.privBytesPerSecond*1e7),this.privBuffers=this.privBuffers.slice(r)}findTimeAtOffset(e){if(e<this.privBufferStartOffset||void 0===this.privBuffers)return 0;for(const t of this.privBuffers){const n=t.byteOffset/this.privBytesPerSecond*1e7,r=n+t.chunk.buffer.byteLength/this.privBytesPerSecond*1e7;if(e>=n&&e<=r)return t.chunk.timeReceived}return 0}}class yr{constructor(e,t,n){this.chunk=e,this.serial=t,this.byteOffset=n}}class wr{constructor(e,t,n,r){this.privProxyHostName=e,this.privProxyPort=t,this.privProxyUserName=n,this.privProxyPassword=r}static fromParameters(e){return new wr(e.getProperty(Qe.SpeechServiceConnection_ProxyHostName),parseInt(e.getProperty(Qe.SpeechServiceConnection_ProxyPort),10),e.getProperty(Qe.SpeechServiceConnection_ProxyUserName),e.getProperty(Qe.SpeechServiceConnection_ProxyPassword))}static fromRecognizerConfig(e){return this.fromParameters(e.parameters)}get HostName(){return this.privProxyHostName}get Port(){return this.privProxyPort}get UserName(){return this.privProxyUserName}get Password(){return this.privProxyPassword}}var Sr={};e(Sr,"RestRequestType",(()=>Er),(e=>Er=e)),e(Sr,"RestMessageAdapter",(()=>Ir),(e=>Ir=e));var xr,Mr;const _r=new Set(["json","buffer","string"]);Mr=e=>(...t)=>{const n=new Set;let r,i,o,a="";return t.forEach((e=>{if("string"==typeof e)if(e.toUpperCase()===e){if(r){throw new Error(`Can't set method to ${e}, already set to ${r}.`)}r=e}else if(e.startsWith("http:")||e.startsWith("https:"))a=e;else{if(!_r.has(e))throw new Error(`Unknown encoding, ${e}`);i=e}else if("number"==typeof e)n.add(e);else{if("object"!=typeof e)throw new Error("Unknown type: "+typeof e);if(Array.isArray(e)||e instanceof Set)e.forEach((e=>n.add(e)));else{if(o)throw new Error("Cannot set headers twice.");o=e}}})),r||(r="GET"),0===n.size&&n.add(200),e(n,r,i,o,a)};class Ar extends Error{constructor(e,...t){let n;super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,Ar),this.name="StatusError",this.message=e.statusMessage,this.statusCode=e.status,this.res=e,this.json=e.json.bind(e),this.text=e.text.bind(e),this.arrayBuffer=e.arrayBuffer.bind(e);Object.defineProperty(this,"responseBody",{get:()=>(n||(n=this.arrayBuffer()),n)}),this.headers={};for(const[t,n]of e.headers.entries())this.headers[t.toLowerCase()]=n}}xr=Mr(((e,t,n,r,i)=>async(o,a,s={})=>{o=i+(o||"");let l=new URL(o);if(r||(r={}),l.username&&(r.Authorization="Basic "+btoa(l.username+":"+l.password),l=new URL(l.protocol+"//"+l.host+l.pathname+l.search)),"https:"!==l.protocol&&"http:"!==l.protocol)throw new Error(`Unknown protocol, ${l.protocol}`);if(a)if(a instanceof ArrayBuffer||ArrayBuffer.isView(a)||"string"==typeof a);else{if("object"!=typeof a)throw new Error("Unknown body type.");a=JSON.stringify(a),r["Content-Type"]="application/json"}s=new Headers({...r||{},...s});const c=await fetch(l,{method:t,headers:s,body:a});if(c.statusCode=c.status,!e.has(c.status))throw new Ar(c);return"json"===n?c.json():"buffer"===n?c.arrayBuffer():"string"===n?c.text():c}));var Er,Cr,Tr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};(Cr=Er||(Er={})).Get="GET",Cr.Post="POST",Cr.Delete="DELETE",Cr.File="file";class Ir{constructor(e){if(!e)throw new Y("configParams");this.privHeaders=e.headers,this.privIgnoreCache=e.ignoreCache}static extractHeaderValue(e,t){let n="";try{const r=t.trim().split(/[\r\n]+/),i={};r.forEach((e=>{const t=e.split(": "),n=t.shift().toLowerCase(),r=t.join(": ");i[n]=r})),n=i[e.toLowerCase()]}catch(e){}return n}set options(e){this.privHeaders=e.headers,this.privIgnoreCache=e.ignoreCache}setHeaders(e,t){this.privHeaders[e]=t}request(e,t,r={},i=null,o=null){const a=new ie,s=e===Er.File?"POST":e,l=(e,t={})=>{const n=e;return{data:JSON.stringify(t),headers:JSON.stringify(e.headers),json:t,ok:e.statusCode>=200&&e.statusCode<300,status:e.statusCode,statusText:t.error?t.error.message:n.statusText?n.statusText:n.statusMessage}},c=i=>{n(xr)(t,s,this.privHeaders,200,201,202,204,400,401,402,403,404)(""===this.queryParams(r)?"":`?${this.queryParams(r)}`,i).then((t=>Tr(this,void 0,void 0,(function*(){if(e===Er.Delete||204===t.statusCode)a.resolve(l(t));else try{const e=yield t.json();a.resolve(l(t,e))}catch(e){a.resolve(l(t))}})))).catch((e=>{a.reject(e)}))};if(this.privIgnoreCache&&(this.privHeaders["Cache-Control"]="no-cache"),e===Er.File&&o){const e="multipart/form-data";this.privHeaders["content-type"]=e,this.privHeaders["Content-Type"]=e,"undefined"!=typeof Blob&&o instanceof Blob?(e=>{const t=new FileReader;return t.readAsArrayBuffer(e),new Promise((e=>{t.onloadend=()=>{e(t.result)}}))})(o).then((e=>{c(e)})).catch((e=>{a.reject(e)})):c(o)}else e===Er.Post&&i&&(this.privHeaders["content-type"]="application/json",this.privHeaders["Content-Type"]="application/json"),c(i);return a.promise}withQuery(e,t={}){const n=this.queryParams(t);return n?e+(-1===e.indexOf("?")?"?":"&")+n:e}queryParams(e={}){return Object.keys(e).map((t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t]))).join("&")}}class kr{static get requestOptions(){return kr.privDefaultRequestOptions}static get configParams(){return kr.privDefaultParams}static get restErrors(){return kr.privRestErrors}}kr.privDefaultRequestOptions={headers:{Accept:"application/json"},ignoreCache:!1,timeout:1e4},kr.privRestErrors={authInvalidSubscriptionKey:"You must specify either an authentication token to use, or a Cognitive Speech subscription key.",authInvalidSubscriptionRegion:"You must specify the Cognitive Speech region to use.",invalidArgs:"Required input not found: {arg}.",invalidCreateJoinConversationResponse:"Creating/Joining conversation failed with HTTP {status}.",invalidParticipantRequest:"The requested participant was not found.",permissionDeniedConnect:"Required credentials not found.",permissionDeniedConversation:"Invalid operation: only the host can {command} the conversation.",permissionDeniedParticipant:"Invalid operation: only the host can {command} a participant.",permissionDeniedSend:"Invalid operation: the conversation is not in a connected state.",permissionDeniedStart:"Invalid operation: there is already an active conversation."},kr.privDefaultParams={apiVersion:"api-version",authorization:"Authorization",clientAppId:"X-ClientAppId",contentTypeKey:"Content-Type",correlationId:"X-CorrelationId",languageCode:"language",nickname:"nickname",profanity:"profanity",requestId:"X-RequestId",roomId:"roomid",sessionToken:"token",subscriptionKey:"Ocp-Apim-Subscription-Key",subscriptionRegion:"Ocp-Apim-Subscription-Region",token:"X-CapitoToken"};var Rr={};e(Rr,"AudioInputStream",(()=>Nr),(e=>Nr=e)),e(Rr,"PullAudioInputStreamImpl",(()=>Ur),(e=>Ur=e));var Or=o("bqBrJ").Buffer,Pr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Nr{constructor(){}static createPushStream(e){return Br.create(e)}static createPullStream(e,t){return Dr.create(e,t)}}class Br extends Nr{static create(e){return new Lr(e)}}class Lr extends Br{constructor(e){super(),this.privFormat=void 0===e?un.getDefaultInputFormat():e,this.privEvents=new ne,this.privId=x(),this.privStream=new ye(this.privFormat.avgBytesPerSec/10)}get format(){return Promise.resolve(this.privFormat)}write(e){this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}id(){return this.privId}get blob(){return this.attach("id").then((e=>{const t=[];let n=Or.from("");const r=()=>e.read().then((e=>!e||e.isEnd?"undefined"!=typeof XMLHttpRequest&&"undefined"!=typeof Blob?Promise.resolve(new Blob(t)):Promise.resolve(Or.from(n)):("undefined"!=typeof Blob?t.push(e.buffer):n=Or.concat([n,this.toBuffer(e.buffer)]),r())));return r()}))}turnOn(){this.onEvent(new P(this.privId)),this.onEvent(new N(this.privId))}attach(e){return Pr(this,void 0,void 0,(function*(){this.onEvent(new U(this.privId,e)),yield this.turnOn();const t=this.privStream;return this.onEvent(new F(this.privId,e)),{detach:()=>Pr(this,void 0,void 0,(function*(){return this.onEvent(new z(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()}}))}detach(e){this.onEvent(new z(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:ot.Unknown,manufacturer:"Speech SDK",model:"PushStream",samplerate:this.privFormat.samplesPerSec,type:st.Stream})}onEvent(e){this.privEvents.onEvent(e),re.instance.onEvent(e)}toBuffer(e){const t=Or.alloc(e.byteLength),n=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=n[e];return t}}class Dr extends Nr{constructor(){super()}static create(e,t){return new Ur(e,t)}}class Ur extends Dr{constructor(e,t){super(),this.privFormat=void 0===t?cn.getDefaultInputFormat():t,this.privEvents=new ne,this.privId=x(),this.privCallback=e,this.privIsClosed=!1,this.privBufferSize=this.privFormat.avgBytesPerSec/10}get format(){return Promise.resolve(this.privFormat)}close(){this.privIsClosed=!0,this.privCallback.close()}id(){return this.privId}get blob(){return Promise.reject("Not implemented")}turnOn(){this.onEvent(new P(this.privId)),this.onEvent(new N(this.privId))}attach(e){return Pr(this,void 0,void 0,(function*(){return this.onEvent(new U(this.privId,e)),yield this.turnOn(),this.onEvent(new F(this.privId,e)),{detach:()=>(this.privCallback.close(),this.onEvent(new z(this.privId,e)),this.turnOff()),id:()=>e,read:()=>{let e,t=0;for(;t<this.privBufferSize;){const n=new ArrayBuffer(this.privBufferSize-t),r=this.privCallback.read(n);if(void 0===e)e=n;else{new Int8Array(e).set(new Int8Array(n),t)}if(0===r)break;t+=r}return Promise.resolve({buffer:e.slice(0,t),isEnd:this.privIsClosed||0===t,timeReceived:Date.now()})}}}))}detach(e){this.onEvent(new z(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:ot.Unknown,manufacturer:"Speech SDK",model:"PullStream",samplerate:this.privFormat.samplesPerSec,type:st.Stream})}onEvent(e){this.privEvents.onEvent(e),re.instance.onEvent(e)}}class Fr{}class zr{}var jr={};e(jr,"SpeakerAudioDestination",(()=>Vr),(e=>Vr=e));var Hr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const Gr={[en.PCM]:"audio/wav",[en.MuLaw]:"audio/x-wav",[en.MP3]:"audio/mpeg",[en.OGG_OPUS]:"audio/ogg",[en.WEBM_OPUS]:"audio/webm; codecs=opus",[en.ALaw]:"audio/x-wav",[en.FLAC]:"audio/flac"};class Vr{constructor(e){this.privPlaybackStarted=!1,this.privAppendingToBuffer=!1,this.privMediaSourceOpened=!1,this.privBytesReceived=0,this.privId=e||x(),this.privIsPaused=!1,this.privIsClosed=!1}id(){return this.privId}write(e,t,n){void 0!==this.privAudioBuffer?(this.privAudioBuffer.push(e),this.updateSourceBuffer().then((()=>{t&&t()}),(e=>{n&&n(e)}))):void 0!==this.privAudioOutputStream&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength)}close(e,t){if(this.privIsClosed=!0,void 0!==this.privSourceBuffer)this.handleSourceBufferUpdateEnd().then((()=>{e&&e()}),(e=>{t&&t(e)}));else if(void 0!==this.privAudioOutputStream&&"undefined"!=typeof window)if(this.privFormat.formatTag!==en.PCM&&this.privFormat.formatTag!==en.MuLaw&&this.privFormat.formatTag!==en.ALaw||!1!==this.privFormat.hasHeader){let n=new ArrayBuffer(this.privBytesReceived);this.privAudioOutputStream.read(n).then((()=>{n=Tn.SynthesisAdapterBase.addHeader(n,this.privFormat);const r=new Blob([n],{type:Gr[this.privFormat.formatTag]});this.privAudio.src=window.URL.createObjectURL(r),this.notifyPlayback().then((()=>{e&&e()}),(e=>{t&&t(e)}))}),(e=>{t&&t(e)}))}else console.warn("Play back is not supported for raw PCM, mulaw or alaw format without header."),this.onAudioEnd&&this.onAudioEnd(this);else this.onAudioEnd&&this.onAudioEnd(this)}set format(e){if("undefined"!=typeof AudioContext||"undefined"!=typeof window&&void 0!==window.webkitAudioContext){this.privFormat=e;const t=Gr[this.privFormat.formatTag];void 0===t?console.warn(`Unknown mimeType for format ${en[this.privFormat.formatTag]}; playback is not supported.`):"undefined"!=typeof MediaSource&&MediaSource.isTypeSupported(t)?(this.privAudio=new Audio,this.privAudioBuffer=[],this.privMediaSource=new MediaSource,this.privAudio.src=URL.createObjectURL(this.privMediaSource),this.privAudio.load(),this.privMediaSource.onsourceopen=()=>{this.privMediaSourceOpened=!0,this.privMediaSource.duration=1800,this.privSourceBuffer=this.privMediaSource.addSourceBuffer(t),this.privSourceBuffer.onupdate=()=>{this.updateSourceBuffer().catch((e=>{re.instance.onEvent(new De(e))}))},this.privSourceBuffer.onupdateend=()=>{this.handleSourceBufferUpdateEnd().catch((e=>{re.instance.onEvent(new De(e))}))},this.privSourceBuffer.onupdatestart=()=>{this.privAppendingToBuffer=!1}},this.updateSourceBuffer().catch((e=>{re.instance.onEvent(new De(e))}))):(console.warn(`Format ${en[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`),this.privAudioOutputStream=new(0,pn.PullAudioOutputStreamImpl),this.privAudioOutputStream.format=this.privFormat,this.privAudio=new Audio)}}get volume(){var e,t;return null!==(t=null===(e=this.privAudio)||void 0===e?void 0:e.volume)&&void 0!==t?t:-1}set volume(e){this.privAudio&&(this.privAudio.volume=e)}mute(){this.privAudio&&(this.privAudio.muted=!0)}unmute(){this.privAudio&&(this.privAudio.muted=!1)}get isClosed(){return this.privIsClosed}get currentTime(){return void 0!==this.privAudio?this.privAudio.currentTime:-1}pause(){this.privIsPaused||void 0===this.privAudio||(this.privAudio.pause(),this.privIsPaused=!0)}resume(e,t){this.privIsPaused&&void 0!==this.privAudio&&(this.privAudio.play().then((()=>{e&&e()}),(e=>{t&&t(e)})),this.privIsPaused=!1)}get internalAudio(){return this.privAudio}updateSourceBuffer(){return Hr(this,void 0,void 0,(function*(){if(void 0!==this.privAudioBuffer&&this.privAudioBuffer.length>0&&this.sourceBufferAvailable()){this.privAppendingToBuffer=!0;const e=this.privAudioBuffer.shift();try{this.privSourceBuffer.appendBuffer(e)}catch(t){return this.privAudioBuffer.unshift(e),void console.log("buffer filled, pausing addition of binaries until space is made")}yield this.notifyPlayback()}else this.canEndStream()&&(yield this.handleSourceBufferUpdateEnd())}))}handleSourceBufferUpdateEnd(){return Hr(this,void 0,void 0,(function*(){this.canEndStream()&&this.sourceBufferAvailable()&&(this.privMediaSource.endOfStream(),yield this.notifyPlayback())}))}notifyPlayback(){return Hr(this,void 0,void 0,(function*(){this.privPlaybackStarted||void 0===this.privAudio||(this.privPlaybackStarted=!0,this.onAudioStart&&this.onAudioStart(this),this.privAudio.onended=()=>{this.onAudioEnd&&this.onAudioEnd(this)},this.privIsPaused||(yield this.privAudio.play()))}))}canEndStream(){return this.isClosed&&void 0!==this.privSourceBuffer&&0===this.privAudioBuffer.length&&this.privMediaSourceOpened&&!this.privAppendingToBuffer&&"open"===this.privMediaSource.readyState}sourceBufferAvailable(){return void 0!==this.privSourceBuffer&&!this.privSourceBuffer.updating}}h=o("1DJXa");class Wr{constructor(e){Ue.throwIfNullOrUndefined(h.openSync,"\nFile System access not available, please use Push or PullAudioOutputStream"),this.privFd=h.openSync(e,"w")}set format(e){Ue.throwIfNotUndefined(this.privAudioFormat,"format is already set"),this.privAudioFormat=e;let t=0;this.privAudioFormat.hasHeader&&(t=this.privAudioFormat.header.byteLength),void 0!==this.privFd&&(this.privWriteStream=h.createWriteStream("",{fd:this.privFd,start:t,autoClose:!1}))}write(e){Ue.throwIfNullOrUndefined(this.privAudioFormat,"must set format before writing."),void 0!==this.privWriteStream&&this.privWriteStream.write(new Uint8Array(e.slice(0)))}close(){void 0!==this.privFd&&(this.privWriteStream.on("finish",(()=>{this.privAudioFormat.hasHeader&&(this.privAudioFormat.updateHeader(this.privWriteStream.bytesWritten),h.writeSync(this.privFd,new Int8Array(this.privAudioFormat.header),0,this.privAudioFormat.header.byteLength,0)),h.closeSync(this.privFd),this.privFd=void 0})),this.privWriteStream.end())}id(){return this.privId}}class qr{static fromDefaultMicrophoneInput(){const e=new or(!0);return new Kr(new(0,Fe.MicAudioSource)(e))}static fromMicrophoneInput(e){const t=new or(!0);return new Kr(new(0,Fe.MicAudioSource)(t,e))}static fromWavFileInput(e,t="unnamedBuffer.wav"){return new Kr(new(0,nr.FileAudioSource)(e,t))}static fromStreamInput(e){if(e instanceof Fr)return new Kr(new(0,Rr.PullAudioInputStreamImpl)(e));if(e instanceof Rr.AudioInputStream)return new Kr(e);if("undefined"!=typeof MediaStream&&e instanceof MediaStream){const t=new or(!1);return new Kr(new(0,Fe.MicAudioSource)(t,null,null,e))}throw new Error("Not Supported Type")}static fromDefaultSpeakerOutput(){return new Jr(new(0,jr.SpeakerAudioDestination))}static fromSpeakerOutput(e){if(void 0===e)return qr.fromDefaultSpeakerOutput();if(e instanceof jr.SpeakerAudioDestination)return new Jr(e);throw new Error("Not Supported Type")}static fromAudioFileOutput(e){return new Jr(new Wr(e))}static fromStreamOutput(e){if(e instanceof zr)return new Jr(new(0,pn.PushAudioOutputStreamImpl)(e));if(e instanceof pn.PushAudioOutputStream)return new Jr(e);if(e instanceof pn.PullAudioOutputStream)return new Jr(e);throw new Error("Not Supported Type")}}class Kr extends qr{constructor(e){super(),this.privSource=e}get format(){return this.privSource.format}close(e,t){this.privSource.turnOff().then((()=>{e&&e()}),(e=>{t&&t(e)}))}id(){return this.privSource.id()}get blob(){return this.privSource.blob}turnOn(){return this.privSource.turnOn()}attach(e){return this.privSource.attach(e)}detach(e){return this.privSource.detach(e)}turnOff(){return this.privSource.turnOff()}get events(){return this.privSource.events}setProperty(e,t){if(Ue.throwIfNull(t,"value"),void 0===this.privSource.setProperty)throw new Error("This AudioConfig instance does not support setting properties.");this.privSource.setProperty(e,t)}getProperty(e,t){if(void 0!==this.privSource.getProperty)return this.privSource.getProperty(e,t);throw new Error("This AudioConfig instance does not support getting properties.")}get deviceInfo(){return this.privSource.deviceInfo}}class Jr extends qr{constructor(e){super(),this.privDestination=e}set format(e){this.privDestination.format=e}write(e){this.privDestination.write(e)}close(){this.privDestination.close()}id(){return this.privDestination.id()}setProperty(){throw new Error("This AudioConfig instance does not support setting properties.")}getProperty(){throw new Error("This AudioConfig instance does not support getting properties.")}}var Qr={};e(Qr,"SpeechRecognizer",(()=>ei),(e=>ei=e));var Xr={};e(Xr,"Recognizer",(()=>Zr),(e=>Zr=e));var Yr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Zr{constructor(e,t,n){this.audioConfig=void 0!==e?e:qr.fromDefaultMicrophoneInput(),this.privDisposed=!1,this.privProperties=t.clone(),this.privConnectionFactory=n,this.implCommonRecognizerSetup()}close(e,t){Ue.throwIfDisposed(this.privDisposed),oe(this.dispose(!0),e,t)}get internalData(){return this.privReco}dispose(e){return Yr(this,void 0,void 0,(function*(){this.privDisposed||(this.privDisposed=!0,e&&this.privReco&&(yield this.privReco.audioSource.turnOff(),yield this.privReco.dispose()))}))}static get telemetryEnabled(){return Ye.ServiceRecognizerBase.telemetryDataEnabled}static enableTelemetry(e){Ye.ServiceRecognizerBase.telemetryDataEnabled=e}implCommonRecognizerSetup(){let e="undefined"!=typeof window?"Browser":"Node",t="unknown",n="unknown";"undefined"!=typeof navigator&&(e=e+"/"+navigator.platform,t=navigator.userAgent,n=navigator.appVersion);const r=this.createRecognizerConfig(new ht(new ft(new mt(e,t,n))));this.privReco=this.createServiceRecognizer(Zr.getAuthFromProperties(this.privProperties),this.privConnectionFactory,this.audioConfig,r)}recognizeOnceAsyncImpl(e){return Yr(this,void 0,void 0,(function*(){Ue.throwIfDisposed(this.privDisposed);const t=new ie;yield this.implRecognizerStop(),yield this.privReco.recognize(e,t.resolve,t.reject);const n=yield t.promise;return yield this.implRecognizerStop(),n}))}startContinuousRecognitionAsyncImpl(e){return Yr(this,void 0,void 0,(function*(){Ue.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop(),yield this.privReco.recognize(e,void 0,void 0)}))}stopContinuousRecognitionAsyncImpl(){return Yr(this,void 0,void 0,(function*(){Ue.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop()}))}implRecognizerStop(){return Yr(this,void 0,void 0,(function*(){this.privReco&&(yield this.privReco.stopRecognizing())}))}static getAuthFromProperties(e){const t=e.getProperty(Qe.SpeechServiceConnection_Key,void 0);return t&&""!==t?new He(t):new Ve((()=>{const t=e.getProperty(Qe.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}),(()=>{const t=e.getProperty(Qe.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}))}}var $r=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class ei extends Xr.Recognizer{constructor(e,t){const n=e;Ue.throwIfNull(n,"speechConfig"),Ue.throwIfNullOrWhitespace(n.properties.getProperty(Qe.SpeechServiceConnection_RecoLanguage),Qe[Qe.SpeechServiceConnection_RecoLanguage]),super(t,n.properties,new Ct),this.privDisposedRecognizer=!1}static FromConfig(e,t,n){const r=e;t.properties.mergeTo(r.properties);return new ei(e,n)}get endpointId(){return Ue.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(Qe.SpeechServiceConnection_EndpointId,"00000000-0000-0000-0000-000000000000")}get authorizationToken(){return this.properties.getProperty(Qe.SpeechServiceAuthorization_Token)}set authorizationToken(e){Ue.throwIfNullOrWhitespace(e,"token"),this.properties.setProperty(Qe.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return Ue.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(Qe.SpeechServiceConnection_RecoLanguage)}get outputFormat(){return Ue.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(Xn,vt[vt.Simple])===vt[vt.Simple]?vt.Simple:vt.Detailed}get properties(){return this.privProperties}recognizeOnceAsync(e,t){oe(this.recognizeOnceAsyncImpl(tt.Interactive),e,t)}startContinuousRecognitionAsync(e,t){oe(this.startContinuousRecognitionAsyncImpl(tt.Conversation),e,t)}stopContinuousRecognitionAsync(e,t){oe(this.stopContinuousRecognitionAsyncImpl(),e,t)}startKeywordRecognitionAsync(e,t,n){Ue.throwIfNull(e,"model"),n&&n("Not yet implemented.")}stopKeywordRecognitionAsync(e){e&&e()}close(e,t){Ue.throwIfDisposed(this.privDisposedRecognizer),oe(this.dispose(!0),e,t)}dispose(e){const t=Object.create(null,{dispose:{get:()=>super.dispose}});return $r(this,void 0,void 0,(function*(){this.privDisposedRecognizer||(e&&(this.privDisposedRecognizer=!0,yield this.implRecognizerStop()),yield t.dispose.call(this,e))}))}createRecognizerConfig(e){return new dt(e,this.properties)}createServiceRecognizer(e,t,n,r){return new(0,Bt.SpeechServiceRecognizer)(e,t,n,r,this)}}var ti,ni,ri,ii,oi={};e(oi,"SpeechSynthesizer",(()=>ci),(e=>ci=e)),(ni=ti||(ti={}))[ni.Unknown=0]="Unknown",ni[ni.Female=1]="Female",ni[ni.Male=2]="Male",(ii=ri||(ri={}))[ii.OnlineNeural=1]="OnlineNeural",ii[ii.OnlineStandard=2]="OnlineStandard",ii[ii.OfflineNeural=3]="OfflineNeural",ii[ii.OfflineStandard=4]="OfflineStandard";class ai{constructor(e){if(this.privStyleList=[],this.privVoicePath="",e&&(this.privName=e.Name,this.privLocale=e.Locale,this.privShortName=e.ShortName,this.privLocalName=e.LocalName,this.privVoiceType=e.VoiceType.endsWith("Standard")?ri.OnlineStandard:ri.OnlineNeural,this.privGender="Male"===e.Gender?ti.Male:"Female"===e.Gender?ti.Female:ti.Unknown,e.StyleList&&Array.isArray(e.StyleList)))for(const t of e.StyleList)this.privStyleList.push(t)}get name(){return this.privName}get locale(){return this.privLocale}get shortName(){return this.privShortName}get localName(){return this.privLocalName}get gender(){return this.privGender}get voiceType(){return this.privVoiceType}get styleList(){return this.privStyleList}get voicePath(){return this.privVoicePath}}class si extends Rn{constructor(e,t,n){if(Array.isArray(t)){super(e,yt.VoicesListRetrieved,void 0,new kt),this.privVoices=[];for(const e of t)this.privVoices.push(new ai(e))}else super(e,yt.Canceled,n||"Error information unavailable",new kt)}get voices(){return this.privVoices}}var li=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class ci{constructor(e,t){const n=e;Ue.throwIfNull(n,"speechConfig"),null!==t&&(this.audioConfig=void 0===t?"undefined"==typeof window?void 0:qr.fromDefaultSpeakerOutput():t),this.privProperties=n.properties.clone(),this.privDisposed=!1,this.privSynthesizing=!1,this.privConnectionFactory=new Tt,this.synthesisRequestQueue=new(0,ae.Queue),this.implCommonSynthesizeSetup()}get authorizationToken(){return this.properties.getProperty(Qe.SpeechServiceAuthorization_Token)}set authorizationToken(e){Ue.throwIfNullOrWhitespace(e,"token"),this.properties.setProperty(Qe.SpeechServiceAuthorization_Token,e)}get properties(){return this.privProperties}get autoDetectSourceLanguage(){return"OpenRange"===this.properties.getProperty(Qe.SpeechServiceConnection_AutoDetectSourceLanguages)}static FromConfig(e,t,n){const r=e;return t.properties.mergeTo(r.properties),new ci(e,n)}buildSsml(e){const t={"af-ZA":"af-ZA-AdriNeural","am-ET":"am-ET-AmehaNeural","ar-AE":"ar-AE-FatimaNeural","ar-BH":"ar-BH-AliNeural","ar-DZ":"ar-DZ-AminaNeural","ar-EG":"ar-EG-SalmaNeural","ar-IQ":"ar-IQ-BasselNeural","ar-JO":"ar-JO-SanaNeural","ar-KW":"ar-KW-FahedNeural","ar-LY":"ar-LY-ImanNeural","ar-MA":"ar-MA-JamalNeural","ar-QA":"ar-QA-AmalNeural","ar-SA":"ar-SA-HamedNeural","ar-SY":"ar-SY-AmanyNeural","ar-TN":"ar-TN-HediNeural","ar-YE":"ar-YE-MaryamNeural","bg-BG":"bg-BG-BorislavNeural","bn-BD":"bn-BD-NabanitaNeural","bn-IN":"bn-IN-BashkarNeural","ca-ES":"ca-ES-JoanaNeural","cs-CZ":"cs-CZ-AntoninNeural","cy-GB":"cy-GB-AledNeural","da-DK":"da-DK-ChristelNeural","de-AT":"de-AT-IngridNeural","de-CH":"de-CH-JanNeural","de-DE":"de-DE-KatjaNeural","el-GR":"el-GR-AthinaNeural","en-AU":"en-AU-NatashaNeural","en-CA":"en-CA-ClaraNeural","en-GB":"en-GB-LibbyNeural","en-HK":"en-HK-SamNeural","en-IE":"en-IE-ConnorNeural","en-IN":"en-IN-NeerjaNeural","en-KE":"en-KE-AsiliaNeural","en-NG":"en-NG-AbeoNeural","en-NZ":"en-NZ-MitchellNeural","en-PH":"en-PH-JamesNeural","en-SG":"en-SG-LunaNeural","en-TZ":"en-TZ-ElimuNeural","en-US":"en-US-JennyNeural","en-ZA":"en-ZA-LeahNeural","es-AR":"es-AR-ElenaNeural","es-BO":"es-BO-MarceloNeural","es-CL":"es-CL-CatalinaNeural","es-CO":"es-CO-GonzaloNeural","es-CR":"es-CR-JuanNeural","es-CU":"es-CU-BelkysNeural","es-DO":"es-DO-EmilioNeural","es-EC":"es-EC-AndreaNeural","es-ES":"es-ES-AlvaroNeural","es-GQ":"es-GQ-JavierNeural","es-GT":"es-GT-AndresNeural","es-HN":"es-HN-CarlosNeural","es-MX":"es-MX-DaliaNeural","es-NI":"es-NI-FedericoNeural","es-PA":"es-PA-MargaritaNeural","es-PE":"es-PE-AlexNeural","es-PR":"es-PR-KarinaNeural","es-PY":"es-PY-MarioNeural","es-SV":"es-SV-LorenaNeural","es-US":"es-US-AlonsoNeural","es-UY":"es-UY-MateoNeural","es-VE":"es-VE-PaolaNeural","et-EE":"et-EE-AnuNeural","fa-IR":"fa-IR-DilaraNeural","fi-FI":"fi-FI-SelmaNeural","fil-PH":"fil-PH-AngeloNeural","fr-BE":"fr-BE-CharlineNeural","fr-CA":"fr-CA-SylvieNeural","fr-CH":"fr-CH-ArianeNeural","fr-FR":"fr-FR-DeniseNeural","ga-IE":"ga-IE-ColmNeural","gl-ES":"gl-ES-RoiNeural","gu-IN":"gu-IN-DhwaniNeural","he-IL":"he-IL-AvriNeural","hi-IN":"hi-IN-MadhurNeural","hr-HR":"hr-HR-GabrijelaNeural","hu-HU":"hu-HU-NoemiNeural","id-ID":"id-ID-ArdiNeural","is-IS":"is-IS-GudrunNeural","it-IT":"it-IT-IsabellaNeural","ja-JP":"ja-JP-NanamiNeural","jv-ID":"jv-ID-DimasNeural","kk-KZ":"kk-KZ-AigulNeural","km-KH":"km-KH-PisethNeural","kn-IN":"kn-IN-GaganNeural","ko-KR":"ko-KR-SunHiNeural","lo-LA":"lo-LA-ChanthavongNeural","lt-LT":"lt-LT-LeonasNeural","lv-LV":"lv-LV-EveritaNeural","mk-MK":"mk-MK-AleksandarNeural","ml-IN":"ml-IN-MidhunNeural","mr-IN":"mr-IN-AarohiNeural","ms-MY":"ms-MY-OsmanNeural","mt-MT":"mt-MT-GraceNeural","my-MM":"my-MM-NilarNeural","nb-NO":"nb-NO-PernilleNeural","nl-BE":"nl-BE-ArnaudNeural","nl-NL":"nl-NL-ColetteNeural","pl-PL":"pl-PL-AgnieszkaNeural","ps-AF":"ps-AF-GulNawazNeural","pt-BR":"pt-BR-FranciscaNeural","pt-PT":"pt-PT-DuarteNeural","ro-RO":"ro-RO-AlinaNeural","ru-RU":"ru-RU-SvetlanaNeural","si-LK":"si-LK-SameeraNeural","sk-SK":"sk-SK-LukasNeural","sl-SI":"sl-SI-PetraNeural","so-SO":"so-SO-MuuseNeural","sr-RS":"sr-RS-NicholasNeural","su-ID":"su-ID-JajangNeural","sv-SE":"sv-SE-SofieNeural","sw-KE":"sw-KE-RafikiNeural","sw-TZ":"sw-TZ-DaudiNeural","ta-IN":"ta-IN-PallaviNeural","ta-LK":"ta-LK-KumarNeural","ta-SG":"ta-SG-AnbuNeural","te-IN":"te-IN-MohanNeural","th-TH":"th-TH-PremwadeeNeural","tr-TR":"tr-TR-AhmetNeural","uk-UA":"uk-UA-OstapNeural","ur-IN":"ur-IN-GulNeural","ur-PK":"ur-PK-AsadNeural","uz-UZ":"uz-UZ-MadinaNeural","vi-VN":"vi-VN-HoaiMyNeural","zh-CN":"zh-CN-XiaoxiaoNeural","zh-HK":"zh-HK-HiuMaanNeural","zh-TW":"zh-TW-HsiaoChenNeural","zu-ZA":"zu-ZA-ThandoNeural"};let n=this.properties.getProperty(Qe.SpeechServiceConnection_SynthLanguage,"en-US"),r=this.properties.getProperty(Qe.SpeechServiceConnection_SynthVoice,""),i=ci.XMLEncode(e);return this.autoDetectSourceLanguage?n="en-US":r=r||t[n],r&&(i=`<voice name='${r}'>${i}</voice>`),i=`<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='http://www.w3.org/2001/mstts' xmlns:emo='http://www.w3.org/2009/10/emotionml' xml:lang='${n}'>${i}</speak>`,i}speakTextAsync(e,t,n,r){this.speakImpl(e,!1,t,n,r)}speakSsmlAsync(e,t,n,r){this.speakImpl(e,!0,t,n,r)}getVoicesAsync(e=""){return li(this,void 0,void 0,(function*(){return this.getVoices(e)}))}close(e,t){Ue.throwIfDisposed(this.privDisposed),oe(this.dispose(!0),e,t)}get internalData(){return this.privAdapter}dispose(e){return li(this,void 0,void 0,(function*(){this.privDisposed||(e&&this.privAdapter&&(yield this.privAdapter.dispose()),this.privDisposed=!0)}))}createSynthesizerConfig(e){return new Jn(e,this.privProperties)}createSynthesisAdapter(e,t,n,r){return new(0,Tn.SynthesisAdapterBase)(e,t,r,this,this.audioConfig)}implCommonSynthesizeSetup(){let e="undefined"!=typeof window?"Browser":"Node",t="unknown",n="unknown";"undefined"!=typeof navigator&&(e=e+"/"+navigator.platform,t=navigator.userAgent,n=navigator.appVersion);const r=this.createSynthesizerConfig(new ht(new ft(new mt(e,t,n)))),i=this.privProperties.getProperty(Qe.SpeechServiceConnection_Key,void 0),o=i&&""!==i?new He(i):new Ve((()=>{const e=this.privProperties.getProperty(Qe.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(e)}),(()=>{const e=this.privProperties.getProperty(Qe.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(e)}));this.privAdapter=this.createSynthesisAdapter(o,this.privConnectionFactory,this.audioConfig,r),this.privAdapter.audioOutputFormat=dn.fromSpeechSynthesisOutputFormat(Zt[this.properties.getProperty(Qe.SpeechServiceConnection_SynthOutputFormat,void 0)]),this.privRestAdapter=new Kn(r)}speakImpl(e,t,n,r,i){try{Ue.throwIfDisposed(this.privDisposed);const o=x();let a;a=i instanceof zr?new(0,pn.PushAudioOutputStreamImpl)(i):i instanceof pn.PullAudioOutputStream?i:void 0!==i?new Wr(i):void 0,this.synthesisRequestQueue.enqueue(new ui(o,e,t,(e=>{if(this.privSynthesizing=!1,n)try{n(e)}catch(e){r&&r(e)}n=void 0,this.adapterSpeak().catch((()=>{}))}),(e=>{r&&r(e)}),a)),this.adapterSpeak().catch((()=>{}))}catch(e){if(r)if(e instanceof Error){const t=e;r(t.name+": "+t.message)}else r(e);this.dispose(!0).catch((()=>{}))}}getVoices(e){return li(this,void 0,void 0,(function*(){const t=x(),n=yield this.privRestAdapter.getVoicesList(t);if(n.ok&&Array.isArray(n.json)){let r=n.json;return e&&e.length>0&&(r=r.filter((t=>!!t.Locale&&t.Locale.toLowerCase()===e.toLowerCase()))),new si(t,r,void 0)}return new si(t,void 0,`Error: ${n.status}: ${n.statusText}`)}))}adapterSpeak(){return li(this,void 0,void 0,(function*(){if(!this.privDisposed&&!this.privSynthesizing){this.privSynthesizing=!0;const e=yield this.synthesisRequestQueue.dequeue();return this.privAdapter.Speak(e.text,e.isSSML,e.requestId,e.cb,e.err,e.dataStream)}}))}static XMLEncode(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}}class ui{constructor(e,t,n,r,i,o){this.requestId=e,this.text=t,this.isSSML=n,this.cb=r,this.err=i,this.dataStream=o}}function di(){
|
|
61
|
+
e.exports=function(t){var n={},r=o("kyWRD"),i=o("85Hg2"),a=o("kMsGZ");function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,c=60103,u=60106,d=60107,h=60108,f=60114,p=60109,m=60110,g=60112,v=60113,b=60120,y=60115,w=60116,S=60121,x=60129,M=60130,_=60131;if("function"==typeof Symbol&&Symbol.for){var A=Symbol.for;c=A("react.element"),u=A("react.portal"),d=A("react.fragment"),h=A("react.strict_mode"),f=A("react.profiler"),p=A("react.provider"),m=A("react.context"),g=A("react.forward_ref"),v=A("react.suspense"),b=A("react.suspense_list"),y=A("react.memo"),w=A("react.lazy"),S=A("react.block"),A("react.scope"),x=A("react.debug_trace_mode"),M=A("react.offscreen"),_=A("react.legacy_hidden")}var E="function"==typeof Symbol&&Symbol.iterator;function C(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=E&&e[E]||e["@@iterator"])?e:null}function T(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case d:return"Fragment";case u:return"Portal";case f:return"Profiler";case h:return"StrictMode";case v:return"Suspense";case b:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case m:return(e.displayName||"Context")+".Consumer";case p:return(e._context.displayName||"Context")+".Provider";case g:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case y:return T(e.type);case S:return T(e._render);case w:t=e._payload,e=e._init;try{return T(e(t))}catch(e){}}return null}function I(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function k(e){if(I(e)!==e)throw Error(s(188))}function R(e){var t=e.alternate;if(!t){if(null===(t=I(e)))throw Error(s(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return k(i),e;if(o===r)return k(i),t;o=o.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,l=i.child;l;){if(l===n){a=!0,n=i,r=o;break}if(l===r){a=!0,r=i,n=o;break}l=l.sibling}if(!a){for(l=o.child;l;){if(l===n){a=!0,n=o,r=i;break}if(l===r){a=!0,r=o,n=i;break}l=l.sibling}if(!a)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(3!==n.tag)throw Error(s(188));return n.stateNode.current===n?e:t}function O(e){if(!(e=R(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function P(e,t){for(var n=e.alternate;null!==t;){if(t===e||t===n)return!0;t=t.return}return!1}var N,B=t.getPublicInstance,L=t.getRootHostContext,D=t.getChildHostContext,U=t.prepareForCommit,F=t.resetAfterCommit,z=t.createInstance,j=t.appendInitialChild,H=t.finalizeInitialChildren,G=t.prepareUpdate,V=t.shouldSetTextContent,W=t.createTextInstance,q=t.scheduleTimeout,K=t.cancelTimeout,J=t.noTimeout,Q=t.isPrimaryRenderer,X=t.supportsMutation,Y=t.supportsPersistence,Z=t.supportsHydration,$=t.getInstanceFromNode,ee=t.makeOpaqueHydratingObject,te=t.makeClientId,ne=t.beforeActiveInstanceBlur,re=t.afterActiveInstanceBlur,ie=t.preparePortalMount,oe=t.supportsTestSelectors,ae=t.findFiberRoot,se=t.getBoundingRect,le=t.getTextContent,ce=t.isHiddenSubtree,ue=t.matchAccessibilityRole,de=t.setFocusIfFocusable,he=t.setupIntersectionObserver,fe=t.appendChild,pe=t.appendChildToContainer,me=t.commitTextUpdate,ge=t.commitMount,ve=t.commitUpdate,be=t.insertBefore,ye=t.insertInContainerBefore,we=t.removeChild,Se=t.removeChildFromContainer,xe=t.resetTextContent,Me=t.hideInstance,_e=t.hideTextInstance,Ae=t.unhideInstance,Ee=t.unhideTextInstance,Ce=t.clearContainer,Te=t.cloneInstance,Ie=t.createContainerChildSet,ke=t.appendChildToContainerChildSet,Re=t.finalizeContainerChildren,Oe=t.replaceContainerChildren,Pe=t.cloneHiddenInstance,Ne=t.cloneHiddenTextInstance,Be=t.canHydrateInstance,Le=t.canHydrateTextInstance,De=t.isSuspenseInstancePending,Ue=t.isSuspenseInstanceFallback,Fe=t.getNextHydratableSibling,ze=t.getFirstHydratableChild,je=t.hydrateInstance,He=t.hydrateTextInstance,Ge=t.getNextHydratableInstanceAfterSuspenseInstance,Ve=t.commitHydratedContainer,We=t.commitHydratedSuspenseInstance;function qe(e){if(void 0===N)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);N=t&&t[1]||""}return"\n"+N+e}var Ke=!1;function Je(e,t){if(!e||Ke)return"";Ke=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(e){if(e&&r&&"string"==typeof e.stack){for(var i=e.stack.split("\n"),o=r.stack.split("\n"),a=i.length-1,s=o.length-1;1<=a&&0<=s&&i[a]!==o[s];)s--;for(;1<=a&&0<=s;a--,s--)if(i[a]!==o[s]){if(1!==a||1!==s)do{if(a--,0>--s||i[a]!==o[s])return"\n"+i[a].replace(" at new "," at ")}while(1<=a&&0<=s);break}}}finally{Ke=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?qe(e):""}var Qe=[],Xe=-1;function Ye(e){return{current:e}}function Ze(e){0>Xe||(e.current=Qe[Xe],Qe[Xe]=null,Xe--)}function $e(e,t){Xe++,Qe[Xe]=e.current,e.current=t}var et={},tt=Ye(et),nt=Ye(!1),rt=et;function it(e,t){var n=e.type.contextTypes;if(!n)return et;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ot(e){return null!=(e=e.childContextTypes)}function at(){Ze(nt),Ze(tt)}function st(e,t,n){if(tt.current!==et)throw Error(s(168));$e(tt,t),$e(nt,n)}function lt(e,t,n){var i=e.stateNode;if(e=t.childContextTypes,"function"!=typeof i.getChildContext)return n;for(var o in i=i.getChildContext())if(!(o in e))throw Error(s(108,T(t)||"Unknown",o));return r({},n,i)}function ct(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||et,rt=tt.current,$e(tt,e),$e(nt,nt.current),!0}function ut(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=lt(e,t,rt),r.__reactInternalMemoizedMergedChildContext=e,Ze(nt),Ze(tt),$e(tt,e)):Ze(nt),$e(nt,n)}var dt=null,ht=null;(0,a.unstable_now)();var ft=0,pt=8;function mt(e){if(0!=(1&e))return pt=15,1;if(0!=(2&e))return pt=14,2;if(0!=(4&e))return pt=13,4;var t=24&e;return 0!==t?(pt=12,t):0!=(32&e)?(pt=11,32):0!==(t=192&e)?(pt=10,t):0!=(256&e)?(pt=9,256):0!==(t=3584&e)?(pt=8,t):0!=(4096&e)?(pt=7,4096):0!==(t=4186112&e)?(pt=6,t):0!==(t=62914560&e)?(pt=5,t):67108864&e?(pt=4,67108864):0!=(134217728&e)?(pt=3,134217728):0!==(t=805306368&e)?(pt=2,t):0!=(1073741824&e)?(pt=1,1073741824):(pt=8,e)}function gt(e,t){var n=e.pendingLanes;if(0===n)return pt=0;var r=0,i=0,o=e.expiredLanes,a=e.suspendedLanes,s=e.pingedLanes;if(0!==o)r=o,i=pt=15;else if(0!==(o=134217727&n)){var l=o&~a;0!==l?(r=mt(l),i=pt):0!==(s&=o)&&(r=mt(s),i=pt)}else 0!==(o=n&~a)?(r=mt(o),i=pt):0!==s&&(r=mt(s),i=pt);if(0===r)return 0;if(r=n&((0>(r=31-xt(r))?0:1<<r)<<1)-1,0!==t&&t!==r&&0==(t&a)){if(mt(t),i<=pt)return t;pt=i}if(0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)i=1<<(n=31-xt(t)),r|=e[n],t&=~i;return r}function vt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function bt(e,t){switch(e){case 15:return 1;case 14:return 2;case 12:return 0===(e=yt(24&~t))?bt(10,t):e;case 10:return 0===(e=yt(192&~t))?bt(8,t):e;case 8:return 0===(e=yt(3584&~t))&&(0===(e=yt(4186112&~t))&&(e=512)),e;case 2:return 0===(t=yt(805306368&~t))&&(t=268435456),t}throw Error(s(358,e))}function yt(e){return e&-e}function wt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function St(e,t,n){e.pendingLanes|=t;var r=t-1;e.suspendedLanes&=r,e.pingedLanes&=r,(e=e.eventTimes)[t=31-xt(t)]=n}var xt=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(Mt(e)/_t|0)|0},Mt=Math.log,_t=Math.LN2;var At=a.unstable_runWithPriority,Et=a.unstable_scheduleCallback,Ct=a.unstable_cancelCallback,Tt=a.unstable_shouldYield,It=a.unstable_requestPaint,kt=a.unstable_now,Rt=a.unstable_getCurrentPriorityLevel,Ot=a.unstable_ImmediatePriority,Pt=a.unstable_UserBlockingPriority,Nt=a.unstable_NormalPriority,Bt=a.unstable_LowPriority,Lt=a.unstable_IdlePriority,Dt={},Ut=void 0!==It?It:function(){},Ft=null,zt=null,jt=!1,Ht=kt(),Gt=1e4>Ht?kt:function(){return kt()-Ht};function Vt(){switch(Rt()){case Ot:return 99;case Pt:return 98;case Nt:return 97;case Bt:return 96;case Lt:return 95;default:throw Error(s(332))}}function Wt(e){switch(e){case 99:return Ot;case 98:return Pt;case 97:return Nt;case 96:return Bt;case 95:return Lt;default:throw Error(s(332))}}function qt(e,t){return e=Wt(e),At(e,t)}function Kt(e,t,n){return e=Wt(e),Et(e,t,n)}function Jt(){if(null!==zt){var e=zt;zt=null,Ct(e)}Qt()}function Qt(){if(!jt&&null!==Ft){jt=!0;var e=0;try{var t=Ft;qt(99,(function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}})),Ft=null}catch(t){throw null!==Ft&&(Ft=Ft.slice(e+1)),Et(Ot,Jt),t}finally{jt=!1}}}var Xt=l.ReactCurrentBatchConfig;var Yt="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Zt=Object.prototype.hasOwnProperty;function $t(e,t){if(Yt(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!Zt.call(t,n[r])||!Yt(e[n[r]],t[n[r]]))return!1;return!0}function en(e){switch(e.tag){case 5:return qe(e.type);case 16:return qe("Lazy");case 13:return qe("Suspense");case 19:return qe("SuspenseList");case 0:case 2:case 15:return e=Je(e.type,!1);case 11:return e=Je(e.type.render,!1);case 22:return e=Je(e.type._render,!1);case 1:return e=Je(e.type,!0);default:return""}}function tn(e,t){if(e&&e.defaultProps){for(var n in t=r({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var nn=Ye(null),rn=null,on=null,an=null;function sn(){an=on=rn=null}function ln(e,t){e=e.type._context,Q?($e(nn,e._currentValue),e._currentValue=t):($e(nn,e._currentValue2),e._currentValue2=t)}function cn(e){var t=nn.current;Ze(nn),e=e.type._context,Q?e._currentValue=t:e._currentValue2=t}function un(e,t){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)===t){if(null===n||(n.childLanes&t)===t)break;n.childLanes|=t}else e.childLanes|=t,null!==n&&(n.childLanes|=t);e=e.return}}function dn(e,t){rn=e,an=on=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(Hr=!0),e.firstContext=null)}function hn(e,t){if(an!==e&&!1!==t&&0!==t)if("number"==typeof t&&1073741823!==t||(an=e,t=1073741823),t={context:e,observedBits:t,next:null},null===on){if(null===rn)throw Error(s(308));on=t,rn.dependencies={lanes:0,firstContext:t,responders:null}}else on=on.next=t;return Q?e._currentValue:e._currentValue2}var fn=!1;function pn(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function mn(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function gn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function vn(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function bn(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?i=o=a:o=o.next=a,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function yn(e,t,n,i){var o=e.updateQueue;fn=!1;var a=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(null!==l){o.shared.pending=null;var c=l,u=c.next;c.next=null,null===s?a=u:s.next=u,s=c;var d=e.alternate;if(null!==d){var h=(d=d.updateQueue).lastBaseUpdate;h!==s&&(null===h?d.firstBaseUpdate=u:h.next=u,d.lastBaseUpdate=c)}}if(null!==a){for(h=o.baseState,s=0,d=u=c=null;;){l=a.lane;var f=a.eventTime;if((i&l)===l){null!==d&&(d=d.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,m=a;switch(l=t,f=n,m.tag){case 1:if("function"==typeof(p=m.payload)){h=p.call(f,h,l);break e}h=p;break e;case 3:p.flags=-4097&p.flags|64;case 0:if(null==(l="function"==typeof(p=m.payload)?p.call(f,h,l):p))break e;h=r({},h,l);break e;case 2:fn=!0}}null!==a.callback&&(e.flags|=32,null===(l=o.effects)?o.effects=[a]:l.push(a))}else f={eventTime:f,lane:l,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===d?(u=d=f,c=h):d=d.next=f,s|=l;if(null===(a=a.next)){if(null===(l=o.shared.pending))break;a=l.next,l.next=null,o.lastBaseUpdate=l,o.shared.pending=null}}null===d&&(c=h),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=d,ho|=s,e.lanes=s,e.memoizedState=h}}function wn(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(null!==i){if(r.callback=null,r=n,"function"!=typeof i)throw Error(s(191,i));i.call(r)}}}var Sn=(new i.Component).refs;function xn(e,t,n,i){n=null==(n=n(i,t=e.memoizedState))?t:r({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var Mn={isMounted:function(e){return!!(e=e._reactInternals)&&I(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Do(),i=Uo(e),o=gn(r,i);o.payload=t,null!=n&&(o.callback=n),vn(e,o),Fo(e,i,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Do(),i=Uo(e),o=gn(r,i);o.tag=1,o.payload=t,null!=n&&(o.callback=n),vn(e,o),Fo(e,i,r)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Do(),r=Uo(e),i=gn(n,r);i.tag=2,null!=t&&(i.callback=t),vn(e,i),Fo(e,r,n)}};function _n(e,t,n,r,i,o,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,a):!t.prototype||!t.prototype.isPureReactComponent||(!$t(n,r)||!$t(i,o))}function An(e,t,n){var r=!1,i=et,o=t.contextType;return"object"==typeof o&&null!==o?o=hn(o):(i=ot(t)?rt:tt.current,o=(r=null!=(r=t.contextTypes))?it(e,i):et),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Mn,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function En(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Mn.enqueueReplaceState(t,t.state,null)}function Cn(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs=Sn,pn(e);var o=t.contextType;"object"==typeof o&&null!==o?i.context=hn(o):(o=ot(t)?rt:tt.current,i.context=it(e,o)),yn(e,n,i,r),i.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(xn(e,t,o,n),i.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(t=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&Mn.enqueueReplaceState(i,i.state,null),yn(e,n,i,r),i.state=e.memoizedState),"function"==typeof i.componentDidMount&&(e.flags|=4)}var Tn=Array.isArray;function In(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(s(309));var r=n.stateNode}if(!r)throw Error(s(147,e));var i=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===i?t.ref:(t=function(e){var t=r.refs;t===Sn&&(t=r.refs={}),null===e?delete t[i]:t[i]=e},t._stringRef=i,t)}if("string"!=typeof e)throw Error(s(284));if(!n._owner)throw Error(s(290,e))}return e}function kn(e,t){if("textarea"!==e.type)throw Error(s(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t))}function Rn(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.flags=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=_a(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags=2,n):r:(t.flags=2,n):n}function a(t){return e&&null===t.alternate&&(t.flags=2),t}function l(e,t,n,r){return null===t||6!==t.tag?((t=Ta(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function h(e,t,n,r){return null!==t&&t.elementType===n.type?((r=i(t,n.props)).ref=In(e,t,n),r.return=e,r):((r=Aa(n.type,n.key,n.props,null,e.mode,r)).ref=In(e,t,n),r.return=e,r)}function f(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Ia(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function p(e,t,n,r,o){return null===t||7!==t.tag?((t=Ea(n,e.mode,r,o)).return=e,t):((t=i(t,n)).return=e,t)}function m(e,t,n){if("string"==typeof t||"number"==typeof t)return(t=Ta(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case c:return(n=Aa(t.type,t.key,t.props,null,e.mode,n)).ref=In(e,null,t),n.return=e,n;case u:return(t=Ia(t,e.mode,n)).return=e,t}if(Tn(t)||C(t))return(t=Ea(t,e.mode,n,null)).return=e,t;kn(e,t)}return null}function g(e,t,n,r){var i=null!==t?t.key:null;if("string"==typeof n||"number"==typeof n)return null!==i?null:l(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case c:return n.key===i?n.type===d?p(e,t,n.props.children,r,i):h(e,t,n,r):null;case u:return n.key===i?f(e,t,n,r):null}if(Tn(n)||C(n))return null!==i?null:p(e,t,n,r,null);kn(e,n)}return null}function v(e,t,n,r,i){if("string"==typeof r||"number"==typeof r)return l(t,e=e.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case c:return e=e.get(null===r.key?n:r.key)||null,r.type===d?p(t,e,r.props.children,i,r.key):h(t,e,r,i);case u:return f(t,e=e.get(null===r.key?n:r.key)||null,r,i)}if(Tn(r)||C(r))return p(t,e=e.get(n)||null,r,i,null);kn(t,r)}return null}function b(i,a,s,l){for(var c=null,u=null,d=a,h=a=0,f=null;null!==d&&h<s.length;h++){d.index>h?(f=d,d=null):f=d.sibling;var p=g(i,d,s[h],l);if(null===p){null===d&&(d=f);break}e&&d&&null===p.alternate&&t(i,d),a=o(p,a,h),null===u?c=p:u.sibling=p,u=p,d=f}if(h===s.length)return n(i,d),c;if(null===d){for(;h<s.length;h++)null!==(d=m(i,s[h],l))&&(a=o(d,a,h),null===u?c=d:u.sibling=d,u=d);return c}for(d=r(i,d);h<s.length;h++)null!==(f=v(d,i,h,s[h],l))&&(e&&null!==f.alternate&&d.delete(null===f.key?h:f.key),a=o(f,a,h),null===u?c=f:u.sibling=f,u=f);return e&&d.forEach((function(e){return t(i,e)})),c}function y(i,a,l,c){var u=C(l);if("function"!=typeof u)throw Error(s(150));if(null==(l=u.call(l)))throw Error(s(151));for(var d=u=null,h=a,f=a=0,p=null,b=l.next();null!==h&&!b.done;f++,b=l.next()){h.index>f?(p=h,h=null):p=h.sibling;var y=g(i,h,b.value,c);if(null===y){null===h&&(h=p);break}e&&h&&null===y.alternate&&t(i,h),a=o(y,a,f),null===d?u=y:d.sibling=y,d=y,h=p}if(b.done)return n(i,h),u;if(null===h){for(;!b.done;f++,b=l.next())null!==(b=m(i,b.value,c))&&(a=o(b,a,f),null===d?u=b:d.sibling=b,d=b);return u}for(h=r(i,h);!b.done;f++,b=l.next())null!==(b=v(h,i,f,b.value,c))&&(e&&null!==b.alternate&&h.delete(null===b.key?f:b.key),a=o(b,a,f),null===d?u=b:d.sibling=b,d=b);return e&&h.forEach((function(e){return t(i,e)})),u}return function(e,r,o,l){var h="object"==typeof o&&null!==o&&o.type===d&&null===o.key;h&&(o=o.props.children);var f="object"==typeof o&&null!==o;if(f)switch(o.$$typeof){case c:e:{for(f=o.key,h=r;null!==h;){if(h.key===f){if(7===h.tag){if(o.type===d){n(e,h.sibling),(r=i(h,o.props.children)).return=e,e=r;break e}}else if(h.elementType===o.type){n(e,h.sibling),(r=i(h,o.props)).ref=In(e,h,o),r.return=e,e=r;break e}n(e,h);break}t(e,h),h=h.sibling}o.type===d?((r=Ea(o.props.children,e.mode,l,o.key)).return=e,e=r):((l=Aa(o.type,o.key,o.props,null,e.mode,l)).ref=In(e,r,o),l.return=e,e=l)}return a(e);case u:e:{for(h=o.key;null!==r;){if(r.key===h){if(4===r.tag&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),(r=i(r,o.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Ia(o,e.mode,l)).return=e,e=r}return a(e)}if("string"==typeof o||"number"==typeof o)return o=""+o,null!==r&&6===r.tag?(n(e,r.sibling),(r=i(r,o)).return=e,e=r):(n(e,r),(r=Ta(o,e.mode,l)).return=e,e=r),a(e);if(Tn(o))return b(e,r,o,l);if(C(o))return y(e,r,o,l);if(f&&kn(e,o),void 0===o&&!h)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(s(152,T(e.type)||"Component"))}return n(e,r)}}var On=Rn(!0),Pn=Rn(!1),Nn={},Bn=Ye(Nn),Ln=Ye(Nn),Dn=Ye(Nn);function Un(e){if(e===Nn)throw Error(s(174));return e}function Fn(e,t){$e(Dn,t),$e(Ln,e),$e(Bn,Nn),e=L(t),Ze(Bn),$e(Bn,e)}function zn(){Ze(Bn),Ze(Ln),Ze(Dn)}function jn(e){var t=Un(Dn.current),n=Un(Bn.current);n!==(t=D(n,e.type,t))&&($e(Ln,e),$e(Bn,t))}function Hn(e){Ln.current===e&&(Ze(Bn),Ze(Ln))}var Gn=Ye(0);function Vn(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||De(n)||Ue(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Wn=null,qn=null,Kn=!1;function Jn(e,t){var n=xa(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function Qn(e,t){switch(e.tag){case 5:return null!==(t=Be(t,e.type,e.pendingProps))&&(e.stateNode=t,!0);case 6:return null!==(t=Le(t,e.pendingProps))&&(e.stateNode=t,!0);default:return!1}}function Xn(e){if(Kn){var t=qn;if(t){var n=t;if(!Qn(e,t)){if(!(t=Fe(n))||!Qn(e,t))return e.flags=-1025&e.flags|2,Kn=!1,void(Wn=e);Jn(Wn,n)}Wn=e,qn=ze(t)}else e.flags=-1025&e.flags|2,Kn=!1,Wn=e}}function Yn(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Wn=e}function Zn(e){if(!Z||e!==Wn)return!1;if(!Kn)return Yn(e),Kn=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!V(t,e.memoizedProps))for(t=qn;t;)Jn(e,t),t=Fe(t);if(Yn(e),13===e.tag){if(!Z)throw Error(s(316));if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(s(317));qn=Ge(e)}else qn=Wn?Fe(e.stateNode):null;return!0}function $n(){Z&&(qn=Wn=null,Kn=!1)}var er=[];function tr(){for(var e=0;e<er.length;e++){var t=er[e];Q?t._workInProgressVersionPrimary=null:t._workInProgressVersionSecondary=null}er.length=0}var nr=l.ReactCurrentDispatcher,rr=l.ReactCurrentBatchConfig,ir=0,or=null,ar=null,sr=null,lr=!1,cr=!1;function ur(){throw Error(s(321))}function dr(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Yt(e[n],t[n]))return!1;return!0}function hr(e,t,n,r,i,o){if(ir=o,or=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,nr.current=null===e||null===e.memoizedState?Ur:Fr,e=n(r,i),cr){o=0;do{if(cr=!1,!(25>o))throw Error(s(301));o+=1,sr=ar=null,t.updateQueue=null,nr.current=zr,e=n(r,i)}while(cr)}if(nr.current=Dr,t=null!==ar&&null!==ar.next,ir=0,sr=ar=or=null,lr=!1,t)throw Error(s(300));return e}function fr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===sr?or.memoizedState=sr=e:sr=sr.next=e,sr}function pr(){if(null===ar){var e=or.alternate;e=null!==e?e.memoizedState:null}else e=ar.next;var t=null===sr?or.memoizedState:sr.next;if(null!==t)sr=t,ar=e;else{if(null===e)throw Error(s(310));e={memoizedState:(ar=e).memoizedState,baseState:ar.baseState,baseQueue:ar.baseQueue,queue:ar.queue,next:null},null===sr?or.memoizedState=sr=e:sr=sr.next=e}return sr}function mr(e,t){return"function"==typeof t?t(e):t}function gr(e){var t=pr(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=ar,i=r.baseQueue,o=n.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var l=a=o=null,c=i;do{var u=c.lane;if((ir&u)===u)null!==l&&(l=l.next={lane:0,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null}),r=c.eagerReducer===e?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null};null===l?(a=l=d,o=r):l=l.next=d,or.lanes|=u,ho|=u}c=c.next}while(null!==c&&c!==i);null===l?o=r:l.next=a,Yt(r,t.memoizedState)||(Hr=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function vr(e){var t=pr(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);Yt(o,t.memoizedState)||(Hr=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function br(e,t,n){var r=t._getVersion;r=r(t._source);var i=Q?t._workInProgressVersionPrimary:t._workInProgressVersionSecondary;if(null!==i?e=i===r:(e=e.mutableReadLanes,(e=(ir&e)===e)&&(Q?t._workInProgressVersionPrimary=r:t._workInProgressVersionSecondary=r,er.push(t))),e)return n(t._source);throw er.push(t),Error(s(350))}function yr(e,t,n,r){var i=ro;if(null===i)throw Error(s(349));var o=t._getVersion,a=o(t._source),l=nr.current,c=l.useState((function(){return br(i,t,n)})),u=c[1],d=c[0];c=sr;var h=e.memoizedState,f=h.refs,p=f.getSnapshot,m=h.source;h=h.subscribe;var g=or;return e.memoizedState={refs:f,source:t,subscribe:r},l.useEffect((function(){f.getSnapshot=n,f.setSnapshot=u;var e=o(t._source);if(!Yt(a,e)){e=n(t._source),Yt(d,e)||(u(e),e=Uo(g),i.mutableReadLanes|=e&i.pendingLanes),e=i.mutableReadLanes,i.entangledLanes|=e;for(var r=i.entanglements,s=e;0<s;){var l=31-xt(s),c=1<<l;r[l]|=e,s&=~c}}}),[n,t,r]),l.useEffect((function(){return r(t._source,(function(){var e=f.getSnapshot,n=f.setSnapshot;try{n(e(t._source));var r=Uo(g);i.mutableReadLanes|=r&i.pendingLanes}catch(e){n((function(){throw e}))}}))}),[t,r]),Yt(p,n)&&Yt(m,t)&&Yt(h,r)||((e={pending:null,dispatch:null,lastRenderedReducer:mr,lastRenderedState:d}).dispatch=u=Lr.bind(null,or,e),c.queue=e,c.baseQueue=null,d=br(i,t,n),c.memoizedState=c.baseState=d),d}function wr(e,t,n){return yr(pr(),e,t,n)}function Sr(e){var t=fr();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:mr,lastRenderedState:e}).dispatch=Lr.bind(null,or,e),[t.memoizedState,e]}function xr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=or.updateQueue)?(t={lastEffect:null},or.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Mr(e){return e={current:e},fr().memoizedState=e}function _r(){return pr().memoizedState}function Ar(e,t,n,r){var i=fr();or.flags|=e,i.memoizedState=xr(1|t,n,void 0,void 0===r?null:r)}function Er(e,t,n,r){var i=pr();r=void 0===r?null:r;var o=void 0;if(null!==ar){var a=ar.memoizedState;if(o=a.destroy,null!==r&&dr(r,a.deps))return void xr(t,n,o,r)}or.flags|=e,i.memoizedState=xr(1|t,n,o,r)}function Cr(e,t){return Ar(516,4,e,t)}function Tr(e,t){return Er(516,4,e,t)}function Ir(e,t){return Er(4,2,e,t)}function kr(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Rr(e,t,n){return n=null!=n?n.concat([e]):null,Er(4,2,kr.bind(null,t,e),n)}function Or(){}function Pr(e,t){var n=pr();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&dr(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Nr(e,t){var n=pr();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&dr(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Br(e,t){var n=Vt();qt(98>n?98:n,(function(){e(!0)})),qt(97<n?97:n,(function(){var n=rr.transition;rr.transition=1;try{e(!1),t()}finally{rr.transition=n}}))}function Lr(e,t,n){var r=Do(),i=Uo(e),o={lane:i,action:n,eagerReducer:null,eagerState:null,next:null},a=t.pending;if(null===a?o.next=o:(o.next=a.next,a.next=o),t.pending=o,a=e.alternate,e===or||null!==a&&a===or)cr=lr=!0;else{if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var s=t.lastRenderedState,l=a(s,n);if(o.eagerReducer=a,o.eagerState=l,Yt(l,s))return}catch(e){}Fo(e,i,r)}}var Dr={readContext:hn,useCallback:ur,useContext:ur,useEffect:ur,useImperativeHandle:ur,useLayoutEffect:ur,useMemo:ur,useReducer:ur,useRef:ur,useState:ur,useDebugValue:ur,useDeferredValue:ur,useTransition:ur,useMutableSource:ur,useOpaqueIdentifier:ur,unstable_isNewReconciler:!1},Ur={readContext:hn,useCallback:function(e,t){return fr().memoizedState=[e,void 0===t?null:t],e},useContext:hn,useEffect:Cr,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Ar(4,2,kr.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ar(4,2,e,t)},useMemo:function(e,t){var n=fr();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=fr();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=Lr.bind(null,or,e),[r.memoizedState,e]},useRef:Mr,useState:Sr,useDebugValue:Or,useDeferredValue:function(e){var t=Sr(e),n=t[0],r=t[1];return Cr((function(){var t=rr.transition;rr.transition=1;try{r(e)}finally{rr.transition=t}}),[e]),n},useTransition:function(){var e=Sr(!1),t=e[0];return Mr(e=Br.bind(null,e[1])),[e,t]},useMutableSource:function(e,t,n){var r=fr();return r.memoizedState={refs:{getSnapshot:t,setSnapshot:null},source:e,subscribe:n},yr(r,e,t,n)},useOpaqueIdentifier:function(){if(Kn){var e=!1,t=ee((function(){throw e||(e=!0,n(te())),Error(s(355))})),n=Sr(t)[1];return 0==(2&or.mode)&&(or.flags|=516,xr(5,(function(){n(te())}),void 0,null)),t}return Sr(t=te()),t},unstable_isNewReconciler:!1},Fr={readContext:hn,useCallback:Pr,useContext:hn,useEffect:Tr,useImperativeHandle:Rr,useLayoutEffect:Ir,useMemo:Nr,useReducer:gr,useRef:_r,useState:function(){return gr(mr)},useDebugValue:Or,useDeferredValue:function(e){var t=gr(mr),n=t[0],r=t[1];return Tr((function(){var t=rr.transition;rr.transition=1;try{r(e)}finally{rr.transition=t}}),[e]),n},useTransition:function(){var e=gr(mr)[0];return[_r().current,e]},useMutableSource:wr,useOpaqueIdentifier:function(){return gr(mr)[0]},unstable_isNewReconciler:!1},zr={readContext:hn,useCallback:Pr,useContext:hn,useEffect:Tr,useImperativeHandle:Rr,useLayoutEffect:Ir,useMemo:Nr,useReducer:vr,useRef:_r,useState:function(){return vr(mr)},useDebugValue:Or,useDeferredValue:function(e){var t=vr(mr),n=t[0],r=t[1];return Tr((function(){var t=rr.transition;rr.transition=1;try{r(e)}finally{rr.transition=t}}),[e]),n},useTransition:function(){var e=vr(mr)[0];return[_r().current,e]},useMutableSource:wr,useOpaqueIdentifier:function(){return vr(mr)[0]},unstable_isNewReconciler:!1},jr=l.ReactCurrentOwner,Hr=!1;function Gr(e,t,n,r){t.child=null===e?Pn(t,null,n,r):On(t,e.child,n,r)}function Vr(e,t,n,r,i){n=n.render;var o=t.ref;return dn(t,i),r=hr(e,t,n,r,o,i),null===e||Hr?(t.flags|=1,Gr(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~i,di(e,t,i))}function Wr(e,t,n,r,i,o){if(null===e){var a=n.type;return"function"!=typeof a||Ma(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Aa(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,qr(e,t,a,r,i,o))}return a=e.child,0==(i&o)&&(i=a.memoizedProps,(n=null!==(n=n.compare)?n:$t)(i,r)&&e.ref===t.ref)?di(e,t,o):(t.flags|=1,(e=_a(a,r)).ref=t.ref,e.return=t,t.child=e)}function qr(e,t,n,r,i,o){if(null!==e&&$t(e.memoizedProps,r)&&e.ref===t.ref){if(Hr=!1,0==(o&i))return t.lanes=e.lanes,di(e,t,o);0!=(16384&e.flags)&&(Hr=!0)}return Qr(e,t,n,r,o)}function Kr(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode||"unstable-defer-without-hiding"===r.mode)if(0==(4&t.mode))t.memoizedState={baseLanes:0},Ko(t,n);else{if(0==(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e},Ko(t,e),null;t.memoizedState={baseLanes:0},Ko(t,null!==o?o.baseLanes:n)}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,Ko(t,r);return Gr(e,t,i,n),t.child}function Jr(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=128)}function Qr(e,t,n,r,i){var o=ot(n)?rt:tt.current;return o=it(t,o),dn(t,i),n=hr(e,t,n,r,o,i),null===e||Hr?(t.flags|=1,Gr(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~i,di(e,t,i))}function Xr(e,t,n,r,i){if(ot(n)){var o=!0;ct(t)}else o=!1;if(dn(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),An(t,n,r),Cn(t,n,r,i),r=!0;else if(null===e){var a=t.stateNode,s=t.memoizedProps;a.props=s;var l=a.context,c=n.contextType;"object"==typeof c&&null!==c?c=hn(c):c=it(t,c=ot(n)?rt:tt.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof a.getSnapshotBeforeUpdate;d||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==r||l!==c)&&En(t,a,r,c),fn=!1;var h=t.memoizedState;a.state=h,yn(t,r,a,i),l=t.memoizedState,s!==r||h!==l||nt.current||fn?("function"==typeof u&&(xn(t,n,u,r),l=t.memoizedState),(s=fn||_n(t,n,s,r,h,l,c))?(d||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4)):("function"==typeof a.componentDidMount&&(t.flags|=4),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=c,r=s):("function"==typeof a.componentDidMount&&(t.flags|=4),r=!1)}else{a=t.stateNode,mn(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:tn(t.type,s),a.props=c,d=t.pendingProps,h=a.context,"object"==typeof(l=n.contextType)&&null!==l?l=hn(l):l=it(t,l=ot(n)?rt:tt.current);var f=n.getDerivedStateFromProps;(u="function"==typeof f||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==d||h!==l)&&En(t,a,r,l),fn=!1,h=t.memoizedState,a.state=h,yn(t,r,a,i);var p=t.memoizedState;s!==d||h!==p||nt.current||fn?("function"==typeof f&&(xn(t,n,f,r),p=t.memoizedState),(c=fn||_n(t,n,c,r,h,p,l))?(u||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,p,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=256)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=256),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=l,r=c):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=256),r=!1)}return Yr(e,t,n,r,o,i)}function Yr(e,t,n,r,i,o){Jr(e,t);var a=0!=(64&t.flags);if(!r&&!a)return i&&ut(t,n,!1),di(e,t,o);r=t.stateNode,jr.current=t;var s=a&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&a?(t.child=On(t,e.child,null,o),t.child=On(t,null,s,o)):Gr(e,t,s,o),t.memoizedState=r.state,i&&ut(t,n,!0),t.child}function Zr(e){var t=e.stateNode;t.pendingContext?st(0,t.pendingContext,t.pendingContext!==t.context):t.context&&st(0,t.context,!1),Fn(e,t.containerInfo)}var $r,ei,ti,ni,ri={dehydrated:null,retryLane:0};function ii(e,t,n){var r,i=t.pendingProps,o=Gn.current,a=!1;return(r=0!=(64&t.flags))||(r=(null===e||null!==e.memoizedState)&&0!=(2&o)),r?(a=!0,t.flags&=-65):null!==e&&null===e.memoizedState||void 0===i.fallback||!0===i.unstable_avoidThisFallback||(o|=1),$e(Gn,1&o),null===e?(void 0!==i.fallback&&Xn(t),e=i.children,o=i.fallback,a?(e=oi(t,e,o,n),t.child.memoizedState={baseLanes:n},t.memoizedState=ri,e):"number"==typeof i.unstable_expectedLoadTime?(e=oi(t,e,o,n),t.child.memoizedState={baseLanes:n},t.memoizedState=ri,t.lanes=33554432,e):((n=Ca({mode:"visible",children:e},t.mode,n,null)).return=t,t.child=n)):(e.memoizedState,a?(i=si(e,t,i.children,i.fallback,n),a=t.child,o=e.child.memoizedState,a.memoizedState=null===o?{baseLanes:n}:{baseLanes:o.baseLanes|n},a.childLanes=e.childLanes&~n,t.memoizedState=ri,i):(n=ai(e,t,i.children,n),t.memoizedState=null,n))}function oi(e,t,n,r){var i=e.mode,o=e.child;return t={mode:"hidden",children:t},0==(2&i)&&null!==o?(o.childLanes=0,o.pendingProps=t):o=Ca(t,i,0,null),n=Ea(n,i,r,null),o.return=e,n.return=e,o.sibling=n,e.child=o,n}function ai(e,t,n,r){var i=e.child;return e=i.sibling,n=_a(i,{mode:"visible",children:n}),0==(2&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(e.nextEffect=null,e.flags=8,t.firstEffect=t.lastEffect=e),t.child=n}function si(e,t,n,r,i){var o=t.mode,a=e.child;e=a.sibling;var s={mode:"hidden",children:n};return 0==(2&o)&&t.child!==a?((n=t.child).childLanes=0,n.pendingProps=s,null!==(a=n.lastEffect)?(t.firstEffect=n.firstEffect,t.lastEffect=a,a.nextEffect=null):t.firstEffect=t.lastEffect=null):n=_a(a,s),null!==e?r=_a(e,r):(r=Ea(r,o,i,null)).flags|=2,r.return=t,n.return=t,n.sibling=r,t.child=n,r}function li(e,t){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),un(e.return,t)}function ci(e,t,n,r,i,o){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,lastEffect:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i,a.lastEffect=o)}function ui(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Gr(e,t,r.children,n),0!=(2&(r=Gn.current)))r=1&r|2,t.flags|=64;else{if(null!==e&&0!=(64&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&li(e,n);else if(19===e.tag)li(e,n);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if($e(Gn,r),0==(2&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===Vn(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ci(t,!1,i,n,o,t.lastEffect);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===Vn(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ci(t,!0,n,null,o,t.lastEffect);break;case"together":ci(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function di(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),ho|=t.lanes,0!=(n&t.childLanes)){if(null!==e&&t.child!==e.child)throw Error(s(153));if(null!==t.child){for(n=_a(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=_a(e,e.pendingProps)).return=t;n.sibling=null}return t.child}return null}function hi(e){e.flags|=4}if(X)$r=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)j(e,n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ei=function(){},ti=function(e,t,n,r,i){if((e=e.memoizedProps)!==r){var o=t.stateNode,a=Un(Bn.current);n=G(o,n,e,r,i,a),(t.updateQueue=n)&&hi(t)}},ni=function(e,t,n,r){n!==r&&hi(t)};else if(Y){$r=function(e,t,n,r){for(var i=t.child;null!==i;){if(5===i.tag){var o=i.stateNode;n&&r&&(o=Pe(o,i.type,i.memoizedProps,i)),j(e,o)}else if(6===i.tag)o=i.stateNode,n&&r&&(o=Ne(o,i.memoizedProps,i)),j(e,o);else if(4!==i.tag){if(13===i.tag&&0!=(4&i.flags)&&(o=null!==i.memoizedState)){var a=i.child;if(null!==a&&(null!==a.child&&(a.child.return=a,$r(e,a,!0,o)),null!==(o=a.sibling))){o.return=i,i=o;continue}}if(null!==i.child){i.child.return=i,i=i.child;continue}}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};var fi=function(e,t,n,r){for(var i=t.child;null!==i;){if(5===i.tag){var o=i.stateNode;n&&r&&(o=Pe(o,i.type,i.memoizedProps,i)),ke(e,o)}else if(6===i.tag)o=i.stateNode,n&&r&&(o=Ne(o,i.memoizedProps,i)),ke(e,o);else if(4!==i.tag){if(13===i.tag&&0!=(4&i.flags)&&(o=null!==i.memoizedState)){var a=i.child;if(null!==a&&(null!==a.child&&(a.child.return=a,fi(e,a,!0,o)),null!==(o=a.sibling))){o.return=i,i=o;continue}}if(null!==i.child){i.child.return=i,i=i.child;continue}}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};ei=function(e){var t=e.stateNode;if(null!==e.firstEffect){var n=t.containerInfo,r=Ie(n);fi(r,e,!1,!1),t.pendingChildren=r,hi(e),Re(n,r)}},ti=function(e,t,n,r,i){var o=e.stateNode,a=e.memoizedProps;if((e=null===t.firstEffect)&&a===r)t.stateNode=o;else{var s=t.stateNode,l=Un(Bn.current),c=null;a!==r&&(c=G(s,n,a,r,i,l)),e&&null===c?t.stateNode=o:(o=Te(o,c,n,a,r,t,e,s),H(o,n,r,i,l)&&hi(t),t.stateNode=o,e?hi(t):$r(o,t,!1,!1))}},ni=function(e,t,n,r){n!==r?(e=Un(Dn.current),n=Un(Bn.current),t.stateNode=W(r,e,n,t),hi(t)):t.stateNode=e.stateNode}}else ei=function(){},ti=function(){},ni=function(){};function pi(e,t){if(!Kn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function mi(e,t,n){var r=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:case 17:return ot(t.type)&&at(),null;case 3:return zn(),Ze(nt),Ze(tt),tr(),(r=t.stateNode).pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(Zn(t)?hi(t):r.hydrate||(t.flags|=256)),ei(t),null;case 5:Hn(t);var i=Un(Dn.current);if(n=t.type,null!==e&&null!=t.stateNode)ti(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=128);else{if(!r){if(null===t.stateNode)throw Error(s(166));return null}if(e=Un(Bn.current),Zn(t)){if(!Z)throw Error(s(175));e=je(t.stateNode,t.type,t.memoizedProps,i,e,t),t.updateQueue=e,null!==e&&hi(t)}else{var o=z(n,r,i,e,t);$r(o,t,!1,!1),t.stateNode=o,H(o,n,r,i,e)&&hi(t)}null!==t.ref&&(t.flags|=128)}return null;case 6:if(e&&null!=t.stateNode)ni(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(s(166));if(e=Un(Dn.current),i=Un(Bn.current),Zn(t)){if(!Z)throw Error(s(176));He(t.stateNode,t.memoizedProps,t)&&hi(t)}else t.stateNode=W(r,e,i,t)}return null;case 13:return Ze(Gn),r=t.memoizedState,0!=(64&t.flags)?(t.lanes=n,t):(r=null!==r,i=!1,null===e?void 0!==t.memoizedProps.fallback&&Zn(t):i=null!==e.memoizedState,r&&!i&&0!=(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!=(1&Gn.current)?0===lo&&(lo=3):(0!==lo&&3!==lo||(lo=4),null===ro||0==(134217727&ho)&&0==(134217727&fo)||Go(ro,oo))),Y&&r&&(t.flags|=4),X&&(r||i)&&(t.flags|=4),null);case 4:return zn(),ei(t),null===e&&ie(t.stateNode.containerInfo),null;case 10:return cn(t),null;case 19:if(Ze(Gn),null===(r=t.memoizedState))return null;if(i=0!=(64&t.flags),null===(o=r.rendering))if(i)pi(r,!1);else{if(0!==lo||null!==e&&0!=(64&e.flags))for(e=t.child;null!==e;){if(null!==(o=Vn(e))){for(t.flags|=64,pi(r,!1),null!==(e=o.updateQueue)&&(t.updateQueue=e,t.flags|=4),null===r.lastEffect&&(t.firstEffect=null),t.lastEffect=r.lastEffect,e=n,r=t.child;null!==r;)n=e,(i=r).flags&=2,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null,null===(o=i.alternate)?(i.childLanes=0,i.lanes=n,i.child=null,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,n=o.dependencies,i.dependencies=null===n?null:{lanes:n.lanes,firstContext:n.firstContext}),r=r.sibling;return $e(Gn,1&Gn.current|2),t.child}e=e.sibling}null!==r.tail&&Gt()>vo&&(t.flags|=64,i=!0,pi(r,!1),t.lanes=33554432)}else{if(!i)if(null!==(e=Vn(o))){if(t.flags|=64,i=!0,null!==(e=e.updateQueue)&&(t.updateQueue=e,t.flags|=4),pi(r,!0),null===r.tail&&"hidden"===r.tailMode&&!o.alternate&&!Kn)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*Gt()-r.renderingStartTime>vo&&1073741824!==n&&(t.flags|=64,i=!0,pi(r,!1),t.lanes=33554432);r.isBackwards?(o.sibling=t.child,t.child=o):(null!==(e=r.last)?e.sibling=o:t.child=o,r.last=o)}return null!==r.tail?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=Gt(),e.sibling=null,t=Gn.current,$e(Gn,i?1&t|2:1&t),e):null;case 23:case 24:return Jo(),null!==e&&null!==e.memoizedState!=(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==r.mode&&(t.flags|=4),null}throw Error(s(156,t.tag))}function gi(e){switch(e.tag){case 1:ot(e.type)&&at();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(zn(),Ze(nt),Ze(tt),tr(),0!=(64&(t=e.flags)))throw Error(s(285));return e.flags=-4097&t|64,e;case 5:return Hn(e),null;case 13:return Ze(Gn),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return Ze(Gn),null;case 4:return zn(),null;case 10:return cn(e),null;case 23:case 24:return Jo(),null;default:return null}}function vi(e,t){try{var n="",r=t;do{n+=en(r),r=r.return}while(r);var i=n}catch(e){i="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:i}}function bi(e,t){try{console.error(t.value)}catch(e){setTimeout((function(){throw e}))}}var yi="function"==typeof WeakMap?WeakMap:Map;function wi(e,t,n){(n=gn(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){So||(So=!0,xo=r),bi(0,t)},n}function Si(e,t,n){(n=gn(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return bi(0,t),r(i)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){"function"!=typeof r&&(null===Mo?Mo=new Set([this]):Mo.add(this),bi(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}var xi="function"==typeof WeakSet?WeakSet:Set;function Mi(e){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(t){da(e,t)}else t.current=null}function _i(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 5:case 6:case 4:case 17:return;case 1:if(256&t.flags&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:tn(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(X&&256&t.flags&&Ce(t.stateNode.containerInfo))}throw Error(s(163))}function Ai(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.destroy;n.destroy=void 0,void 0!==r&&r()}n=n.next}while(n!==t)}}function Ei(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3==(3&e.tag)){var r=e.create;e.destroy=r()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var i=e;r=i.next,0!=(4&(i=i.tag))&&0!=(1&i)&&(la(n,e),sa(n,e)),e=r}while(e!==t)}return;case 1:return e=n.stateNode,4&n.flags&&(null===t?e.componentDidMount():(r=n.elementType===n.type?t.memoizedProps:tn(n.type,t.memoizedProps),e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=n.updateQueue)&&wn(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:e=B(n.child.stateNode);break;case 1:e=n.child.stateNode}wn(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.flags&&ge(e,n.type,n.memoizedProps,n));case 6:case 4:case 12:case 19:case 17:case 20:case 21:case 23:case 24:return;case 13:return void(Z&&null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&We(n)))))}throw Error(s(163))}function Ci(e,t){if(X)for(var n=e;;){if(5===n.tag){var r=n.stateNode;t?Me(r):Ae(n.stateNode,n.memoizedProps)}else if(6===n.tag)r=n.stateNode,t?_e(r):Ee(r,n.memoizedProps);else if((23!==n.tag&&24!==n.tag||null===n.memoizedState||n===e)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function Ti(e,t){if(ht&&"function"==typeof ht.onCommitFiberUnmount)try{ht.onCommitFiberUnmount(dt,t)}catch(e){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var n=e=e.next;do{var r=n,i=r.destroy;if(r=r.tag,void 0!==i)if(0!=(4&r))la(t,n);else{r=t;try{i()}catch(e){da(r,e)}}n=n.next}while(n!==e)}break;case 1:if(Mi(t),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(e){da(t,e)}break;case 5:Mi(t);break;case 4:X?Bi(e,t):Y&&Y&&(t=t.stateNode.containerInfo,e=Ie(t),Oe(t,e))}}function Ii(e,t){for(var n=t;;)if(Ti(e,n),null===n.child||X&&4===n.tag){if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}else n.child.return=n,n=n.child}function ki(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function Ri(e){return 5===e.tag||3===e.tag||4===e.tag}function Oi(e){if(X){e:{for(var t=e.return;null!==t;){if(Ri(t))break e;t=t.return}throw Error(s(160))}var n=t;switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(s(161))}16&n.flags&&(xe(t),n.flags&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||Ri(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.flags)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.flags)){n=n.stateNode;break e}}r?Pi(e,n,t):Ni(e,n,t)}}function Pi(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?ye(n,e,t):pe(n,e);else if(4!==r&&null!==(e=e.child))for(Pi(e,t,n),e=e.sibling;null!==e;)Pi(e,t,n),e=e.sibling}function Ni(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?be(n,e,t):fe(n,e);else if(4!==r&&null!==(e=e.child))for(Ni(e,t,n),e=e.sibling;null!==e;)Ni(e,t,n),e=e.sibling}function Bi(e,t){for(var n,r,i=t,o=!1;;){if(!o){o=i.return;e:for(;;){if(null===o)throw Error(s(160));switch(n=o.stateNode,o.tag){case 5:r=!1;break e;case 3:case 4:n=n.containerInfo,r=!0;break e}o=o.return}o=!0}if(5===i.tag||6===i.tag)Ii(e,i),r?Se(n,i.stateNode):we(n,i.stateNode);else if(4===i.tag){if(null!==i.child){n=i.stateNode.containerInfo,r=!0,i.child.return=i,i=i.child;continue}}else if(Ti(e,i),null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;4===(i=i.return).tag&&(o=!1)}i.sibling.return=i.return,i=i.sibling}}function Li(e,t){if(X){switch(t.tag){case 0:case 11:case 14:case 15:case 22:return void Ai(3,t);case 1:case 12:case 17:return;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps;e=null!==e?e.memoizedProps:r;var i=t.type,o=t.updateQueue;t.updateQueue=null,null!==o&&ve(n,o,i,e,r,t)}return;case 6:if(null===t.stateNode)throw Error(s(162));return n=t.memoizedProps,void me(t.stateNode,null!==e?e.memoizedProps:n,n);case 3:return void(Z&&(t=t.stateNode,t.hydrate&&(t.hydrate=!1,Ve(t.containerInfo))));case 13:return Di(t),void Ui(t);case 19:return void Ui(t);case 23:case 24:return void Ci(t,null!==t.memoizedState)}throw Error(s(163))}switch(t.tag){case 0:case 11:case 14:case 15:case 22:return void Ai(3,t);case 12:case 23:case 24:return;case 13:return Di(t),void Ui(t);case 19:return void Ui(t);case 3:Z&&((n=t.stateNode).hydrate&&(n.hydrate=!1,Ve(n.containerInfo)))}e:if(Y){switch(t.tag){case 1:case 5:case 6:case 20:break e;case 3:case 4:t=t.stateNode,Oe(t.containerInfo,t.pendingChildren);break e}throw Error(s(163))}}function Di(e){null!==e.memoizedState&&(go=Gt(),X&&Ci(e.child,!0))}function Ui(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new xi),t.forEach((function(t){var r=fa.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function Fi(e,t){return null!==e&&(null===(e=e.memoizedState)||null!==e.dehydrated)&&(null!==(t=t.memoizedState)&&null===t.dehydrated)}var zi=0,ji=1,Hi=2,Gi=3,Vi=4;if("function"==typeof Symbol&&Symbol.for){var Wi=Symbol.for;zi=Wi("selector.component"),ji=Wi("selector.has_pseudo_class"),Hi=Wi("selector.role"),Gi=Wi("selector.test_id"),Vi=Wi("selector.text")}function qi(e){var t=$(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(s(364));return t}if(null===(e=ae(e)))throw Error(s(362));return e.stateNode.current}function Ki(e,t){switch(t.$$typeof){case zi:if(e.type===t.value)return!0;break;case ji:e:{t=t.value,e=[e,0];for(var n=0;n<e.length;){var r=e[n++],i=e[n++],o=t[i];if(5!==r.tag||!ce(r)){for(;null!=o&&Ki(r,o);)o=t[++i];if(i===t.length){t=!0;break e}for(r=r.child;null!==r;)e.push(r,i),r=r.sibling}}t=!1}return t;case Hi:if(5===e.tag&&ue(e.stateNode,t.value))return!0;break;case Vi:if((5===e.tag||6===e.tag)&&null!==(e=le(e))&&0<=e.indexOf(t.value))return!0;break;case Gi:if(5===e.tag&&("string"==typeof(e=e.memoizedProps["data-testname"])&&e.toLowerCase()===t.value.toLowerCase()))return!0;break;default:throw Error(s(365,t))}return!1}function Ji(e){switch(e.$$typeof){case zi:return"<"+(T(e.value)||"Unknown")+">";case ji:return":has("+(Ji(e)||"")+")";case Hi:return'[role="'+e.value+'"]';case Vi:return'"'+e.value+'"';case Gi:return'[data-testname="'+e.value+'"]';default:throw Error(s(365,e))}}function Qi(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var i=e[r++],o=e[r++],a=t[o];if(5!==i.tag||!ce(i)){for(;null!=a&&Ki(i,a);)a=t[++o];if(o===t.length)n.push(i);else for(i=i.child;null!==i;)e.push(i,o),i=i.sibling}}return n}function Xi(e,t){if(!oe)throw Error(s(363));e=Qi(e=qi(e),t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var r=e[n++];if(5===r.tag)ce(r)||t.push(r.stateNode);else for(r=r.child;null!==r;)e.push(r),r=r.sibling}return t}var Yi=null;var Zi=Math.ceil,$i=l.ReactCurrentDispatcher,eo=l.ReactCurrentOwner,to=l.IsSomeRendererActing,no=0,ro=null,io=null,oo=0,ao=0,so=Ye(0),lo=0,co=null,uo=0,ho=0,fo=0,po=0,mo=null,go=0,vo=1/0;function bo(){vo=Gt()+500}var yo,wo=null,So=!1,xo=null,Mo=null,_o=!1,Ao=null,Eo=90,Co=[],To=[],Io=null,ko=0,Ro=null,Oo=-1,Po=0,No=0,Bo=null,Lo=!1;function Do(){return 0!=(48&no)?Gt():-1!==Oo?Oo:Oo=Gt()}function Uo(e){if(0==(2&(e=e.mode)))return 1;if(0==(4&e))return 99===Vt()?1:2;if(0===Po&&(Po=uo),0!==Xt.transition){0!==No&&(No=null!==mo?mo.pendingLanes:0),e=Po;var t=4186112&~No;return 0===(t&=-t)&&(0===(t=(e=4186112&~e)&-e)&&(t=8192)),t}return e=Vt(),0!=(4&no)&&98===e?e=bt(12,Po):e=bt(e=function(e){switch(e){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}(e),Po),e}function Fo(e,t,n){if(50<ko)throw ko=0,Ro=null,Error(s(185));if(null===(e=zo(e,t)))return null;St(e,t,n),e===ro&&(fo|=t,4===lo&&Go(e,oo));var r=Vt();1===t?0!=(8&no)&&0==(48&no)?Vo(e):(jo(e,n),0===no&&(bo(),Jt())):(0==(4&no)||98!==r&&99!==r||(null===Io?Io=new Set([e]):Io.add(e)),jo(e,n)),mo=e}function zo(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}function jo(e,t){for(var n=e.callbackNode,r=e.suspendedLanes,i=e.pingedLanes,o=e.expirationTimes,a=e.pendingLanes;0<a;){var l=31-xt(a),c=1<<l,u=o[l];if(-1===u){if(0==(c&r)||0!=(c&i)){u=t,mt(c);var d=pt;o[l]=10<=d?u+250:6<=d?u+5e3:-1}}else u<=t&&(e.expiredLanes|=c);a&=~c}if(r=gt(e,e===ro?oo:0),t=pt,0===r)null!==n&&(n!==Dt&&Ct(n),e.callbackNode=null,e.callbackPriority=0);else{if(null!==n){if(e.callbackPriority===t)return;n!==Dt&&Ct(n)}15===t?(n=Vo.bind(null,e),null===Ft?(Ft=[n],zt=Et(Ot,Qt)):Ft.push(n),n=Dt):14===t?n=Kt(99,Vo.bind(null,e)):(n=function(e){switch(e){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(s(358,e))}}(t),n=Kt(n,Ho.bind(null,e))),e.callbackPriority=t,e.callbackNode=n}}function Ho(e){if(Oo=-1,No=Po=0,0!=(48&no))throw Error(s(327));var t=e.callbackNode;if(aa()&&e.callbackNode!==t)return null;var n=gt(e,e===ro?oo:0);if(0===n)return null;var r=n,i=no;no|=16;var o=Yo();for(ro===e&&oo===r||(bo(),Qo(e,r));;)try{ea();break}catch(t){Xo(e,t)}if(sn(),$i.current=o,no=i,null!==io?r=0:(ro=null,oo=0,r=lo),0!=(uo&fo))Qo(e,0);else if(0!==r){if(2===r&&(no|=64,e.hydrate&&(e.hydrate=!1,Ce(e.containerInfo)),0!==(n=vt(e))&&(r=Zo(e,n))),1===r)throw t=co,Qo(e,0),Go(e,n),jo(e,Gt()),t;switch(e.finishedWork=e.current.alternate,e.finishedLanes=n,r){case 0:case 1:throw Error(s(345));case 2:case 5:ra(e);break;case 3:if(Go(e,n),(62914560&n)===n&&10<(r=go+500-Gt())){if(0!==gt(e,0))break;if(((i=e.suspendedLanes)&n)!==n){Do(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=q(ra.bind(null,e),r);break}ra(e);break;case 4:if(Go(e,n),(4186112&n)===n)break;for(r=e.eventTimes,i=-1;0<n;){var a=31-xt(n);o=1<<a,(a=r[a])>i&&(i=a),n&=~o}if(n=i,10<(n=(120>(n=Gt()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Zi(n/1960))-n)){e.timeoutHandle=q(ra.bind(null,e),n);break}ra(e);break;default:throw Error(s(329))}}return jo(e,Gt()),e.callbackNode===t?Ho.bind(null,e):null}function Go(e,t){for(t&=~po,t&=~fo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-xt(t),r=1<<n;e[n]=-1,t&=~r}}function Vo(e){if(0!=(48&no))throw Error(s(327));if(aa(),e===ro&&0!=(e.expiredLanes&oo)){var t=oo,n=Zo(e,t);0!=(uo&fo)&&(n=Zo(e,t=gt(e,t)))}else n=Zo(e,t=gt(e,0));if(0!==e.tag&&2===n&&(no|=64,e.hydrate&&(e.hydrate=!1,Ce(e.containerInfo)),0!==(t=vt(e))&&(n=Zo(e,t))),1===n)throw n=co,Qo(e,0),Go(e,t),jo(e,Gt()),n;return e.finishedWork=e.current.alternate,e.finishedLanes=t,ra(e),jo(e,Gt()),null}function Wo(e,t){var n=no;no|=1;try{return e(t)}finally{0===(no=n)&&(bo(),Jt())}}function qo(e,t){var n=no;if(0!=(48&n))return e(t);no|=1;try{if(e)return qt(99,e.bind(null,t))}finally{no=n,Jt()}}function Ko(e,t){$e(so,ao),ao|=t,uo|=t}function Jo(){ao=so.current,Ze(so)}function Qo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==J&&(e.timeoutHandle=J,K(n)),null!==io)for(n=io.return;null!==n;){var r=n;switch(r.tag){case 1:null!=(r=r.type.childContextTypes)&&at();break;case 3:zn(),Ze(nt),Ze(tt),tr();break;case 5:Hn(r);break;case 4:zn();break;case 13:case 19:Ze(Gn);break;case 10:cn(r);break;case 23:case 24:Jo()}n=n.return}ro=e,io=_a(e.current,null),oo=ao=uo=t,lo=0,co=null,po=fo=ho=0}function Xo(e,t){for(;;){var n=io;try{if(sn(),nr.current=Dr,lr){for(var r=or.memoizedState;null!==r;){var i=r.queue;null!==i&&(i.pending=null),r=r.next}lr=!1}if(ir=0,sr=ar=or=null,cr=!1,eo.current=null,null===n||null===n.return){lo=1,co=t,io=null;break}e:{var o=e,a=n.return,s=n,l=t;if(t=oo,s.flags|=2048,s.firstEffect=s.lastEffect=null,null!==l&&"object"==typeof l&&"function"==typeof l.then){var c=l;if(0==(2&s.mode)){var u=s.alternate;u?(s.updateQueue=u.updateQueue,s.memoizedState=u.memoizedState,s.lanes=u.lanes):(s.updateQueue=null,s.memoizedState=null)}var d=0!=(1&Gn.current),h=a;do{var f;if(f=13===h.tag){var p=h.memoizedState;if(null!==p)f=null!==p.dehydrated;else{var m=h.memoizedProps;f=void 0!==m.fallback&&(!0!==m.unstable_avoidThisFallback||!d)}}if(f){var g=h.updateQueue;if(null===g){var v=new Set;v.add(c),h.updateQueue=v}else g.add(c);if(0==(2&h.mode)){if(h.flags|=64,s.flags|=16384,s.flags&=-2981,1===s.tag)if(null===s.alternate)s.tag=17;else{var b=gn(-1,1);b.tag=2,vn(s,b)}s.lanes|=1;break e}l=void 0,s=t;var y=o.pingCache;if(null===y?(y=o.pingCache=new yi,l=new Set,y.set(c,l)):void 0===(l=y.get(c))&&(l=new Set,y.set(c,l)),!l.has(s)){l.add(s);var w=ha.bind(null,o,c,s);c.then(w,w)}h.flags|=4096,h.lanes=t;break e}h=h.return}while(null!==h);l=Error((T(s.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.")}5!==lo&&(lo=2),l=vi(l,s),h=a;do{switch(h.tag){case 3:o=l,h.flags|=4096,t&=-t,h.lanes|=t,bn(h,wi(0,o,t));break e;case 1:o=l;var S=h.type,x=h.stateNode;if(0==(64&h.flags)&&("function"==typeof S.getDerivedStateFromError||null!==x&&"function"==typeof x.componentDidCatch&&(null===Mo||!Mo.has(x)))){h.flags|=4096,t&=-t,h.lanes|=t,bn(h,Si(h,o,t));break e}}h=h.return}while(null!==h)}na(n)}catch(e){t=e,io===n&&null!==n&&(io=n=n.return);continue}break}}function Yo(){var e=$i.current;return $i.current=Dr,null===e?Dr:e}function Zo(e,t){var n=no;no|=16;var r=Yo();for(ro===e&&oo===t||Qo(e,t);;)try{$o();break}catch(t){Xo(e,t)}if(sn(),no=n,$i.current=r,null!==io)throw Error(s(261));return ro=null,oo=0,lo}function $o(){for(;null!==io;)ta(io)}function ea(){for(;null!==io&&!Tt();)ta(io)}function ta(e){var t=yo(e.alternate,e,ao);e.memoizedProps=e.pendingProps,null===t?na(e):io=t,eo.current=null}function na(e){var t=e;do{var n=t.alternate;if(e=t.return,0==(2048&t.flags)){if(null!==(n=mi(n,t,ao)))return void(io=n);if(24!==(n=t).tag&&23!==n.tag||null===n.memoizedState||0!=(1073741824&ao)||0==(4&n.mode)){for(var r=0,i=n.child;null!==i;)r|=i.lanes|i.childLanes,i=i.sibling;n.childLanes=r}null!==e&&0==(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1<t.flags&&(null!==e.lastEffect?e.lastEffect.nextEffect=t:e.firstEffect=t,e.lastEffect=t))}else{if(null!==(n=gi(t)))return n.flags&=2047,void(io=n);null!==e&&(e.firstEffect=e.lastEffect=null,e.flags|=2048)}if(null!==(t=t.sibling))return void(io=t);io=t=e}while(null!==t);0===lo&&(lo=5)}function ra(e){var t=Vt();return qt(99,ia.bind(null,e,t)),null}function ia(e,t){do{aa()}while(null!==Ao);if(0!=(48&no))throw Error(s(327));var n=e.finishedWork;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(s(177));e.callbackNode=null;var r=n.lanes|n.childLanes,i=r,o=e.pendingLanes&~i;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=i,e.mutableReadLanes&=i,e.entangledLanes&=i,i=e.entanglements;for(var a=e.eventTimes,l=e.expirationTimes;0<o;){var c=31-xt(o),u=1<<c;i[c]=0,a[c]=-1,l[c]=-1,o&=~u}if(null!==Io&&0==(24&r)&&Io.has(e)&&Io.delete(e),e===ro&&(io=ro=null,oo=0),1<n.flags?null!==n.lastEffect?(n.lastEffect.nextEffect=n,r=n.firstEffect):r=n:r=n.firstEffect,null!==r){i=no,no|=32,eo.current=null,Bo=U(e.containerInfo),Lo=!1,wo=r;do{try{oa()}catch(e){if(null===wo)throw Error(s(330));da(wo,e),wo=wo.nextEffect}}while(null!==wo);Bo=null,wo=r;do{try{for(a=e;null!==wo;){var d=wo.flags;if(16&d&&X&&xe(wo.stateNode),128&d){var h=wo.alternate;if(null!==h){var f=h.ref;null!==f&&("function"==typeof f?f(null):f.current=null)}}switch(1038&d){case 2:Oi(wo),wo.flags&=-3;break;case 6:Oi(wo),wo.flags&=-3,Li(wo.alternate,wo);break;case 1024:wo.flags&=-1025;break;case 1028:wo.flags&=-1025,Li(wo.alternate,wo);break;case 4:Li(wo.alternate,wo);break;case 8:l=a,o=wo,X?Bi(l,o):Ii(l,o);var p=o.alternate;ki(o),null!==p&&ki(p)}wo=wo.nextEffect}}catch(e){if(null===wo)throw Error(s(330));da(wo,e),wo=wo.nextEffect}}while(null!==wo);Lo&&re(),F(e.containerInfo),e.current=n,wo=r;do{try{for(d=e;null!==wo;){var m=wo.flags;if(36&m&&Ei(d,wo.alternate,wo),128&m){h=void 0;var g=wo.ref;if(null!==g){var v=wo.stateNode;if(5===wo.tag)h=B(v);else h=v;"function"==typeof g?g(h):g.current=h}}wo=wo.nextEffect}}catch(e){if(null===wo)throw Error(s(330));da(wo,e),wo=wo.nextEffect}}while(null!==wo);wo=null,Ut(),no=i}else e.current=n;if(_o)_o=!1,Ao=e,Eo=t;else for(wo=r;null!==wo;)t=wo.nextEffect,wo.nextEffect=null,8&wo.flags&&((m=wo).sibling=null,m.stateNode=null),wo=t;if(0===(r=e.pendingLanes)&&(Mo=null),1===r?e===Ro?ko++:(ko=0,Ro=e):ko=0,n=n.stateNode,ht&&"function"==typeof ht.onCommitFiberRoot)try{ht.onCommitFiberRoot(dt,n,void 0,64==(64&n.current.flags))}catch(e){}if(jo(e,Gt()),So)throw So=!1,e=xo,xo=null,e;return 0!=(8&no)||Jt(),null}function oa(){for(;null!==wo;){var e=wo.alternate;Lo||null===Bo||(0!=(8&wo.flags)?P(wo,Bo)&&(Lo=!0,ne()):13===wo.tag&&Fi(e,wo)&&P(wo,Bo)&&(Lo=!0,ne()));var t=wo.flags;0!=(256&t)&&_i(e,wo),0==(512&t)||_o||(_o=!0,Kt(97,(function(){return aa(),null}))),wo=wo.nextEffect}}function aa(){if(90!==Eo){var e=97<Eo?97:Eo;return Eo=90,qt(e,ca)}return!1}function sa(e,t){Co.push(t,e),_o||(_o=!0,Kt(97,(function(){return aa(),null})))}function la(e,t){To.push(t,e),_o||(_o=!0,Kt(97,(function(){return aa(),null})))}function ca(){if(null===Ao)return!1;var e=Ao;if(Ao=null,0!=(48&no))throw Error(s(331));var t=no;no|=32;var n=To;To=[];for(var r=0;r<n.length;r+=2){var i=n[r],o=n[r+1],a=i.destroy;if(i.destroy=void 0,"function"==typeof a)try{a()}catch(e){if(null===o)throw Error(s(330));da(o,e)}}for(n=Co,Co=[],r=0;r<n.length;r+=2){i=n[r],o=n[r+1];try{var l=i.create;i.destroy=l()}catch(e){if(null===o)throw Error(s(330));da(o,e)}}for(l=e.current.firstEffect;null!==l;)e=l.nextEffect,l.nextEffect=null,8&l.flags&&(l.sibling=null,l.stateNode=null),l=e;return no=t,Jt(),!0}function ua(e,t,n){vn(e,t=wi(0,t=vi(n,t),1)),t=Do(),null!==(e=zo(e,1))&&(St(e,1,t),jo(e,t))}function da(e,t){if(3===e.tag)ua(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){ua(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Mo||!Mo.has(r))){var i=Si(n,e=vi(t,e),1);if(vn(n,i),i=Do(),null!==(n=zo(n,1)))St(n,1,i),jo(n,i);else if("function"==typeof r.componentDidCatch&&(null===Mo||!Mo.has(r)))try{r.componentDidCatch(t,e)}catch(e){}break}}n=n.return}}function ha(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=Do(),e.pingedLanes|=e.suspendedLanes&n,ro===e&&(oo&n)===n&&(4===lo||3===lo&&(62914560&oo)===oo&&500>Gt()-go?Qo(e,0):po|=n),jo(e,t)}function fa(e,t){var n=e.stateNode;null!==n&&n.delete(t),0===(t=0)&&(0==(2&(t=e.mode))?t=1:0==(4&t)?t=99===Vt()?1:2:(0===Po&&(Po=uo),0===(t=yt(62914560&~Po))&&(t=4194304))),n=Do(),null!==(e=zo(e,t))&&(St(e,t,n),jo(e,n))}yo=function(e,t,n){var r=t.lanes;if(null!==e)if(e.memoizedProps!==t.pendingProps||nt.current)Hr=!0;else{if(0==(n&r)){switch(Hr=!1,t.tag){case 3:Zr(t),$n();break;case 5:jn(t);break;case 1:ot(t.type)&&ct(t);break;case 4:Fn(t,t.stateNode.containerInfo);break;case 10:ln(t,t.memoizedProps.value);break;case 13:if(null!==t.memoizedState)return 0!=(n&t.child.childLanes)?ii(e,t,n):($e(Gn,1&Gn.current),null!==(t=di(e,t,n))?t.sibling:null);$e(Gn,1&Gn.current);break;case 19:if(r=0!=(n&t.childLanes),0!=(64&e.flags)){if(r)return ui(e,t,n);t.flags|=64}var i=t.memoizedState;if(null!==i&&(i.rendering=null,i.tail=null,i.lastEffect=null),$e(Gn,Gn.current),r)break;return null;case 23:case 24:return t.lanes=0,Kr(e,t,n)}return di(e,t,n)}Hr=0!=(16384&e.flags)}else Hr=!1;switch(t.lanes=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=it(t,tt.current),dn(t,n),i=hr(null,t,r,e,i,n),t.flags|=1,"object"==typeof i&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,ot(r)){var o=!0;ct(t)}else o=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,pn(t);var a=r.getDerivedStateFromProps;"function"==typeof a&&xn(t,r,a,e),i.updater=Mn,t.stateNode=i,i._reactInternals=t,Cn(t,r,e,n),t=Yr(null,t,r,!0,o,n)}else t.tag=0,Gr(null,t,i,n),t=t.child;return t;case 16:i=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=(o=i._init)(i._payload),t.type=i,o=t.tag=function(e){if("function"==typeof e)return Ma(e)?1:0;if(null!=e){if((e=e.$$typeof)===g)return 11;if(e===y)return 14}return 2}(i),e=tn(i,e),o){case 0:t=Qr(null,t,i,e,n);break e;case 1:t=Xr(null,t,i,e,n);break e;case 11:t=Vr(null,t,i,e,n);break e;case 14:t=Wr(null,t,i,tn(i.type,e),r,n);break e}throw Error(s(306,i,""))}return t;case 0:return r=t.type,i=t.pendingProps,Qr(e,t,r,i=t.elementType===r?i:tn(r,i),n);case 1:return r=t.type,i=t.pendingProps,Xr(e,t,r,i=t.elementType===r?i:tn(r,i),n);case 3:if(Zr(t),r=t.updateQueue,null===e||null===r)throw Error(s(282));if(r=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,mn(e,t),yn(t,r,null,n),(r=t.memoizedState.element)===i)$n(),t=di(e,t,n);else{if((o=(i=t.stateNode).hydrate)&&(Z?(qn=ze(t.stateNode.containerInfo),Wn=t,o=Kn=!0):o=!1),o){if(Z&&null!=(e=i.mutableSourceEagerHydrationData))for(i=0;i<e.length;i+=2)o=e[i],a=e[i+1],Q?o._workInProgressVersionPrimary=a:o._workInProgressVersionSecondary=a,er.push(o);for(n=Pn(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|1024,n=n.sibling}else Gr(e,t,r,n),$n();t=t.child}return t;case 5:return jn(t),null===e&&Xn(t),r=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,a=i.children,V(r,i)?a=null:null!==o&&V(r,o)&&(t.flags|=16),Jr(e,t),Gr(e,t,a,n),t.child;case 6:return null===e&&Xn(t),null;case 13:return ii(e,t,n);case 4:return Fn(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=On(t,null,r,n):Gr(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,Vr(e,t,r,i=t.elementType===r?i:tn(r,i),n);case 7:return Gr(e,t,t.pendingProps,n),t.child;case 8:case 12:return Gr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,ln(t,o=i.value),null!==a){var l=a.value;if(0===(o=Yt(l,o)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(l,o):1073741823))){if(a.children===i.children&&!nt.current){t=di(e,t,n);break e}}else for(null!==(l=t.child)&&(l.return=t);null!==l;){var c=l.dependencies;if(null!==c){a=l.child;for(var u=c.firstContext;null!==u;){if(u.context===r&&0!=(u.observedBits&o)){1===l.tag&&((u=gn(-1,n&-n)).tag=2,vn(l,u)),l.lanes|=n,null!==(u=l.alternate)&&(u.lanes|=n),un(l.return,n),c.lanes|=n;break}u=u.next}}else a=10===l.tag&&l.type===t.type?null:l.child;if(null!==a)a.return=l;else for(a=l;null!==a;){if(a===t){a=null;break}if(null!==(l=a.sibling)){l.return=a.return,a=l;break}a=a.return}l=a}}Gr(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=(o=t.pendingProps).children,dn(t,n),r=r(i=hn(i,o.unstable_observedBits)),t.flags|=1,Gr(e,t,r,n),t.child;case 14:return o=tn(i=t.type,t.pendingProps),Wr(e,t,i,o=tn(i.type,o),r,n);case 15:return qr(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:tn(r,i),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,ot(r)?(e=!0,ct(t)):e=!1,dn(t,n),An(t,r,i),Cn(t,r,i,n),Yr(null,t,r,!0,e,n);case 19:return ui(e,t,n);case 23:case 24:return Kr(e,t,n)}throw Error(s(156,t.tag))};var pa={current:!1},ma=a.unstable_flushAllWithoutAsserting,ga="function"==typeof ma;function va(){if(void 0!==ma)return ma();for(var e=!1;aa();)e=!0;return e}function ba(t){try{va(),function(t){if(null===Yi)try{var n=("require"+Math.random()).slice(0,7);Yi=(e&&e[n]).call(e,"timers").setImmediate}catch(e){Yi=function(e){var t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(void 0)}}Yi(t)}((function(){va()?ba(t):t()}))}catch(e){t(e)}}var ya=0,wa=!1;function Sa(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function xa(e,t,n,r){return new Sa(e,t,n,r)}function Ma(e){return!(!(e=e.prototype)||!e.isReactComponent)}function _a(e,t){var n=e.alternate;return null===n?((n=xa(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Aa(e,t,n,r,i,o){var a=2;if(r=e,"function"==typeof e)Ma(e)&&(a=1);else if("string"==typeof e)a=5;else e:switch(e){case d:return Ea(n.children,i,o,t);case x:a=8,i|=16;break;case h:a=8,i|=1;break;case f:return(e=xa(12,n,t,8|i)).elementType=f,e.type=f,e.lanes=o,e;case v:return(e=xa(13,n,t,i)).type=v,e.elementType=v,e.lanes=o,e;case b:return(e=xa(19,n,t,i)).elementType=b,e.lanes=o,e;case M:return Ca(n,i,o,t);case _:return(e=xa(24,n,t,i)).elementType=_,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case p:a=10;break e;case m:a=9;break e;case g:a=11;break e;case y:a=14;break e;case w:a=16,r=null;break e;case S:a=22;break e}throw Error(s(130,null==e?e:typeof e,""))}return(t=xa(a,n,t,i)).elementType=e,t.type=r,t.lanes=o,t}function Ea(e,t,n,r){return(e=xa(7,e,r,t)).lanes=n,e}function Ca(e,t,n,r){return(e=xa(23,e,r,t)).elementType=M,e.lanes=n,e}function Ta(e,t,n){return(e=xa(6,e,null,t)).lanes=n,e}function Ia(e,t,n){return(t=xa(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ka(e,t,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=J,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=wt(0),this.expirationTimes=wt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wt(0),Z&&(this.mutableSourceEagerHydrationData=null)}function Ra(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(s(188));throw Error(s(268,Object.keys(e)))}return null===(e=O(t))?null:e.stateNode}function Oa(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Pa(e,t){Oa(e,t),(e=e.alternate)&&Oa(e,t)}function Na(e){return null===(e=O(e))?null:e.stateNode}function Ba(){return null}return n.IsThisRendererActing=pa,n.act=function(e){function t(){ya--,to.current=n,pa.current=r}!1===wa&&(wa=!0,console.error("act(...) is not supported in production builds of React, and might not behave as expected.")),ya++;var n=to.current,r=pa.current;to.current=!0,pa.current=!0;try{var i=Wo(e)}catch(e){throw t(),e}if(null!==i&&"object"==typeof i&&"function"==typeof i.then)return{then:function(e,r){i.then((function(){1<ya||!0===ga&&!0===n?(t(),e()):ba((function(n){t(),n?r(n):e()}))}),(function(e){t(),r(e)}))}};try{1!==ya||!1!==ga&&!1!==n||va(),t()}catch(e){throw t(),e}return{then:function(e){e()}}},n.attemptContinuousHydration=function(e){13===e.tag&&(Fo(e,67108864,Do()),Pa(e,67108864))},n.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var t=Do(),n=Uo(e);Fo(e,n,t),Pa(e,n)}},n.attemptSynchronousHydration=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.hydrate){var n=mt(t.pendingLanes);t.expiredLanes|=n&t.pendingLanes,jo(t,Gt()),0==(48&no)&&(bo(),Jt())}break;case 13:var r=Do();qo((function(){return Fo(e,1,r)})),Pa(e,4)}},n.attemptUserBlockingHydration=function(e){13===e.tag&&(Fo(e,4,Do()),Pa(e,4))},n.batchedEventUpdates=function(e,t){var n=no;no|=2;try{return e(t)}finally{0===(no=n)&&(bo(),Jt())}},n.batchedUpdates=Wo,n.createComponentSelector=function(e){return{$$typeof:zi,value:e}},n.createContainer=function(e,t,n){return e=new ka(e,t,n),t=xa(3,null,null,2===t?7:1===t?3:0),e.current=t,t.stateNode=e,pn(t),e},n.createHasPsuedoClassSelector=function(e){return{$$typeof:ji,value:e}},n.createPortal=function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:u,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}},n.createRoleSelector=function(e){return{$$typeof:Hi,value:e}},n.createTestNameSelector=function(e){return{$$typeof:Gi,value:e}},n.createTextSelector=function(e){return{$$typeof:Vi,value:e}},n.deferredUpdates=function(e){return qt(97,e)},n.discreteUpdates=function(e,t,n,r,i){var o=no;no|=4;try{return qt(98,e.bind(null,t,n,r,i))}finally{0===(no=o)&&(bo(),Jt())}},n.findAllNodes=Xi,n.findBoundingRects=function(e,t){if(!oe)throw Error(s(363));t=Xi(e,t),e=[];for(var n=0;n<t.length;n++)e.push(se(t[n]));for(t=e.length-1;0<t;t--)for(var r=(n=e[t]).x,i=r+n.width,o=n.y,a=o+n.height,l=t-1;0<=l;l--)if(t!==l){var c=e[l],u=c.x,d=u+c.width,h=c.y,f=h+c.height;if(r>=u&&o>=h&&i<=d&&a<=f){e.splice(t,1);break}if(!(r!==u||n.width!==c.width||f<o||h>a)){h>o&&(c.height+=h-o,c.y=o),f<a&&(c.height=a-h),e.splice(t,1);break}if(!(o!==h||n.height!==c.height||d<r||u>i)){u>r&&(c.width+=u-r,c.x=r),d<i&&(c.width=i-u),e.splice(t,1);break}}return e},n.findHostInstance=Ra,n.findHostInstanceWithNoPortals=function(e){return null===(e=function(e){if(!(e=R(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child&&4!==t.tag)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}(e))?null:20===e.tag?e.stateNode.instance:e.stateNode},n.findHostInstanceWithWarning=function(e){return Ra(e)},n.flushControlled=function(e){var t=no;no|=1;try{qt(99,e)}finally{0===(no=t)&&(bo(),Jt())}},n.flushDiscreteUpdates=function(){0==(49&no)&&(function(){if(null!==Io){var e=Io;Io=null,e.forEach((function(e){e.expiredLanes|=24&e.pendingLanes,jo(e,Gt())}))}Jt()}(),aa())},n.flushPassiveEffects=aa,n.flushSync=qo,n.focusWithin=function(e,t){if(!oe)throw Error(s(363));for(t=Qi(e=qi(e),t),t=Array.from(t),e=0;e<t.length;){var n=t[e++];if(!ce(n)){if(5===n.tag&&de(n.stateNode))return!0;for(n=n.child;null!==n;)t.push(n),n=n.sibling}}return!1},n.getCurrentUpdateLanePriority=function(){return ft},n.getFindAllNodesFailureDescription=function(e,t){if(!oe)throw Error(s(363));var n=0,r=[];e=[qi(e),0];for(var i=0;i<e.length;){var o=e[i++],a=e[i++],l=t[a];if((5!==o.tag||!ce(o))&&(Ki(o,l)&&(r.push(Ji(l)),++a>n&&(n=a)),a<t.length))for(o=o.child;null!==o;)e.push(o,a),o=o.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(Ji(t[n]));return"findAllNodes was able to match part of the selector:\n "+r.join(" > ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},n.getPublicRootInstance=function(e){return(e=e.current).child?5===e.child.tag?B(e.child.stateNode):e.child.stateNode:null},n.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:Na,findFiberByHostInstance:e.findFiberByHostInstance||Ba,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null},"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t.isDisabled&&t.supportsFiber)try{dt=t.inject(e),ht=t}catch(e){}e=!0}return e},n.observeVisibleRects=function(e,t,n,r){if(!oe)throw Error(s(363));e=Xi(e,t);var i=he(e,n,r).disconnect;return{disconnect:function(){i()}}},n.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),null==e.mutableSourceEagerHydrationData?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},n.runWithPriority=function(e,t){var n=ft;try{return ft=e,t()}finally{ft=n}},n.shouldSuspend=function(){return!1},n.unbatchedUpdates=function(e,t){var n=no;no&=-2,no|=8;try{return e(t)}finally{0===(no=n)&&(bo(),Jt())}},n.updateContainer=function(e,t,n,r){var i=t.current,o=Do(),a=Uo(i);e:if(n){t:{if(I(n=n._reactInternals)!==n||1!==n.tag)throw Error(s(170));var l=n;do{switch(l.tag){case 3:l=l.stateNode.context;break t;case 1:if(ot(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break t}}l=l.return}while(null!==l);throw Error(s(171))}if(1===n.tag){var c=n.type;if(ot(c)){n=lt(n,c,l);break e}}n=l}else n=et;return null===t.context?t.context=n:t.pendingContext=n,(t=gn(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),vn(i,t),Fo(i,a,o),a},n}})),o("juxiN").register(JSON.parse('{"adfgW":"index.js","cmazm":"abap.bc6c1a94.js","jPTA1":"abnf.a3fdbafa.js","jdWNC":"actionscript.59d9b9ea.js","2CBqg":"ada.7ae8a3a8.js","3wHhO":"agda.c22a72e2.js","kFVdl":"al.43edf93f.js","3V4RR":"antlr4.fab93bd9.js","ksX9L":"apacheconf.1ea6f6bc.js","3N81M":"apex.5f5d0b00.js","lBh32":"apl.f0e0255a.js","1cOI2":"applescript.f8873ad2.js","hwV5I":"aql.0596cd74.js","cxQUy":"arduino.8a10351d.js","h8XDs":"arff.b6eba224.js","1glOK":"asciidoc.3591554e.js","5YI5Q":"asm6502.eb3baf93.js","5aM2c":"asmatmel.93b67168.js","aKcNk":"aspnet.a154be94.js","bYGuI":"csharp.60bc2788.js","4ffJ6":"autohotkey.dc99c6b5.js","6o8gr":"autoit.7bd54007.js","d0QlI":"avisynth.506bbdad.js","1vpfH":"avro-idl.ab78e3d7.js","d78C2":"basic.09310972.js","1V5ou":"batch.5c48c918.js","h9qnw":"bbcode.4e0cb2f2.js","eluAn":"bicep.e394696d.js","jD2Yh":"birb.54766d79.js","3ligT":"bison.2c2552ab.js","cSnAi":"bnf.ec556d42.js","gmloY":"brainfuck.4e81eb1d.js","77rtQ":"brightscript.3c7cc723.js","hfFki":"bro.8db28f8a.js","8SYqo":"bsl.260fabfb.js","i4HkI":"cfscript.92c90b90.js","1rBYK":"chaiscript.76481f4b.js","gQYEz":"cil.622792d1.js","bq2uf":"clike.36346267.js","h7tza":"clojure.9da4900e.js","aK2oY":"cmake.234b57e3.js","3V5TZ":"cobol.2e8bd2ea.js","72v5N":"coffeescript.261b318a.js","lNJYg":"concurnas.9d189a8c.js","cHo4f":"coq.917e2a53.js","7GKmU":"crystal.d23925f3.js","a5f4n":"cshtml.92086949.js","2nOzn":"csp.9b5dd573.js","iZH8k":"css-extras.7f3088a6.js","3V9km":"css.fb6f00e3.js","7TCh4":"csv.06af3522.js","8MqYl":"cypher.6af6e534.js","6Oo3A":"d.303192e5.js","6ks0D":"dart.6fb62874.js","huqsT":"dataweave.e97ef31d.js","YtcLG":"dax.013d5e9a.js","1s9Hz":"dhall.d5ee83ba.js","b677V":"diff.9ef56ea8.js","ak2pO":"django.13b0bb49.js","8LDFZ":"dns-zone-file.189b08c5.js","1awLf":"docker.1da9769e.js","9dPYr":"dot.8dca92f3.js","e2ZjS":"ebnf.58c0fa63.js","9h8KW":"editorconfig.9c7b63a5.js","4SWgd":"eiffel.090bab86.js","6HmuU":"ejs.0ee535c3.js","2KAkF":"elixir.dc192ee6.js","jPV3v":"elm.c88782bd.js","agNrQ":"erb.55ec7cf0.js","9BmS2":"erlang.956455fa.js","fqf1c":"etlua.79f6dba5.js","cgMSr":"lua.88c0a077.js","92McF":"excel-formula.d0dd1424.js","juFxG":"factor.e311ca38.js","1dWPh":"false.a93fe44c.js","2k0b2":"firestore-security-rules.4ea155d7.js","dvL1Q":"flow.96e0f48a.js","5oumN":"fortran.0811bc79.js","fP8jO":"fsharp.0119d0fd.js","7L6sP":"ftl.c5671dbe.js","2ujce":"gap.b0574953.js","hzgIA":"gcode.29260c31.js","5MUDD":"gdscript.545f127b.js","ghckm":"gedcom.d53f8a81.js","ian9z":"gherkin.0c5a099f.js","dsuH3":"git.2d89a25c.js","dvV8S":"glsl.0bf837a6.js","6BDWE":"gml.04204c1b.js","btSYt":"gn.cbb4c3be.js","j94Lr":"go-module.2bebc9b8.js","207xG":"go.cc49e5b2.js","iQ4Nh":"graphql.3d658adb.js","9E9pJ":"groovy.3e5836cd.js","hLXUt":"haml.9a056759.js","5ob5h":"handlebars.8c13dfe6.js","1nDhS":"haskell.3c80aa72.js","kQehe":"haxe.40a1dc98.js","1sziu":"hcl.84488f47.js","28Tam":"hlsl.323b0c17.js","awNOU":"hoon.df16cb45.js","eeLMI":"hpkp.9c950797.js","gjEKw":"hsts.0440ab7b.js","3bCJ7":"http.96d5f1c1.js","id4YZ":"ichigojam.c0bd16f5.js","5TKHe":"icon.439feb9f.js","eijPh":"icu-message-format.e96f6551.js","lv8gR":"idris.d3811412.js","bW8K3":"iecst.3fdbbc52.js","b8EBv":"ignore.00726ce9.js","jOS96":"inform7.65978ef5.js","dn3Yf":"ini.1cbb0515.js","iUSU6":"io.e628fd7e.js","6wbwo":"j.b959d174.js","5qA0j":"java.0ffd8069.js","hdx4d":"javadoc.b99752ae.js","jRMSs":"javadoclike.8cc3d825.js","l2DRD":"javascript.fe729813.js","cpOeo":"javastacktrace.cc22fb4b.js","fSVrK":"jexl.2cce5cc0.js","03mi8":"jolie.d8f352cd.js","j6YjP":"jq.65b95777.js","6JQIv":"js-extras.7d041902.js","5nVrm":"js-templates.a3463d0b.js","9gPZY":"jsdoc.0c5cc4d3.js","8q0xA":"json5.b9de5531.js","fIx8j":"jsonp.eefdc553.js","a3ur7":"jsstacktrace.8d3a2b71.js","bKtxi":"julia.679e1c74.js","9vqI0":"keepalived.e694c167.js","lDUCl":"keyman.d1406200.js","gcEXq":"kotlin.fd040b34.js","cxxOt":"kumir.b2072cfc.js","b8NIc":"kusto.98546fcc.js","iXz7U":"latex.ecc17a0d.js","9nRbn":"latte.18295a4f.js","lWxq2":"less.a8a986ab.js","7dEcL":"lilypond.0423d709.js","ck7Ll":"scheme.4039466f.js","hI3m3":"liquid.533f073c.js","7qpQZ":"lisp.b075bd53.js","8Cm1D":"livescript.2b19fb05.js","9sT8D":"llvm.6b74465d.js","gQkTU":"log.b74346d6.js","86y52":"lolcode.0fbc730a.js","6bXdx":"magma.bbb66246.js","hDIxO":"makefile.bf1a7653.js","4wRUQ":"markdown.4a5510a8.js","66rgq":"markup.973a8c4c.js","iAx9A":"matlab.caaa1e9f.js","5SXMq":"maxscript.58a0bf4d.js","gnQ55":"mel.c5da9d2e.js","8G54S":"mermaid.ced53190.js","gfXsu":"mizar.4e6d6035.js","7nZsb":"mongodb.5c4e0cf9.js","hUs37":"monkey.9be800f3.js","fKqwA":"moonscript.fc782589.js","luHXo":"n1ql.7f05115f.js","j0sqX":"n4js.318f41b7.js","avS2d":"nand2tetris-hdl.be3bb656.js","8fNUI":"naniscript.ec3afc9a.js","6PKtR":"nasm.1ee2623a.js","2LUGi":"neon.1d5a4ec8.js","esMLb":"nevod.6908715c.js","jQ8dR":"nginx.404fbeb4.js","1kuW2":"nim.36bf497b.js","7YxPR":"nix.3af3b6b2.js","b1EPY":"nsis.94e1fb71.js","j169M":"objectivec.49a6b342.js","1b4qw":"ocaml.c5fca1eb.js","c0JxA":"opencl.4194613a.js","54ivl":"openqasm.4b589cb3.js","kYO5l":"oz.498e9cbd.js","811Qi":"parigp.ed6a3789.js","gXO52":"parser.3329b2ab.js","4SQCy":"pascal.82aebbcf.js","9KuwN":"pascaligo.4bbd3a85.js","eM7TR":"pcaxis.e636466e.js","6w6GH":"peoplecode.32e124c6.js","eQPpI":"perl.7d72d7fd.js","b83gb":"php-extras.9606406b.js","l8BPM":"phpdoc.617f8af6.js","2cVRv":"plsql.482f8da9.js","gOyA3":"powerquery.486ee359.js","1BYb4":"powershell.856a4dd0.js","lIwm5":"processing.2c7d4403.js","cHCln":"prolog.812b5c86.js","d460J":"promql.8e6b9da4.js","lAnQP":"properties.40afd4d0.js","dG8OA":"protobuf.84963e3e.js","eRbDh":"psl.9c32166c.js","27W0o":"pug.54462c11.js","75Y4h":"puppet.2646aef5.js","kgGGG":"pure.a10bd6b4.js","hFuIq":"purebasic.629b75cd.js","db2yj":"purescript.216751ba.js","8ZppB":"q.b46a94a4.js","iFM89":"qml.bd71f711.js","7FNJV":"qore.d7e006f8.js","6AsUF":"qsharp.7bab07d1.js","7Xrsp":"r.3036c5c0.js","dh9BI":"racket.b867dd29.js","8pRTf":"reason.405183ad.js","kUbHD":"regex.aa4684b4.js","bNx4l":"rego.61da6b5d.js","jbksA":"renpy.ff0ce389.js","gP26j":"rest.91bee177.js","6FCYh":"rip.33f479a4.js","lEjxk":"roboconf.0ba2e9bf.js","c8BOJ":"robotframework.72ccad61.js","elAoE":"rust.9a35cb62.js","eDL1o":"sas.b3b3be64.js","gIQMB":"sass.165275f3.js","i7Y8T":"scala.a51a6234.js","OzRer":"shell-session.c47a7880.js","hZA2W":"smali.46e3f703.js","gT51y":"smalltalk.fb31e155.js","2OoIP":"smarty.abd6973e.js","33hrk":"sml.6d8c2545.js","3uuqi":"solidity.80562c5b.js","kHJvD":"solution-file.30e00f5f.js","6iiDq":"soy.46a7ec1f.js","2TkEp":"sparql.dbb56be0.js","eirDq":"turtle.b8836781.js","jmDes":"splunk-spl.149146f6.js","81dr7":"sqf.ea070acb.js","i4XqC":"squirrel.1efaf6f3.js","1zw3p":"stan.6efb4565.js","kfIG2":"stylus.d4d41ca4.js","dksml":"swift.ea86fdd0.js","4w3mZ":"systemd.df819c28.js","6b6p1":"t4-cs.b3eaa646.js","budu0":"t4-templating.db399052.js","7RUUk":"t4-vb.082c208c.js","2cwdT":"vbnet.ac572fcc.js","fBA7X":"tap.82e5520b.js","gqbYu":"yaml.3d0bf472.js","lCVk7":"tcl.fffb53bb.js","aKXaK":"textile.20ae1d45.js","ks7hU":"toml.69754057.js","kCJbl":"tremor.262b95d4.js","iZ71n":"tt2.f07906cb.js","5mLLA":"twig.a95c4964.js","i9AIa":"typoscript.3dbd38d9.js","iHNMy":"unrealscript.e5c3fc1d.js","bKWLJ":"uorazor.cf3ed6dc.js","2XcAn":"uri.59c4e10c.js","enDcg":"v.fe8e0874.js","db4Ta":"vala.386e6270.js","cmaSk":"velocity.9a0ffb21.js","29RKO":"verilog.4308f028.js","4aBVG":"vhdl.ca8ee4c0.js","6Jrfy":"vim.897929a5.js","kNyzl":"visual-basic.bc36aaac.js","4LJ5s":"warpscript.6d00b50f.js","6Ocza":"wasm.029f651e.js","hvPGO":"web-idl.97fc763d.js","lS90V":"wiki.1179d7f8.js","9LY8Y":"wolfram.7017e6a0.js","bFBdJ":"wren.d4121438.js","iskNq":"xeora.cce693be.js","ek7X7":"xml-doc.025d4193.js","hwA94":"xojo.843f212e.js","f8rnQ":"xquery.50701bd4.js","3Q9qv":"yang.2c70775f.js","a0Oht":"zig.e33efe11.js","dnGOp":"core.ade097c7.js","9u7s7":"index.css"}'));var a;a=o("9Hk4c"),o("85Hg2");var s={};!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),s=o("bU6y3");var l,c=o("85Hg2");l=o("bG9xl")();var u,d=o("dCyaf"),h=o("1DJXa"),f=new Uint8Array(16);function p(){if(!u&&!(u="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return u(f)}var m=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var g=function(e){return"string"==typeof e&&m.test(e)},v=[],b=0;b<256;++b)v.push((b+256).toString(16).substr(1));var y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(v[e[t+0]]+v[e[t+1]]+v[e[t+2]]+v[e[t+3]]+"-"+v[e[t+4]]+v[e[t+5]]+"-"+v[e[t+6]]+v[e[t+7]]+"-"+v[e[t+8]]+v[e[t+9]]+"-"+v[e[t+10]]+v[e[t+11]]+v[e[t+12]]+v[e[t+13]]+v[e[t+14]]+v[e[t+15]]).toLowerCase();if(!g(n))throw TypeError("Stringified UUID is invalid");return n};var w=function(e,t,n){var r=(e=e||{}).random||(e.rng||p)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return y(r)};const S=()=>w(),x=()=>S().replace(new RegExp("-","g"),"").toUpperCase();var M,_,A,E,C,T,I,k;(_=M||(M={}))[_.Debug=0]="Debug",_[_.Info=1]="Info",_[_.Warning=2]="Warning",_[_.Error=3]="Error",_[_.None=4]="None";class R{constructor(e,t){this.privName=e,this.privEventId=x(),this.privEventTime=(new Date).toISOString(),this.privEventType=t,this.privMetadata={}}get name(){return this.privName}get eventId(){return this.privEventId}get eventTime(){return this.privEventTime}get eventType(){return this.privEventType}get metadata(){return this.privMetadata}}class O extends R{constructor(e,t,n=M.Info){super(e,n),this.privAudioSourceId=t}get audioSourceId(){return this.privAudioSourceId}}class P extends O{constructor(e){super("AudioSourceInitializingEvent",e)}}class N extends O{constructor(e){super("AudioSourceReadyEvent",e)}}class B extends O{constructor(e){super("AudioSourceOffEvent",e)}}class L extends O{constructor(e,t){super("AudioSourceErrorEvent",e,M.Error),this.privError=t}get error(){return this.privError}}class D extends O{constructor(e,t,n){super(e,t),this.privAudioNodeId=n}get audioNodeId(){return this.privAudioNodeId}}class U extends D{constructor(e,t){super("AudioStreamNodeAttachingEvent",e,t)}}class F extends D{constructor(e,t){super("AudioStreamNodeAttachedEvent",e,t)}}class z extends D{constructor(e,t){super("AudioStreamNodeDetachedEvent",e,t)}}class j extends D{constructor(e,t,n){super("AudioStreamNodeErrorEvent",e,t),this.privError=n}get error(){return this.privError}}class H extends R{constructor(e,t,n=M.Info){super(e,n),this.privJsonResult=t}get jsonString(){return this.privJsonResult}}class G extends R{constructor(e,t,n=M.Info){super(e,n),this.privConnectionId=t}get connectionId(){return this.privConnectionId}}class V extends G{constructor(e,t,n){super("ConnectionStartEvent",e),this.privUri=t,this.privHeaders=n}get uri(){return this.privUri}get headers(){return this.privHeaders}}class W extends G{constructor(e){super("ConnectionEstablishedEvent",e)}}class q extends G{constructor(e,t,n){super("ConnectionClosedEvent",e,M.Debug),this.privReason=n,this.privStatusCode=t}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class K extends G{constructor(e,t,n){super("ConnectionErrorEvent",e,M.Debug),this.privMessage=t,this.privType=n}get message(){return this.privMessage}get type(){return this.privType}}class J extends G{constructor(e,t,n){super("ConnectionEstablishErrorEvent",e,M.Error),this.privStatusCode=t,this.privReason=n}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class Q extends G{constructor(e,t,n){super("ConnectionMessageReceivedEvent",e),this.privNetworkReceivedTime=t,this.privMessage=n}get networkReceivedTime(){return this.privNetworkReceivedTime}get message(){return this.privMessage}}class X extends G{constructor(e,t,n){super("ConnectionMessageSentEvent",e),this.privNetworkSentTime=t,this.privMessage=n}get networkSentTime(){return this.privNetworkSentTime}get message(){return this.privMessage}}class Y extends Error{constructor(e){super(e),this.name="ArgumentNull",this.message=e}}class Z extends Error{constructor(e){super(e),this.name="InvalidOperation",this.message=e}}class $ extends Error{constructor(e,t){super(t),this.name=e+"ObjectDisposed",this.message=t}}(E=A||(A={}))[E.Text=0]="Text",E[E.Binary=1]="Binary";class ee{constructor(e,t,n,r){if(this.privBody=null,e===A.Text&&t&&"string"!=typeof t)throw new Z("Payload must be a string");if(e===A.Binary&&t&&!(t instanceof ArrayBuffer))throw new Z("Payload must be ArrayBuffer");switch(this.privMessageType=e,this.privBody=t,this.privHeaders=n||{},this.privId=r||x(),this.messageType){case A.Binary:this.privSize=null!==this.binaryBody?this.binaryBody.byteLength:0;break;case A.Text:this.privSize=this.textBody.length}}get messageType(){return this.privMessageType}get headers(){return this.privHeaders}get body(){return this.privBody}get textBody(){if(this.privMessageType===A.Binary)throw new Z("Not supported for binary message");return this.privBody}get binaryBody(){if(this.privMessageType===A.Text)throw new Z("Not supported for text message");return this.privBody}get id(){return this.privId}}class te{constructor(e,t){this.privStatusCode=e,this.privReason=t}get statusCode(){return this.privStatusCode}get reason(){return this.privReason}}class ne{constructor(e){this.privEventListeners={},this.privIsDisposed=!1,this.privConsoleListener=void 0,this.privMetadata=e}onEvent(e){if(this.isDisposed())throw new $("EventSource");if(this.metadata)for(const t in this.metadata)t&&e.metadata&&(e.metadata[t]||(e.metadata[t]=this.metadata[t]));for(const t in this.privEventListeners)t&&this.privEventListeners[t]&&this.privEventListeners[t](e)}attach(e){const t=x();return this.privEventListeners[t]=e,{detach:()=>(delete this.privEventListeners[t],Promise.resolve())}}attachListener(e){return this.attach((t=>e.onEvent(t)))}attachConsoleListener(e){return this.privConsoleListener&&this.privConsoleListener.detach(),this.privConsoleListener=this.attach((t=>e.onEvent(t))),this.privConsoleListener}isDisposed(){return this.privIsDisposed}dispose(){this.privEventListeners=null,this.privIsDisposed=!0}get metadata(){return this.privMetadata}}class re{static setEventSource(e){if(!e)throw new Y("eventSource");re.privInstance=e}static get instance(){return re.privInstance}}re.privInstance=new ne,(T=C||(C={}))[T.None=0]="None",T[T.Connected=1]="Connected",T[T.Connecting=2]="Connecting",T[T.Disconnected=3]="Disconnected",(k=I||(I={}))[k.None=0]="None",k[k.Resolved=1]="Resolved",k[k.Rejected=2]="Rejected";class ie{constructor(){this.resolve=e=>(this.privResolve(e),this),this.reject=e=>(this.privReject(e),this),this.privPromise=new Promise(((e,t)=>{this.privResolve=e,this.privReject=t}))}get promise(){return this.privPromise}}function oe(e,t,n){e.then((e=>{try{t&&t(e)}catch(e){if(n)try{if(e instanceof Error){const t=e;n(t.name+": "+t.message)}else n(e)}catch(e){}}}),(e=>{if(n)try{if(e instanceof Error){const t=e;n(t.name+": "+t.message)}else n(e)}catch(e){}}))}var ae={};e(ae,"Queue",(()=>de),(e=>de=e));class se{constructor(e){if(this.privSubscriptionIdCounter=0,this.privAddSubscriptions={},this.privRemoveSubscriptions={},this.privDisposedSubscriptions={},this.privDisposeReason=null,this.privList=[],e)for(const t of e)this.privList.push(t)}get(e){return this.throwIfDisposed(),this.privList[e]}first(){return this.get(0)}last(){return this.get(this.length()-1)}add(e){this.throwIfDisposed(),this.insertAt(this.privList.length,e)}insertAt(e,t){this.throwIfDisposed(),0===e?this.privList.unshift(t):e===this.privList.length?this.privList.push(t):this.privList.splice(e,0,t),this.triggerSubscriptions(this.privAddSubscriptions)}removeFirst(){return this.throwIfDisposed(),this.removeAt(0)}removeLast(){return this.throwIfDisposed(),this.removeAt(this.length()-1)}removeAt(e){return this.throwIfDisposed(),this.remove(e,1)[0]}remove(e,t){this.throwIfDisposed();const n=this.privList.splice(e,t);return this.triggerSubscriptions(this.privRemoveSubscriptions),n}clear(){this.throwIfDisposed(),this.remove(0,this.length())}length(){return this.throwIfDisposed(),this.privList.length}onAdded(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privAddSubscriptions[t]=e,{detach:()=>(delete this.privAddSubscriptions[t],Promise.resolve())}}onRemoved(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privRemoveSubscriptions[t]=e,{detach:()=>(delete this.privRemoveSubscriptions[t],Promise.resolve())}}onDisposed(e){this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privDisposedSubscriptions[t]=e,{detach:()=>(delete this.privDisposedSubscriptions[t],Promise.resolve())}}join(e){return this.throwIfDisposed(),this.privList.join(e)}toArray(){const e=Array();return this.privList.forEach((t=>{e.push(t)})),e}any(e){return this.throwIfDisposed(),e?this.where(e).length()>0:this.length()>0}all(e){return this.throwIfDisposed(),this.where(e).length()===this.length()}forEach(e){this.throwIfDisposed();for(let t=0;t<this.length();t++)e(this.privList[t],t)}select(e){this.throwIfDisposed();const t=[];for(let n=0;n<this.privList.length;n++)t.push(e(this.privList[n],n));return new se(t)}where(e){this.throwIfDisposed();const t=new se;for(let n=0;n<this.privList.length;n++)e(this.privList[n],n)&&t.add(this.privList[n]);return t}orderBy(e){this.throwIfDisposed();const t=this.toArray().sort(e);return new se(t)}orderByDesc(e){return this.throwIfDisposed(),this.orderBy(((t,n)=>e(n,t)))}clone(){return this.throwIfDisposed(),new se(this.toArray())}concat(e){return this.throwIfDisposed(),new se(this.privList.concat(e.toArray()))}concatArray(e){return this.throwIfDisposed(),new se(this.privList.concat(e))}isDisposed(){return null==this.privList}dispose(e){this.isDisposed()||(this.privDisposeReason=e,this.privList=null,this.privAddSubscriptions=null,this.privRemoveSubscriptions=null,this.triggerSubscriptions(this.privDisposedSubscriptions))}throwIfDisposed(){if(this.isDisposed())throw new $("List",this.privDisposeReason)}triggerSubscriptions(e){if(e)for(const t in e)t&&e[t]()}}var le,ce,ue=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};(ce=le||(le={}))[ce.Dequeue=0]="Dequeue",ce[ce.Peek=1]="Peek";class de{constructor(e){this.privPromiseStore=new se,this.privIsDrainInProgress=!1,this.privIsDisposing=!1,this.privDisposeReason=null,this.privList=e||new se,this.privDetachables=[],this.privSubscribers=new se,this.privDetachables.push(this.privList.onAdded((()=>this.drain())))}enqueue(e){this.throwIfDispose(),this.enqueueFromPromise(new Promise((t=>t(e))))}enqueueFromPromise(e){this.throwIfDispose(),e.then((e=>{this.privList.add(e)}),(()=>{}))}dequeue(){this.throwIfDispose();const e=new ie;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:le.Dequeue}),this.drain()),e.promise}peek(){this.throwIfDispose();const e=new ie;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:le.Peek}),this.drain()),e.promise}length(){return this.throwIfDispose(),this.privList.length()}isDisposed(){return null==this.privSubscribers}drainAndDispose(e,t){return ue(this,void 0,void 0,(function*(){if(!this.isDisposed()&&!this.privIsDisposing){this.privDisposeReason=t,this.privIsDisposing=!0;const n=this.privSubscribers;if(n){for(;n.length()>0;){n.removeFirst().deferral.resolve(void 0)}this.privSubscribers===n&&(this.privSubscribers=n)}for(const e of this.privDetachables)yield e.detach();if(this.privPromiseStore.length()>0&&e){const t=[];return this.privPromiseStore.toArray().forEach((e=>{t.push(e)})),Promise.all(t).finally((()=>{this.privSubscribers=null,this.privList.forEach((t=>{e(t)})),this.privList=null})).then()}this.privSubscribers=null,this.privList=null}}))}dispose(e){return ue(this,void 0,void 0,(function*(){yield this.drainAndDispose(null,e)}))}drain(){if(!this.privIsDrainInProgress&&!this.privIsDisposing){this.privIsDrainInProgress=!0;const e=this.privSubscribers,t=this.privList;if(e&&t){for(;t.length()>0&&e.length()>0&&!this.privIsDisposing;){const n=e.removeFirst();if(n.type===le.Peek)n.deferral.resolve(t.first());else{const e=t.removeFirst();n.deferral.resolve(e)}}this.privSubscribers===e&&(this.privSubscribers=e),this.privList===t&&(this.privList=t)}this.privIsDrainInProgress=!1}}throwIfDispose(){if(this.isDisposed()){if(this.privDisposeReason)throw new Z(this.privDisposeReason);throw new $("Queue")}if(this.privIsDisposing)throw new Z("Queue disposing")}}class he{constructor(e,t,n){if(this.privPayload=null,!t)throw new Y("payload");if(e===A.Binary&&"ArrayBuffer"!==t.__proto__.constructor.name)throw new Z("Payload must be ArrayBuffer");if(e===A.Text&&"string"!=typeof t)throw new Z("Payload must be a string");this.privMessageType=e,this.privPayload=t,this.privId=n||x()}get messageType(){return this.privMessageType}get payload(){return this.privPayload}get textContent(){if(this.privMessageType===A.Binary)throw new Z("Not supported for binary message");return this.privPayload}get binaryContent(){if(this.privMessageType===A.Text)throw new Z("Not supported for text message");return this.privPayload}get id(){return this.privId}}class fe{constructor(e,t){this.privActualSampleRate=e,this.privDesiredSampleRate=t}encode(e){const t=this.downSampleAudioFrame(e,this.privActualSampleRate,this.privDesiredSampleRate);if(!t)return null;const n=2*t.length,r=new ArrayBuffer(n),i=new DataView(r);return this.floatTo16BitPCM(i,0,t),r}setString(e,t,n){for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))}floatTo16BitPCM(e,t,n){for(let r=0;r<n.length;r++,t+=2){const i=Math.max(-1,Math.min(1,n[r]));e.setInt16(t,i<0?32768*i:32767*i,!0)}}downSampleAudioFrame(e,t,n){if(!e)return null;if(n===t||n>t)return e;const r=t/n,i=Math.round(e.length/r),o=new Float32Array(i);let a=0,s=0;for(;s<i;){const t=Math.round((s+1)*r);let n=0,i=0;for(;a<t&&a<e.length;)n+=e[a++],i++;o[s++]=n/i}return o}}var pe={};e(pe,"Stream",(()=>be),(e=>be=e));var me,ge,ve=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class be{constructor(e){this.privIsWriteEnded=!1,this.privIsReadEnded=!1,this.privId=e||x(),this.privReaderQueue=new(0,ae.Queue)}get isClosed(){return this.privIsWriteEnded}get isReadEnded(){return this.privIsReadEnded}get id(){return this.privId}close(){this.privIsWriteEnded||(this.writeStreamChunk({buffer:null,isEnd:!0,timeReceived:Date.now()}),this.privIsWriteEnded=!0)}writeStreamChunk(e){if(this.throwIfClosed(),!this.privReaderQueue.isDisposed())try{this.privReaderQueue.enqueue(e)}catch(e){}}read(){if(this.privIsReadEnded)throw new Z("Stream read has already finished");return this.privReaderQueue.dequeue().then((e=>ve(this,void 0,void 0,(function*(){return(void 0===e||e.isEnd)&&(yield this.privReaderQueue.dispose("End of stream reached")),e}))))}readEnded(){this.privIsReadEnded||(this.privIsReadEnded=!0,this.privReaderQueue=new(0,ae.Queue))}throwIfClosed(){if(this.privIsWriteEnded)throw new Z("Stream closed")}}(ge=me||(me={}))[ge.Success=0]="Success",ge[ge.Error=1]="Error";class ye extends pe.Stream{constructor(e,t){super(t),this.privTargetChunkSize=e,this.privNextBufferReadyBytes=0}writeStreamChunk(e){if(e.isEnd||0===this.privNextBufferReadyBytes&&e.buffer.byteLength===this.privTargetChunkSize)return void super.writeStreamChunk(e);let t=0;for(;t<e.buffer.byteLength;){void 0===this.privNextBufferToWrite&&(this.privNextBufferToWrite=new ArrayBuffer(this.privTargetChunkSize),this.privNextBufferStartTime=e.timeReceived);const n=Math.min(e.buffer.byteLength-t,this.privTargetChunkSize-this.privNextBufferReadyBytes),r=new Uint8Array(this.privNextBufferToWrite),i=new Uint8Array(e.buffer.slice(t,n+t));r.set(i,this.privNextBufferReadyBytes),this.privNextBufferReadyBytes+=n,t+=n,this.privNextBufferReadyBytes===this.privTargetChunkSize&&(super.writeStreamChunk({buffer:this.privNextBufferToWrite,isEnd:!1,timeReceived:this.privNextBufferStartTime}),this.privNextBufferReadyBytes=0,this.privNextBufferToWrite=void 0)}}close(){0===this.privNextBufferReadyBytes||this.isClosed||super.writeStreamChunk({buffer:this.privNextBufferToWrite.slice(0,this.privNextBufferReadyBytes),isEnd:!1,timeReceived:this.privNextBufferStartTime}),super.close()}}class we{static load(e){const t=new Map([[0,()=>{}]]),n=new Map,r=new Worker(e);r.addEventListener("message",(({data:e})=>{if(we.isCallNotification(e)){const{params:{timerId:r}}=e,i=t.get(r);if("number"==typeof i){const e=n.get(i);if(void 0===e||e!==r)throw new Error("The timer is in an undefined state.")}else{if(void 0===i)throw new Error("The timer is in an undefined state.");i(),t.delete(r)}}else{if(!we.isClearResponse(e)){const{error:{message:t}}=e;throw new Error(t)}{const{id:r}=e,i=n.get(r);if(void 0===i)throw new Error("The timer is in an undefined state.");n.delete(r),t.delete(i)}}}));return{clearTimeout:e=>{const i=Math.random();n.set(i,e),t.set(e,i),r.postMessage({id:i,method:"clear",params:{timerId:e}})},setTimeout:(e,n)=>{const i=Math.random();return t.set(i,e),r.postMessage({id:null,method:"set",params:{delay:n,now:performance.now(),timerId:i}}),i}}}static loadWorkerTimers(){return()=>{if(null!==we.workerTimers)return we.workerTimers;const e=new Blob(['!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return d}));const r=new Map,o=new Map,i=e=>{const t=r.get(e);if(void 0===t)throw new Error(\'There is no interval scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(t),r.delete(e)},u=e=>{const t=o.get(e);if(void 0===t)throw new Error(\'There is no timeout scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(t),o.delete(e)},f=(e,t)=>{let n,r;if("performance"in self){const o=performance.now();n=o,r=e-Math.max(0,o-t)}else n=Date.now(),r=e;return{expected:n+r,remainingDelay:r}},c=(e,t,n,r)=>{const o="performance"in self?performance.now():Date.now();o>n?postMessage({id:null,method:"call",params:{timerId:t}}):e.set(t,setTimeout(c,n-o,e,t,n))},a=(e,t,n)=>{const{expected:o,remainingDelay:i}=f(e,n);r.set(t,setTimeout(c,i,r,t,o))},d=(e,t,n)=>{const{expected:r,remainingDelay:i}=f(e,n);o.set(t,setTimeout(c,i,o,t,r))}},function(e,t,n){"use strict";n.r(t);var r=n(2);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(3);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(4);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o);var f=n(5);for(var o in f)"default"!==o&&function(e){n.d(t,e,(function(){return f[e]}))}(o);var c=n(6);for(var o in c)"default"!==o&&function(e){n.d(t,e,(function(){return c[e]}))}(o);var a=n(7);for(var o in a)"default"!==o&&function(e){n.d(t,e,(function(){return a[e]}))}(o);var d=n(8);for(var o in d)"default"!==o&&function(e){n.d(t,e,(function(){return d[e]}))}(o);var s=n(9);for(var o in s)"default"!==o&&function(e){n.d(t,e,(function(){return s[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(11);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(12);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(13);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(1);for(var i in o)"default"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);var u=n(10);for(var i in u)"default"!==i&&function(e){n.d(t,e,(function(){return u[e]}))}(i);addEventListener("message",({data:e})=>{try{if("clear"===e.method){const{id:t,params:{timerId:n}}=e;Object(r.b)(n),postMessage({error:null,id:t})}else{if("set"!==e.method)throw new Error(\'The given method "\'.concat(e.method,\'" is not supported\'));{const{params:{delay:t,now:n,timerId:o}}=e;Object(r.d)(t,o,n)}}}catch(t){postMessage({error:{message:t.message},id:e.id,result:null})}})}]);'],{type:"application/javascript; charset=utf-8"}),t=URL.createObjectURL(e);return we.workerTimers=we.load(t),we.workerTimers.setTimeout((()=>URL.revokeObjectURL(t)),0),we.workerTimers}}static isCallNotification(e){return void 0!==e.method&&"call"===e.method}static isClearResponse(e){return null===e.error&&"number"==typeof e.id}}we.workerTimers=null,we.clearTimeout=e=>we.timers().clearTimeout(e),we.setTimeout=(e,t)=>we.timers().setTimeout(e,t),we.timers=we.loadWorkerTimers();class Se extends R{constructor(e,t,n){super(e,t),this.privSignature=n}}class xe extends Se{constructor(e){super("OCSPMemoryCacheHitEvent",M.Debug,e)}}class Me extends Se{constructor(e){super("OCSPCacheMissEvent",M.Debug,e)}}class _e extends Se{constructor(e){super("OCSPDiskCacheHitEvent",M.Debug,e)}}class Ae extends Se{constructor(e){super("OCSPCacheUpdateNeededEvent",M.Debug,e)}}class Ee extends Se{constructor(e){super("OCSPMemoryCacheStoreEvent",M.Debug,e)}}class Ce extends Se{constructor(e){super("OCSPDiskCacheStoreEvent",M.Debug,e)}}class Te extends Se{constructor(e){super("OCSPCacheUpdateCompleteEvent",M.Debug,e)}}class Ie extends Se{constructor(){super("OCSPStapleReceivedEvent",M.Debug,"")}}class ke extends Se{constructor(e,t){super("OCSPCacheEntryExpiredEvent",M.Debug,e),this.privExpireTime=t}}class Re extends Se{constructor(e,t,n){super("OCSPCacheEntryNeedsRefreshEvent",M.Debug,e),this.privExpireTime=n,this.privStartTime=t}}class Oe extends Se{constructor(e,t,n){super("OCSPCacheHitEvent",M.Debug,e),this.privExpireTime=n,this.privExpireTimeString=new Date(n).toLocaleDateString(),this.privStartTime=t,this.privStartTimeString=new Date(t).toLocaleTimeString()}}class Pe extends Se{constructor(e,t){super("OCSPVerificationFailedEvent",M.Debug,e),this.privError=t}}class Ne extends Se{constructor(e,t){super("OCSPCacheFetchErrorEvent",M.Debug,e),this.privError=t}}class Be extends Se{constructor(e){super("OCSPResponseRetrievedEvent",M.Debug,e)}}class Le extends Se{constructor(e,t){super("OCSPCacheUpdateErrorEvent",M.Debug,e),this.privError=t}}class De extends R{constructor(e){super("BackgroundEvent",M.Error),this.privError=e}get error(){return this.privError}}class Ue{static throwIfNullOrUndefined(e,t){if(null==e)throw new Error("throwIfNullOrUndefined:"+t)}static throwIfNull(e,t){if(null===e)throw new Error("throwIfNull:"+t)}static throwIfNullOrWhitespace(e,t){if(Ue.throwIfNullOrUndefined(e,t),(""+e).trim().length<1)throw new Error("throwIfNullOrWhitespace:"+t)}static throwIfDisposed(e){if(e)throw new Error("the object is already disposed")}static throwIfArrayEmptyOrWhitespace(e,t){if(Ue.throwIfNullOrUndefined(e,t),0===e.length)throw new Error("throwIfArrayEmptyOrWhitespace:"+t);for(const n of e)Ue.throwIfNullOrWhitespace(n,t)}static throwIfFileDoesNotExist(e,t){Ue.throwIfNullOrWhitespace(e,t)}static throwIfNotUndefined(e,t){if(void 0!==e)throw new Error("throwIfNotUndefined:"+t)}}var Fe={};e(Fe,"MicAudioSource",(()=>tr),(e=>tr=e));class ze{}ze.AuthKey="Ocp-Apim-Subscription-Key",ze.ConnectionId="X-ConnectionId",ze.ContentType="Content-Type",ze.CustomCommandsAppId="X-CommandsAppId",ze.Path="Path",ze.RequestId="X-RequestId",ze.RequestStreamId="X-StreamId",ze.RequestTimestamp="X-Timestamp";class je{constructor(e,t){this.privHeaderName=e,this.privToken=t}get headerName(){return this.privHeaderName}get token(){return this.privToken}}class He{constructor(e){if(!e)throw new Y("subscriptionKey");this.privAuthInfo=new je(ze.AuthKey,e)}fetch(e){return Promise.resolve(this.privAuthInfo)}fetchOnExpiry(e){return Promise.resolve(this.privAuthInfo)}}const Ge="Authorization";class Ve{constructor(e,t){if(!e)throw new Y("fetchCallback");if(!t)throw new Y("fetchOnExpiryCallback");this.privFetchCallback=e,this.privFetchOnExpiryCallback=t}fetch(e){return this.privFetchCallback(e).then((e=>new je(Ge,Ve.privTokenPrefix+e)))}fetchOnExpiry(e){return this.privFetchOnExpiryCallback(e).then((e=>new je(Ge,Ve.privTokenPrefix+e)))}}Ve.privTokenPrefix="bearer ";var We,qe,Ke,Je,Qe,Xe,Ye={};e(Ye,"ServiceRecognizerBase",(()=>ut),(e=>ut=e)),(qe=We||(We={}))[qe.NoError=0]="NoError",qe[qe.AuthenticationFailure=1]="AuthenticationFailure",qe[qe.BadRequestParameters=2]="BadRequestParameters",qe[qe.TooManyRequests=3]="TooManyRequests",qe[qe.ConnectionFailure=4]="ConnectionFailure",qe[qe.ServiceTimeout=5]="ServiceTimeout",qe[qe.ServiceError=6]="ServiceError",qe[qe.RuntimeError=7]="RuntimeError",qe[qe.Forbidden=8]="Forbidden",(Je=Ke||(Ke={}))[Je.Error=0]="Error",Je[Je.EndOfStream=1]="EndOfStream",(Xe=Qe||(Qe={}))[Xe.SpeechServiceConnection_Key=0]="SpeechServiceConnection_Key",Xe[Xe.SpeechServiceConnection_Endpoint=1]="SpeechServiceConnection_Endpoint",Xe[Xe.SpeechServiceConnection_Region=2]="SpeechServiceConnection_Region",Xe[Xe.SpeechServiceAuthorization_Token=3]="SpeechServiceAuthorization_Token",Xe[Xe.SpeechServiceAuthorization_Type=4]="SpeechServiceAuthorization_Type",Xe[Xe.SpeechServiceConnection_EndpointId=5]="SpeechServiceConnection_EndpointId",Xe[Xe.SpeechServiceConnection_TranslationToLanguages=6]="SpeechServiceConnection_TranslationToLanguages",Xe[Xe.SpeechServiceConnection_TranslationVoice=7]="SpeechServiceConnection_TranslationVoice",Xe[Xe.SpeechServiceConnection_TranslationFeatures=8]="SpeechServiceConnection_TranslationFeatures",Xe[Xe.SpeechServiceConnection_IntentRegion=9]="SpeechServiceConnection_IntentRegion",Xe[Xe.SpeechServiceConnection_ProxyHostName=10]="SpeechServiceConnection_ProxyHostName",Xe[Xe.SpeechServiceConnection_ProxyPort=11]="SpeechServiceConnection_ProxyPort",Xe[Xe.SpeechServiceConnection_ProxyUserName=12]="SpeechServiceConnection_ProxyUserName",Xe[Xe.SpeechServiceConnection_ProxyPassword=13]="SpeechServiceConnection_ProxyPassword",Xe[Xe.SpeechServiceConnection_RecoMode=14]="SpeechServiceConnection_RecoMode",Xe[Xe.SpeechServiceConnection_RecoLanguage=15]="SpeechServiceConnection_RecoLanguage",Xe[Xe.Speech_SessionId=16]="Speech_SessionId",Xe[Xe.SpeechServiceConnection_SynthLanguage=17]="SpeechServiceConnection_SynthLanguage",Xe[Xe.SpeechServiceConnection_SynthVoice=18]="SpeechServiceConnection_SynthVoice",Xe[Xe.SpeechServiceConnection_SynthOutputFormat=19]="SpeechServiceConnection_SynthOutputFormat",Xe[Xe.SpeechServiceConnection_AutoDetectSourceLanguages=20]="SpeechServiceConnection_AutoDetectSourceLanguages",Xe[Xe.SpeechServiceResponse_RequestDetailedResultTrueFalse=21]="SpeechServiceResponse_RequestDetailedResultTrueFalse",Xe[Xe.SpeechServiceResponse_RequestProfanityFilterTrueFalse=22]="SpeechServiceResponse_RequestProfanityFilterTrueFalse",Xe[Xe.SpeechServiceResponse_JsonResult=23]="SpeechServiceResponse_JsonResult",Xe[Xe.SpeechServiceResponse_JsonErrorDetails=24]="SpeechServiceResponse_JsonErrorDetails",Xe[Xe.CancellationDetails_Reason=25]="CancellationDetails_Reason",Xe[Xe.CancellationDetails_ReasonText=26]="CancellationDetails_ReasonText",Xe[Xe.CancellationDetails_ReasonDetailedText=27]="CancellationDetails_ReasonDetailedText",Xe[Xe.LanguageUnderstandingServiceResponse_JsonResult=28]="LanguageUnderstandingServiceResponse_JsonResult",Xe[Xe.SpeechServiceConnection_Url=29]="SpeechServiceConnection_Url",Xe[Xe.SpeechServiceConnection_InitialSilenceTimeoutMs=30]="SpeechServiceConnection_InitialSilenceTimeoutMs",Xe[Xe.SpeechServiceConnection_EndSilenceTimeoutMs=31]="SpeechServiceConnection_EndSilenceTimeoutMs",Xe[Xe.Speech_SegmentationSilenceTimeoutMs=32]="Speech_SegmentationSilenceTimeoutMs",Xe[Xe.SpeechServiceConnection_EnableAudioLogging=33]="SpeechServiceConnection_EnableAudioLogging",Xe[Xe.SpeechServiceConnection_AtStartLanguageIdPriority=34]="SpeechServiceConnection_AtStartLanguageIdPriority",Xe[Xe.SpeechServiceConnection_ContinuousLanguageIdPriority=35]="SpeechServiceConnection_ContinuousLanguageIdPriority",Xe[Xe.SpeechServiceConnection_RecognitionEndpointVersion=36]="SpeechServiceConnection_RecognitionEndpointVersion",Xe[Xe.SpeechServiceResponse_ProfanityOption=37]="SpeechServiceResponse_ProfanityOption",Xe[Xe.SpeechServiceResponse_PostProcessingOption=38]="SpeechServiceResponse_PostProcessingOption",Xe[Xe.SpeechServiceResponse_RequestWordLevelTimestamps=39]="SpeechServiceResponse_RequestWordLevelTimestamps",Xe[Xe.SpeechServiceResponse_StablePartialResultThreshold=40]="SpeechServiceResponse_StablePartialResultThreshold",Xe[Xe.SpeechServiceResponse_OutputFormatOption=41]="SpeechServiceResponse_OutputFormatOption",Xe[Xe.SpeechServiceResponse_TranslationRequestStablePartialResult=42]="SpeechServiceResponse_TranslationRequestStablePartialResult",Xe[Xe.SpeechServiceResponse_RequestWordBoundary=43]="SpeechServiceResponse_RequestWordBoundary",Xe[Xe.SpeechServiceResponse_RequestPunctuationBoundary=44]="SpeechServiceResponse_RequestPunctuationBoundary",Xe[Xe.SpeechServiceResponse_RequestSentenceBoundary=45]="SpeechServiceResponse_RequestSentenceBoundary",Xe[Xe.Conversation_ApplicationId=46]="Conversation_ApplicationId",Xe[Xe.Conversation_DialogType=47]="Conversation_DialogType",Xe[Xe.Conversation_Initial_Silence_Timeout=48]="Conversation_Initial_Silence_Timeout",Xe[Xe.Conversation_From_Id=49]="Conversation_From_Id",Xe[Xe.Conversation_Conversation_Id=50]="Conversation_Conversation_Id",Xe[Xe.Conversation_Custom_Voice_Deployment_Ids=51]="Conversation_Custom_Voice_Deployment_Ids",Xe[Xe.Conversation_Speech_Activity_Template=52]="Conversation_Speech_Activity_Template",Xe[Xe.Conversation_Request_Bot_Status_Messages=53]="Conversation_Request_Bot_Status_Messages",Xe[Xe.Conversation_Agent_Connection_Id=54]="Conversation_Agent_Connection_Id",Xe[Xe.SpeechServiceConnection_Host=55]="SpeechServiceConnection_Host",Xe[Xe.ConversationTranslator_Host=56]="ConversationTranslator_Host",Xe[Xe.ConversationTranslator_Name=57]="ConversationTranslator_Name",Xe[Xe.ConversationTranslator_CorrelationId=58]="ConversationTranslator_CorrelationId",Xe[Xe.ConversationTranslator_Token=59]="ConversationTranslator_Token",Xe[Xe.PronunciationAssessment_ReferenceText=60]="PronunciationAssessment_ReferenceText",Xe[Xe.PronunciationAssessment_GradingSystem=61]="PronunciationAssessment_GradingSystem",Xe[Xe.PronunciationAssessment_Granularity=62]="PronunciationAssessment_Granularity",Xe[Xe.PronunciationAssessment_EnableMiscue=63]="PronunciationAssessment_EnableMiscue",Xe[Xe.PronunciationAssessment_Json=64]="PronunciationAssessment_Json",Xe[Xe.PronunciationAssessment_Params=65]="PronunciationAssessment_Params",Xe[Xe.SpeakerRecognition_Api_Version=66]="SpeakerRecognition_Api_Version";class Ze{constructor(e){this.privSessionId=e}get sessionId(){return this.privSessionId}}class $e extends Ze{constructor(e,t){super(t),this.privOffset=e}get offset(){return this.privOffset}}class et extends ee{constructor(e,t,n,r,i,o,a,s){if(!t)throw new Y("path");if(!n)throw new Y("requestId");const l={};if(l[ze.Path]=t,l[ze.RequestId]=n,l[ze.RequestTimestamp]=(new Date).toISOString(),r&&(l[ze.ContentType]=r),o&&(l[ze.RequestStreamId]=o),a)for(const e in a)e&&(l[e]=a[e]);s?super(e,i,l,s):super(e,i,l),this.privPath=t,this.privRequestId=n,this.privContentType=r,this.privStreamId=o,this.privAdditionalHeaders=a}get path(){return this.privPath}get requestId(){return this.privRequestId}get contentType(){return this.privContentType}get streamId(){return this.privStreamId}get additionalHeaders(){return this.privAdditionalHeaders}static fromConnectionMessage(e){let t=null,n=null,r=null,i=null;const o={};if(e.headers)for(const a in e.headers)a&&(a.toLowerCase()===ze.Path.toLowerCase()?t=e.headers[a]:a.toLowerCase()===ze.RequestId.toLowerCase()?n=e.headers[a]:a.toLowerCase()===ze.ContentType.toLowerCase()?r=e.headers[a]:a.toLowerCase()===ze.RequestStreamId.toLowerCase()?i=e.headers[a]:o[a]=e.headers[a]);return new et(e.messageType,t,n,r,e.body,i,o,e.id)}}var tt,nt,rt,it,ot,at,st,lt,ct=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class ut{constructor(e,t,n,r,i){if(this.privConnectionConfigurationPromise=void 0,this.privConnectionPromise=void 0,this.privSetTimeout=setTimeout,this.privIsLiveAudio=!1,this.recognizeOverride=void 0,this.disconnectOverride=void 0,this.receiveMessageOverride=void 0,this.sendPrePayloadJSONOverride=void 0,this.postConnectImplOverride=void 0,this.configConnectionOverride=void 0,!e)throw new Y("authentication");if(!t)throw new Y("connectionFactory");if(!n)throw new Y("audioSource");if(!r)throw new Y("recognizerConfig");this.privMustReportEndOfStream=!1,this.privAuthentication=e,this.privConnectionFactory=t,this.privAudioSource=n,this.privRecognizerConfig=r,this.privIsDisposed=!1,this.privRecognizer=i,this.privRequestSession=new(0,Wt.RequestSession)(this.privAudioSource.id()),this.privConnectionEvents=new ne,this.privServiceEvents=new ne,this.privDynamicGrammar=new ln,this.privSpeechContext=new sn(this.privDynamicGrammar),this.privAgentConfig=new An,"undefined"!=typeof Blob&&"undefined"!=typeof Worker&&(this.privSetTimeout=we.setTimeout),this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;(1003===t.statusCode||1007===t.statusCode||1002===t.statusCode||4e3===t.statusCode||this.privRequestSession.numConnectionAttempts>this.privRecognizerConfig.maxRetryCount)&&this.cancelRecognitionLocal(Ke.Error,1007===t.statusCode?We.BadRequestParameters:We.ConnectionFailure,`${t.reason} websocket error code: ${t.statusCode}`)}}))}get audioSource(){return this.privAudioSource}get speechContext(){return this.privSpeechContext}get dynamicGrammar(){return this.privDynamicGrammar}get agentConfig(){return this.privAgentConfig}set conversationTranslatorToken(e){this.privRecognizerConfig.parameters.setProperty(Qe.ConversationTranslator_Token,e)}set authentication(e){this.privAuthentication=this.authentication}isDisposed(){return this.privIsDisposed}dispose(e){return ct(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,void 0!==this.privConnectionConfigurationPromise)try{const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}catch(e){return}}))}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}get recognitionMode(){return this.privRecognizerConfig.recognitionMode}recognize(e,t,n){return ct(this,void 0,void 0,(function*(){if(void 0!==this.recognizeOverride)return void(yield this.recognizeOverride(e,t,n));this.privConnectionConfigurationPromise=void 0,this.privRecognizerConfig.recognitionMode=e,this.privSuccessCallback=t,this.privErrorCallback=n,this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);const r=this.connectImpl();let i;try{const e=yield this.audioSource.attach(this.privRequestSession.audioNodeId),t=yield this.audioSource.format,n=yield this.audioSource.deviceInfo;this.privIsLiveAudio=n.type&&n.type===st.Microphones,i=new br(e,t.avgBytesPerSec),yield this.privRequestSession.onAudioSourceAttachCompleted(i,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:n}}catch(e){throw yield this.privRequestSession.onStopRecognizing(),e}try{yield r}catch(e){return void(yield this.cancelRecognitionLocal(Ke.Error,We.ConnectionFailure,e))}const o=new Ze(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,o),this.receiveMessage();this.sendAudio(i).catch((e=>ct(this,void 0,void 0,(function*(){yield this.cancelRecognitionLocal(Ke.Error,We.RuntimeError,e)}))))}))}stopRecognizing(){return ct(this,void 0,void 0,(function*(){if(this.privRequestSession.isRecognizing)try{yield this.audioSource.turnOff(),yield this.sendFinalAudio(),yield this.privRequestSession.onStopRecognizing(),yield this.privRequestSession.turnCompletionPromise}finally{yield this.privRequestSession.dispose()}}))}connect(){return ct(this,void 0,void 0,(function*(){return yield this.connectImpl(),Promise.resolve()}))}connectAsync(e,t){this.connectImpl().then((()=>{try{e&&e()}catch(e){t&&t(e)}}),(e=>{try{t&&t(e)}catch(e){}}))}disconnect(){return ct(this,void 0,void 0,(function*(){if(yield this.cancelRecognitionLocal(Ke.Error,We.NoError,"Disconnecting"),void 0!==this.disconnectOverride&&(yield this.disconnectOverride()),void 0!==this.privConnectionPromise)try{yield(yield this.privConnectionPromise).dispose()}catch(e){}this.privConnectionPromise=void 0}))}sendMessage(e){}sendNetworkMessage(e,t){return ct(this,void 0,void 0,(function*(){const n="string"==typeof t?A.Text:A.Binary,r="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new et(n,e,this.privRequestSession.requestId,r,t))}))}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}sendTelemetryData(){return ct(this,void 0,void 0,(function*(){const e=this.privRequestSession.getTelemetry();if(!0!==ut.telemetryDataEnabled||this.privIsDisposed||null===e)return;if(ut.telemetryData)try{ut.telemetryData(e)}catch(e){}const t=yield this.fetchConnection();yield t.send(new et(A.Text,"telemetry",this.privRequestSession.requestId,"application/json",e))}))}cancelRecognitionLocal(e,t,n){return ct(this,void 0,void 0,(function*(){this.privRequestSession.isRecognizing&&(yield this.privRequestSession.onStopRecognizing(),this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,e,t,n))}))}receiveMessage(){return ct(this,void 0,void 0,(function*(){try{if(this.privIsDisposed)return;let e=yield this.fetchConnection();const t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(!t)return this.privRequestSession.isRecognizing?this.receiveMessage():void 0;this.privServiceHasSentMessage=!0;const n=et.fromConnectionMessage(t);if(n.requestId.toLowerCase()===this.privRequestSession.requestId.toLowerCase())switch(n.path.toLowerCase()){case"turn.start":this.privMustReportEndOfStream=!0,this.privRequestSession.onServiceTurnStartResponse();break;case"speech.startdetected":const t=Pt.fromJSON(n.textBody),r=new $e(t.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechStartDetected&&this.privRecognizer.speechStartDetected(this.privRecognizer,r);break;case"speech.enddetected":let i;i=n.textBody.length>0?n.textBody:"{ Offset: 0 }";const o=Pt.fromJSON(i);this.privRecognizerConfig.isContinuousRecognition&&this.privRequestSession.onServiceRecognized(o.Offset+this.privRequestSession.currentTurnAudioOffset);const a=new $e(o.Offset+this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId);this.privRecognizer.speechEndDetected&&this.privRecognizer.speechEndDetected(this.privRecognizer,a);break;case"turn.end":yield this.sendTelemetryData(),this.privRequestSession.isSpeechEnded&&this.privMustReportEndOfStream&&(this.privMustReportEndOfStream=!1,yield this.cancelRecognitionLocal(Ke.EndOfStream,We.NoError,void 0));const s=new Ze(this.privRequestSession.sessionId);if(yield this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition),!this.privRecognizerConfig.isContinuousRecognition||this.privRequestSession.isSpeechEnded||!this.privRequestSession.isRecognizing)return void(this.privRecognizer.sessionStopped&&this.privRecognizer.sessionStopped(this.privRecognizer,s));e=yield this.fetchConnection(),yield this.sendPrePayloadJSON(e);break;default:(yield this.processTypeSpecificMessages(n))||this.privServiceEvents&&this.serviceEvents.onEvent(new H(n.path.toLowerCase(),n.textBody))}return this.receiveMessage()}catch(e){return null}}))}sendSpeechContext(e,t){const n=this.speechContext.toJSON();if(t&&this.privRequestSession.onSpeechContext(),n)return e.send(new et(A.Text,"speech.context",this.privRequestSession.requestId,"application/json",n))}sendPrePayloadJSON(e,t=!0){return ct(this,void 0,void 0,(function*(){if(void 0!==this.sendPrePayloadJSONOverride)return this.sendPrePayloadJSONOverride(e);yield this.sendSpeechContext(e,t),yield this.sendWaveHeader(e)}))}sendWaveHeader(e){return ct(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;return e.send(new et(A.Binary,"audio",this.privRequestSession.requestId,"audio/x-wav",t.header))}))}connectImpl(){return void 0!==this.privConnectionPromise?this.privConnectionPromise.then((e=>e.state()===C.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=void 0,this.privServiceHasSentMessage=!1,this.connectImpl()):this.privConnectionPromise),(()=>(this.privConnectionId=null,this.privConnectionPromise=void 0,this.privServiceHasSentMessage=!1,this.connectImpl()))):(this.privConnectionPromise=this.retryableConnect(),this.privConnectionPromise.catch((()=>{})),void 0!==this.postConnectImplOverride?this.postConnectImplOverride(this.privConnectionPromise):this.privConnectionPromise)}sendSpeechServiceConfig(e,t,n){if(t.onSpeechContext(),!0!==ut.telemetryDataEnabled){const e={context:{system:JSON.parse(n).context.system}};n=JSON.stringify(e)}if("true"===this.privRecognizerConfig.parameters.getProperty("TranscriptionService_SingleChannel","false").toLowerCase()){const e=JSON.parse(n);e.context.DisableReferenceChannel="True",e.context.MicSpec="1_0_0",n=JSON.stringify(e)}if(n)return e.send(new et(A.Text,"speech.config",t.requestId,"application/json",n))}fetchConnection(){return ct(this,void 0,void 0,(function*(){return void 0!==this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===C.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.privServiceHasSentMessage=!1,this.fetchConnection()):this.privConnectionConfigurationPromise),(()=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.privServiceHasSentMessage=!1,this.fetchConnection()))):(this.privConnectionConfigurationPromise=this.configureConnection(),yield this.privConnectionConfigurationPromise)}))}sendAudio(e){return ct(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;let n=Date.now();const r=this.privRecognizerConfig.parameters.getProperty("SPEECH-TransmitLengthBeforThrottleMs","5000"),i=t.avgBytesPerSec/1e3*parseInt(r,10),o=this.privRequestSession.recogNumber,a=()=>ct(this,void 0,void 0,(function*(){if(!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===o){const r=yield this.fetchConnection(),s=yield e.read();if(this.privRequestSession.isSpeechEnded)return;let l,c;if(!s||s.isEnd?(l=null,c=0):(l=s.buffer,this.privRequestSession.onAudioSent(l.byteLength),c=i>=this.privRequestSession.bytesSent?0:Math.max(0,n-Date.now())),0!==c&&(yield this.delay(c)),null!==l&&(n=Date.now()+1e3*l.byteLength/(2*t.avgBytesPerSec)),!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===o){if(r.send(new et(A.Binary,"audio",this.privRequestSession.requestId,null,l)).catch((()=>{this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch((()=>{}))})),!(null==s?void 0:s.isEnd))return a();this.privIsLiveAudio||this.privRequestSession.onSpeechEnded()}}}));return a()}))}retryableConnect(){return ct(this,void 0,void 0,(function*(){let e=!1;this.privAuthFetchEventId=x();const t=this.privRequestSession.sessionId;this.privConnectionId=void 0!==t?t:x(),this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId,this.privConnectionId);let n=0,r="";for(;this.privRequestSession.numConnectionAttempts<=this.privRecognizerConfig.maxRetryCount;){const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId),i=yield t;yield this.privRequestSession.onAuthCompleted(!1);const o=this.privConnectionFactory.create(this.privRecognizerConfig,i,this.privConnectionId);this.privRequestSession.listenForServiceTelemetry(o.events),o.events.attach((e=>{this.connectionEvents.onEvent(e)}));const a=yield o.open();if(200===a.statusCode)return yield this.privRequestSession.onConnectionEstablishCompleted(a.statusCode),Promise.resolve(o);1006===a.statusCode&&(e=!0),n=a.statusCode,r=a.reason,this.privRequestSession.onRetryConnection()}return yield this.privRequestSession.onConnectionEstablishCompleted(n,r),Promise.reject(`Unable to contact server. StatusCode: ${n}, ${this.privRecognizerConfig.parameters.getProperty(Qe.SpeechServiceConnection_Endpoint)} Reason: ${r}`)}))}delay(e){return new Promise((t=>this.privSetTimeout(t,e)))}writeBufferToConsole(e){let t="Buffer Size: ";if(null===e)t+="null";else{const n=new Uint8Array(e);t+=`${e.byteLength}\r\n`;for(let r=0;r<e.byteLength;r++)t+=n[r].toString(16).padStart(2,"0")+" "}console.info(t)}sendFinalAudio(){return ct(this,void 0,void 0,(function*(){const e=yield this.fetchConnection();yield e.send(new et(A.Binary,"audio",this.privRequestSession.requestId,null,null))}))}configureConnection(){return ct(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privRequestSession,this.privRecognizerConfig.SpeechServiceConfig.serialize()),yield this.sendPrePayloadJSON(e,!1),e)}))}}ut.telemetryDataEnabled=!0,(nt=tt||(tt={}))[nt.Interactive=0]="Interactive",nt[nt.Conversation=1]="Conversation",nt[nt.Dictation=2]="Dictation",(it=rt||(rt={}))[it.Simple=0]="Simple",it[it.Detailed=1]="Detailed";class dt{constructor(e,t){this.privSpeechServiceConfig=e||new ht(new ft(null)),this.privParameters=t,this.privMaxRetryCount=parseInt(t.getProperty("SPEECH-Error-MaxRetryCount","4"),10),this.privLanguageIdPriority=t.getProperty(Qe.SpeechServiceConnection_ContinuousLanguageIdPriority,void 0),this.privLanguageIdMode="Latency"===this.privLanguageIdPriority?"DetectContinuous":"DetectAtAudioStart","DetectAtAudioStart"===this.privLanguageIdMode&&(this.privLanguageIdPriority=t.getProperty(Qe.SpeechServiceConnection_AtStartLanguageIdPriority,void 0))}get parameters(){return this.privParameters}get recognitionMode(){return this.privRecognitionMode}set recognitionMode(e){this.privRecognitionMode=e,this.privRecognitionActivityTimeout=e===tt.Interactive?8e3:25e3,this.privSpeechServiceConfig.Recognition=tt[e]}get SpeechServiceConfig(){return this.privSpeechServiceConfig}get recognitionActivityTimeout(){return this.privRecognitionActivityTimeout}get isContinuousRecognition(){return this.privRecognitionMode!==tt.Interactive}get languageIdPriority(){return this.privLanguageIdPriority?`Prioritize${this.privLanguageIdPriority}`:""}get languageIdMode(){return this.privLanguageIdMode}get autoDetectSourceLanguages(){return this.parameters.getProperty(Qe.SpeechServiceConnection_AutoDetectSourceLanguages,void 0)}get recognitionEndpointVersion(){return this.parameters.getProperty(Qe.SpeechServiceConnection_RecognitionEndpointVersion,void 0)}get sourceLanguageModels(){const e=[];let t=!1;if(void 0!==this.autoDetectSourceLanguages)for(const n of this.autoDetectSourceLanguages.split(",")){const r=n+Qe.SpeechServiceConnection_EndpointId.toString(),i=this.parameters.getProperty(r,void 0);void 0!==i?(e.push({language:n,endpoint:i}),t=!0):e.push({language:n,endpoint:""})}return t?e:void 0}get maxRetryCount(){return this.privMaxRetryCount}}class ht{constructor(e){this.context=e}serialize(){return JSON.stringify(this,((e,t)=>{if(t&&"object"==typeof t){const e={};for(const n in t)Object.hasOwnProperty.call(t,n)&&(e[n&&n.charAt(0).toLowerCase()+n.substring(1)]=t[n]);return e}return t}))}get Context(){return this.context}get Recognition(){return this.recognition}set Recognition(e){this.recognition=e.toLowerCase()}}class ft{constructor(e){this.system=new pt,this.os=e}}class pt{constructor(){this.name="SpeechSDK",this.version="1.22.0",this.build="JavaScript",this.lang="JavaScript"}}class mt{constructor(e,t,n){this.platform=e,this.name=t,this.version=n}}(at=ot||(ot={})).Bluetooth="Bluetooth",at.Wired="Wired",at.WiFi="WiFi",at.Cellular="Cellular",at.InBuilt="InBuilt",at.Unknown="Unknown",(lt=st||(st={})).Phone="Phone",lt.Speaker="Speaker",lt.Car="Car",lt.Headset="Headset",lt.Thermostat="Thermostat",lt.Microphones="Microphones",lt.Deskphone="Deskphone",lt.RemoteControl="RemoteControl",lt.Unknown="Unknown",lt.File="File",lt.Stream="Stream";class gt{toConnectionMessage(e){const t=new ie;try{if(e.messageType===A.Text){const n=e.textContent;let r={},i=null;if(n){const e=n.split("\r\n\r\n");e&&e.length>0&&(r=this.parseHeaders(e[0]),e.length>1&&(i=e[1]))}t.resolve(new ee(e.messageType,i,r,e.id))}else if(e.messageType===A.Binary){const n=e.binaryContent;let r={},i=null;if(!n||n.byteLength<2)throw new Error("Invalid binary message format. Header length missing.");const o=new DataView(n),a=o.getInt16(0);if(n.byteLength<a+2)throw new Error("Invalid binary message format. Header content missing.");let s="";for(let e=0;e<a;e++)s+=String.fromCharCode(o.getInt8(e+2));r=this.parseHeaders(s),n.byteLength>a+2&&(i=n.slice(2+a)),t.resolve(new ee(e.messageType,i,r,e.id))}}catch(e){t.reject(`Error formatting the message. Error: ${e}`)}return t.promise}fromConnectionMessage(e){const t=new ie;try{if(e.messageType===A.Text){const n=`${this.makeHeaders(e)}\r\n${e.textBody?e.textBody:""}`;t.resolve(new he(A.Text,n,e.id))}else if(e.messageType===A.Binary){const n=this.makeHeaders(e),r=e.binaryBody,i=this.stringToArrayBuffer(n),o=new Int8Array(i),a=o.byteLength,s=new Int8Array(2+a+(r?r.byteLength:0));if(s[0]=a>>8&255,s[1]=255&a,s.set(o,2),r){const e=new Int8Array(r);s.set(e,2+a)}const l=s.buffer;t.resolve(new he(A.Binary,l,e.id))}}catch(e){t.reject(`Error formatting the message. ${e}`)}return t.promise}makeHeaders(e){let t="";if(e.headers)for(const n in e.headers)n&&(t+=`${n}: ${e.headers[n]}\r\n`);return t}parseHeaders(e){const t={};if(e){const n=e.match(/[^\r\n]+/g);if(t)for(const e of n)if(e){const n=e.indexOf(":"),r=n>0?e.substr(0,n).trim().toLowerCase():e,i=n>0&&e.length>n+1?e.substr(n+1).trim():"";t[r]=i}}return t}stringToArrayBuffer(e){const t=new ArrayBuffer(e.length),n=new DataView(t);for(let t=0;t<e.length;t++)n.setUint8(t,e.charCodeAt(t));return t}}var vt,bt,yt,wt,St,xt,Mt,_t;(bt=vt||(vt={}))[bt.Simple=0]="Simple",bt[bt.Detailed=1]="Detailed";class At{}At.BotId="botid",At.CustomSpeechDeploymentId="cid",At.CustomVoiceDeploymentId="deploymentId",At.EnableAudioLogging="storeAudio",At.EnableLanguageId="lidEnabled",At.EnableWordLevelTimestamps="wordLevelTimestamps",At.EndSilenceTimeoutMs="endSilenceTimeoutMs",At.SegmentationSilenceTimeoutMs="segmentationSilenceTimeoutMs",At.Format="format",At.InitialSilenceTimeoutMs="initialSilenceTimeoutMs",At.Language="language",At.Profanity="profanity",At.RequestBotStatusMessages="enableBotMessageStatus",At.StableIntermediateThreshold="stableIntermediateThreshold",At.StableTranslation="stableTranslation",At.TestHooks="testhooks",At.Postprocessing="postprocessing";class Et{static getHostSuffix(e){if(e){if(e.toLowerCase().startsWith("china"))return".azure.cn";if(e.toLowerCase().startsWith("usgov"))return".azure.us"}return".microsoft.com"}setCommonUrlParams(e,t,n){new Map([[Qe.Speech_SegmentationSilenceTimeoutMs,At.SegmentationSilenceTimeoutMs],[Qe.SpeechServiceConnection_EnableAudioLogging,At.EnableAudioLogging],[Qe.SpeechServiceConnection_EndSilenceTimeoutMs,At.EndSilenceTimeoutMs],[Qe.SpeechServiceConnection_InitialSilenceTimeoutMs,At.InitialSilenceTimeoutMs],[Qe.SpeechServiceResponse_PostProcessingOption,At.Postprocessing],[Qe.SpeechServiceResponse_ProfanityOption,At.Profanity],[Qe.SpeechServiceResponse_RequestWordLevelTimestamps,At.EnableWordLevelTimestamps],[Qe.SpeechServiceResponse_StablePartialResultThreshold,At.StableIntermediateThreshold]]).forEach(((r,i)=>{this.setUrlParameter(i,r,e,t,n)}));const r=JSON.parse(e.parameters.getProperty(Zn,"{}"));Object.keys(r).forEach((e=>{t[e]=r[e]}))}setUrlParameter(e,t,n,r,i){const o=n.parameters.getProperty(e,void 0);!o||i&&-1!==i.search(t)||(r[t]=o.toLocaleLowerCase())}}class Ct extends Et{constructor(){super(...arguments),this.interactiveRelativeUri="/speech/recognition/interactive/cognitiveservices/v1",this.conversationRelativeUri="/speech/recognition/conversation/cognitiveservices/v1",this.dictationRelativeUri="/speech/recognition/dictation/cognitiveservices/v1",this.universalUri="/speech/universal/v"}create(e,t,n){let r=e.parameters.getProperty(Qe.SpeechServiceConnection_Endpoint,void 0);const i=e.parameters.getProperty(Qe.SpeechServiceConnection_Region,void 0),o=Et.getHostSuffix(i),a=e.parameters.getProperty(Qe.SpeechServiceConnection_Host,"wss://"+i+".stt.speech"+o),s={},l=e.parameters.getProperty(Qe.SpeechServiceConnection_EndpointId,void 0),c=e.parameters.getProperty(Qe.SpeechServiceConnection_RecoLanguage,void 0);if(l?r&&-1!==r.search(At.CustomSpeechDeploymentId)||(s[At.CustomSpeechDeploymentId]=l):c&&(r&&-1!==r.search(At.Language)||(s[At.Language]=c)),r&&-1!==r.search(At.Format)||(s[At.Format]=e.parameters.getProperty(Xn,vt[vt.Simple]).toLowerCase()),void 0!==e.autoDetectSourceLanguages&&(s[At.EnableLanguageId]="true"),this.setCommonUrlParams(e,s,r),!r)switch(e.recognitionMode){case tt.Conversation:r="true"===e.parameters.getProperty($n,"false")?a+this.dictationRelativeUri:void 0!==e.recognitionEndpointVersion&&parseInt(e.recognitionEndpointVersion,10)>1?`${a}${this.universalUri}${e.recognitionEndpointVersion}`:a+this.conversationRelativeUri;break;case tt.Dictation:r=a+this.dictationRelativeUri;break;default:r=void 0!==e.recognitionEndpointVersion&&parseInt(e.recognitionEndpointVersion,10)>1?`${a}${this.universalUri}${e.recognitionEndpointVersion}`:a+this.interactiveRelativeUri}const u={};void 0!==t.token&&""!==t.token&&(u[t.headerName]=t.token),u[ze.ConnectionId]=n,e.parameters.setProperty(Qe.SpeechServiceConnection_Url,r);const d="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false");return new(0,ar.WebsocketConnection)(r,s,u,new gt,wr.fromRecognizerConfig(e),d,n)}}class Tt{constructor(){this.synthesisUri="/cognitiveservices/websocket/v1"}create(e,t,n){let r=e.parameters.getProperty(Qe.SpeechServiceConnection_Endpoint,void 0);const i=e.parameters.getProperty(Qe.SpeechServiceConnection_Region,void 0),o=Et.getHostSuffix(i),a=e.parameters.getProperty(Qe.SpeechServiceConnection_EndpointId,void 0),s=void 0===a?"tts":"voice",l=e.parameters.getProperty(Qe.SpeechServiceConnection_Host,"wss://"+i+"."+s+".speech"+o);r||(r=l+this.synthesisUri);const c={};void 0!==t.token&&""!==t.token&&(c[t.headerName]=t.token),c[ze.ConnectionId]=n,void 0!==a&&(c[At.CustomVoiceDeploymentId]=a),e.parameters.setProperty(Qe.SpeechServiceConnection_Url,r);const u="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false");return new(0,ar.WebsocketConnection)(r,{},c,new gt,wr.fromParameters(e.parameters),u,n)}}(wt=yt||(yt={}))[wt.NoMatch=0]="NoMatch",wt[wt.Canceled=1]="Canceled",wt[wt.RecognizingSpeech=2]="RecognizingSpeech",wt[wt.RecognizedSpeech=3]="RecognizedSpeech",wt[wt.RecognizedKeyword=4]="RecognizedKeyword",wt[wt.RecognizingIntent=5]="RecognizingIntent",wt[wt.RecognizedIntent=6]="RecognizedIntent",wt[wt.TranslatingSpeech=7]="TranslatingSpeech",wt[wt.TranslatedSpeech=8]="TranslatedSpeech",wt[wt.SynthesizingAudio=9]="SynthesizingAudio",wt[wt.SynthesizingAudioCompleted=10]="SynthesizingAudioCompleted",wt[wt.SynthesizingAudioStarted=11]="SynthesizingAudioStarted",wt[wt.EnrollingVoiceProfile=12]="EnrollingVoiceProfile",wt[wt.EnrolledVoiceProfile=13]="EnrolledVoiceProfile",wt[wt.RecognizedSpeakers=14]="RecognizedSpeakers",wt[wt.RecognizedSpeaker=15]="RecognizedSpeaker",wt[wt.ResetVoiceProfile=16]="ResetVoiceProfile",wt[wt.DeletedVoiceProfile=17]="DeletedVoiceProfile",wt[wt.VoicesListRetrieved=18]="VoicesListRetrieved";class It{static implTranslateRecognitionResult(e){let t=yt.Canceled;switch(e){case Mt.Success:t=yt.RecognizedSpeech;break;case Mt.NoMatch:case Mt.InitialSilenceTimeout:case Mt.BabbleTimeout:case Mt.EndOfDictation:t=yt.NoMatch;break;case Mt.Error:case Mt.BadRequest:case Mt.Forbidden:default:t=yt.Canceled}return t}static implTranslateCancelResult(e){let t=Ke.EndOfStream;switch(e){case Mt.Success:case Mt.EndOfDictation:case Mt.NoMatch:t=Ke.EndOfStream;break;case Mt.InitialSilenceTimeout:case Mt.BabbleTimeout:case Mt.Error:case Mt.BadRequest:case Mt.Forbidden:default:t=Ke.Error}return t}static implTranslateCancelErrorCode(e){let t=We.NoError;switch(e){case Mt.Error:t=We.ServiceError;break;case Mt.TooManyRequests:t=We.TooManyRequests;break;case Mt.BadRequest:t=We.BadRequestParameters;break;case Mt.Forbidden:t=We.Forbidden;break;default:t=We.NoError}return t}static implTranslateErrorDetails(e){let t="The speech service encountered an internal error and could not continue.";switch(e){case We.Forbidden:t="The recognizer is using a free subscription that ran out of quota.";break;case We.BadRequestParameters:t="Invalid parameter or unsupported audio format in the request.";break;case We.TooManyRequests:t="The number of parallel requests exceeded the number of allowed concurrent transcriptions."}return t}}(xt=St||(St={}))[xt.Success=0]="Success",xt[xt.SynthesisEnd=1]="SynthesisEnd",xt[xt.Error=2]="Error",(_t=Mt||(Mt={}))[_t.Success=0]="Success",_t[_t.NoMatch=1]="NoMatch",_t[_t.InitialSilenceTimeout=2]="InitialSilenceTimeout",_t[_t.BabbleTimeout=3]="BabbleTimeout",_t[_t.Error=4]="Error",_t[_t.EndOfDictation=5]="EndOfDictation",_t[_t.TooManyRequests=6]="TooManyRequests",_t[_t.BadRequest=7]="BadRequest",_t[_t.Forbidden=8]="Forbidden";class kt{constructor(){this.privKeys=[],this.privValues=[]}getProperty(e,t){let n;n="string"==typeof e?e:Qe[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===n)return this.privValues[e];if(void 0!==t)return String(t)}setProperty(e,t){let n;n="string"==typeof e?e:Qe[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===n)return void(this.privValues[e]=t);this.privKeys.push(n),this.privValues.push(t)}clone(){const e=new kt;for(let t=0;t<this.privKeys.length;t++)e.privKeys.push(this.privKeys[t]),e.privValues.push(this.privValues[t]);return e}mergeTo(e){this.privKeys.forEach((t=>{if(void 0===e.getProperty(t,void 0)){const n=this.getProperty(t);e.setProperty(t,n)}}))}get keys(){return this.privKeys}}class Rt{constructor(e,t,n,r,i,o,a,s,l,c){this.privResultId=e,this.privReason=t,this.privText=n,this.privDuration=r,this.privOffset=i,this.privLanguage=o,this.privLanguageDetectionConfidence=a,this.privErrorDetails=s,this.privJson=l,this.privProperties=c}get resultId(){return this.privResultId}get reason(){return this.privReason}get text(){return this.privText}get duration(){return this.privDuration}get offset(){return this.privOffset}get language(){return this.privLanguage}get languageDetectionConfidence(){return this.privLanguageDetectionConfidence}get errorDetails(){return this.privErrorDetails}get json(){return this.privJson}get properties(){return this.privProperties}}class Ot extends Rt{constructor(e,t,n,r,i,o,a,s,l,c,u){super(e,t,n,r,i,o,a,l,c,u),this.privSpeakerId=s}get speakerId(){return this.privSpeakerId}}class Pt{constructor(e){this.privSpeechStartDetected=JSON.parse(e)}static fromJSON(e){return new Pt(e)}get Offset(){return this.privSpeechStartDetected.Offset}}class Nt{constructor(e){this.privSpeechHypothesis=JSON.parse(e)}static fromJSON(e){return new Nt(e)}get Text(){return this.privSpeechHypothesis.Text}get Offset(){return this.privSpeechHypothesis.Offset}get Duration(){return this.privSpeechHypothesis.Duration}get Language(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSpeechHypothesis.SpeakerId}}var Bt={};e(Bt,"SpeechServiceRecognizer",(()=>zt),(e=>zt=e));class Lt extends $e{constructor(e,t,n,r,i){super(r,i),this.privReason=e,this.privErrorDetails=t,this.privErrorCode=n}get reason(){return this.privReason}get errorCode(){return this.privErrorCode}get errorDetails(){return this.privErrorDetails}}class Dt extends Lt{}class Ut extends $e{constructor(e,t,n){super(t,n),this.privResult=e}get result(){return this.privResult}}var Ft=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class zt extends Ye.ServiceRecognizerBase{constructor(e,t,n,r,i){if(super(e,t,n,r,i),this.privSpeechRecognizer=i,void 0!==r.autoDetectSourceLanguages){const e=r.autoDetectSourceLanguages.split(",");this.privSpeechContext.setSection("languageId",{Priority:r.languageIdPriority,languages:e,mode:r.languageIdMode,onSuccess:{action:"Recognize"},onUnknown:{action:"None"}}),this.privSpeechContext.setSection("phraseOutput",{interimResults:{resultType:"Auto"},phraseResults:{resultType:"Always"}});const t=r.sourceLanguageModels;void 0!==t&&this.privSpeechContext.setSection("phraseDetection",{customModels:t,onInterim:{action:"None"},onSuccess:{action:"None"}})}}processTypeSpecificMessages(e){return Ft(this,void 0,void 0,(function*(){let t;const n=new kt;n.setProperty(Qe.SpeechServiceResponse_JsonResult,e.textBody);let r=!1;switch(e.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const i=Nt.fromJSON(e.textBody),o=i.Offset+this.privRequestSession.currentTurnAudioOffset;t=new Ot(this.privRequestSession.requestId,yt.RecognizingSpeech,i.Text,i.Duration,o,i.Language,i.LanguageDetectionConfidence,void 0,void 0,e.textBody,n),this.privRequestSession.onHypothesis(o);const a=new Ut(t,i.Duration,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognizing)try{this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer,a)}catch(e){}r=!0;break;case"speech.phrase":const s=Ht.fromJSON(e.textBody),l=It.implTranslateRecognitionResult(s.RecognitionStatus);if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+s.Offset+s.Duration),yt.Canceled===l){const e=It.implTranslateCancelResult(s.RecognitionStatus),t=It.implTranslateCancelErrorCode(s.RecognitionStatus);yield this.cancelRecognitionLocal(e,t,It.implTranslateErrorDetails(t))}else{if(!this.privRequestSession.isSpeechEnded||l!==yt.NoMatch||s.RecognitionStatus===Mt.InitialSilenceTimeout){if(this.privRecognizerConfig.parameters.getProperty(Xn)===vt[vt.Simple])t=new Ot(this.privRequestSession.requestId,l,s.DisplayText,s.Duration,s.Offset+this.privRequestSession.currentTurnAudioOffset,s.Language,s.LanguageDetectionConfidence,void 0,void 0,e.textBody,n);else{const r=jt.fromJSON(e.textBody),i=r.Offset+this.privRequestSession.currentTurnAudioOffset,o=r.getJsonWithCorrectedOffsets(i);t=new Ot(this.privRequestSession.requestId,l,r.RecognitionStatus===Mt.Success?r.NBest[0].Display:void 0,r.Duration,i,r.Language,r.LanguageDetectionConfidence,void 0,void 0,o,n)}const r=new Ut(t,t.offset,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognized)try{this.privSpeechRecognizer.recognized(this.privSpeechRecognizer,r)}catch(e){}}if(this.privSuccessCallback){try{this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}r=!0}return r}))}cancelRecognition(e,t,n,r,i){const o=new kt;if(o.setProperty(Yn,We[r]),this.privSpeechRecognizer.canceled){const t=new Dt(n,i,r,void 0,e);try{this.privSpeechRecognizer.canceled(this.privSpeechRecognizer,t)}catch(e){}}if(this.privSuccessCallback){const e=new Ot(t,yt.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,i,void 0,o);try{this.privSuccessCallback(e),this.privSuccessCallback=void 0}catch(e){}}}}class jt{constructor(e){this.privDetailedSpeechPhrase=JSON.parse(e),this.privDetailedSpeechPhrase.RecognitionStatus=Mt[this.privDetailedSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new jt(e)}getJsonWithCorrectedOffsets(e){if(this.privDetailedSpeechPhrase.NBest){let t;for(const e of this.privDetailedSpeechPhrase.NBest)if(e.Words&&e.Words[0]){t=e.Words[0].Offset;break}if(t&&t<e){const n=e-t;for(const e of this.privDetailedSpeechPhrase.NBest)if(e.Words)for(const t of e.Words)t.Offset+=n}}return JSON.stringify(this.privDetailedSpeechPhrase)}get RecognitionStatus(){return this.privDetailedSpeechPhrase.RecognitionStatus}get NBest(){return this.privDetailedSpeechPhrase.NBest}get Duration(){return this.privDetailedSpeechPhrase.Duration}get Offset(){return this.privDetailedSpeechPhrase.Offset}get Language(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence}get Text(){return this.privDetailedSpeechPhrase.NBest&&this.privDetailedSpeechPhrase.NBest[0]?this.privDetailedSpeechPhrase.NBest[0].Display||this.privDetailedSpeechPhrase.NBest[0].DisplayText:this.privDetailedSpeechPhrase.DisplayText}get SpeakerId(){return this.privDetailedSpeechPhrase.SpeakerId}}class Ht{constructor(e){this.privSimpleSpeechPhrase=JSON.parse(e),this.privSimpleSpeechPhrase.RecognitionStatus=Mt[this.privSimpleSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new Ht(e)}get RecognitionStatus(){return this.privSimpleSpeechPhrase.RecognitionStatus}get DisplayText(){return this.privSimpleSpeechPhrase.DisplayText}get Offset(){return this.privSimpleSpeechPhrase.Offset}get Duration(){return this.privSimpleSpeechPhrase.Duration}get Language(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSimpleSpeechPhrase.SpeakerId}}var Gt,Vt,Wt={};e(Wt,"RequestSession",(()=>an),(e=>an=e));class qt extends R{constructor(e,t,n,r=M.Info){super(e,r),this.privRequestId=t,this.privSessionId=n}get requestId(){return this.privRequestId}get sessionId(){return this.privSessionId}}class Kt extends qt{constructor(e,t,n,r){super("RecognitionTriggeredEvent",e,t),this.privAudioSourceId=n,this.privAudioNodeId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class Jt extends qt{constructor(e,t,n,r){super("ListeningStartedEvent",e,t),this.privAudioSourceId=n,this.privAudioNodeId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class Qt extends qt{constructor(e,t,n){super("ConnectingToServiceEvent",e,n),this.privAuthFetchEventid=t}get authFetchEventid(){return this.privAuthFetchEventid}}class Xt extends qt{constructor(e,t,n,r,i){super("RecognitionStartedEvent",e,i),this.privAudioSourceId=t,this.privAudioNodeId=n,this.privAuthFetchEventId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}get authFetchEventId(){return this.privAuthFetchEventId}}(Vt=Gt||(Gt={}))[Vt.Success=0]="Success",Vt[Vt.AudioSourceError=1]="AudioSourceError",Vt[Vt.AudioSourceTimeout=2]="AudioSourceTimeout",Vt[Vt.AuthTokenFetchError=3]="AuthTokenFetchError",Vt[Vt.AuthTokenFetchTimeout=4]="AuthTokenFetchTimeout",Vt[Vt.UnAuthorized=5]="UnAuthorized",Vt[Vt.ConnectTimeout=6]="ConnectTimeout",Vt[Vt.ConnectError=7]="ConnectError",Vt[Vt.ClientRecognitionActivityTimeout=8]="ClientRecognitionActivityTimeout",Vt[Vt.UnknownError=9]="UnknownError";class Yt{constructor(e,t,n){this.privIsDisposed=!1,this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privRequestId=e,this.privAudioSourceId=t,this.privAudioNodeId=n,this.privReceivedMessages={},this.privPhraseLatencies=[],this.privHypothesisLatencies=[]}phraseReceived(e){e>0&&this.privPhraseLatencies.push(Date.now()-e)}hypothesisReceived(e){e>0&&this.privHypothesisLatencies.push(Date.now()-e)}onEvent(e){if(!this.privIsDisposed&&(e instanceof Kt&&e.requestId===this.privRequestId&&(this.privListeningTriggerMetric={End:e.eventTime,Name:"ListeningTrigger",Start:e.eventTime}),e instanceof U&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof F&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof L&&e.audioSourceId===this.privAudioSourceId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof j&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof z&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Name:"Microphone",Start:this.privMicStartTime})),e instanceof Qt&&e.requestId===this.privRequestId&&(this.privConnectionId=e.sessionId),e instanceof V&&e.connectionId===this.privConnectionId&&(this.privConnectionStartTime=e.eventTime),e instanceof W&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof J&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Error:this.getConnectionError(e.statusCode),Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof Q&&e.connectionId===this.privConnectionId&&e.message&&e.message.headers&&e.message.headers.path)){this.privReceivedMessages[e.message.headers.path]||(this.privReceivedMessages[e.message.headers.path]=new Array);const t=50;this.privReceivedMessages[e.message.headers.path].length<t&&this.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime)}}getTelemetry(){const e=new Array;this.privListeningTriggerMetric&&e.push(this.privListeningTriggerMetric),this.privMicMetric&&e.push(this.privMicMetric),this.privConnectionEstablishMetric&&e.push(this.privConnectionEstablishMetric),this.privPhraseLatencies.length>0&&e.push({PhraseLatencyMs:this.privPhraseLatencies}),this.privHypothesisLatencies.length>0&&e.push({FirstHypothesisLatencyMs:this.privHypothesisLatencies});const t={Metrics:e,ReceivedMessages:this.privReceivedMessages},n=JSON.stringify(t);return this.privReceivedMessages={},this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privPhraseLatencies=[],this.privHypothesisLatencies=[],n}get hasTelemetry(){return 0!==Object.keys(this.privReceivedMessages).length||null!==this.privListeningTriggerMetric||null!==this.privMicMetric||null!==this.privConnectionEstablishMetric||0!==this.privPhraseLatencies.length||0!==this.privHypothesisLatencies.length}dispose(){this.privIsDisposed=!0}getConnectionError(e){switch(e){case 400:case 1002:case 1003:case 1005:case 1007:case 1008:case 1009:return"BadRequest";case 401:return"Unauthorized";case 403:return"Forbidden";case 503:case 1001:return"ServerUnavailable";case 500:case 1011:return"ServerError";case 408:case 504:return"Timeout";default:return"statuscode:"+e.toString()}}}var Zt,$t,en,tn,nn,rn,on=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class an{constructor(e){this.privIsDisposed=!1,this.privDetachables=new Array,this.privIsAudioNodeDetached=!1,this.privIsRecognizing=!1,this.privIsSpeechEnded=!1,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privHypothesisReceived=!1,this.privBytesSent=0,this.privRecogNumber=0,this.privInTurn=!1,this.privConnectionAttempts=0,this.privAudioSourceId=e,this.privRequestId=x(),this.privAudioNodeId=x(),this.privTurnDeferral=new ie,this.privTurnDeferral.resolve()}get sessionId(){return this.privSessionId}get requestId(){return this.privRequestId}get audioNodeId(){return this.privAudioNodeId}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSpeechEnded(){return this.privIsSpeechEnded}get isRecognizing(){return this.privIsRecognizing}get currentTurnAudioOffset(){return this.privTurnStartAudioOffset}get recogNumber(){return this.privRecogNumber}get numConnectionAttempts(){return this.privConnectionAttempts}get bytesSent(){return this.privBytesSent}listenForServiceTelemetry(e){this.privServiceTelemetryListener&&this.privDetachables.push(e.attachListener(this.privServiceTelemetryListener))}startNewRecognition(){this.privIsSpeechEnded=!1,this.privIsRecognizing=!0,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privRecogNumber++,this.privServiceTelemetryListener=new Yt(this.privRequestId,this.privAudioSourceId,this.privAudioNodeId),this.onEvent(new Kt(this.requestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}onAudioSourceAttachCompleted(e,t){return on(this,void 0,void 0,(function*(){this.privAudioNode=e,this.privIsAudioNodeDetached=!1,t?yield this.onComplete():this.onEvent(new Jt(this.privRequestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}))}onPreConnectionStart(e,t){this.privAuthFetchEventId=e,this.privSessionId=t,this.onEvent(new Qt(this.privRequestId,this.privAuthFetchEventId,this.privSessionId))}onAuthCompleted(e){return on(this,void 0,void 0,(function*(){e&&(yield this.onComplete())}))}onConnectionEstablishCompleted(e,t){return on(this,void 0,void 0,(function*(){if(200===e)return this.onEvent(new Xt(this.requestId,this.privAudioSourceId,this.privAudioNodeId,this.privAuthFetchEventId,this.privSessionId)),this.privAudioNode&&this.privAudioNode.replay(),this.privTurnStartAudioOffset=this.privLastRecoOffset,void(this.privBytesSent=0);403===e&&(yield this.onComplete())}))}onServiceTurnEndResponse(e){return on(this,void 0,void 0,(function*(){this.privTurnDeferral.resolve(),!e||this.isSpeechEnded?(yield this.onComplete(),this.privInTurn=!1):(this.privTurnStartAudioOffset=this.privLastRecoOffset,this.privAudioNode.replay())}))}onSpeechContext(){this.privRequestId=x()}onServiceTurnStartResponse(){this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch((()=>{}))),this.privInTurn=!0,this.privTurnDeferral=new ie}onHypothesis(e){this.privHypothesisReceived||(this.privHypothesisReceived=!0,this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(e)))}onPhraseRecognized(e){this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(e)),this.onServiceRecognized(e)}onServiceRecognized(e){this.privLastRecoOffset=e,this.privHypothesisReceived=!1,this.privAudioNode.shrinkBuffers(e),this.privConnectionAttempts=0}onAudioSent(e){this.privBytesSent+=e}onRetryConnection(){this.privConnectionAttempts++}dispose(){return on(this,void 0,void 0,(function*(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const e of this.privDetachables)yield e.detach();this.privServiceTelemetryListener&&this.privServiceTelemetryListener.dispose(),this.privIsRecognizing=!1}}))}getTelemetry(){return this.privServiceTelemetryListener.hasTelemetry?this.privServiceTelemetryListener.getTelemetry():null}onStopRecognizing(){return on(this,void 0,void 0,(function*(){yield this.onComplete()}))}onSpeechEnded(){this.privIsSpeechEnded=!0}onEvent(e){this.privServiceTelemetryListener&&this.privServiceTelemetryListener.onEvent(e),re.instance.onEvent(e)}onComplete(){return on(this,void 0,void 0,(function*(){this.privIsRecognizing&&(this.privIsRecognizing=!1,yield this.detachAudioNode())}))}detachAudioNode(){return on(this,void 0,void 0,(function*(){this.privIsAudioNodeDetached||(this.privIsAudioNodeDetached=!0,this.privAudioNode&&(yield this.privAudioNode.detach()))}))}}class sn{constructor(e){this.privContext={},this.privDynamicGrammar=e}setSection(e,t){this.privContext[e]=t}setPronunciationAssessmentParams(e){void 0===this.privContext.phraseDetection&&(this.privContext.phraseDetection={enrichment:{pronunciationAssessment:{}}}),this.privContext.phraseDetection.enrichment.pronunciationAssessment=JSON.parse(e),this.setWordLevelTimings(),this.privContext.phraseOutput.detailed.options.push("PronunciationAssessment"),-1===this.privContext.phraseOutput.detailed.options.indexOf("SNR")&&this.privContext.phraseOutput.detailed.options.push("SNR")}setWordLevelTimings(){void 0===this.privContext.phraseOutput&&(this.privContext.phraseOutput={detailed:{options:[]},format:{}}),void 0===this.privContext.phraseOutput.detailed&&(this.privContext.phraseOutput.detailed={options:[]}),this.privContext.phraseOutput.format="Detailed",-1===this.privContext.phraseOutput.detailed.options.indexOf("WordTimings")&&this.privContext.phraseOutput.detailed.options.push("WordTimings")}toJSON(){const e=this.privDynamicGrammar.generateGrammarObject();this.setSection("dgi",e);return JSON.stringify(this.privContext)}}class ln{addPhrase(e){this.privPhrases||(this.privPhrases=[]),e instanceof Array?this.privPhrases=this.privPhrases.concat(e):this.privPhrases.push(e)}clearPhrases(){this.privPhrases=void 0}addReferenceGrammar(e){this.privGrammars||(this.privGrammars=[]),e instanceof Array?this.privGrammars=this.privGrammars.concat(e):this.privGrammars.push(e)}clearGrammars(){this.privGrammars=void 0}generateGrammarObject(){if(void 0===this.privGrammars&&void 0===this.privPhrases)return;const e={};if(e.ReferenceGrammars=this.privGrammars,void 0!==this.privPhrases&&0!==this.privPhrases.length){const t=[];this.privPhrases.forEach((e=>{t.push({Text:e})})),e.Groups=[{Type:"Generic",Items:t}]}return e}}($t=Zt||(Zt={}))[$t.Raw8Khz8BitMonoMULaw=0]="Raw8Khz8BitMonoMULaw",$t[$t.Riff16Khz16KbpsMonoSiren=1]="Riff16Khz16KbpsMonoSiren",$t[$t.Audio16Khz16KbpsMonoSiren=2]="Audio16Khz16KbpsMonoSiren",$t[$t.Audio16Khz32KBitRateMonoMp3=3]="Audio16Khz32KBitRateMonoMp3",$t[$t.Audio16Khz128KBitRateMonoMp3=4]="Audio16Khz128KBitRateMonoMp3",$t[$t.Audio16Khz64KBitRateMonoMp3=5]="Audio16Khz64KBitRateMonoMp3",$t[$t.Audio24Khz48KBitRateMonoMp3=6]="Audio24Khz48KBitRateMonoMp3",$t[$t.Audio24Khz96KBitRateMonoMp3=7]="Audio24Khz96KBitRateMonoMp3",$t[$t.Audio24Khz160KBitRateMonoMp3=8]="Audio24Khz160KBitRateMonoMp3",$t[$t.Raw16Khz16BitMonoTrueSilk=9]="Raw16Khz16BitMonoTrueSilk",$t[$t.Riff16Khz16BitMonoPcm=10]="Riff16Khz16BitMonoPcm",$t[$t.Riff8Khz16BitMonoPcm=11]="Riff8Khz16BitMonoPcm",$t[$t.Riff24Khz16BitMonoPcm=12]="Riff24Khz16BitMonoPcm",$t[$t.Riff8Khz8BitMonoMULaw=13]="Riff8Khz8BitMonoMULaw",$t[$t.Raw16Khz16BitMonoPcm=14]="Raw16Khz16BitMonoPcm",$t[$t.Raw24Khz16BitMonoPcm=15]="Raw24Khz16BitMonoPcm",$t[$t.Raw8Khz16BitMonoPcm=16]="Raw8Khz16BitMonoPcm",$t[$t.Ogg16Khz16BitMonoOpus=17]="Ogg16Khz16BitMonoOpus",$t[$t.Ogg24Khz16BitMonoOpus=18]="Ogg24Khz16BitMonoOpus",$t[$t.Raw48Khz16BitMonoPcm=19]="Raw48Khz16BitMonoPcm",$t[$t.Riff48Khz16BitMonoPcm=20]="Riff48Khz16BitMonoPcm",$t[$t.Audio48Khz96KBitRateMonoMp3=21]="Audio48Khz96KBitRateMonoMp3",$t[$t.Audio48Khz192KBitRateMonoMp3=22]="Audio48Khz192KBitRateMonoMp3",$t[$t.Ogg48Khz16BitMonoOpus=23]="Ogg48Khz16BitMonoOpus",$t[$t.Webm16Khz16BitMonoOpus=24]="Webm16Khz16BitMonoOpus",$t[$t.Webm24Khz16BitMonoOpus=25]="Webm24Khz16BitMonoOpus",$t[$t.Raw24Khz16BitMonoTrueSilk=26]="Raw24Khz16BitMonoTrueSilk",$t[$t.Raw8Khz8BitMonoALaw=27]="Raw8Khz8BitMonoALaw",$t[$t.Riff8Khz8BitMonoALaw=28]="Riff8Khz8BitMonoALaw",$t[$t.Webm24Khz16Bit24KbpsMonoOpus=29]="Webm24Khz16Bit24KbpsMonoOpus",$t[$t.Audio16Khz16Bit32KbpsMonoOpus=30]="Audio16Khz16Bit32KbpsMonoOpus",$t[$t.Audio24Khz16Bit48KbpsMonoOpus=31]="Audio24Khz16Bit48KbpsMonoOpus",$t[$t.Audio24Khz16Bit24KbpsMonoOpus=32]="Audio24Khz16Bit24KbpsMonoOpus",$t[$t.Raw22050Hz16BitMonoPcm=33]="Raw22050Hz16BitMonoPcm",$t[$t.Riff22050Hz16BitMonoPcm=34]="Riff22050Hz16BitMonoPcm",$t[$t.Raw44100Hz16BitMonoPcm=35]="Raw44100Hz16BitMonoPcm",$t[$t.Riff44100Hz16BitMonoPcm=36]="Riff44100Hz16BitMonoPcm",(tn=en||(en={}))[tn.PCM=1]="PCM",tn[tn.MuLaw=2]="MuLaw",tn[tn.Siren=3]="Siren",tn[tn.MP3=4]="MP3",tn[tn.SILKSkype=5]="SILKSkype",tn[tn.OGG_OPUS=6]="OGG_OPUS",tn[tn.WEBM_OPUS=7]="WEBM_OPUS",tn[tn.ALaw=8]="ALaw",tn[tn.FLAC=9]="FLAC",tn[tn.OPUS=10]="OPUS";class cn{static getDefaultInputFormat(){return un.getDefaultInputFormat()}static getWaveFormat(e,t,n,r){return new un(e,t,n,r)}static getWaveFormatPCM(e,t,n){return new un(e,t,n)}}class un extends cn{constructor(e=16e3,t=16,n=1,r=en.PCM){super();let i=!0;switch(r){case en.PCM:this.formatTag=1;break;case en.ALaw:this.formatTag=6;break;case en.MuLaw:this.formatTag=7;break;default:i=!1}if(this.bitsPerSample=t,this.samplesPerSec=e,this.channels=n,this.avgBytesPerSec=this.samplesPerSec*this.channels*(this.bitsPerSample/8),this.blockAlign=this.channels*Math.max(this.bitsPerSample,8),i){this.privHeader=new ArrayBuffer(44);const e=new DataView(this.privHeader);this.setString(e,0,"RIFF"),e.setUint32(4,0,!0),this.setString(e,8,"WAVEfmt "),e.setUint32(16,16,!0),e.setUint16(20,this.formatTag,!0),e.setUint16(22,this.channels,!0),e.setUint32(24,this.samplesPerSec,!0),e.setUint32(28,this.avgBytesPerSec,!0),e.setUint16(32,this.channels*(this.bitsPerSample/8),!0),e.setUint16(34,this.bitsPerSample,!0),this.setString(e,36,"data"),e.setUint32(40,0,!0)}}static getDefaultInputFormat(){return new un}static getAudioContext(e){const t=window.AudioContext||window.webkitAudioContext||!1;if(t)return void 0!==e&&navigator.mediaDevices.getSupportedConstraints().sampleRate?new t({sampleRate:e}):new t;throw new Error("Browser does not support Web Audio API (AudioContext is not available).")}close(){}get header(){return this.privHeader}setString(e,t,n){for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))}}class dn extends un{constructor(e,t,n,r,i,o,a,s,l){super(n,o,t,e),this.formatTag=e,this.avgBytesPerSec=r,this.blockAlign=i,this.priAudioFormatString=a,this.priRequestAudioFormatString=s,this.priHasHeader=l}static fromSpeechSynthesisOutputFormat(e){return void 0===e?dn.getDefaultOutputFormat():dn.fromSpeechSynthesisOutputFormatString(dn.SpeechSynthesisOutputFormatToString[e])}static fromSpeechSynthesisOutputFormatString(e){switch(e){case"raw-8khz-8bit-mono-mulaw":return new dn(en.MuLaw,1,8e3,8e3,1,8,e,e,!1);case"riff-16khz-16kbps-mono-siren":return new dn(en.Siren,1,16e3,2e3,40,0,e,"audio-16khz-16kbps-mono-siren",!0);case"audio-16khz-16kbps-mono-siren":return new dn(en.Siren,1,16e3,2e3,40,0,e,e,!1);case"audio-16khz-32kbitrate-mono-mp3":return new dn(en.MP3,1,16e3,4096,2,16,e,e,!1);case"audio-16khz-128kbitrate-mono-mp3":return new dn(en.MP3,1,16e3,16384,2,16,e,e,!1);case"audio-16khz-64kbitrate-mono-mp3":return new dn(en.MP3,1,16e3,8192,2,16,e,e,!1);case"audio-24khz-48kbitrate-mono-mp3":return new dn(en.MP3,1,24e3,6144,2,16,e,e,!1);case"audio-24khz-96kbitrate-mono-mp3":return new dn(en.MP3,1,24e3,12288,2,16,e,e,!1);case"audio-24khz-160kbitrate-mono-mp3":return new dn(en.MP3,1,24e3,20480,2,16,e,e,!1);case"raw-16khz-16bit-mono-truesilk":return new dn(en.SILKSkype,1,16e3,32e3,2,16,e,e,!1);case"riff-8khz-16bit-mono-pcm":return new dn(en.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!0);case"riff-24khz-16bit-mono-pcm":return new dn(en.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!0);case"riff-8khz-8bit-mono-mulaw":return new dn(en.MuLaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-mulaw",!0);case"raw-16khz-16bit-mono-pcm":return new dn(en.PCM,1,16e3,32e3,2,16,e,"raw-16khz-16bit-mono-pcm",!1);case"raw-24khz-16bit-mono-pcm":return new dn(en.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!1);case"raw-8khz-16bit-mono-pcm":return new dn(en.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!1);case"ogg-16khz-16bit-mono-opus":return new dn(en.OGG_OPUS,1,16e3,8192,2,16,e,e,!1);case"ogg-24khz-16bit-mono-opus":return new dn(en.OGG_OPUS,1,24e3,8192,2,16,e,e,!1);case"raw-48khz-16bit-mono-pcm":return new dn(en.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!1);case"riff-48khz-16bit-mono-pcm":return new dn(en.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!0);case"audio-48khz-96kbitrate-mono-mp3":return new dn(en.MP3,1,48e3,12288,2,16,e,e,!1);case"audio-48khz-192kbitrate-mono-mp3":return new dn(en.MP3,1,48e3,24576,2,16,e,e,!1);case"ogg-48khz-16bit-mono-opus":return new dn(en.OGG_OPUS,1,48e3,12e3,2,16,e,e,!1);case"webm-16khz-16bit-mono-opus":return new dn(en.WEBM_OPUS,1,16e3,4e3,2,16,e,e,!1);case"webm-24khz-16bit-mono-opus":return new dn(en.WEBM_OPUS,1,24e3,6e3,2,16,e,e,!1);case"webm-24khz-16bit-24kbps-mono-opus":return new dn(en.WEBM_OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-16khz-16bit-32kbps-mono-opus":return new dn(en.OPUS,1,16e3,4e3,2,16,e,e,!1);case"audio-24khz-16bit-48kbps-mono-opus":return new dn(en.OPUS,1,24e3,6e3,2,16,e,e,!1);case"audio-24khz-16bit-24kbps-mono-opus":return new dn(en.OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-24khz-16bit-mono-flac":return new dn(en.FLAC,1,24e3,24e3,2,16,e,e,!1);case"audio-48khz-16bit-mono-flac":return new dn(en.FLAC,1,48e3,3e4,2,16,e,e,!1);case"raw-24khz-16bit-mono-truesilk":return new dn(en.SILKSkype,1,24e3,48e3,2,16,e,e,!1);case"raw-8khz-8bit-mono-alaw":return new dn(en.ALaw,1,8e3,8e3,1,8,e,e,!1);case"riff-8khz-8bit-mono-alaw":return new dn(en.ALaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-alaw",!0);case"raw-22050hz-16bit-mono-pcm":return new dn(en.PCM,1,22050,44100,2,16,e,e,!1);case"riff-22050hz-16bit-mono-pcm":return new dn(en.PCM,1,22050,44100,2,16,e,"raw-22050hz-16bit-mono-pcm",!0);case"raw-44100hz-16bit-mono-pcm":return new dn(en.PCM,1,44100,88200,2,16,e,e,!1);case"riff-44100hz-16bit-mono-pcm":return new dn(en.PCM,1,44100,88200,2,16,e,"raw-44100hz-16bit-mono-pcm",!0);default:return new dn(en.PCM,1,16e3,32e3,2,16,"riff-16khz-16bit-mono-pcm","raw-16khz-16bit-mono-pcm",!0)}}static getDefaultOutputFormat(){return dn.fromSpeechSynthesisOutputFormatString("undefined"!=typeof window?"audio-24khz-48kbitrate-mono-mp3":"riff-16khz-16bit-mono-pcm")}get hasHeader(){return this.priHasHeader}get header(){if(this.hasHeader)return this.privHeader}updateHeader(e){if(this.priHasHeader){const t=new DataView(this.privHeader);t.setUint32(4,e+this.privHeader.byteLength-8,!0),t.setUint32(40,e,!0)}}get requestAudioFormatString(){return this.priRequestAudioFormatString}}dn.SpeechSynthesisOutputFormatToString={[Zt.Raw8Khz8BitMonoMULaw]:"raw-8khz-8bit-mono-mulaw",[Zt.Riff16Khz16KbpsMonoSiren]:"riff-16khz-16kbps-mono-siren",[Zt.Audio16Khz16KbpsMonoSiren]:"audio-16khz-16kbps-mono-siren",[Zt.Audio16Khz32KBitRateMonoMp3]:"audio-16khz-32kbitrate-mono-mp3",[Zt.Audio16Khz128KBitRateMonoMp3]:"audio-16khz-128kbitrate-mono-mp3",[Zt.Audio16Khz64KBitRateMonoMp3]:"audio-16khz-64kbitrate-mono-mp3",[Zt.Audio24Khz48KBitRateMonoMp3]:"audio-24khz-48kbitrate-mono-mp3",[Zt.Audio24Khz96KBitRateMonoMp3]:"audio-24khz-96kbitrate-mono-mp3",[Zt.Audio24Khz160KBitRateMonoMp3]:"audio-24khz-160kbitrate-mono-mp3",[Zt.Raw16Khz16BitMonoTrueSilk]:"raw-16khz-16bit-mono-truesilk",[Zt.Riff16Khz16BitMonoPcm]:"riff-16khz-16bit-mono-pcm",[Zt.Riff8Khz16BitMonoPcm]:"riff-8khz-16bit-mono-pcm",[Zt.Riff24Khz16BitMonoPcm]:"riff-24khz-16bit-mono-pcm",[Zt.Riff8Khz8BitMonoMULaw]:"riff-8khz-8bit-mono-mulaw",[Zt.Raw16Khz16BitMonoPcm]:"raw-16khz-16bit-mono-pcm",[Zt.Raw24Khz16BitMonoPcm]:"raw-24khz-16bit-mono-pcm",[Zt.Raw8Khz16BitMonoPcm]:"raw-8khz-16bit-mono-pcm",[Zt.Ogg16Khz16BitMonoOpus]:"ogg-16khz-16bit-mono-opus",[Zt.Ogg24Khz16BitMonoOpus]:"ogg-24khz-16bit-mono-opus",[Zt.Raw48Khz16BitMonoPcm]:"raw-48khz-16bit-mono-pcm",[Zt.Riff48Khz16BitMonoPcm]:"riff-48khz-16bit-mono-pcm",[Zt.Audio48Khz96KBitRateMonoMp3]:"audio-48khz-96kbitrate-mono-mp3",[Zt.Audio48Khz192KBitRateMonoMp3]:"audio-48khz-192kbitrate-mono-mp3",[Zt.Ogg48Khz16BitMonoOpus]:"ogg-48khz-16bit-mono-opus",[Zt.Webm16Khz16BitMonoOpus]:"webm-16khz-16bit-mono-opus",[Zt.Webm24Khz16BitMonoOpus]:"webm-24khz-16bit-mono-opus",[Zt.Webm24Khz16Bit24KbpsMonoOpus]:"webm-24khz-16bit-24kbps-mono-opus",[Zt.Raw24Khz16BitMonoTrueSilk]:"raw-24khz-16bit-mono-truesilk",[Zt.Raw8Khz8BitMonoALaw]:"raw-8khz-8bit-mono-alaw",[Zt.Riff8Khz8BitMonoALaw]:"riff-8khz-8bit-mono-alaw",[Zt.Audio16Khz16Bit32KbpsMonoOpus]:"audio-16khz-16bit-32kbps-mono-opus",[Zt.Audio24Khz16Bit48KbpsMonoOpus]:"audio-24khz-16bit-48kbps-mono-opus",[Zt.Audio24Khz16Bit24KbpsMonoOpus]:"audio-24khz-16bit-24kbps-mono-opus",[Zt.Raw22050Hz16BitMonoPcm]:"raw-22050hz-16bit-mono-pcm",[Zt.Riff22050Hz16BitMonoPcm]:"riff-22050hz-16bit-mono-pcm",[Zt.Raw44100Hz16BitMonoPcm]:"raw-44100hz-16bit-mono-pcm",[Zt.Riff44100Hz16BitMonoPcm]:"riff-44100hz-16bit-mono-pcm"};(rn=nn||(nn={}))[rn.Masked=0]="Masked",rn[rn.Removed=1]="Removed",rn[rn.Raw=2]="Raw";class hn{constructor(){}static fromSubscription(e,t){Ue.throwIfNullOrWhitespace(e,"subscriptionKey"),Ue.throwIfNullOrWhitespace(t,"region");const n=new fn;return n.setProperty(Qe.SpeechServiceConnection_Region,t),n.setProperty(Qe.SpeechServiceConnection_IntentRegion,t),n.setProperty(Qe.SpeechServiceConnection_Key,e),n}static fromEndpoint(e,t){Ue.throwIfNull(e,"endpoint");const n=new fn;return n.setProperty(Qe.SpeechServiceConnection_Endpoint,e.href),void 0!==t&&n.setProperty(Qe.SpeechServiceConnection_Key,t),n}static fromHost(e,t){Ue.throwIfNull(e,"hostName");const n=new fn;return n.setProperty(Qe.SpeechServiceConnection_Host,e.protocol+"//"+e.hostname+(""===e.port?"":":"+e.port)),void 0!==t&&n.setProperty(Qe.SpeechServiceConnection_Key,t),n}static fromAuthorizationToken(e,t){Ue.throwIfNull(e,"authorizationToken"),Ue.throwIfNullOrWhitespace(t,"region");const n=new fn;return n.setProperty(Qe.SpeechServiceConnection_Region,t),n.setProperty(Qe.SpeechServiceConnection_IntentRegion,t),n.authorizationToken=e,n}close(){}}class fn extends hn{constructor(){super(),this.privProperties=new kt,this.speechRecognitionLanguage="en-US",this.outputFormat=vt.Simple}get properties(){return this.privProperties}get endPoint(){return new URL(this.privProperties.getProperty(Qe.SpeechServiceConnection_Endpoint))}get subscriptionKey(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_Key)}get region(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_Region)}get authorizationToken(){return this.privProperties.getProperty(Qe.SpeechServiceAuthorization_Token)}set authorizationToken(e){this.privProperties.setProperty(Qe.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_RecoLanguage)}set speechRecognitionLanguage(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_RecoLanguage,e)}get autoDetectSourceLanguages(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_AutoDetectSourceLanguages)}set autoDetectSourceLanguages(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_AutoDetectSourceLanguages,e)}get outputFormat(){return vt[this.privProperties.getProperty(Xn,void 0)]}set outputFormat(e){this.privProperties.setProperty(Xn,vt[e])}get endpointId(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_EndpointId)}set endpointId(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_EndpointId,e)}setProperty(e,t){Ue.throwIfNull(t,"value"),this.privProperties.setProperty(e,t)}getProperty(e,t){return this.privProperties.getProperty(e,t)}setProxy(e,t,n,r){this.setProperty(Qe[Qe.SpeechServiceConnection_ProxyHostName],e),this.setProperty(Qe[Qe.SpeechServiceConnection_ProxyPort],t),this.setProperty(Qe[Qe.SpeechServiceConnection_ProxyUserName],n),this.setProperty(Qe[Qe.SpeechServiceConnection_ProxyPassword],r)}setServiceProperty(e,t){const n=JSON.parse(this.privProperties.getProperty(Zn,"{}"));n[e]=t,this.privProperties.setProperty(Zn,JSON.stringify(n))}setProfanity(e){this.privProperties.setProperty(Qe.SpeechServiceResponse_ProfanityOption,nn[e])}enableAudioLogging(){this.privProperties.setProperty(Qe.SpeechServiceConnection_EnableAudioLogging,"true")}requestWordLevelTimestamps(){this.privProperties.setProperty(Qe.SpeechServiceResponse_RequestWordLevelTimestamps,"true")}enableDictation(){this.privProperties.setProperty($n,"true")}clone(){const e=new fn;return e.privProperties=this.privProperties.clone(),e}get speechSynthesisLanguage(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_SynthLanguage)}set speechSynthesisLanguage(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_SynthLanguage,e)}get speechSynthesisVoiceName(){return this.privProperties.getProperty(Qe.SpeechServiceConnection_SynthVoice)}set speechSynthesisVoiceName(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_SynthVoice,e)}get speechSynthesisOutputFormat(){return Zt[this.privProperties.getProperty(Qe.SpeechServiceConnection_SynthOutputFormat,void 0)]}set speechSynthesisOutputFormat(e){this.privProperties.setProperty(Qe.SpeechServiceConnection_SynthOutputFormat,Zt[e])}}var pn={};e(pn,"AudioOutputStream",(()=>bn),(e=>bn=e)),e(pn,"PullAudioOutputStream",(()=>yn),(e=>yn=e)),e(pn,"PullAudioOutputStreamImpl",(()=>wn),(e=>wn=e)),e(pn,"PushAudioOutputStream",(()=>Sn),(e=>Sn=e)),e(pn,"PushAudioOutputStreamImpl",(()=>xn),(e=>xn=e));var mn,gn,vn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class bn{constructor(){}static createPullStream(){return yn.create()}}class yn extends bn{static create(){return new wn}}class wn extends yn{constructor(){super(),this.privId=x(),this.privStream=new(0,pe.Stream)}set format(e){null==e&&(this.privFormat=dn.getDefaultOutputFormat()),this.privFormat=e}get format(){return this.privFormat}get isClosed(){return this.privStream.isClosed}id(){return this.privId}read(e){return vn(this,void 0,void 0,(function*(){const t=new Int8Array(e);let n=0;if(void 0!==this.privLastChunkView){if(this.privLastChunkView.length>e.byteLength)return t.set(this.privLastChunkView.slice(0,e.byteLength)),this.privLastChunkView=this.privLastChunkView.slice(e.byteLength),Promise.resolve(e.byteLength);t.set(this.privLastChunkView),n=this.privLastChunkView.length,this.privLastChunkView=void 0}for(;n<e.byteLength&&!this.privStream.isReadEnded;){const r=yield this.privStream.read();if(void 0===r||r.isEnd)this.privStream.readEnded();else{let i;r.buffer.byteLength>e.byteLength-n?(i=r.buffer.slice(0,e.byteLength-n),this.privLastChunkView=new Int8Array(r.buffer.slice(e.byteLength-n))):i=r.buffer,t.set(new Int8Array(i),n),n+=i.byteLength}}return n}))}write(e){Ue.throwIfNullOrUndefined(this.privStream,"must set format before writing"),this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}}class Sn extends bn{constructor(){super()}static create(e){return new xn(e)}}class xn extends Sn{constructor(e){super(),this.privId=x(),this.privCallback=e}set format(e){}write(e){this.privCallback.write&&this.privCallback.write(e)}close(){this.privCallback.close&&this.privCallback.close()}id(){return this.privId}}(gn=mn||(mn={}))[gn.None=0]="None",gn[gn.TextToSpeechAudio=1]="TextToSpeechAudio";var Mn,_n;class An{toJsonString(){return JSON.stringify(this.iPrivConfig)}get(){return this.iPrivConfig}set(e){this.iPrivConfig=e}}(_n=Mn||(Mn={})).WordBoundary="WordBoundary",_n.Bookmark="Bookmark",_n.Viseme="Viseme",_n.SentenceBoundary="SentenceBoundary",_n.SessionEnd="SessionEnd";class En{constructor(e){this.privSynthesisAudioMetadata=JSON.parse(e)}static fromJSON(e){return new En(e)}get Metadata(){return this.privSynthesisAudioMetadata.Metadata}}var Cn={};e(Cn,"SynthesisTurn",(()=>qn),(e=>qn=e));var Tn={};e(Tn,"SynthesisAdapterBase",(()=>Ln),(e=>Ln=e));class In{constructor(e,t){this.privAudioOffset=e,this.privText=t}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}}class kn{constructor(e){this.privResult=e}get result(){return this.privResult}}class Rn{constructor(e,t,n,r){this.privResultId=e,this.privReason=t,this.privErrorDetails=n,this.privProperties=r}get resultId(){return this.privResultId}get reason(){return this.privReason}get errorDetails(){return this.privErrorDetails}get properties(){return this.privProperties}}class On extends Rn{constructor(e,t,n,r,i,o){super(e,t,r,i),this.privAudioData=n,this.privAudioDuration=o}get audioData(){return this.privAudioData}get audioDuration(){return this.privAudioDuration}}class Pn{constructor(e,t,n){this.privAudioOffset=e,this.privVisemeId=t,this.privAnimation=n}get audioOffset(){return this.privAudioOffset}get visemeId(){return this.privVisemeId}get animation(){return this.privAnimation}}class Nn{constructor(e,t,n,r,i,o){this.privAudioOffset=e,this.privDuration=t,this.privText=n,this.privWordLength=r,this.privTextOffset=i,this.privBoundaryType=o}get audioOffset(){return this.privAudioOffset}get duration(){return this.privDuration}get text(){return this.privText}get wordLength(){return this.privWordLength}get textOffset(){return this.privTextOffset}get boundaryType(){return this.privBoundaryType}}var Bn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Ln{constructor(e,t,n,r,i){if(this.speakOverride=void 0,this.receiveMessageOverride=void 0,this.connectImplOverride=void 0,this.configConnectionOverride=void 0,this.privConnectionConfigurationPromise=void 0,!e)throw new Y("authentication");if(!t)throw new Y("connectionFactory");if(!n)throw new Y("synthesizerConfig");this.privAuthentication=e,this.privConnectionFactory=t,this.privSynthesizerConfig=n,this.privIsDisposed=!1,this.privSpeechSynthesizer=r,this.privSessionAudioDestination=i,this.privSynthesisTurn=new(0,Cn.SynthesisTurn),this.privConnectionEvents=new ne,this.privServiceEvents=new ne,this.privSynthesisContext=new Qn(this.privSpeechSynthesizer),this.privAgentConfig=new An,this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;1e3!==t.statusCode&&this.cancelSynthesisLocal(Ke.Error,1007===t.statusCode?We.BadRequestParameters:We.ConnectionFailure,`${t.reason} websocket error code: ${t.statusCode}`)}}))}get synthesisContext(){return this.privSynthesisContext}get agentConfig(){return this.privAgentConfig}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}set audioOutputFormat(e){this.privAudioOutputFormat=e,this.privSynthesisTurn.audioOutputFormat=e,void 0!==this.privSessionAudioDestination&&(this.privSessionAudioDestination.format=e),void 0!==this.synthesisContext&&(this.synthesisContext.audioOutputFormat=e)}static addHeader(e,t){if(!t.hasHeader)return e;t.updateHeader(e.byteLength);const n=new Uint8Array(e.byteLength+t.header.byteLength);return n.set(new Uint8Array(t.header),0),n.set(new Uint8Array(e),t.header.byteLength),n.buffer}isDisposed(){return this.privIsDisposed}dispose(e){return Bn(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.close(),void 0!==this.privConnectionConfigurationPromise){const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}}))}connect(){return Bn(this,void 0,void 0,(function*(){yield this.connectImpl()}))}sendNetworkMessage(e,t){return Bn(this,void 0,void 0,(function*(){const n="string"==typeof t?A.Text:A.Binary,r="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new et(n,e,this.privSynthesisTurn.requestId,r,t))}))}Speak(e,t,n,r,i,o){return Bn(this,void 0,void 0,(function*(){let a;if(a=t?e:this.privSpeechSynthesizer.buildSsml(e),void 0!==this.speakOverride)return this.speakOverride(a,n,r,i);this.privSuccessCallback=r,this.privErrorCallback=i,this.privSynthesisTurn.startNewSynthesis(n,e,t,o);try{yield this.connectImpl();const e=yield this.fetchConnection();yield this.sendSynthesisContext(e),yield this.sendSsmlMessage(e,a,n);const t=new kn(new On(n,yt.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,t),this.receiveMessage()}catch(e){return this.cancelSynthesisLocal(Ke.Error,We.ConnectionFailure,e),Promise.reject(e)}}))}cancelSynthesis(e,t,n,r){const i=new kt;i.setProperty(Yn,We[n]);const o=new On(e,yt.Canceled,void 0,r,i);if(this.privSpeechSynthesizer.SynthesisCanceled){const e=new kn(o);try{this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer,e)}catch(e){}}if(this.privSuccessCallback)try{this.privSuccessCallback(o)}catch(e){}}cancelSynthesisLocal(e,t,n){this.privSynthesisTurn.isSynthesizing&&(this.privSynthesisTurn.onStopSynthesizing(),this.cancelSynthesis(this.privSynthesisTurn.requestId,e,t,n))}processTypeSpecificMessages(e){return!0}receiveMessage(){return Bn(this,void 0,void 0,(function*(){try{const e=yield this.fetchConnection(),t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(this.privIsDisposed)return;if(!t)return this.privSynthesisTurn.isSynthesizing?this.receiveMessage():void 0;const n=et.fromConnectionMessage(t);if(n.requestId.toLowerCase()===this.privSynthesisTurn.requestId.toLowerCase())switch(n.path.toLowerCase()){case"turn.start":this.privSynthesisTurn.onServiceTurnStartResponse();break;case"response":this.privSynthesisTurn.onServiceResponseMessage(n.textBody);break;case"audio":if(this.privSynthesisTurn.streamId.toLowerCase()===n.streamId.toLowerCase()&&n.binaryBody){if(this.privSynthesisTurn.onAudioChunkReceived(n.binaryBody),this.privSpeechSynthesizer.synthesizing)try{const e=Ln.addHeader(n.binaryBody,this.privSynthesisTurn.audioOutputFormat),t=new kn(new On(this.privSynthesisTurn.requestId,yt.SynthesizingAudio,e));this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer,t)}catch(e){}void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.write(n.binaryBody)}break;case"audio.metadata":const e=En.fromJSON(n.textBody).Metadata;for(const t of e)switch(t.Type){case Mn.WordBoundary:case Mn.SentenceBoundary:this.privSynthesisTurn.onTextBoundaryEvent(t);const e=new Nn(t.Data.Offset,t.Data.Duration,t.Data.text.Text,t.Data.text.Length,t.Type===Mn.WordBoundary?this.privSynthesisTurn.currentTextOffset:this.privSynthesisTurn.currentSentenceOffset,t.Data.text.BoundaryType);if(this.privSpeechSynthesizer.wordBoundary)try{this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer,e)}catch(e){}break;case Mn.Bookmark:const n=new In(t.Data.Offset,t.Data.Bookmark);if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,n)}catch(e){}break;case Mn.Viseme:if(this.privSynthesisTurn.onVisemeMetadataReceived(t),t.Data.IsLastAnimation){const e=new Pn(t.Data.Offset,t.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation());if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,e)}catch(e){}}break;case Mn.SessionEnd:this.privSynthesisTurn.onSessionEnd(t)}break;case"turn.end":let t;this.privSynthesisTurn.onServiceTurnEndResponse();try{const e=yield this.privSynthesisTurn.getAllReceivedAudioWithHeader();t=new On(this.privSynthesisTurn.requestId,yt.SynthesizingAudioCompleted,e,void 0,void 0,this.privSynthesisTurn.audioDuration),this.privSuccessCallback&&this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}if(this.privSpeechSynthesizer.synthesisCompleted)try{this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer,new kn(t))}catch(e){}break;default:this.processTypeSpecificMessages(n)||this.privServiceEvents&&this.serviceEvents.onEvent(new H(n.path.toLowerCase(),n.textBody))}return this.receiveMessage()}catch(e){}}))}sendSynthesisContext(e){const t=this.synthesisContext.toJSON();if(t)return e.send(new et(A.Text,"synthesis.context",this.privSynthesisTurn.requestId,"application/json",t))}connectImpl(e=!1){if(null!=this.privConnectionPromise)return this.privConnectionPromise.then((e=>e.state()===C.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl()):this.privConnectionPromise),(()=>(this.privConnectionId=null,this.privConnectionPromise=null,this.connectImpl())));this.privAuthFetchEventId=x(),this.privConnectionId=x(),this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId);const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId);return this.privConnectionPromise=t.then((t=>Bn(this,void 0,void 0,(function*(){this.privSynthesisTurn.onAuthCompleted(!1);const n=this.privConnectionFactory.create(this.privSynthesizerConfig,t,this.privConnectionId);n.events.attach((e=>{this.connectionEvents.onEvent(e)}));const r=yield n.open();return 200===r.statusCode?(this.privSynthesisTurn.onConnectionEstablishCompleted(r.statusCode),Promise.resolve(n)):403!==r.statusCode||e?(this.privSynthesisTurn.onConnectionEstablishCompleted(r.statusCode),Promise.reject(`Unable to contact server. StatusCode: ${r.statusCode}, ${this.privSynthesizerConfig.parameters.getProperty(Qe.SpeechServiceConnection_Endpoint)} Reason: ${r.reason}`)):this.connectImpl(!0)}))),(e=>{throw this.privSynthesisTurn.onAuthCompleted(!0),new Error(e)})),this.privConnectionPromise.catch((()=>{})),this.privConnectionPromise}sendSpeechServiceConfig(e,t){if(t)return e.send(new et(A.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",t))}sendSsmlMessage(e,t,n){return e.send(new et(A.Text,"ssml",n,"application/ssml+xml",t))}fetchConnection(){return Bn(this,void 0,void 0,(function*(){return void 0!==this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===C.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.fetchConnection()):this.privConnectionConfigurationPromise),(()=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=void 0,this.fetchConnection()))):(this.privConnectionConfigurationPromise=this.configureConnection(),yield this.privConnectionConfigurationPromise)}))}configureConnection(){return Bn(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privSynthesizerConfig.SpeechServiceConfig.serialize()),e)}))}}Ln.telemetryDataEnabled=!0;class Dn extends R{constructor(e,t,n=M.Info){super(e,n),this.privRequestId=t}get requestId(){return this.privRequestId}}class Un extends Dn{constructor(e,t,n){super("SynthesisTriggeredEvent",e),this.privSessionAudioDestinationId=t,this.privTurnAudioDestinationId=n}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}class Fn extends Dn{constructor(e,t){super("ConnectingToSynthesisServiceEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}class zn extends Dn{constructor(e,t){super("SynthesisStartedEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}var jn,Hn,Gn,Vn,Wn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class qn{constructor(){this.privIsDisposed=!1,this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!1,this.privBytesReceived=0,this.privInTurn=!1,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.privSentenceOffset=0,this.privNextSearchSentenceIndex=0,this.privRequestId=x(),this.privTurnDeferral=new ie,this.privTurnDeferral.resolve()}get requestId(){return this.privRequestId}get streamId(){return this.privStreamId}set streamId(e){this.privStreamId=e}get audioOutputFormat(){return this.privAudioOutputFormat}set audioOutputFormat(e){this.privAudioOutputFormat=e}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSynthesisEnded(){return this.privIsSynthesisEnded}get isSynthesizing(){return this.privIsSynthesizing}get currentTextOffset(){return this.privTextOffset}get currentSentenceOffset(){return this.privSentenceOffset}get bytesReceived(){return this.privBytesReceived}get audioDuration(){return this.privAudioDuration}getAllReceivedAudio(){return Wn(this,void 0,void 0,(function*(){return this.privReceivedAudio?Promise.resolve(this.privReceivedAudio):this.privIsSynthesisEnded?(yield this.readAllAudioFromStream(),Promise.resolve(this.privReceivedAudio)):null}))}getAllReceivedAudioWithHeader(){return Wn(this,void 0,void 0,(function*(){if(this.privReceivedAudioWithHeader)return this.privReceivedAudioWithHeader;if(!this.privIsSynthesisEnded)return null;if(this.audioOutputFormat.hasHeader){const e=yield this.getAllReceivedAudio();return this.privReceivedAudioWithHeader=Tn.SynthesisAdapterBase.addHeader(e,this.audioOutputFormat),this.privReceivedAudioWithHeader}return this.getAllReceivedAudio()}))}startNewSynthesis(e,t,n,r){this.privIsSynthesisEnded=!1,this.privIsSynthesizing=!0,this.privRequestId=e,this.privRawText=t,this.privIsSSML=n,this.privAudioOutputStream=new(0,pn.PullAudioOutputStreamImpl),this.privAudioOutputStream.format=this.privAudioOutputFormat,this.privReceivedAudio=null,this.privReceivedAudioWithHeader=null,this.privBytesReceived=0,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.privSentenceOffset=0,this.privNextSearchSentenceIndex=0,this.privPartialVisemeAnimation="",void 0!==r&&(this.privTurnAudioDestination=r,this.privTurnAudioDestination.format=this.privAudioOutputFormat),this.onEvent(new Un(this.requestId,void 0,void 0===r?void 0:r.id()))}onPreConnectionStart(e){this.privAuthFetchEventId=e,this.onEvent(new Fn(this.privRequestId,this.privAuthFetchEventId))}onAuthCompleted(e){e&&this.onComplete()}onConnectionEstablishCompleted(e){if(200===e)return this.onEvent(new zn(this.requestId,this.privAuthFetchEventId)),void(this.privBytesReceived=0);403===e&&this.onComplete()}onServiceResponseMessage(e){const t=JSON.parse(e);this.streamId=t.audio.streamId}onServiceTurnEndResponse(){this.privInTurn=!1,this.privTurnDeferral.resolve(),this.onComplete()}onServiceTurnStartResponse(){this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch((()=>{}))),this.privInTurn=!0,this.privTurnDeferral=new ie}onAudioChunkReceived(e){this.isSynthesizing&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength,void 0!==this.privTurnAudioDestination&&this.privTurnAudioDestination.write(e))}onTextBoundaryEvent(e){this.updateTextOffset(e.Data.text.Text,e.Type)}onVisemeMetadataReceived(e){void 0!==e.Data.AnimationChunk&&(this.privPartialVisemeAnimation+=e.Data.AnimationChunk)}onSessionEnd(e){this.privAudioDuration=e.Data.Offset}dispose(){this.privIsDisposed||(this.privIsDisposed=!0)}onStopSynthesizing(){this.onComplete()}getAndClearVisemeAnimation(){const e=this.privPartialVisemeAnimation;return this.privPartialVisemeAnimation="",e}onEvent(e){re.instance.onEvent(e)}static isXmlTag(e){return e.length>=2&&"<"===e[0]&&">"===e[e.length-1]}updateTextOffset(e,t){t===Mn.WordBoundary?(this.privTextOffset=this.privRawText.indexOf(e,this.privNextSearchTextIndex),this.privTextOffset>=0&&(this.privNextSearchTextIndex=this.privTextOffset+e.length,this.privIsSSML&&this.withinXmlTag(this.privTextOffset)&&!qn.isXmlTag(e)&&this.updateTextOffset(e,t))):(this.privSentenceOffset=this.privRawText.indexOf(e,this.privNextSearchSentenceIndex),this.privSentenceOffset>=0&&(this.privNextSearchSentenceIndex=this.privSentenceOffset+e.length,this.privIsSSML&&this.withinXmlTag(this.privSentenceOffset)&&!qn.isXmlTag(e)&&this.updateTextOffset(e,t)))}onComplete(){this.privIsSynthesizing&&(this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!0,this.privAudioOutputStream.close(),this.privInTurn=!1,void 0!==this.privTurnAudioDestination&&(this.privTurnAudioDestination.close(),this.privTurnAudioDestination=void 0))}readAllAudioFromStream(){return Wn(this,void 0,void 0,(function*(){if(this.privIsSynthesisEnded){this.privReceivedAudio=new ArrayBuffer(this.bytesReceived);try{yield this.privAudioOutputStream.read(this.privReceivedAudio)}catch(e){this.privReceivedAudio=new ArrayBuffer(0)}}}))}withinXmlTag(e){return this.privRawText.indexOf("<",e+1)>this.privRawText.indexOf(">",e+1)}}class Kn{constructor(e){let t=e.parameters.getProperty(Qe.SpeechServiceConnection_Endpoint,void 0);if(!t){const n=e.parameters.getProperty(Qe.SpeechServiceConnection_Region,"westus"),r=Et.getHostSuffix(n);t=e.parameters.getProperty(Qe.SpeechServiceConnection_Host,`https://${n}.tts.speech${r}`)}this.privUri=`${t}/cognitiveservices/voices/list`;const n=kr.requestOptions;n.headers[kr.configParams.subscriptionKey]=e.parameters.getProperty(Qe.SpeechServiceConnection_Key,void 0),this.privRestAdapter=new(0,Sr.RestMessageAdapter)(n)}getVoicesList(e){return this.privRestAdapter.setHeaders(ze.ConnectionId,e),this.privRestAdapter.request(Sr.RestRequestType.Get,this.privUri)}}(Hn=jn||(jn={}))[Hn.Standard=0]="Standard",Hn[Hn.Custom=1]="Custom";class Jn{constructor(e,t){this.privSynthesisServiceType=jn.Standard,this.privSpeechServiceConfig=e||new ht(new ft(null)),this.privParameters=t}get parameters(){return this.privParameters}get synthesisServiceType(){return this.privSynthesisServiceType}set synthesisServiceType(e){this.privSynthesisServiceType=e}get SpeechServiceConfig(){return this.privSpeechServiceConfig}}class Qn{constructor(e){this.privContext={},this.privSpeechSynthesizer=e}setSection(e,t){this.privContext[e]=t}set audioOutputFormat(e){this.privAudioOutputFormat=e}toJSON(){const e=this.buildSynthesisContext();return this.setSection("synthesis",e),JSON.stringify(this.privContext)}buildSynthesisContext(){return{audio:{metadataOptions:{bookmarkEnabled:!!this.privSpeechSynthesizer.bookmarkReached,punctuationBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(Qe.SpeechServiceResponse_RequestPunctuationBoundary,!!this.privSpeechSynthesizer.wordBoundary),sentenceBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(Qe.SpeechServiceResponse_RequestSentenceBoundary,!1),sessionEndEnabled:!0,visemeEnabled:!!this.privSpeechSynthesizer.visemeReceived,wordBoundaryEnabled:this.privSpeechSynthesizer.properties.getProperty(Qe.SpeechServiceResponse_RequestWordBoundary,!!this.privSpeechSynthesizer.wordBoundary)},outputFormat:this.privAudioOutputFormat.requestAudioFormatString},language:{autoDetection:this.privSpeechSynthesizer.autoDetectSourceLanguage}}}}(Vn=Gn||(Gn={}))[Vn.TextIndependentIdentification=0]="TextIndependentIdentification",Vn[Vn.TextDependentVerification=1]="TextDependentVerification",Vn[Vn.TextIndependentVerification=2]="TextIndependentVerification";const Xn="OutputFormat",Yn="CancellationErrorCode",Zn="ServiceProperties",$n="ForceDictation";var er=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class tr{constructor(e,t,n,r){this.privRecorder=e,this.deviceId=t,this.privStreams={},this.privOutputChunkSize=tr.AUDIOFORMAT.avgBytesPerSec/10,this.privId=n||x(),this.privEvents=new ne,this.privMediaStream=r||null,this.privIsClosing=!1}get format(){return Promise.resolve(tr.AUDIOFORMAT)}get blob(){return Promise.reject("Not implemented for Mic input")}turnOn(){if(this.privInitializeDeferral)return this.privInitializeDeferral.promise;this.privInitializeDeferral=new ie;try{this.createAudioContext()}catch(e){if(e instanceof Error){const t=e;this.privInitializeDeferral.reject(t.name+": "+t.message)}else this.privInitializeDeferral.reject(e);return this.privInitializeDeferral.promise}const e=window.navigator;let t=e.getUserMedia||e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia;if(e.mediaDevices&&(t=(t,n,r)=>{e.mediaDevices.getUserMedia(t).then(n).catch(r)}),t){const e=()=>{this.onEvent(new P(this.privId)),this.privMediaStream&&this.privMediaStream.active?(this.onEvent(new N(this.privId)),this.privInitializeDeferral.resolve()):t({audio:!this.deviceId||{deviceId:this.deviceId},video:!1},(e=>{this.privMediaStream=e,this.onEvent(new N(this.privId)),this.privInitializeDeferral.resolve()}),(e=>{const t=`Error occurred during microphone initialization: ${e}`;this.privInitializeDeferral.reject(t),this.onEvent(new L(this.privId,t))}))};"suspended"===this.privContext.state?this.privContext.resume().then(e).catch((e=>{this.privInitializeDeferral.reject(`Failed to initialize audio context: ${e}`)})):e()}else{const e="Browser does not support getUserMedia.";this.privInitializeDeferral.reject(e),this.onEvent(new L(e,""))}return this.privInitializeDeferral.promise}id(){return this.privId}attach(e){return this.onEvent(new U(this.privId,e)),this.listen(e).then((t=>(this.onEvent(new F(this.privId,e)),{detach:()=>er(this,void 0,void 0,(function*(){return t.readEnded(),delete this.privStreams[e],this.onEvent(new z(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()})))}detach(e){e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new z(this.privId,e)))}turnOff(){return er(this,void 0,void 0,(function*(){for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&t.close()}this.onEvent(new B(this.privId)),this.privInitializeDeferral&&(yield this.privInitializeDeferral,this.privInitializeDeferral=null),yield this.destroyAudioContext()}))}get events(){return this.privEvents}get deviceInfo(){return this.getMicrophoneLabel().then((e=>({bitspersample:tr.AUDIOFORMAT.bitsPerSample,channelcount:tr.AUDIOFORMAT.channels,connectivity:ot.Unknown,manufacturer:"Speech SDK",model:e,samplerate:tr.AUDIOFORMAT.samplesPerSec,type:st.Microphones})))}setProperty(e,t){if("MICROPHONE-WorkletSourceUrl"!==e)throw new Error("Property '"+e+"' is not supported on Microphone.");this.privRecorder.setWorkletUrl(t)}getMicrophoneLabel(){const e="microphone";if(void 0!==this.privMicrophoneLabel)return Promise.resolve(this.privMicrophoneLabel);if(void 0===this.privMediaStream||!this.privMediaStream.active)return Promise.resolve(e);this.privMicrophoneLabel=e;const t=this.privMediaStream.getTracks()[0].getSettings().deviceId;if(void 0===t)return Promise.resolve(this.privMicrophoneLabel);const n=new ie;return navigator.mediaDevices.enumerateDevices().then((e=>{for(const n of e)if(n.deviceId===t){this.privMicrophoneLabel=n.label;break}n.resolve(this.privMicrophoneLabel)}),(()=>n.resolve(this.privMicrophoneLabel))),n.promise}listen(e){return er(this,void 0,void 0,(function*(){yield this.turnOn();const t=new ye(this.privOutputChunkSize,e);this.privStreams[e]=t;try{this.privRecorder.record(this.privContext,this.privMediaStream,t)}catch(t){throw this.onEvent(new j(this.privId,e,t)),t}return t}))}onEvent(e){this.privEvents.onEvent(e),re.instance.onEvent(e)}createAudioContext(){this.privContext||(this.privContext=un.getAudioContext(tr.AUDIOFORMAT.samplesPerSec))}destroyAudioContext(){return er(this,void 0,void 0,(function*(){if(!this.privContext)return;this.privRecorder.releaseMediaResources(this.privContext);let e=!1;"close"in this.privContext&&(e=!0),e?this.privIsClosing||(this.privIsClosing=!0,yield this.privContext.close(),this.privContext=null,this.privIsClosing=!1):null!==this.privContext&&"running"===this.privContext.state&&(yield this.privContext.suspend())}))}}tr.AUDIOFORMAT=cn.getDefaultInputFormat();var nr={};e(nr,"FileAudioSource",(()=>ir),(e=>ir=e));var rr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class ir{constructor(e,t,n){this.privStreams={},this.privHeaderEnd=44,this.privId=n||x(),this.privEvents=new ne,this.privSource=e,"undefined"!=typeof window&&"undefined"!=typeof Blob&&this.privSource instanceof Blob?this.privFilename=e.name:this.privFilename=t||"unknown.wav",this.privAudioFormatPromise=this.readHeader()}get format(){return this.privAudioFormatPromise}get blob(){return Promise.resolve(this.privSource)}turnOn(){if(this.privFilename.lastIndexOf(".wav")!==this.privFilename.length-4){const e=this.privFilename+" is not supported. Only WAVE files are allowed at the moment.";return this.onEvent(new L(e,"")),Promise.reject(e)}this.onEvent(new P(this.privId)),this.onEvent(new N(this.privId))}id(){return this.privId}attach(e){return rr(this,void 0,void 0,(function*(){this.onEvent(new U(this.privId,e));const t=yield this.upload(e);return this.onEvent(new F(this.privId,e)),Promise.resolve({detach:()=>rr(this,void 0,void 0,(function*(){t.readEnded(),delete this.privStreams[e],this.onEvent(new z(this.privId,e)),yield this.turnOff()})),id:()=>e,read:()=>t.read()})}))}detach(e){e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new z(this.privId,e)))}turnOff(){for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&!t.isClosed&&t.close()}return this.onEvent(new B(this.privId)),Promise.resolve()}get events(){return this.privEvents}get deviceInfo(){return this.privAudioFormatPromise.then((e=>Promise.resolve({bitspersample:e.bitsPerSample,channelcount:e.channels,connectivity:ot.Unknown,manufacturer:"Speech SDK",model:"File",samplerate:e.samplesPerSec,type:st.File})))}readHeader(){const e=this.privSource.slice(0,512),t=new ie,n=e=>{const n=new DataView(e),r=e=>String.fromCharCode(n.getUint8(e),n.getUint8(e+1),n.getUint8(e+2),n.getUint8(e+3));if("RIFF"!==r(0))return void t.reject("Invalid WAV header in file, RIFF was not found");if("WAVE"!==r(8)||"fmt "!==r(12))return void t.reject("Invalid WAV header in file, WAVEfmt was not found");const i=n.getInt32(16,!0),o=n.getUint16(22,!0),a=n.getUint32(24,!0),s=n.getUint16(34,!0);let l=36+Math.max(i-16,0);for(;"data"!==r(l);l+=2)if(l>504)return void t.reject("Invalid WAV header in file, data block was not found");this.privHeaderEnd=l+8,t.resolve(cn.getWaveFormatPCM(a,s,o))};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&e instanceof Blob){const t=new FileReader;t.onload=e=>{const t=e.target.result;n(t)},t.readAsArrayBuffer(e)}else{const t=e;n(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}return t.promise}upload(e){return rr(this,void 0,void 0,(function*(){const t=t=>{const n=`Error occurred while processing '${this.privFilename}'. ${t}`;throw this.onEvent(new j(this.privId,e,n)),new Error(n)};try{yield this.turnOn();const n=yield this.privAudioFormatPromise,r=new ye(n.avgBytesPerSec/10,e);this.privStreams[e]=r;const i=this.privSource.slice(this.privHeaderEnd),o=e=>{r.isClosed||(r.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()}),r.close())};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&i instanceof Blob){const e=new FileReader;e.onerror=e=>t(e.toString()),e.onload=e=>{const t=e.target.result;o(t)},e.readAsArrayBuffer(i)}else{const e=i;o(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}return r}catch(e){t(e)}}))}onEvent(e){this.privEvents.onEvent(e),re.instance.onEvent(e)}}class or{constructor(e){this.privStopInputOnRelease=e}record(e,t,n){const r=new fe(e.sampleRate,16e3),i=e.createMediaStreamSource(t);if(!this.privSpeechProcessorScript){const e=new Blob(["class SP extends AudioWorkletProcessor {\n constructor(options) {\n super(options);\n }\n process(inputs, outputs) {\n const input = inputs[0];\n const output = [];\n for (let channel = 0; channel < input.length; channel += 1) {\n output[channel] = input[channel];\n }\n this.port.postMessage(output[0]);\n return true;\n }\n }\n registerProcessor('speech-processor', SP);"],{type:"application/javascript; charset=utf-8"});this.privSpeechProcessorScript=URL.createObjectURL(e)}const o=()=>{const o=(()=>{let t=0;try{return e.createScriptProcessor(t,1,1)}catch(n){t=2048;let r=e.sampleRate;for(;t<16384&&r>=32e3;)t<<=1,r>>=1;return e.createScriptProcessor(t,1,1)}})();o.onaudioprocess=e=>{const t=e.inputBuffer.getChannelData(0);if(n&&!n.isClosed){const e=r.encode(t);e&&n.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}},i.connect(o),o.connect(e.destination),this.privMediaResources={scriptProcessorNode:o,source:i,stream:t}};if(this.privSpeechProcessorScript&&e.audioWorklet)e.audioWorklet.addModule(this.privSpeechProcessorScript).then((()=>{const o=new AudioWorkletNode(e,"speech-processor");o.port.onmessage=e=>{const t=e.data;if(n&&!n.isClosed){const e=r.encode(t);e&&n.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}},i.connect(o),o.connect(e.destination),this.privMediaResources={scriptProcessorNode:o,source:i,stream:t}})).catch((()=>{o()}));else try{o()}catch(e){throw new Error(`Unable to start audio worklet node for PCMRecorder: ${e}`)}}releaseMediaResources(e){this.privMediaResources&&(this.privMediaResources.scriptProcessorNode&&(this.privMediaResources.scriptProcessorNode.disconnect(e.destination),this.privMediaResources.scriptProcessorNode=null),this.privMediaResources.source&&(this.privMediaResources.source.disconnect(),this.privStopInputOnRelease&&this.privMediaResources.stream.getTracks().forEach((e=>e.stop())),this.privMediaResources.source=null))}setWorkletUrl(e){this.privSpeechProcessorScript=e}}var ar={};e(ar,"WebsocketConnection",(()=>vr),(e=>vr=e));var sr={};e(sr,"WebsocketMessageAdapter",(()=>mr),(e=>mr=e));h=o("1DJXa");var lr={};e(lr,"CertCheckAgent",(()=>fr),(e=>fr=e));h=o("1DJXa");var cr=o("5U18c"),ur=(h=o("1DJXa"),h=o("1DJXa"),h=o("1DJXa"),h=o("1DJXa"),o("ePtPP")),dr=o("bqBrJ").Buffer,hr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class fr{constructor(e){e&&(this.privProxyInfo=e),fr.privDiskCache||(fr.privDiskCache=new(n(h))("microsoft-cognitiveservices-speech-sdk-cache",{supportBuffer:!0,location:void 0}))}static forceReinitDiskCache(){fr.privDiskCache=void 0,fr.privMemCache={}}GetAgent(e){const t=new(n(h).Agent)(this.CreateConnection);if(void 0!==this.privProxyInfo&&void 0!==this.privProxyInfo.HostName&&this.privProxyInfo.Port>0){t["privProxyInfo"]=this.privProxyInfo}return t}static GetProxyAgent(e){const t={host:e.HostName,port:e.Port};e.UserName?t.headers={"Proxy-Authentication":"Basic "+new dr(`${e.UserName}:${void 0===e.Password?"":e.Password}`).toString("base64")}:t.headers={},t.headers.requestOCSP="true";return new(n(h))(t)}static OCSPCheck(e,t){return hr(this,void 0,void 0,(function*(){let n,r,i=!1;const o=yield e;o.cork();const a=o;return new Promise(((e,s)=>{o.on("OCSPResponse",(e=>{e&&(this.onEvent(new Ie),r=e)})),o.on("error",(e=>{i||(i=!0,o.destroy(),s(e))})),a.on("secure",(()=>hr(this,void 0,void 0,(function*(){const l=a.getPeerCertificate(!0);try{const a=yield this.GetIssuer(l);n=cr.request.generate(l.raw,a.raw);const s=n.id.toString("hex");if(!r){const e=yield fr.GetResponseFromCache(s,n,t);r=e}yield this.VerifyOCSPResponse(r,n,t),o.uncork(),i=!0,e(o)}catch(e){o.destroy(),i=!0,s(e)}}))))}))}))}static GetIssuer(e){return e.issuerCertificate?Promise.resolve(e.issuerCertificate):new Promise(((t,n)=>{new cr.Agent({}).fetchIssuer(e,null,((e,r)=>{e?n(e):t(r)}))}))}static GetResponseFromCache(e,t,n){return hr(this,void 0,void 0,(function*(){let r=fr.privMemCache[e];if(r&&this.onEvent(new xe(e)),!r)try{const t=yield fr.privDiskCache.get(e);t.isCached&&(fr.onEvent(new _e(e)),fr.StoreMemoryCacheEntry(e,t.value),r=t.value)}catch(e){r=null}if(!r)return r;try{const i=cr.utils.parseResponse(r),o=i.value.tbsResponseData;if(o.responses.length<1)return void this.onEvent(new Ne(e,"Not enough data in cached response"));const a=o.responses[0].thisUpdate,s=o.responses[0].nextUpdate;if(s<Date.now()+this.testTimeOffset-6e4)this.onEvent(new ke(e,s)),r=null;else{const r=Math.min(864e5,(s-a)/2);s-(Date.now()+this.testTimeOffset)<r?(this.onEvent(new Re(e,a,s)),this.UpdateCache(t,n).catch((t=>{this.onEvent(new Le(e,t.toString()))}))):this.onEvent(new Oe(e,a,s))}}catch(t){this.onEvent(new Ne(e,t)),r=null}return r||this.onEvent(new Me(e)),r}))}static VerifyOCSPResponse(e,t,n){return hr(this,void 0,void 0,(function*(){let r=e;return r||(r=yield fr.GetOCSPResponse(t,n)),new Promise(((i,o)=>{cr.verify({request:t,response:r},(a=>{a?(fr.onEvent(new Pe(t.id.toString("hex"),a)),e?this.VerifyOCSPResponse(null,t,n).then((()=>{i()}),(e=>{o(e)})):o(a)):(e||fr.StoreCacheEntry(t.id.toString("hex"),r),i())}))}))}))}static UpdateCache(e,t){return hr(this,void 0,void 0,(function*(){const n=e.id.toString("hex");this.onEvent(new Ae(n));const r=yield this.GetOCSPResponse(e,t);this.StoreCacheEntry(n,r),this.onEvent(new Te(e.id.toString("hex")))}))}static StoreCacheEntry(e,t){this.StoreMemoryCacheEntry(e,t),this.StoreDiskCacheEntry(e,t)}static StoreMemoryCacheEntry(e,t){this.privMemCache[e]=t,this.onEvent(new Ee(e))}static StoreDiskCacheEntry(e,t){this.privDiskCache.set(e,t).then((()=>{this.onEvent(new Ce(e))}))}static GetOCSPResponse(e,t){let n={};if(t){const e=fr.GetProxyAgent(t);n.agent=e}return new Promise(((t,r)=>{cr.utils.getAuthorityInfo(e.cert,"1.3.6.1.5.5.7.48.1",((i,o)=>{if(i)return void r(i);const a=new URL(o);n=Object.assign(Object.assign({},n),{host:a.host,protocol:a.protocol,port:a.port,path:a.pathname,hostname:a.host}),cr.utils.getResponse(n,e.data,((n,i)=>{if(n)return void r(n);const o=e.certID;this.onEvent(new Be(o.toString("hex"))),t(i)}))}))}))}static onEvent(e){re.instance.onEvent(e)}CreateConnection(e,t){const n=void 0!==ur&&t.secureEndpoint;let r;if(t=Object.assign(Object.assign({},t),{requestOCSP:!fr.forceDisableOCSPStapling,servername:t.host}),this.privProxyInfo){const n=fr.GetProxyAgent(this.privProxyInfo);r=new Promise(((r,i)=>{n.callback(e,t,((e,t)=>{e?i(e):r(t)}))}))}else r=(t.secureEndpoint,Promise.resolve(h.connect(t)));return n?fr.OCSPCheck(r,this.privProxyInfo):r}}fr.testTimeOffset=0,fr.forceDisableOCSPStapling=!1,fr.privMemCache={};var pr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class mr{constructor(e,t,n,r,i,o){if(!e)throw new Y("uri");if(!n)throw new Y("messageFormatter");this.proxyInfo=r,this.privConnectionEvents=new ne,this.privConnectionId=t,this.privMessageFormatter=n,this.privConnectionState=C.None,this.privUri=e,this.privHeaders=i,this.privEnableCompression=o,this.privHeaders[ze.ConnectionId]=this.privConnectionId,this.privLastErrorReceived=""}get state(){return this.privConnectionState}open(){if(this.privConnectionState===C.Disconnected)return Promise.reject(`Cannot open a connection that is in ${this.privConnectionState} state`);if(this.privConnectionEstablishDeferral)return this.privConnectionEstablishDeferral.promise;this.privConnectionEstablishDeferral=new ie,this.privCertificateValidatedDeferral=new ie,this.privConnectionState=C.Connecting;try{if("undefined"==typeof WebSocket||mr.forceNpmWebSocket){const e={headers:this.privHeaders,perMessageDeflate:this.privEnableCompression};this.privCertificateValidatedDeferral.resolve();const t=new(0,lr.CertCheckAgent)(this.proxyInfo);e.agent=t.GetAgent();let r=new URL(this.privUri).protocol;"wss:"===(null==r?void 0:r.toLocaleLowerCase())?r="https:":"ws:"===(null==r?void 0:r.toLocaleLowerCase())&&(r="http:"),e.agent.protocol=r,this.privWebsocketClient=new(n(h))(this.privUri,e)}else this.privCertificateValidatedDeferral.resolve(),this.privWebsocketClient=new WebSocket(this.privUri);this.privWebsocketClient.binaryType="arraybuffer",this.privReceivingMessageQueue=new(0,ae.Queue),this.privDisconnectDeferral=new ie,this.privSendMessageQueue=new(0,ae.Queue),this.processSendQueue().catch((e=>{re.instance.onEvent(new De(e))}))}catch(e){return this.privConnectionEstablishDeferral.resolve(new te(500,e)),this.privConnectionEstablishDeferral.promise}return this.onEvent(new V(this.privConnectionId,this.privUri)),this.privWebsocketClient.onopen=()=>{this.privCertificateValidatedDeferral.promise.then((()=>{this.privConnectionState=C.Connected,this.onEvent(new W(this.privConnectionId)),this.privConnectionEstablishDeferral.resolve(new te(200,""))}),(e=>{this.privConnectionEstablishDeferral.reject(e)}))},this.privWebsocketClient.onerror=e=>{this.onEvent(new K(this.privConnectionId,e.message,e.type)),this.privLastErrorReceived=e.message},this.privWebsocketClient.onclose=e=>{this.privConnectionState===C.Connecting?(this.privConnectionState=C.Disconnected,this.privConnectionEstablishDeferral.resolve(new te(e.code,e.reason+" "+this.privLastErrorReceived))):(this.privConnectionState=C.Disconnected,this.privWebsocketClient=null,this.onEvent(new q(this.privConnectionId,e.code,e.reason))),this.onClose(e.code,e.reason).catch((e=>{re.instance.onEvent(new De(e))}))},this.privWebsocketClient.onmessage=e=>{const t=(new Date).toISOString();if(this.privConnectionState===C.Connected){const n=new ie;if(this.privReceivingMessageQueue.enqueueFromPromise(n.promise),e.data instanceof ArrayBuffer){const r=new he(A.Binary,e.data);this.privMessageFormatter.toConnectionMessage(r).then((e=>{this.onEvent(new Q(this.privConnectionId,t,e)),n.resolve(e)}),(e=>{n.reject(`Invalid binary message format. Error: ${e}`)}))}else{const r=new he(A.Text,e.data);this.privMessageFormatter.toConnectionMessage(r).then((e=>{this.onEvent(new Q(this.privConnectionId,t,e)),n.resolve(e)}),(e=>{n.reject(`Invalid text message format. Error: ${e}`)}))}}},this.privConnectionEstablishDeferral.promise}send(e){if(this.privConnectionState!==C.Connected)return Promise.reject(`Cannot send on connection that is in ${C[this.privConnectionState]} state`);const t=new ie,n=new ie;return this.privSendMessageQueue.enqueueFromPromise(n.promise),this.privMessageFormatter.fromConnectionMessage(e).then((r=>{n.resolve({Message:e,RawWebsocketMessage:r,sendStatusDeferral:t})}),(e=>{n.reject(`Error formatting the message. ${e}`)})),t.promise}read(){return this.privConnectionState!==C.Connected?Promise.reject(`Cannot read on connection that is in ${this.privConnectionState} state`):this.privReceivingMessageQueue.dequeue()}close(e){return this.privWebsocketClient?(this.privConnectionState!==C.Disconnected&&this.privWebsocketClient.close(1e3,e||"Normal closure by client"),this.privDisconnectDeferral.promise):Promise.resolve()}get events(){return this.privConnectionEvents}sendRawMessage(e){try{return e?(this.onEvent(new X(this.privConnectionId,(new Date).toISOString(),e.Message)),this.isWebsocketOpen?(this.privWebsocketClient.send(e.RawWebsocketMessage.payload),Promise.resolve()):Promise.reject("websocket send error: Websocket not ready "+this.privConnectionId+" "+e.Message.id+" "+(new Error).stack)):Promise.resolve()}catch(e){return Promise.reject(`websocket send error: ${e}`)}}onClose(e,t){return pr(this,void 0,void 0,(function*(){const n=`Connection closed. ${e}: ${t}`;this.privConnectionState=C.Disconnected,this.privDisconnectDeferral.resolve(),yield this.privReceivingMessageQueue.drainAndDispose((()=>{}),n),yield this.privSendMessageQueue.drainAndDispose((e=>{e.sendStatusDeferral.reject(n)}),n)}))}processSendQueue(){return pr(this,void 0,void 0,(function*(){for(;;){const e=this.privSendMessageQueue.dequeue(),t=yield e;if(!t)return;try{yield this.sendRawMessage(t),t.sendStatusDeferral.resolve()}catch(e){t.sendStatusDeferral.reject(e)}}}))}onEvent(e){this.privConnectionEvents.onEvent(e),re.instance.onEvent(e)}get isWebsocketOpen(){return this.privWebsocketClient&&this.privWebsocketClient.readyState===this.privWebsocketClient.OPEN}}mr.forceNpmWebSocket=!1;var gr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class vr{constructor(e,t,n,r,i,o=!1,a){if(this.privIsDisposed=!1,!e)throw new Y("uri");if(!r)throw new Y("messageFormatter");this.privMessageFormatter=r;let s="",l=0;if(t)for(const n in t)if(n){s+=0===l&&-1===e.indexOf("?")?"?":"&";s+=`${n}=${encodeURIComponent(t[n])}`,l++}if(n)for(const t in n)if(t){s+=0===l&&-1===e.indexOf("?")?"?":"&";s+=`${t}=${encodeURIComponent(n[t])}`,l++}this.privUri=e+s,this.privId=a||x(),this.privConnectionMessageAdapter=new(0,sr.WebsocketMessageAdapter)(this.privUri,this.id,this.privMessageFormatter,i,n,o)}dispose(){return gr(this,void 0,void 0,(function*(){this.privIsDisposed=!0,this.privConnectionMessageAdapter&&(yield this.privConnectionMessageAdapter.close())}))}isDisposed(){return this.privIsDisposed}get id(){return this.privId}state(){return this.privConnectionMessageAdapter.state}open(){return this.privConnectionMessageAdapter.open()}send(e){return this.privConnectionMessageAdapter.send(e)}read(){return this.privConnectionMessageAdapter.read()}get events(){return this.privConnectionMessageAdapter.events}}class br{constructor(e,t){this.privBuffers=[],this.privReplayOffset=0,this.privLastShrinkOffset=0,this.privBufferStartOffset=0,this.privBufferSerial=0,this.privBufferedBytes=0,this.privReplay=!1,this.privLastChunkAcquiredTime=0,this.privAudioNode=e,this.privBytesPerSecond=t}id(){return this.privAudioNode.id()}read(){if(this.privReplay&&0!==this.privBuffers.length){const e=this.privReplayOffset-this.privBufferStartOffset;let t=Math.round(e*this.privBytesPerSecond*1e-7);0!=t%2&&t++;let n=0;for(;n<this.privBuffers.length&&t>=this.privBuffers[n].chunk.buffer.byteLength;)t-=this.privBuffers[n++].chunk.buffer.byteLength;if(n<this.privBuffers.length){const e=this.privBuffers[n].chunk.buffer.slice(t);return this.privReplayOffset+=e.byteLength/this.privBytesPerSecond*1e7,n===this.privBuffers.length-1&&(this.privReplay=!1),Promise.resolve({buffer:e,isEnd:!1,timeReceived:this.privBuffers[n].chunk.timeReceived})}}return this.privAudioNode.read().then((e=>(e&&e.buffer&&(this.privBuffers.push(new yr(e,this.privBufferSerial++,this.privBufferedBytes)),this.privBufferedBytes+=e.buffer.byteLength),e)))}detach(){return this.privBuffers=void 0,this.privAudioNode.detach()}replay(){this.privBuffers&&0!==this.privBuffers.length&&(this.privReplay=!0,this.privReplayOffset=this.privLastShrinkOffset)}shrinkBuffers(e){if(void 0===this.privBuffers||0===this.privBuffers.length)return;this.privLastShrinkOffset=e;const t=e-this.privBufferStartOffset;let n=Math.round(t*this.privBytesPerSecond*1e-7),r=0;for(;r<this.privBuffers.length&&n>=this.privBuffers[r].chunk.buffer.byteLength;)n-=this.privBuffers[r++].chunk.buffer.byteLength;this.privBufferStartOffset=Math.round(e-n/this.privBytesPerSecond*1e7),this.privBuffers=this.privBuffers.slice(r)}findTimeAtOffset(e){if(e<this.privBufferStartOffset||void 0===this.privBuffers)return 0;for(const t of this.privBuffers){const n=t.byteOffset/this.privBytesPerSecond*1e7,r=n+t.chunk.buffer.byteLength/this.privBytesPerSecond*1e7;if(e>=n&&e<=r)return t.chunk.timeReceived}return 0}}class yr{constructor(e,t,n){this.chunk=e,this.serial=t,this.byteOffset=n}}class wr{constructor(e,t,n,r){this.privProxyHostName=e,this.privProxyPort=t,this.privProxyUserName=n,this.privProxyPassword=r}static fromParameters(e){return new wr(e.getProperty(Qe.SpeechServiceConnection_ProxyHostName),parseInt(e.getProperty(Qe.SpeechServiceConnection_ProxyPort),10),e.getProperty(Qe.SpeechServiceConnection_ProxyUserName),e.getProperty(Qe.SpeechServiceConnection_ProxyPassword))}static fromRecognizerConfig(e){return this.fromParameters(e.parameters)}get HostName(){return this.privProxyHostName}get Port(){return this.privProxyPort}get UserName(){return this.privProxyUserName}get Password(){return this.privProxyPassword}}var Sr={};e(Sr,"RestRequestType",(()=>Er),(e=>Er=e)),e(Sr,"RestMessageAdapter",(()=>Ir),(e=>Ir=e));var xr,Mr;const _r=new Set(["json","buffer","string"]);Mr=e=>(...t)=>{const n=new Set;let r,i,o,a="";return t.forEach((e=>{if("string"==typeof e)if(e.toUpperCase()===e){if(r){throw new Error(`Can't set method to ${e}, already set to ${r}.`)}r=e}else if(e.startsWith("http:")||e.startsWith("https:"))a=e;else{if(!_r.has(e))throw new Error(`Unknown encoding, ${e}`);i=e}else if("number"==typeof e)n.add(e);else{if("object"!=typeof e)throw new Error("Unknown type: "+typeof e);if(Array.isArray(e)||e instanceof Set)e.forEach((e=>n.add(e)));else{if(o)throw new Error("Cannot set headers twice.");o=e}}})),r||(r="GET"),0===n.size&&n.add(200),e(n,r,i,o,a)};class Ar extends Error{constructor(e,...t){let n;super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,Ar),this.name="StatusError",this.message=e.statusMessage,this.statusCode=e.status,this.res=e,this.json=e.json.bind(e),this.text=e.text.bind(e),this.arrayBuffer=e.arrayBuffer.bind(e);Object.defineProperty(this,"responseBody",{get:()=>(n||(n=this.arrayBuffer()),n)}),this.headers={};for(const[t,n]of e.headers.entries())this.headers[t.toLowerCase()]=n}}xr=Mr(((e,t,n,r,i)=>async(o,a,s={})=>{o=i+(o||"");let l=new URL(o);if(r||(r={}),l.username&&(r.Authorization="Basic "+btoa(l.username+":"+l.password),l=new URL(l.protocol+"//"+l.host+l.pathname+l.search)),"https:"!==l.protocol&&"http:"!==l.protocol)throw new Error(`Unknown protocol, ${l.protocol}`);if(a)if(a instanceof ArrayBuffer||ArrayBuffer.isView(a)||"string"==typeof a);else{if("object"!=typeof a)throw new Error("Unknown body type.");a=JSON.stringify(a),r["Content-Type"]="application/json"}s=new Headers({...r||{},...s});const c=await fetch(l,{method:t,headers:s,body:a});if(c.statusCode=c.status,!e.has(c.status))throw new Ar(c);return"json"===n?c.json():"buffer"===n?c.arrayBuffer():"string"===n?c.text():c}));var Er,Cr,Tr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};(Cr=Er||(Er={})).Get="GET",Cr.Post="POST",Cr.Delete="DELETE",Cr.File="file";class Ir{constructor(e){if(!e)throw new Y("configParams");this.privHeaders=e.headers,this.privIgnoreCache=e.ignoreCache}static extractHeaderValue(e,t){let n="";try{const r=t.trim().split(/[\r\n]+/),i={};r.forEach((e=>{const t=e.split(": "),n=t.shift().toLowerCase(),r=t.join(": ");i[n]=r})),n=i[e.toLowerCase()]}catch(e){}return n}set options(e){this.privHeaders=e.headers,this.privIgnoreCache=e.ignoreCache}setHeaders(e,t){this.privHeaders[e]=t}request(e,t,r={},i=null,o=null){const a=new ie,s=e===Er.File?"POST":e,l=(e,t={})=>{const n=e;return{data:JSON.stringify(t),headers:JSON.stringify(e.headers),json:t,ok:e.statusCode>=200&&e.statusCode<300,status:e.statusCode,statusText:t.error?t.error.message:n.statusText?n.statusText:n.statusMessage}},c=i=>{n(xr)(t,s,this.privHeaders,200,201,202,204,400,401,402,403,404)(""===this.queryParams(r)?"":`?${this.queryParams(r)}`,i).then((t=>Tr(this,void 0,void 0,(function*(){if(e===Er.Delete||204===t.statusCode)a.resolve(l(t));else try{const e=yield t.json();a.resolve(l(t,e))}catch(e){a.resolve(l(t))}})))).catch((e=>{a.reject(e)}))};if(this.privIgnoreCache&&(this.privHeaders["Cache-Control"]="no-cache"),e===Er.File&&o){const e="multipart/form-data";this.privHeaders["content-type"]=e,this.privHeaders["Content-Type"]=e,"undefined"!=typeof Blob&&o instanceof Blob?(e=>{const t=new FileReader;return t.readAsArrayBuffer(e),new Promise((e=>{t.onloadend=()=>{e(t.result)}}))})(o).then((e=>{c(e)})).catch((e=>{a.reject(e)})):c(o)}else e===Er.Post&&i&&(this.privHeaders["content-type"]="application/json",this.privHeaders["Content-Type"]="application/json"),c(i);return a.promise}withQuery(e,t={}){const n=this.queryParams(t);return n?e+(-1===e.indexOf("?")?"?":"&")+n:e}queryParams(e={}){return Object.keys(e).map((t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t]))).join("&")}}class kr{static get requestOptions(){return kr.privDefaultRequestOptions}static get configParams(){return kr.privDefaultParams}static get restErrors(){return kr.privRestErrors}}kr.privDefaultRequestOptions={headers:{Accept:"application/json"},ignoreCache:!1,timeout:1e4},kr.privRestErrors={authInvalidSubscriptionKey:"You must specify either an authentication token to use, or a Cognitive Speech subscription key.",authInvalidSubscriptionRegion:"You must specify the Cognitive Speech region to use.",invalidArgs:"Required input not found: {arg}.",invalidCreateJoinConversationResponse:"Creating/Joining conversation failed with HTTP {status}.",invalidParticipantRequest:"The requested participant was not found.",permissionDeniedConnect:"Required credentials not found.",permissionDeniedConversation:"Invalid operation: only the host can {command} the conversation.",permissionDeniedParticipant:"Invalid operation: only the host can {command} a participant.",permissionDeniedSend:"Invalid operation: the conversation is not in a connected state.",permissionDeniedStart:"Invalid operation: there is already an active conversation."},kr.privDefaultParams={apiVersion:"api-version",authorization:"Authorization",clientAppId:"X-ClientAppId",contentTypeKey:"Content-Type",correlationId:"X-CorrelationId",languageCode:"language",nickname:"nickname",profanity:"profanity",requestId:"X-RequestId",roomId:"roomid",sessionToken:"token",subscriptionKey:"Ocp-Apim-Subscription-Key",subscriptionRegion:"Ocp-Apim-Subscription-Region",token:"X-CapitoToken"};var Rr={};e(Rr,"AudioInputStream",(()=>Nr),(e=>Nr=e)),e(Rr,"PullAudioInputStreamImpl",(()=>Ur),(e=>Ur=e));var Or=o("bqBrJ").Buffer,Pr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Nr{constructor(){}static createPushStream(e){return Br.create(e)}static createPullStream(e,t){return Dr.create(e,t)}}class Br extends Nr{static create(e){return new Lr(e)}}class Lr extends Br{constructor(e){super(),this.privFormat=void 0===e?un.getDefaultInputFormat():e,this.privEvents=new ne,this.privId=x(),this.privStream=new ye(this.privFormat.avgBytesPerSec/10)}get format(){return Promise.resolve(this.privFormat)}write(e){this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}id(){return this.privId}get blob(){return this.attach("id").then((e=>{const t=[];let n=Or.from("");const r=()=>e.read().then((e=>!e||e.isEnd?"undefined"!=typeof XMLHttpRequest&&"undefined"!=typeof Blob?Promise.resolve(new Blob(t)):Promise.resolve(Or.from(n)):("undefined"!=typeof Blob?t.push(e.buffer):n=Or.concat([n,this.toBuffer(e.buffer)]),r())));return r()}))}turnOn(){this.onEvent(new P(this.privId)),this.onEvent(new N(this.privId))}attach(e){return Pr(this,void 0,void 0,(function*(){this.onEvent(new U(this.privId,e)),yield this.turnOn();const t=this.privStream;return this.onEvent(new F(this.privId,e)),{detach:()=>Pr(this,void 0,void 0,(function*(){return this.onEvent(new z(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()}}))}detach(e){this.onEvent(new z(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:ot.Unknown,manufacturer:"Speech SDK",model:"PushStream",samplerate:this.privFormat.samplesPerSec,type:st.Stream})}onEvent(e){this.privEvents.onEvent(e),re.instance.onEvent(e)}toBuffer(e){const t=Or.alloc(e.byteLength),n=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=n[e];return t}}class Dr extends Nr{constructor(){super()}static create(e,t){return new Ur(e,t)}}class Ur extends Dr{constructor(e,t){super(),this.privFormat=void 0===t?cn.getDefaultInputFormat():t,this.privEvents=new ne,this.privId=x(),this.privCallback=e,this.privIsClosed=!1,this.privBufferSize=this.privFormat.avgBytesPerSec/10}get format(){return Promise.resolve(this.privFormat)}close(){this.privIsClosed=!0,this.privCallback.close()}id(){return this.privId}get blob(){return Promise.reject("Not implemented")}turnOn(){this.onEvent(new P(this.privId)),this.onEvent(new N(this.privId))}attach(e){return Pr(this,void 0,void 0,(function*(){return this.onEvent(new U(this.privId,e)),yield this.turnOn(),this.onEvent(new F(this.privId,e)),{detach:()=>(this.privCallback.close(),this.onEvent(new z(this.privId,e)),this.turnOff()),id:()=>e,read:()=>{let e,t=0;for(;t<this.privBufferSize;){const n=new ArrayBuffer(this.privBufferSize-t),r=this.privCallback.read(n);if(void 0===e)e=n;else{new Int8Array(e).set(new Int8Array(n),t)}if(0===r)break;t+=r}return Promise.resolve({buffer:e.slice(0,t),isEnd:this.privIsClosed||0===t,timeReceived:Date.now()})}}}))}detach(e){this.onEvent(new z(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:ot.Unknown,manufacturer:"Speech SDK",model:"PullStream",samplerate:this.privFormat.samplesPerSec,type:st.Stream})}onEvent(e){this.privEvents.onEvent(e),re.instance.onEvent(e)}}class Fr{}class zr{}var jr={};e(jr,"SpeakerAudioDestination",(()=>Vr),(e=>Vr=e));var Hr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const Gr={[en.PCM]:"audio/wav",[en.MuLaw]:"audio/x-wav",[en.MP3]:"audio/mpeg",[en.OGG_OPUS]:"audio/ogg",[en.WEBM_OPUS]:"audio/webm; codecs=opus",[en.ALaw]:"audio/x-wav",[en.FLAC]:"audio/flac"};class Vr{constructor(e){this.privPlaybackStarted=!1,this.privAppendingToBuffer=!1,this.privMediaSourceOpened=!1,this.privBytesReceived=0,this.privId=e||x(),this.privIsPaused=!1,this.privIsClosed=!1}id(){return this.privId}write(e,t,n){void 0!==this.privAudioBuffer?(this.privAudioBuffer.push(e),this.updateSourceBuffer().then((()=>{t&&t()}),(e=>{n&&n(e)}))):void 0!==this.privAudioOutputStream&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength)}close(e,t){if(this.privIsClosed=!0,void 0!==this.privSourceBuffer)this.handleSourceBufferUpdateEnd().then((()=>{e&&e()}),(e=>{t&&t(e)}));else if(void 0!==this.privAudioOutputStream&&"undefined"!=typeof window)if(this.privFormat.formatTag!==en.PCM&&this.privFormat.formatTag!==en.MuLaw&&this.privFormat.formatTag!==en.ALaw||!1!==this.privFormat.hasHeader){let n=new ArrayBuffer(this.privBytesReceived);this.privAudioOutputStream.read(n).then((()=>{n=Tn.SynthesisAdapterBase.addHeader(n,this.privFormat);const r=new Blob([n],{type:Gr[this.privFormat.formatTag]});this.privAudio.src=window.URL.createObjectURL(r),this.notifyPlayback().then((()=>{e&&e()}),(e=>{t&&t(e)}))}),(e=>{t&&t(e)}))}else console.warn("Play back is not supported for raw PCM, mulaw or alaw format without header."),this.onAudioEnd&&this.onAudioEnd(this);else this.onAudioEnd&&this.onAudioEnd(this)}set format(e){if("undefined"!=typeof AudioContext||"undefined"!=typeof window&&void 0!==window.webkitAudioContext){this.privFormat=e;const t=Gr[this.privFormat.formatTag];void 0===t?console.warn(`Unknown mimeType for format ${en[this.privFormat.formatTag]}; playback is not supported.`):"undefined"!=typeof MediaSource&&MediaSource.isTypeSupported(t)?(this.privAudio=new Audio,this.privAudioBuffer=[],this.privMediaSource=new MediaSource,this.privAudio.src=URL.createObjectURL(this.privMediaSource),this.privAudio.load(),this.privMediaSource.onsourceopen=()=>{this.privMediaSourceOpened=!0,this.privMediaSource.duration=1800,this.privSourceBuffer=this.privMediaSource.addSourceBuffer(t),this.privSourceBuffer.onupdate=()=>{this.updateSourceBuffer().catch((e=>{re.instance.onEvent(new De(e))}))},this.privSourceBuffer.onupdateend=()=>{this.handleSourceBufferUpdateEnd().catch((e=>{re.instance.onEvent(new De(e))}))},this.privSourceBuffer.onupdatestart=()=>{this.privAppendingToBuffer=!1}},this.updateSourceBuffer().catch((e=>{re.instance.onEvent(new De(e))}))):(console.warn(`Format ${en[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`),this.privAudioOutputStream=new(0,pn.PullAudioOutputStreamImpl),this.privAudioOutputStream.format=this.privFormat,this.privAudio=new Audio)}}get volume(){var e,t;return null!==(t=null===(e=this.privAudio)||void 0===e?void 0:e.volume)&&void 0!==t?t:-1}set volume(e){this.privAudio&&(this.privAudio.volume=e)}mute(){this.privAudio&&(this.privAudio.muted=!0)}unmute(){this.privAudio&&(this.privAudio.muted=!1)}get isClosed(){return this.privIsClosed}get currentTime(){return void 0!==this.privAudio?this.privAudio.currentTime:-1}pause(){this.privIsPaused||void 0===this.privAudio||(this.privAudio.pause(),this.privIsPaused=!0)}resume(e,t){this.privIsPaused&&void 0!==this.privAudio&&(this.privAudio.play().then((()=>{e&&e()}),(e=>{t&&t(e)})),this.privIsPaused=!1)}get internalAudio(){return this.privAudio}updateSourceBuffer(){return Hr(this,void 0,void 0,(function*(){if(void 0!==this.privAudioBuffer&&this.privAudioBuffer.length>0&&this.sourceBufferAvailable()){this.privAppendingToBuffer=!0;const e=this.privAudioBuffer.shift();try{this.privSourceBuffer.appendBuffer(e)}catch(t){return this.privAudioBuffer.unshift(e),void console.log("buffer filled, pausing addition of binaries until space is made")}yield this.notifyPlayback()}else this.canEndStream()&&(yield this.handleSourceBufferUpdateEnd())}))}handleSourceBufferUpdateEnd(){return Hr(this,void 0,void 0,(function*(){this.canEndStream()&&this.sourceBufferAvailable()&&(this.privMediaSource.endOfStream(),yield this.notifyPlayback())}))}notifyPlayback(){return Hr(this,void 0,void 0,(function*(){this.privPlaybackStarted||void 0===this.privAudio||(this.privPlaybackStarted=!0,this.onAudioStart&&this.onAudioStart(this),this.privAudio.onended=()=>{this.onAudioEnd&&this.onAudioEnd(this)},this.privIsPaused||(yield this.privAudio.play()))}))}canEndStream(){return this.isClosed&&void 0!==this.privSourceBuffer&&0===this.privAudioBuffer.length&&this.privMediaSourceOpened&&!this.privAppendingToBuffer&&"open"===this.privMediaSource.readyState}sourceBufferAvailable(){return void 0!==this.privSourceBuffer&&!this.privSourceBuffer.updating}}h=o("1DJXa");class Wr{constructor(e){Ue.throwIfNullOrUndefined(h.openSync,"\nFile System access not available, please use Push or PullAudioOutputStream"),this.privFd=h.openSync(e,"w")}set format(e){Ue.throwIfNotUndefined(this.privAudioFormat,"format is already set"),this.privAudioFormat=e;let t=0;this.privAudioFormat.hasHeader&&(t=this.privAudioFormat.header.byteLength),void 0!==this.privFd&&(this.privWriteStream=h.createWriteStream("",{fd:this.privFd,start:t,autoClose:!1}))}write(e){Ue.throwIfNullOrUndefined(this.privAudioFormat,"must set format before writing."),void 0!==this.privWriteStream&&this.privWriteStream.write(new Uint8Array(e.slice(0)))}close(){void 0!==this.privFd&&(this.privWriteStream.on("finish",(()=>{this.privAudioFormat.hasHeader&&(this.privAudioFormat.updateHeader(this.privWriteStream.bytesWritten),h.writeSync(this.privFd,new Int8Array(this.privAudioFormat.header),0,this.privAudioFormat.header.byteLength,0)),h.closeSync(this.privFd),this.privFd=void 0})),this.privWriteStream.end())}id(){return this.privId}}class qr{static fromDefaultMicrophoneInput(){const e=new or(!0);return new Kr(new(0,Fe.MicAudioSource)(e))}static fromMicrophoneInput(e){const t=new or(!0);return new Kr(new(0,Fe.MicAudioSource)(t,e))}static fromWavFileInput(e,t="unnamedBuffer.wav"){return new Kr(new(0,nr.FileAudioSource)(e,t))}static fromStreamInput(e){if(e instanceof Fr)return new Kr(new(0,Rr.PullAudioInputStreamImpl)(e));if(e instanceof Rr.AudioInputStream)return new Kr(e);if("undefined"!=typeof MediaStream&&e instanceof MediaStream){const t=new or(!1);return new Kr(new(0,Fe.MicAudioSource)(t,null,null,e))}throw new Error("Not Supported Type")}static fromDefaultSpeakerOutput(){return new Jr(new(0,jr.SpeakerAudioDestination))}static fromSpeakerOutput(e){if(void 0===e)return qr.fromDefaultSpeakerOutput();if(e instanceof jr.SpeakerAudioDestination)return new Jr(e);throw new Error("Not Supported Type")}static fromAudioFileOutput(e){return new Jr(new Wr(e))}static fromStreamOutput(e){if(e instanceof zr)return new Jr(new(0,pn.PushAudioOutputStreamImpl)(e));if(e instanceof pn.PushAudioOutputStream)return new Jr(e);if(e instanceof pn.PullAudioOutputStream)return new Jr(e);throw new Error("Not Supported Type")}}class Kr extends qr{constructor(e){super(),this.privSource=e}get format(){return this.privSource.format}close(e,t){this.privSource.turnOff().then((()=>{e&&e()}),(e=>{t&&t(e)}))}id(){return this.privSource.id()}get blob(){return this.privSource.blob}turnOn(){return this.privSource.turnOn()}attach(e){return this.privSource.attach(e)}detach(e){return this.privSource.detach(e)}turnOff(){return this.privSource.turnOff()}get events(){return this.privSource.events}setProperty(e,t){if(Ue.throwIfNull(t,"value"),void 0===this.privSource.setProperty)throw new Error("This AudioConfig instance does not support setting properties.");this.privSource.setProperty(e,t)}getProperty(e,t){if(void 0!==this.privSource.getProperty)return this.privSource.getProperty(e,t);throw new Error("This AudioConfig instance does not support getting properties.")}get deviceInfo(){return this.privSource.deviceInfo}}class Jr extends qr{constructor(e){super(),this.privDestination=e}set format(e){this.privDestination.format=e}write(e){this.privDestination.write(e)}close(){this.privDestination.close()}id(){return this.privDestination.id()}setProperty(){throw new Error("This AudioConfig instance does not support setting properties.")}getProperty(){throw new Error("This AudioConfig instance does not support getting properties.")}}var Qr={};e(Qr,"SpeechRecognizer",(()=>ei),(e=>ei=e));var Xr={};e(Xr,"Recognizer",(()=>Zr),(e=>Zr=e));var Yr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Zr{constructor(e,t,n){this.audioConfig=void 0!==e?e:qr.fromDefaultMicrophoneInput(),this.privDisposed=!1,this.privProperties=t.clone(),this.privConnectionFactory=n,this.implCommonRecognizerSetup()}close(e,t){Ue.throwIfDisposed(this.privDisposed),oe(this.dispose(!0),e,t)}get internalData(){return this.privReco}dispose(e){return Yr(this,void 0,void 0,(function*(){this.privDisposed||(this.privDisposed=!0,e&&this.privReco&&(yield this.privReco.audioSource.turnOff(),yield this.privReco.dispose()))}))}static get telemetryEnabled(){return Ye.ServiceRecognizerBase.telemetryDataEnabled}static enableTelemetry(e){Ye.ServiceRecognizerBase.telemetryDataEnabled=e}implCommonRecognizerSetup(){let e="undefined"!=typeof window?"Browser":"Node",t="unknown",n="unknown";"undefined"!=typeof navigator&&(e=e+"/"+navigator.platform,t=navigator.userAgent,n=navigator.appVersion);const r=this.createRecognizerConfig(new ht(new ft(new mt(e,t,n))));this.privReco=this.createServiceRecognizer(Zr.getAuthFromProperties(this.privProperties),this.privConnectionFactory,this.audioConfig,r)}recognizeOnceAsyncImpl(e){return Yr(this,void 0,void 0,(function*(){Ue.throwIfDisposed(this.privDisposed);const t=new ie;yield this.implRecognizerStop(),yield this.privReco.recognize(e,t.resolve,t.reject);const n=yield t.promise;return yield this.implRecognizerStop(),n}))}startContinuousRecognitionAsyncImpl(e){return Yr(this,void 0,void 0,(function*(){Ue.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop(),yield this.privReco.recognize(e,void 0,void 0)}))}stopContinuousRecognitionAsyncImpl(){return Yr(this,void 0,void 0,(function*(){Ue.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop()}))}implRecognizerStop(){return Yr(this,void 0,void 0,(function*(){this.privReco&&(yield this.privReco.stopRecognizing())}))}static getAuthFromProperties(e){const t=e.getProperty(Qe.SpeechServiceConnection_Key,void 0);return t&&""!==t?new He(t):new Ve((()=>{const t=e.getProperty(Qe.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}),(()=>{const t=e.getProperty(Qe.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}))}}var $r=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class ei extends Xr.Recognizer{constructor(e,t){const n=e;Ue.throwIfNull(n,"speechConfig"),Ue.throwIfNullOrWhitespace(n.properties.getProperty(Qe.SpeechServiceConnection_RecoLanguage),Qe[Qe.SpeechServiceConnection_RecoLanguage]),super(t,n.properties,new Ct),this.privDisposedRecognizer=!1}static FromConfig(e,t,n){const r=e;t.properties.mergeTo(r.properties);return new ei(e,n)}get endpointId(){return Ue.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(Qe.SpeechServiceConnection_EndpointId,"00000000-0000-0000-0000-000000000000")}get authorizationToken(){return this.properties.getProperty(Qe.SpeechServiceAuthorization_Token)}set authorizationToken(e){Ue.throwIfNullOrWhitespace(e,"token"),this.properties.setProperty(Qe.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return Ue.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(Qe.SpeechServiceConnection_RecoLanguage)}get outputFormat(){return Ue.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(Xn,vt[vt.Simple])===vt[vt.Simple]?vt.Simple:vt.Detailed}get properties(){return this.privProperties}recognizeOnceAsync(e,t){oe(this.recognizeOnceAsyncImpl(tt.Interactive),e,t)}startContinuousRecognitionAsync(e,t){oe(this.startContinuousRecognitionAsyncImpl(tt.Conversation),e,t)}stopContinuousRecognitionAsync(e,t){oe(this.stopContinuousRecognitionAsyncImpl(),e,t)}startKeywordRecognitionAsync(e,t,n){Ue.throwIfNull(e,"model"),n&&n("Not yet implemented.")}stopKeywordRecognitionAsync(e){e&&e()}close(e,t){Ue.throwIfDisposed(this.privDisposedRecognizer),oe(this.dispose(!0),e,t)}dispose(e){const t=Object.create(null,{dispose:{get:()=>super.dispose}});return $r(this,void 0,void 0,(function*(){this.privDisposedRecognizer||(e&&(this.privDisposedRecognizer=!0,yield this.implRecognizerStop()),yield t.dispose.call(this,e))}))}createRecognizerConfig(e){return new dt(e,this.properties)}createServiceRecognizer(e,t,n,r){return new(0,Bt.SpeechServiceRecognizer)(e,t,n,r,this)}}var ti,ni,ri,ii,oi={};e(oi,"SpeechSynthesizer",(()=>ci),(e=>ci=e)),(ni=ti||(ti={}))[ni.Unknown=0]="Unknown",ni[ni.Female=1]="Female",ni[ni.Male=2]="Male",(ii=ri||(ri={}))[ii.OnlineNeural=1]="OnlineNeural",ii[ii.OnlineStandard=2]="OnlineStandard",ii[ii.OfflineNeural=3]="OfflineNeural",ii[ii.OfflineStandard=4]="OfflineStandard";class ai{constructor(e){if(this.privStyleList=[],this.privVoicePath="",e&&(this.privName=e.Name,this.privLocale=e.Locale,this.privShortName=e.ShortName,this.privLocalName=e.LocalName,this.privVoiceType=e.VoiceType.endsWith("Standard")?ri.OnlineStandard:ri.OnlineNeural,this.privGender="Male"===e.Gender?ti.Male:"Female"===e.Gender?ti.Female:ti.Unknown,e.StyleList&&Array.isArray(e.StyleList)))for(const t of e.StyleList)this.privStyleList.push(t)}get name(){return this.privName}get locale(){return this.privLocale}get shortName(){return this.privShortName}get localName(){return this.privLocalName}get gender(){return this.privGender}get voiceType(){return this.privVoiceType}get styleList(){return this.privStyleList}get voicePath(){return this.privVoicePath}}class si extends Rn{constructor(e,t,n){if(Array.isArray(t)){super(e,yt.VoicesListRetrieved,void 0,new kt),this.privVoices=[];for(const e of t)this.privVoices.push(new ai(e))}else super(e,yt.Canceled,n||"Error information unavailable",new kt)}get voices(){return this.privVoices}}var li=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class ci{constructor(e,t){const n=e;Ue.throwIfNull(n,"speechConfig"),null!==t&&(this.audioConfig=void 0===t?"undefined"==typeof window?void 0:qr.fromDefaultSpeakerOutput():t),this.privProperties=n.properties.clone(),this.privDisposed=!1,this.privSynthesizing=!1,this.privConnectionFactory=new Tt,this.synthesisRequestQueue=new(0,ae.Queue),this.implCommonSynthesizeSetup()}get authorizationToken(){return this.properties.getProperty(Qe.SpeechServiceAuthorization_Token)}set authorizationToken(e){Ue.throwIfNullOrWhitespace(e,"token"),this.properties.setProperty(Qe.SpeechServiceAuthorization_Token,e)}get properties(){return this.privProperties}get autoDetectSourceLanguage(){return"OpenRange"===this.properties.getProperty(Qe.SpeechServiceConnection_AutoDetectSourceLanguages)}static FromConfig(e,t,n){const r=e;return t.properties.mergeTo(r.properties),new ci(e,n)}buildSsml(e){const t={"af-ZA":"af-ZA-AdriNeural","am-ET":"am-ET-AmehaNeural","ar-AE":"ar-AE-FatimaNeural","ar-BH":"ar-BH-AliNeural","ar-DZ":"ar-DZ-AminaNeural","ar-EG":"ar-EG-SalmaNeural","ar-IQ":"ar-IQ-BasselNeural","ar-JO":"ar-JO-SanaNeural","ar-KW":"ar-KW-FahedNeural","ar-LY":"ar-LY-ImanNeural","ar-MA":"ar-MA-JamalNeural","ar-QA":"ar-QA-AmalNeural","ar-SA":"ar-SA-HamedNeural","ar-SY":"ar-SY-AmanyNeural","ar-TN":"ar-TN-HediNeural","ar-YE":"ar-YE-MaryamNeural","bg-BG":"bg-BG-BorislavNeural","bn-BD":"bn-BD-NabanitaNeural","bn-IN":"bn-IN-BashkarNeural","ca-ES":"ca-ES-JoanaNeural","cs-CZ":"cs-CZ-AntoninNeural","cy-GB":"cy-GB-AledNeural","da-DK":"da-DK-ChristelNeural","de-AT":"de-AT-IngridNeural","de-CH":"de-CH-JanNeural","de-DE":"de-DE-KatjaNeural","el-GR":"el-GR-AthinaNeural","en-AU":"en-AU-NatashaNeural","en-CA":"en-CA-ClaraNeural","en-GB":"en-GB-LibbyNeural","en-HK":"en-HK-SamNeural","en-IE":"en-IE-ConnorNeural","en-IN":"en-IN-NeerjaNeural","en-KE":"en-KE-AsiliaNeural","en-NG":"en-NG-AbeoNeural","en-NZ":"en-NZ-MitchellNeural","en-PH":"en-PH-JamesNeural","en-SG":"en-SG-LunaNeural","en-TZ":"en-TZ-ElimuNeural","en-US":"en-US-JennyNeural","en-ZA":"en-ZA-LeahNeural","es-AR":"es-AR-ElenaNeural","es-BO":"es-BO-MarceloNeural","es-CL":"es-CL-CatalinaNeural","es-CO":"es-CO-GonzaloNeural","es-CR":"es-CR-JuanNeural","es-CU":"es-CU-BelkysNeural","es-DO":"es-DO-EmilioNeural","es-EC":"es-EC-AndreaNeural","es-ES":"es-ES-AlvaroNeural","es-GQ":"es-GQ-JavierNeural","es-GT":"es-GT-AndresNeural","es-HN":"es-HN-CarlosNeural","es-MX":"es-MX-DaliaNeural","es-NI":"es-NI-FedericoNeural","es-PA":"es-PA-MargaritaNeural","es-PE":"es-PE-AlexNeural","es-PR":"es-PR-KarinaNeural","es-PY":"es-PY-MarioNeural","es-SV":"es-SV-LorenaNeural","es-US":"es-US-AlonsoNeural","es-UY":"es-UY-MateoNeural","es-VE":"es-VE-PaolaNeural","et-EE":"et-EE-AnuNeural","fa-IR":"fa-IR-DilaraNeural","fi-FI":"fi-FI-SelmaNeural","fil-PH":"fil-PH-AngeloNeural","fr-BE":"fr-BE-CharlineNeural","fr-CA":"fr-CA-SylvieNeural","fr-CH":"fr-CH-ArianeNeural","fr-FR":"fr-FR-DeniseNeural","ga-IE":"ga-IE-ColmNeural","gl-ES":"gl-ES-RoiNeural","gu-IN":"gu-IN-DhwaniNeural","he-IL":"he-IL-AvriNeural","hi-IN":"hi-IN-MadhurNeural","hr-HR":"hr-HR-GabrijelaNeural","hu-HU":"hu-HU-NoemiNeural","id-ID":"id-ID-ArdiNeural","is-IS":"is-IS-GudrunNeural","it-IT":"it-IT-IsabellaNeural","ja-JP":"ja-JP-NanamiNeural","jv-ID":"jv-ID-DimasNeural","kk-KZ":"kk-KZ-AigulNeural","km-KH":"km-KH-PisethNeural","kn-IN":"kn-IN-GaganNeural","ko-KR":"ko-KR-SunHiNeural","lo-LA":"lo-LA-ChanthavongNeural","lt-LT":"lt-LT-LeonasNeural","lv-LV":"lv-LV-EveritaNeural","mk-MK":"mk-MK-AleksandarNeural","ml-IN":"ml-IN-MidhunNeural","mr-IN":"mr-IN-AarohiNeural","ms-MY":"ms-MY-OsmanNeural","mt-MT":"mt-MT-GraceNeural","my-MM":"my-MM-NilarNeural","nb-NO":"nb-NO-PernilleNeural","nl-BE":"nl-BE-ArnaudNeural","nl-NL":"nl-NL-ColetteNeural","pl-PL":"pl-PL-AgnieszkaNeural","ps-AF":"ps-AF-GulNawazNeural","pt-BR":"pt-BR-FranciscaNeural","pt-PT":"pt-PT-DuarteNeural","ro-RO":"ro-RO-AlinaNeural","ru-RU":"ru-RU-SvetlanaNeural","si-LK":"si-LK-SameeraNeural","sk-SK":"sk-SK-LukasNeural","sl-SI":"sl-SI-PetraNeural","so-SO":"so-SO-MuuseNeural","sr-RS":"sr-RS-NicholasNeural","su-ID":"su-ID-JajangNeural","sv-SE":"sv-SE-SofieNeural","sw-KE":"sw-KE-RafikiNeural","sw-TZ":"sw-TZ-DaudiNeural","ta-IN":"ta-IN-PallaviNeural","ta-LK":"ta-LK-KumarNeural","ta-SG":"ta-SG-AnbuNeural","te-IN":"te-IN-MohanNeural","th-TH":"th-TH-PremwadeeNeural","tr-TR":"tr-TR-AhmetNeural","uk-UA":"uk-UA-OstapNeural","ur-IN":"ur-IN-GulNeural","ur-PK":"ur-PK-AsadNeural","uz-UZ":"uz-UZ-MadinaNeural","vi-VN":"vi-VN-HoaiMyNeural","zh-CN":"zh-CN-XiaoxiaoNeural","zh-HK":"zh-HK-HiuMaanNeural","zh-TW":"zh-TW-HsiaoChenNeural","zu-ZA":"zu-ZA-ThandoNeural"};let n=this.properties.getProperty(Qe.SpeechServiceConnection_SynthLanguage,"en-US"),r=this.properties.getProperty(Qe.SpeechServiceConnection_SynthVoice,""),i=ci.XMLEncode(e);return this.autoDetectSourceLanguage?n="en-US":r=r||t[n],r&&(i=`<voice name='${r}'>${i}</voice>`),i=`<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='http://www.w3.org/2001/mstts' xmlns:emo='http://www.w3.org/2009/10/emotionml' xml:lang='${n}'>${i}</speak>`,i}speakTextAsync(e,t,n,r){this.speakImpl(e,!1,t,n,r)}speakSsmlAsync(e,t,n,r){this.speakImpl(e,!0,t,n,r)}getVoicesAsync(e=""){return li(this,void 0,void 0,(function*(){return this.getVoices(e)}))}close(e,t){Ue.throwIfDisposed(this.privDisposed),oe(this.dispose(!0),e,t)}get internalData(){return this.privAdapter}dispose(e){return li(this,void 0,void 0,(function*(){this.privDisposed||(e&&this.privAdapter&&(yield this.privAdapter.dispose()),this.privDisposed=!0)}))}createSynthesizerConfig(e){return new Jn(e,this.privProperties)}createSynthesisAdapter(e,t,n,r){return new(0,Tn.SynthesisAdapterBase)(e,t,r,this,this.audioConfig)}implCommonSynthesizeSetup(){let e="undefined"!=typeof window?"Browser":"Node",t="unknown",n="unknown";"undefined"!=typeof navigator&&(e=e+"/"+navigator.platform,t=navigator.userAgent,n=navigator.appVersion);const r=this.createSynthesizerConfig(new ht(new ft(new mt(e,t,n)))),i=this.privProperties.getProperty(Qe.SpeechServiceConnection_Key,void 0),o=i&&""!==i?new He(i):new Ve((()=>{const e=this.privProperties.getProperty(Qe.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(e)}),(()=>{const e=this.privProperties.getProperty(Qe.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(e)}));this.privAdapter=this.createSynthesisAdapter(o,this.privConnectionFactory,this.audioConfig,r),this.privAdapter.audioOutputFormat=dn.fromSpeechSynthesisOutputFormat(Zt[this.properties.getProperty(Qe.SpeechServiceConnection_SynthOutputFormat,void 0)]),this.privRestAdapter=new Kn(r)}speakImpl(e,t,n,r,i){try{Ue.throwIfDisposed(this.privDisposed);const o=x();let a;a=i instanceof zr?new(0,pn.PushAudioOutputStreamImpl)(i):i instanceof pn.PullAudioOutputStream?i:void 0!==i?new Wr(i):void 0,this.synthesisRequestQueue.enqueue(new ui(o,e,t,(e=>{if(this.privSynthesizing=!1,n)try{n(e)}catch(e){r&&r(e)}n=void 0,this.adapterSpeak().catch((()=>{}))}),(e=>{r&&r(e)}),a)),this.adapterSpeak().catch((()=>{}))}catch(e){if(r)if(e instanceof Error){const t=e;r(t.name+": "+t.message)}else r(e);this.dispose(!0).catch((()=>{}))}}getVoices(e){return li(this,void 0,void 0,(function*(){const t=x(),n=yield this.privRestAdapter.getVoicesList(t);if(n.ok&&Array.isArray(n.json)){let r=n.json;return e&&e.length>0&&(r=r.filter((t=>!!t.Locale&&t.Locale.toLowerCase()===e.toLowerCase()))),new si(t,r,void 0)}return new si(t,void 0,`Error: ${n.status}: ${n.statusText}`)}))}adapterSpeak(){return li(this,void 0,void 0,(function*(){if(!this.privDisposed&&!this.privSynthesizing){this.privSynthesizing=!0;const e=yield this.synthesisRequestQueue.dequeue();return this.privAdapter.Speak(e.text,e.isSSML,e.requestId,e.cb,e.err,e.dataStream)}}))}static XMLEncode(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}}class ui{constructor(e,t,n,r,i,o){this.requestId=e,this.text=t,this.isSSML=n,this.cb=r,this.err=i,this.dataStream=o}}function di(){
|
|
62
62
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */di=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof d?t:d,o=Object.create(i.prototype),a=new M(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return A()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=w(a,n);if(s){if(s===u)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=c(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,a),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var u={};function d(){}function h(){}function f(){}var p={};s(p,i,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(_([])));g&&g!==t&&n.call(g,i)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){function r(i,o,a,s){var l=c(e[i],e,o);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,s)}))}s(l.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,u;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function _(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=f,s(v,"constructor",f),s(f,"constructor",h),h.displayName=s(f,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,s(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(y.prototype),s(y.prototype,o,(function(){return this})),e.AsyncIterator=y,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new y(l(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(v),s(v,a,"Generator"),s(v,i,(function(){return this})),s(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=_,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:_(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function hi(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function fi(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){hi(o,r,i,a,s,"next",e)}function s(e){hi(o,r,i,a,s,"throw",e)}a(void 0)}))}}function pi(){return pi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pi.apply(this,arguments)}var mi=function(e,t){return n(d)(""+t.apiUrl+e,pi({},t,{body:null!=t&&t.body?JSON.stringify(t.body):void 0,mode:"cors",credentials:"include",headers:pi({"Content-Type":"application/json"},null==t?void 0:t.headers)})).then((function(e){return null!=t&&t.text?e.text():e.json()}))},gi=function(e){return{getTenantPublicMemoriList:function(t){return mi("/TenantPublicMemori/"+encodeURI(t),{apiUrl:e})},getTenantMetaverseMemoriList:function(t){return mi("/TenantMetaverseMemori/"+encodeURI(t),{apiUrl:e})},getPublicMemoriList:function(t){return mi("/PublicMemori/"+t,{apiUrl:e})},getAllMemori:function(t){return mi("/AllMemori/"+t,{apiUrl:e})},getUserMemoriList:function(t){return mi("/Memori/"+t,{apiUrl:e})},getSharedMemoriList:function(t){return mi("/SharedMemori/"+t,{apiUrl:e})},getTenantCategories:function(t){return mi("/TenantMemoriCategories/"+encodeURI(t),{apiUrl:e})},getMemoriConfigs:function(t){return mi("/MemoriConfigs/"+t,{apiUrl:e})},createMemori:function(t,n){return mi("/Memori/"+t,{apiUrl:e,body:n,method:"POST"})},updateMemori:function(t,n){return mi("/Memori/"+t+"/"+n.memoriID,{apiUrl:e,body:n,method:"PATCH"})},deleteMemori:function(t,n){return mi("/Memori/"+t,{apiUrl:e,body:n,method:"DELETE"})},getMemoriById:function(t,n){return mi("/Memori/"+t+"/"+n,{apiUrl:e})},getMemoriByUserAndId:function(t,n,r,i){return mi("/MemoriById/"+t+"/"+n+"/"+r+(i?"/"+i:""),{apiUrl:e})},getMemori:function(t,n,r,i){return mi("/Memori/"+encodeURI(t)+"/"+encodeURI(n)+"/"+encodeURI(r)+"/"+(null!=i?i:""),{apiUrl:e})},getMemoriSessions:function(t,n,r,i){return mi("/MemoriSessions/"+t+"/"+n+(r?"/"+r:"")+(r&&i?"/"+i:""),{apiUrl:e})},transferMemori:function(t,n){return mi("/TransferMemori/"+t,{apiUrl:e,body:n,method:"POST"})},memoriContentUpdated:function(t,n){return mi("/MemoriContentUpdated/"+t+"/"+n,{apiUrl:e,method:"POST"})}}},vi=function(e){return{userSignIn:function(t){return mi("/User",{apiUrl:e,body:t,method:"POST"})},userConfirmSignIn:function(t){return mi("/UserConfirm",{apiUrl:e,body:t,method:"POST"})},userLogin:function(t){return mi("/Login",{apiUrl:e,body:t,method:"POST"})},userLogout:function(t){return mi("/Logout/"+t,{apiUrl:e,method:"POST"})},getUser:function(t,n){return mi("/User/"+t+"/"+n,{apiUrl:e})},getUsersList:function(t){return mi("/Users/"+t,{apiUrl:e})},deleteUser:function(t,n){return mi("/User/"+t+"/"+n,{apiUrl:e,method:"DELETE"})},updateUser:function(t,n,r){return mi("/User/"+t+"/"+n,{apiUrl:e,method:"PATCH",body:r})},resetPassword:function(t){return mi("/ResetPassword",{apiUrl:e,body:t,method:"POST"})},resetConfirm:function(t){return mi("/ResetConfirm",{apiUrl:e,body:t,method:"POST"})},recoverUsername:function(t){return mi("/RecoverUsername",{apiUrl:e,body:t,method:"POST"})},getTenantConfig:function(t){return mi("/Tenant/"+t,{apiUrl:e})},resendVerificationCode:function(t){return mi("/ResendVerificationCode",{apiUrl:e,body:t,method:"POST"})},createUser:function(t,n){return mi("/User/"+t,{apiUrl:e,body:n,method:"POST"})}}},bi=function(e){return{getMemoriIntegrationsList:function(t,n){return mi("/Integrations/"+t+"/"+n,{apiUrl:e})},getAllIntegrationsList:function(t){return mi("/AllIntegrations/"+t,{apiUrl:e})},getIntegration:function(t,n){return mi("/Integration/"+t+"/"+n,{apiUrl:e})},deleteIntegration:function(t,n){return mi("/Integration/"+t+"/"+n,{apiUrl:e,method:"DELETE"})},createIntegration:function(t,n){return mi("/Integration/"+t,{apiUrl:e,method:"POST",body:n})},updateIntegration:function(t,n,r){return mi("/Integration/"+t+"/"+n,{apiUrl:e,method:"PATCH",body:r})}}},yi=function(e){return{getUploadAssetURL:function(t,n,r){return e+"/Asset/"+t+"/"+n+(r?"/"+r:"")},uploadAsset:(t=fi(di().mark((function t(n,r,i,o,a){var s,l,c,u;return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=new FormData,t.next=3,fetch(r);case 3:return l=t.sent,t.next=6,l.blob();case 6:return c=t.sent,s.append(n,c,n),t.next=10,fetch(e+"/Asset/"+i+"/"+o+(a?"/"+a:""),{method:"POST",body:s});case 10:return u=t.sent,t.next=13,u.json();case 13:return t.abrupt("return",t.sent);case 14:case"end":return t.stop()}}),t)}))),function(e,n,r,i,o){return t.apply(this,arguments)}),getAsset:function(t,n){return mi("/Asset/"+t+"/"+n,{apiUrl:e,method:"GET"})},updateAsset:function(t,n,r){return mi("/Asset/"+t+"/"+n.split("/").reverse()[0],{apiUrl:e,method:"PATCH",body:r})},deleteAsset:function(t,n){return mi("/Asset/"+t+"/"+n.split("/").reverse()[0],{apiUrl:e,method:"DELETE"})}};var t},wi=function(e){return{getSentInvitations:function(t){return mi("/SentInvitations/"+t,{apiUrl:e})},getReceivedInvitations:function(t){return mi("/ReceivedInvitations/"+t,{apiUrl:e})},getAllInvitations:function(t){return mi("/AllInvitations/"+t,{apiUrl:e})},getInvitation:function(t,n){return mi("/Invitation/"+t+"/"+n,{apiUrl:e})},updateInvitation:function(t,n){return mi("/Invitation/"+t+"/"+n.invitationID,{apiUrl:e,method:"PATCH",body:n})},deleteInvitation:function(t,n){return mi("/Invitation/"+t+"/"+n,{apiUrl:e,method:"DELETE"})},acceptInvitation:function(t,n){return mi("/AcceptInvitation/"+t+"/"+n,{apiUrl:e,method:"POST"})},rejectInvitation:function(t,n){return mi("/RejectInvitation/"+t+"/"+n,{apiUrl:e,method:"POST"})},sendInvitation:function(t,n){return mi("/SendInvitation/"+t,{apiUrl:e,method:"POST",body:n})}}},Si=function(e){return{getTenantConsumptionLogs:function(t,n,r,i,o){return mi("/TenantConsumptionLogs/"+t+"/"+n+"/"+r+(i?"/"+i:"")+(i&&o?"/"+o:""),{apiUrl:e})},getUserConsumptionLogs:function(t,n,r,i,o){return mi("/UserConsumptionLogs/"+t+"/"+n+"/"+r+(i?"/"+i:"")+(i&&o?"/"+o:""),{apiUrl:e})},getMemoriConsumptionLogs:function(t,n,r,i,o){return mi("/MemoriConsumptionLogs/"+t+"/"+n+"/"+r+(i?"/"+i:"")+(i&&o?"/"+o:""),{apiUrl:e})}}},xi=function(e){return{getTenantNotifications:function(t){return mi("/TenantNotifications/"+t,{apiUrl:e})},getUserNotifications:function(t){return mi("/UserNotifications/"+t,{apiUrl:e})}}},Mi=function(e){return pi({asset:yi(e),memori:gi(e),user:vi(e),integration:bi(e),invitation:wi(e),consumptionLogs:Si(e),notifications:xi(e)},yi(e),gi(e),vi(e),bi(e),wi(e),Si(e),xi(e))},_i=function(e){return{getCorrelationPairs:(n=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/CorrelationPairs/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),deleteCorrelationPair:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/CorrelationPair/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n},Ai=function(e){return{postTextEnteredEvent:(c=fi(di().mark((function t(n){var r,i;return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.sessionId,i=n.text,t.abrupt("return",mi("/TextEnteredEvent/"+r,{method:"POST",apiUrl:e,body:{text:i}}));case 2:case"end":return t.stop()}}),t)}))),function(e){return c.apply(this,arguments)}),postPlaceChangedEvent:(l=fi(di().mark((function t(n){var r,i,o,a,s;return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.sessionId,i=n.placeName,o=n.latitude,a=n.longitude,s=n.uncertaintyKm,t.abrupt("return",mi("/PlaceChangedEvent/"+r,{method:"POST",apiUrl:e,body:{placeName:i,latitude:o,longitude:a,uncertaintyKm:s}}));case 2:case"end":return t.stop()}}),t)}))),function(e){return l.apply(this,arguments)}),postDateChangedEvent:(s=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/DateChangedEvent/"+n,{method:"POST",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return s.apply(this,arguments)}),postTagChangedEvent:(a=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/TagChangedEvent/"+n,{method:"POST",apiUrl:e,body:{tag:r}}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return a.apply(this,arguments)}),postTimeoutEvent:(o=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/TimeoutEvent/"+n,{method:"POST",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),postMediumSelectedEvent:(i=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/MediumSelectedEvent/"+n,{method:"POST",apiUrl:e,body:{medium:r}}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),postDateSelectedEvent:(r=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/DateSelectedEvent/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),postPlaceSelectedEvent:(n=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/PlaceSelectedEvent/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),postTagSelectedEvent:(t=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/TagSelectedEvent/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};var t,n,r,i,o,a,s,l,c},Ei=function(e){return{importCSV:(n=fi(di().mark((function t(n,r,i){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/ImportExport/ImportCSV/"+n,{method:"POST",apiUrl:e,body:pi({csvRows:r},i)}));case 1:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)}),exportCSV:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/ImportExport/ExportCSV/"+n,{method:"POST",apiUrl:e,body:r,text:!0}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n},Ci=function(e){return{getIntents:(u=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Intents/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return u.apply(this,arguments)}),getIntent:(c=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Intent/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return c.apply(this,arguments)}),patchIntent:(l=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Intent/"+n+"/"+r.intentID,{method:"PATCH",apiUrl:e,body:r}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return l.apply(this,arguments)}),deleteIntent:(s=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Intent/"+n+"/"+r,{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return s.apply(this,arguments)}),createIntent:(a=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Intent/"+n,{method:"POST",apiUrl:e,body:r}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return a.apply(this,arguments)}),getIntentSlots:(o=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/IntentSlots/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),getIntentSlot:(i=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/IntentSlot/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),patchIntentSlot:(r=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/IntentSlot/"+n+"/"+r.intentSlotID,{method:"PATCH",apiUrl:e,body:r}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),deleteIntentSlot:(n=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/IntentSlot/"+n+"/"+r,{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return n.apply(this,arguments)}),createIntentSlot:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/IntentSlot/"+n,{method:"POST",apiUrl:e,body:r}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n,r,i,o,a,s,l,c,u},Ti=function(e){return{getLocalizationKeys:(o=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/LocalizationKeys/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),getLocalizationKey:(i=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/LocalizationKey/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),deleteLocalizationKey:(r=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/LocalizationKey/"+n+"/"+r,{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),postLocalizationKey:(n=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/LocalizationKey/"+n,{method:"POST",apiUrl:e,body:r}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return n.apply(this,arguments)}),patchLocalizationKey:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/LocalizationKey/"+n,{method:"PATCH",apiUrl:e,body:r}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n,r,i,o},Ii=function(e){return{getMedia:(o=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Media/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return o.apply(this,arguments)}),deleteMedia:(i=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Media/"+n+"/"+r,{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),getMedium:(r=fi(di().mark((function t(n,r,i){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Medium/"+n+"/"+r+"/"+i,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t,n){return r.apply(this,arguments)}),patchMedium:(n=fi(di().mark((function t(n,r,i){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Medium/"+n+"/"+r+"/"+i,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)}),deleteMedium:function(t,n,r){return mi("/Medium/"+t+"/"+n+"/"+r,{method:"GET",apiUrl:e})},postMedium:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Medium/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n,r,i,o},ki=function(e){return{getMemories:(s=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Memories/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return s.apply(this,arguments)}),getMemoriesPaginated:(a=fi(di().mark((function t(n,r,i,o){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Memories/"+n+"/"+r+"/"+i+(o?"/"+o:""),{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t,n,r){return a.apply(this,arguments)}),getMemory:(o=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Memory/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return o.apply(this,arguments)}),patchMemory:(i=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Memory/"+n+"/"+r.memoryID,{method:"PATCH",apiUrl:e,body:r}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),deleteMemory:(r=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Memory/"+n+"/"+r,{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),postMemory:(n=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Memory/"+n,{method:"POST",apiUrl:e,body:r}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return n.apply(this,arguments)}),getMemoryAccess:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/MemoryAccess/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n,r,i,o,a,s},Ri=function(e){return{getWordVector:(o=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/WordVector/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return o.apply(this,arguments)}),getSimilarWords:(i=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/SimilarWords/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),guessLanguage:(r=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/GuessLanguage/"+n,{method:"POST",apiUrl:e,body:{text:r}}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),computeSimilarity:(n=fi(di().mark((function t(n,r,i,o,a){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/ComputeSimilarity/"+n,{method:"POST",apiUrl:e,body:{referenceText:r,referenceTextType:i,comparisonText:o,comparisonTextType:a}}));case 1:case"end":return t.stop()}}),t)}))),function(e,t,r,i,o){return n.apply(this,arguments)}),checkWords:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/CheckWords/"+n,{method:"POST",apiUrl:e,body:{text:r}}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n,r,i,o},Oi=function(e){return{getPeople:(o=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/People/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),getPerson:(i=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Person/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),patchPerson:(r=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Person/"+n+"/"+r.personID,{method:"PATCH",body:r,apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),deletePerson:(n=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Person/"+n+"/"+r,{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return n.apply(this,arguments)}),postPerson:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Person/"+n,{method:"POST",body:r,apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n,r,i,o},Pi=function(e){return{getPromptedQuestions:(o=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/PromptedQuestions/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),getPromptedQuestion:(i=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/PromptedQuestion/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),patchPromptedQuestion:(r=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/PromptedQuestion/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),deletePromptedQuestion:(n=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/PromptedQuestion/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return n.apply(this,arguments)}),postPromptedQuestion:(t=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/PromptedQuestion/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};var t,n,r,i,o},Ni=function(e){return{searchMemory:(r=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Search/"+n,{method:"POST",body:r,apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),postRandom:(n=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Random/"+n,{method:"POST",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),postHints:(t=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Hints/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};var t,n,r},Bi=function(e){return{initSession:(r=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Session",{method:"POST",body:n,apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),getSession:(n=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Session/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),deleteSession:(t=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Session/"+n,{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};var t,n,r},Li=function(e){return{getStatistics:(a=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/Statistics/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return a.apply(this,arguments)}),getContentQualityIndexes:(o=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/ContentQualityIndexes/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),getTextQualityIndexes:(i=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/TextQualityIndexes/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getEventLogs:(r=fi(di().mark((function t(n,r,i){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/EventLogs/"+n+"/"+r+"/"+i,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t,n){return r.apply(this,arguments)}),getMemoryEventLogs:(n=fi(di().mark((function t(n,r,i,o){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/EventLogs/"+n+"/"+r+"/"+i+"/"+o,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t,r,i){return n.apply(this,arguments)}),getIntentEventLogs:(t=fi(di().mark((function t(n,r,i,o){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/EventLogs/"+n+"/"+r+"/"+i+"/"+o,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,n,r,i){return t.apply(this,arguments)})};var t,n,r,i,o,a},Di=function(e){return{getUnansweredQuestions:(r=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/UnansweredQuestions/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),getUnansweredQuestionsPaginated:(n=fi(di().mark((function t(n,r,i){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/UnansweredQuestions/"+n+"/"+r+"/"+i,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)}),deleteUnansweredQuestion:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/UnansweredQuestion/"+n+"/"+r,{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n,r},Ui=function(e){return{getContextVars:(r=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/ContextVars/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),getContextVarNames:(n=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/ContextVarNames/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getContextVarValues:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/ContextVarValues/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n,r},Fi=function(e){return{getCustomWords:(o=fi(di().mark((function t(n){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/CustomWords/"+n,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),getCustomWord:(i=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/CustomWord/"+n+"/"+r,{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),deleteCustomWord:(r=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/CustomWord/"+n+"/"+r,{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),postCustomWord:(n=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/CustomWord/"+n,{method:"POST",apiUrl:e,body:r}));case 1:case"end":return t.stop()}}),t)}))),function(e,t){return n.apply(this,arguments)}),patchCustomWord:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/CustomWord/"+n+"/"+r.customWordID,{method:"PATCH",apiUrl:e,body:r}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n,r,i,o},zi=function(e){return{getChatLogs:(r=fi(di().mark((function t(n,r,i){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/ChatLogs/"+n+(r?"/"+r:"")+(r&&i?"/"+i:""),{method:"GET",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t,n){return r.apply(this,arguments)}),deleteChatLogs:(n=fi(di().mark((function t(n,r,i){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/ChatLogs/"+n+(r?"/"+r:"")+(r&&i?"/"+i:""),{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)}),deleteChatLog:(t=fi(di().mark((function t(n,r){return di().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",mi("/ChatLog/"+n+"/"+r,{method:"DELETE",apiUrl:e}));case 1:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})};var t,n,r},ji={__proto__:null,allowedMediaTypes:["image/jpeg","image/png","image/jpg","image/gif","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/pdf","video/mp4","video/avi","audio/mpeg3","audio/wav","audio/mpeg","video/mpeg","model/gltf-binary"],anonTag:"👤"},Hi=function(e,t){return void 0===t&&(t=!1),function(n,r){var i,o,a=hn.fromSubscription(e,"eastus");o=new(0,jr.SpeakerAudioDestination);var s=qr.fromSpeakerOutput(o);a.speechSynthesisVoiceName=function(e,t){var n="";switch(e.toUpperCase()){case"IT":n="MALE"===t?"it-IT-DiegoNeural":"it-IT-ElsaNeural";break;case"DE":n="MALE"===t?"de-DE-ConradNeural":"de-DE-KatjaNeural";break;case"EN":n="MALE"===t?"en-GB-RyanNeural":"en-GB-SoniaNeural";break;case"ES":n="MALE"===t?"es-ES-AlvaroNeural":"es-ES-ElviraNeural";break;case"FR":n="MALE"===t?"fr-FR-HenriNeural":"fr-FR-DeniseNeural";break;case"PT":n="MALE"===t?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural";break;default:n="MALE"===t?"it-IT-DiegoNeural":"it-IT-IsabellaNeural"}return n}(n,r);var l=function(e){var t="";switch(e.toUpperCase()){case"IT":default:t="it-IT";break;case"DE":t="de-DE";break;case"EN":t="en-US";break;case"ES":t="es-ES";break;case"FR":t="fr-FR";break;case"PT":t="pt-PT"}return t}(n);a.speechSynthesisLanguage=l,a.speechRecognitionLanguage=l;var c,u=function(){o&&o.pause(),i&&(i.close(),i=null)},d=qr.fromDefaultMicrophoneInput(),h=function(e){c&&(c.stopContinuousRecognitionAsync(),c.close(),c=null,e&&e())};return{speak:function(e,n){u(),i=new(0,oi.SpeechSynthesizer)(a,s),n&&(o.onAudioEnd=n),i.speakTextAsync(e,(function(n){if(n)try{t&&console.log("speak result",n),i&&(i.close(),i=null)}catch(t){console.error("speak error: ",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e))}else t&&console.log("speak no result",n)}),(function(t){console.error("speak:",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e))}))},isSpeaking:function(){return!!i},stopSpeaking:u,recognize:function(e){(c=new(0,Qr.SpeechRecognizer)(a,d)).recognizing=function(e,n){t&&console.log("RECOGNIZING: Text="+n.result.text)},c.recognized=function(n,r){var i;r.result.reason===yt.RecognizedSpeech?(t&&console.log("RECOGNIZED: Text="+r.result.text),e(null!=(i=r.result.text)?i:"")):r.result.reason===yt.NoMatch&&t&&console.log("NOMATCH: Speech could not be recognized.")},c.canceled=function(e,n){t&&console.log("CANCELED: Reason="+n.reason),n.reason===Ke.Error&&t&&(console.log('"CANCELED: ErrorCode='+n.errorCode),console.log('"CANCELED: ErrorDetails='+n.errorDetails),console.log("CANCELED: Did you set the speech resource key and region values?")),h()},c.sessionStopped=function(e,n){t&&console.log("\n Session stopped event."),c&&c.stopContinuousRecognitionAsync()},c.startContinuousRecognitionAsync()},isRecognizing:function(){return!!c},stopRecognizing:h}}},Gi=function(e){return{getResourceUrl:function(t){var n=t.type,r=t.resourceURI,i=t.sessionID,o=t.baseURL,a=void 0===o?"https://app.twincreator.com":o,s="cover"===n?a+"/images/memoriCover.png":a+"/images/memoriAvatar.png";return r&&0!==r.length?r.includes("memoriai/memory")?r+"?memori-ai-session-id="+i:r.startsWith("https://")||r.startsWith("http://")?r+(i?"/"+i:""):r.startsWith("cloud://")?e.replace(/v2/,"v1")+"/CloudAsset/"+r.replace("cloud://",""):r.startsWith("guid://")?e.replace(/v2/,"v1")+"/GuidAsset/"+r.replace("guid://",""):s:s}}},Vi=function(e){var t=function(e){return e?new URL(e.startsWith("http")?e:"https://"+e).origin.replace("http://","https://"):"https://backend.memori.ai"}(e);return pi({backend:Mi(t+"/api/v2")},function(e){return pi({correlationPairs:_i(e)},_i(e),{dialog:Ai(e)},Ai(e),{importExport:Ei(e)},Ei(e),{intents:Ci(e)},Ci(e),{localizationKeys:Ti(e)},Ti(e),{media:Ii(e)},Ii(e),{memories:ki(e)},ki(e),{nlp:Ri(e)},Ri(e),{people:Oi(e)},Oi(e),{promptedQuestions:Pi(e)},Pi(e),{search:Ni(e)},Ni(e),{session:Bi(e)},Bi(e),{stats:Li(e)},Li(e),{unansweredQuestions:Di(e)},Di(e),{contextVars:Ui(e)},Ui(e),{customDictionary:Fi(e)},Fi(e),{chatLogs:zi(e)},zi(e))}(t+"/memori/v2"),{speech:Hi,constants:ji,asset:Gi(t+"/api/v2")})},Wi=(c=o("85Hg2"),o("hcaHr")),qi={},Ki=o("k9HYU");(qi=function(e,t,n){return(t=Ki(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}).__esModule=!0,qi.default=qi;c=o("85Hg2");var Ji=o("ffgrs"),Qi=o("22y1y"),Xi=(c=o("85Hg2"),/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g),Yi={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Zi=function(e){return Yi[e]};function $i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function eo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$i(Object(r),!0).forEach((function(t){n(qi)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var to,no={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:function(e){return e.replace(Xi,Zi)}},ro=(0,c.createContext)();function io(){return no}var oo=function(){function e(){n(Ji)(this,e),this.usedNamespaces={}}return n(Qi)(e,[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach((function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),e}();function ao(){return to}var so={type:"3rdParty",init:function(e){!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};no=eo(eo({},no),e)}(e.options.react),function(e){to=e}(e)}};function lo(){if(console&&console.warn){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];"string"==typeof n[0]&&(n[0]="react-i18next:: ".concat(n[0])),(e=console).warn.apply(e,n)}}var co={};function uo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];"string"==typeof t[0]&&co[t[0]]||("string"==typeof t[0]&&(co[t[0]]=new Date),lo.apply(void 0,t))}function ho(e,t,n){e.loadNamespaces(t,(function(){if(e.isInitialized)n();else{e.on("initialized",(function t(){setTimeout((function(){e.off("initialized",t)}),0),n()}))}}))}function fo(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.languages[0],i=!!t.options&&t.options.fallbackLng,o=t.languages[t.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};return!(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e))&&(!!t.hasResourceBundle(r,e)||(!(t.services.backendConnector.backend&&(!t.options.resources||t.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e))))}function po(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t.languages||!t.languages.length)return uo("i18n.languages were undefined or empty",t.languages),!0;var r=void 0!==t.options.ignoreJSONStructure;return r?t.hasLoadedNamespace(e,{precheck:function(t,r){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}):fo(e,t,n)}function mo(e){return e.displayName||e.name||("string"==typeof e&&e.length>0?e:"Unknown")}function go(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function vo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?go(Object(r),!0).forEach((function(t){n(qi)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):go(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var bo=function(e,t){var n=(0,c.useRef)();return(0,c.useEffect)((function(){n.current=t?n.current:e}),[e,t]),n.current};function yo(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.i18n,i=(0,c.useContext)(ro)||{},o=i.i18n,a=i.defaultNS,s=r||o||ao();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new oo),!s){uo("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},u=[l,{},!1];return u.t=l,u.i18n={},u.ready=!1,u}s.options.react&&void 0!==s.options.react.wait&&uo("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var d=vo(vo(vo({},io()),s.options.react),t),h=d.useSuspense,f=d.keyPrefix,p=e||a||s.options&&s.options.defaultNS;p="string"==typeof p?[p]:p||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(p);var m=(s.isInitialized||s.initializedStoreOnce)&&p.every((function(e){return po(e,s,d)}));function g(){return s.getFixedT(null,"fallback"===d.nsMode?p:p[0],f)}var v=(0,c.useState)(g),b=n(Wi)(v,2),y=b[0],w=b[1],S=p.join(),x=bo(S),M=(0,c.useRef)(!0);(0,c.useEffect)((function(){var e=d.bindI18n,t=d.bindI18nStore;function n(){M.current&&w(g)}return M.current=!0,m||h||ho(s,p,(function(){M.current&&w(g)})),m&&x&&x!==S&&M.current&&w(g),e&&s&&s.on(e,n),t&&s&&s.store.on(t,n),function(){M.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,n)})),t&&s&&t.split(" ").forEach((function(e){return s.store.off(e,n)}))}}),[s,S]);var _=(0,c.useRef)(!0);(0,c.useEffect)((function(){M.current&&!_.current&&w(g),_.current=!1}),[s,f]);var A=[y,s,m];if(A.t=y,A.i18n=s,A.ready=m,m)return A;if(!m&&!h)return A;throw new Promise((function(e){ho(s,p,(function(){e()}))}))}var wo={};!function(e,t,n,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(t),a=i(n),s=i(r),l=function(e,t,n){return{endTime:t,insertTime:n,type:"exponentialRampToValue",value:e}},c=function(e,t,n){return{endTime:t,insertTime:n,type:"linearRampToValue",value:e}},u=function(e,t){return{startTime:t,type:"setValue",value:e}},d=function(e,t,n){return{duration:n,startTime:t,type:"setValueCurve",values:e}},h=function(e,t,n){var r=n.startTime,i=n.target,o=n.timeConstant;return i+(t-i)*Math.exp((r-e)/o)},f=function(e){return"exponentialRampToValue"===e.type},p=function(e){return"linearRampToValue"===e.type},m=function(e){return f(e)||p(e)},g=function(e){return"setValue"===e.type},v=function(e){return"setValueCurve"===e.type},b=function e(t,n,r,i){var o=t[n];return void 0===o?i:m(o)||g(o)?o.value:v(o)?o.values[o.values.length-1]:h(r,e(t,n-1,o.startTime,i),o)},y=function(e,t,n,r,i){return void 0===n?[r.insertTime,i]:m(n)?[n.endTime,n.value]:g(n)?[n.startTime,n.value]:v(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,b(e,t-1,n.startTime,i)]},w=function(e){return"cancelAndHold"===e.type},S=function(e){return"cancelScheduledValues"===e.type},x=function(e){return w(e)||S(e)?e.cancelTime:f(e)||p(e)?e.endTime:e.startTime},M=function(e,t,n,r){var i=r.endTime,o=r.value;return n===o?o:0<n&&0<o||n<0&&o<0?n*Math.pow(o/n,(e-t)/(i-t)):0},_=function(e,t,n,r){return n+(e-t)/(r.endTime-t)*(r.value-n)},A=function(e,t){var n=Math.floor(t),r=Math.ceil(t);return n===r?e[n]:(1-(t-n))*e[n]+(1-(r-t))*e[r]},E=function(e,t){var n=t.duration,r=t.startTime,i=t.values,o=(e-r)/n*(i.length-1);return A(i,o)},C=function(e){return"setTarget"===e.type},T=function(e){function t(e){a.default(this,t),this._automationEvents=[],this._currenTime=0,this._defaultValue=e}return s.default(t,[{key:e,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:"add",value:function(e){var t=x(e);if(w(e)||S(e)){var n=this._automationEvents.findIndex((function(n){return S(e)&&v(n)?n.startTime+n.duration>=t:x(n)>=t})),r=this._automationEvents[n];if(-1!==n&&(this._automationEvents=this._automationEvents.slice(0,n)),w(e)){var i=this._automationEvents[this._automationEvents.length-1];if(void 0!==r&&m(r)){if(C(i))throw new Error("The internal list is malformed.");var o=v(i)?i.startTime+i.duration:x(i),a=v(i)?i.values[i.values.length-1]:i.value,s=f(r)?M(t,o,a,r):_(t,o,a,r),h=f(r)?l(s,t,this._currenTime):c(s,t,this._currenTime);this._automationEvents.push(h)}void 0!==i&&C(i)&&this._automationEvents.push(u(this.getValue(t),t)),void 0!==i&&v(i)&&i.startTime+i.duration>t&&(this._automationEvents[this._automationEvents.length-1]=d(new Float32Array([6,7]),i.startTime,t-i.startTime))}}else{var g=this._automationEvents.findIndex((function(e){return x(e)>t})),b=-1===g?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[g-1];if(void 0!==b&&v(b)&&x(b)+b.duration>t)return!1;var y=f(e)?l(e.value,e.endTime,this._currenTime):p(e)?c(e.value,t,this._currenTime):e;if(-1===g)this._automationEvents.push(y);else{if(v(e)&&t+e.duration>x(this._automationEvents[g]))return!1;this._automationEvents.splice(g,0,y)}}return!0}},{key:"flush",value:function(e){var t=this._automationEvents.findIndex((function(t){return x(t)>e}));if(t>1){var n=this._automationEvents.slice(t-1),r=n[0];C(r)&&n.unshift(u(b(this._automationEvents,t-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=n}}},{key:"getValue",value:function(e){if(0===this._automationEvents.length)return this._defaultValue;var t=this._automationEvents.findIndex((function(t){return x(t)>e})),n=this._automationEvents[t],r=(-1===t?this._automationEvents.length:t)-1,i=this._automationEvents[r];if(void 0!==i&&C(i)&&(void 0===n||!m(n)||n.insertTime>e))return h(e,b(this._automationEvents,r-1,i.startTime,this._defaultValue),i);if(void 0!==i&&g(i)&&(void 0===n||!m(n)))return i.value;if(void 0!==i&&v(i)&&(void 0===n||!m(n)||i.startTime+i.duration>e))return e<i.startTime+i.duration?E(e,i):i.values[i.values.length-1];if(void 0!==i&&m(i)&&(void 0===n||!m(n)))return i.value;if(void 0!==n&&f(n)){var a=y(this._automationEvents,r,i,n,this._defaultValue),s=o.default(a,2),l=s[0],c=s[1];return M(e,l,c,n)}if(void 0!==n&&p(n)){var u=y(this._automationEvents,r,i,n,this._defaultValue),d=o.default(u,2),w=d[0],S=d[1];return _(e,w,S,n)}return this._defaultValue}}]),t}(Symbol.iterator),I=function(e){return{cancelTime:e,type:"cancelAndHold"}},k=function(e){return{cancelTime:e,type:"cancelScheduledValues"}},R=function(e,t){return{endTime:t,type:"exponentialRampToValue",value:e}},O=function(e,t){return{endTime:t,type:"linearRampToValue",value:e}},P=function(e,t,n){return{startTime:t,target:e,timeConstant:n,type:"setTarget"}};e.AutomationEventList=T,e.createCancelAndHoldAutomationEvent=I,e.createCancelScheduledValuesAutomationEvent=k,e.createExponentialRampToValueAutomationEvent=R,e.createLinearRampToValueAutomationEvent=O,e.createSetTargetAutomationEvent=P,e.createSetValueAutomationEvent=u,e.createSetValueCurveAutomationEvent=d,Object.defineProperty(e,"__esModule",{value:!0})}(wo,o("hcaHr"),o("ffgrs"),o("22y1y"));const So=new WeakSet,xo=new WeakMap,Mo=new WeakMap,_o=new WeakMap,Ao=new WeakMap,Eo=new WeakMap,Co=new WeakMap,To=new WeakMap,Io=new WeakMap,ko=new WeakMap,Ro={construct:()=>Ro},Oo=e=>{try{new new Proxy(e,Ro)}catch{return!1}return!0},Po=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,No=(e,t)=>{const n=[];let r=e.replace(/^[\s]+/,""),i=r.match(Po);for(;null!==i;){const e=i[1].slice(1,-1),o=i[0].replace(/([\s]+)?;?$/,"").replace(e,new URL(e,t).toString());n.push(o),r=r.slice(i[0].length).replace(/^[\s]+/,""),i=r.match(Po)}return[n.join(";"),r]},Bo=e=>{if(void 0!==e&&!Array.isArray(e))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},Lo=e=>{if(!Oo(e))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===e.prototype||"object"!=typeof e.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},Do=(e,t)=>{const n=e.get(t);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},Uo=(e,t)=>{const n=Array.from(e).filter(t);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");const[r]=n;return e.delete(r),r},Fo=(e,t,n,r)=>{const i=Do(e,t),o=Uo(i,(e=>e[0]===n&&e[1]===r));return 0===i.size&&e.delete(t),o},zo=e=>Do(Co,e),jo=e=>{if(So.has(e))throw new Error("The AudioNode is already stored.");So.add(e),zo(e).forEach((e=>e(!0)))},Ho=e=>"port"in e,Go=e=>{if(!So.has(e))throw new Error("The AudioNode is not stored.");So.delete(e),zo(e).forEach((e=>e(!1)))},Vo=(e,t)=>{!Ho(e)&&t.every((e=>0===e.size))&&Go(e)},Wo={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},qo=(e,t)=>e.context===t,Ko=e=>{try{e.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},Jo=()=>new DOMException("","IndexSizeError"),Qo=e=>{var t;e.getChannelData=(t=e.getChannelData,n=>{try{return t.call(e,n)}catch(e){if(12===e.code)throw Jo();throw e}})},Xo={numberOfChannels:1},Yo=-34028234663852886e22,Zo=34028234663852886e22,$o=e=>So.has(e),ea={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},ta=e=>"playbackRate"in e,na=e=>"frequency"in e&&"gain"in e,ra=e=>"offset"in e,ia=e=>!("frequency"in e)&&"gain"in e,oa=e=>"detune"in e&&"frequency"in e,aa=e=>"pan"in e,sa=e=>Do(xo,e),la=e=>Do(_o,e),ca=(e,t)=>{const{activeInputs:n}=sa(e);n.forEach((n=>n.forEach((([n])=>{t.includes(e)||ca(n,[...t,e])}))));const r=ta(e)?[e.playbackRate]:Ho(e)?Array.from(e.parameters.values()):na(e)?[e.Q,e.detune,e.frequency,e.gain]:ra(e)?[e.offset]:ia(e)?[e.gain]:oa(e)?[e.detune,e.frequency]:aa(e)?[e.pan]:[];for(const e of r){const n=la(e);void 0!==n&&n.activeInputs.forEach((([e])=>ca(e,t)))}$o(e)&&Go(e)},ua=e=>{ca(e.destination,[])},da=e=>void 0===e||"number"==typeof e||"string"==typeof e&&("balanced"===e||"interactive"===e||"playback"===e),ha=e=>"context"in e,fa=e=>ha(e[0]),pa=(e,t,n,r)=>{for(const t of e)if(n(t)){if(r)return!1;throw Error("The set contains at least one similar element.")}return e.add(t),!0},ma=(e,t,[n,r],i)=>{pa(e,[t,n,r],(e=>e[0]===t&&e[1]===n),i)},ga=(e,[t,n,r],i)=>{const o=e.get(t);void 0===o?e.set(t,new Set([[n,r]])):pa(o,[n,r],(e=>e[0]===n),i)},va=e=>"inputs"in e,ba=(e,t,n,r)=>{if(va(t)){const i=t.inputs[r];return e.connect(i,n,0),[i,n,0]}return e.connect(t,n,r),[t,n,r]},ya=(e,t,n)=>{for(const r of e)if(r[0]===t&&r[1]===n)return e.delete(r),r;return null},wa=(e,t,n)=>Uo(e,(e=>e[0]===t&&e[1]===n)),Sa=(e,t)=>{if(!zo(e).delete(t))throw new Error("Missing the expected event listener.")},xa=(e,t,n)=>{const r=Do(e,t),i=Uo(r,(e=>e[0]===n));return 0===r.size&&e.delete(t),i},Ma=(e,t,n,r)=>{va(t)?e.disconnect(t.inputs[r],n,0):e.disconnect(t,n,r)},_a=e=>Do(Mo,e),Aa=e=>Do(Ao,e),Ea=e=>To.has(e),Ca=e=>!So.has(e),Ta=(e,t)=>new Promise((n=>{if(null!==t)n(!0);else{const t=e.createScriptProcessor(256,1,1),r=e.createGain(),i=e.createBuffer(1,2,44100),o=i.getChannelData(0);o[0]=1,o[1]=1;const a=e.createBufferSource();a.buffer=i,a.loop=!0,a.connect(t).connect(e.destination),a.connect(r),a.disconnect(r),t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0);Array.prototype.some.call(i,(e=>1===e))?n(!0):n(!1),a.stop(),t.onaudioprocess=null,a.disconnect(t),t.disconnect(e.destination)},a.start()}})),Ia=(e,t)=>{const n=new Map;for(const t of e)for(const e of t){const t=n.get(e);n.set(e,void 0===t?1:t+1)}n.forEach(((e,n)=>t(n,e)))},ka=e=>"context"in e,Ra=e=>{const t=new Map;var n,r;e.connect=(n=e.connect.bind(e),(e,r=0,i=0)=>{const o=ka(e)?n(e,r,i):n(e,r),a=t.get(e);return void 0===a?t.set(e,[{input:i,output:r}]):a.every((e=>e.input!==i||e.output!==r))&&a.push({input:i,output:r}),o}),e.disconnect=(r=e.disconnect,(n,i,o)=>{if(r.apply(e),void 0===n)t.clear();else if("number"==typeof n)for(const[e,r]of t){const i=r.filter((e=>e.output!==n));0===i.length?t.delete(e):t.set(e,i)}else if(t.has(n))if(void 0===i)t.delete(n);else{const e=t.get(n);if(void 0!==e){const r=e.filter((e=>e.output!==i&&(e.input!==o||void 0===o)));0===r.length?t.delete(n):t.set(n,r)}}for(const[n,r]of t)r.forEach((t=>{ka(n)?e.connect(n,t.output,t.input):e.connect(n,t.output)}))})},Oa=(e,t,n,r)=>{const{activeInputs:i,passiveInputs:o}=la(t),{outputs:a}=sa(e),s=zo(e),l=a=>{const s=_a(e),l=Aa(t);if(a){const t=xa(o,e,n);ma(i,e,t,!1),r||Ea(e)||s.connect(l,n)}else{const t=wa(i,e,n);ga(o,t,!1),r||Ea(e)||s.disconnect(l,n)}};return!!pa(a,[t,n],(e=>e[0]===t&&e[1]===n),!0)&&(s.add(l),$o(e)?ma(i,e,[n,l],!0):ga(o,[e,n,l],!0),!0)},Pa=(e,t,n,r,i)=>{const[o,a]=((e,t,n,r)=>{const{activeInputs:i,passiveInputs:o}=sa(t),a=ya(i[r],e,n);if(null===a)return[Fo(o,e,n,r)[2],!1];return[a[2],!0]})(e,n,r,i);if(null!==o&&(Sa(e,o),!a||t||Ea(e)||Ma(_a(e),_a(n),r,i)),$o(n)){const{activeInputs:e}=sa(n);Vo(n,e)}},Na=(e,t,n,r)=>{const[i,o]=((e,t,n)=>{const{activeInputs:r,passiveInputs:i}=la(t),o=ya(r,e,n);if(null===o)return[xa(i,e,n)[1],!1];return[o[2],!0]})(e,n,r);null!==i&&(Sa(e,i),!o||t||Ea(e)||_a(e).disconnect(Aa(n),r))};class Ba{constructor(e){this._map=new Map(e)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(e,t=null){return this._map.forEach(((n,r)=>e.call(t,n,r,this)))}get(e){return this._map.get(e)}has(e){return this._map.has(e)}keys(){return this._map.keys()}values(){return this._map.values()}}const La={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function Da(e,t,n,r,i){if("function"==typeof e.copyFromChannel)0===t[n].byteLength&&(t[n]=new Float32Array(128)),e.copyFromChannel(t[n],r,i);else{const o=e.getChannelData(r);if(0===t[n].byteLength)t[n]=o.slice(i,i+128);else{const e=new Float32Array(o.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);t[n].set(e)}}}const Ua=(e,t,n,r,i)=>{"function"==typeof e.copyToChannel?0!==t[n].byteLength&&e.copyToChannel(t[n],r,i):0!==t[n].byteLength&&e.getChannelData(r).set(t[n],i)},Fa=(e,t)=>{const n=[];for(let r=0;r<e;r+=1){const e=[],i="number"==typeof t?t:t[r];for(let t=0;t<i;t+=1)e.push(new Float32Array(128));n.push(e)}return n},za=(e,t)=>{const n=Do(ko,e),r=_a(t);return Do(n,r)},ja=async(e,t,n,r,i,o,a)=>{const s=null===t?128*Math.ceil(e.context.length/128):t.length,l=r.channelCount*r.numberOfInputs,c=i.reduce(((e,t)=>e+t),0),u=0===c?null:n.createBuffer(c,s,n.sampleRate);if(void 0===o)throw new Error("Missing the processor constructor.");const d=sa(e),h=await za(n,e),f=Fa(r.numberOfInputs,r.channelCount),p=Fa(r.numberOfOutputs,i),m=Array.from(e.parameters.keys()).reduce(((e,t)=>({...e,[t]:new Float32Array(128)})),{});for(let c=0;c<s;c+=128){if(r.numberOfInputs>0&&null!==t)for(let e=0;e<r.numberOfInputs;e+=1)for(let n=0;n<r.channelCount;n+=1)Da(t,f[e],n,n,c);void 0!==o.parameterDescriptors&&null!==t&&o.parameterDescriptors.forEach((({name:e},n)=>{Da(t,m,e,l+n,c)}));for(let e=0;e<r.numberOfInputs;e+=1)for(let t=0;t<i[e];t+=1)0===p[e][t].byteLength&&(p[e][t]=new Float32Array(128));try{const e=f.map(((e,t)=>0===d.activeInputs[t].size?[]:e)),t=a(c/n.sampleRate,n.sampleRate,(()=>h.process(e,p,m)));if(null!==u)for(let e=0,t=0;e<r.numberOfOutputs;e+=1){for(let n=0;n<i[e];n+=1)Ua(u,p[e],n,t+n,c);t+=i[e]}if(!t)break}catch(t){e.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}));break}}return u},Ha={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},Ga={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},Va={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Wa={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},qa={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Ka=e=>{const{port1:t,port2:n}=new MessageChannel;return new Promise((r=>{const i=()=>{n.onmessage=null,t.close(),n.close(),r()};n.onmessage=()=>i();try{t.postMessage(e,[e])}finally{i()}}))},Ja={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},Qa=e=>"delayTime"in e,Xa=(e,t,n)=>{const r=t[n];if(void 0===r)throw e();return r},Ya={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},Za={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},$a=()=>new DOMException("","InvalidStateError"),es=()=>new DOMException("","InvalidAccessError"),ts=e=>{var t;e.getFrequencyResponse=(t=e.getFrequencyResponse,(n,r,i)=>{if(n.length!==r.length||r.length!==i.length)throw es();return t.call(e,n,r,i)})},ns={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},rs=(e,t,n,r,i,o,a,s,l,c,u)=>{const d=c.length;let h=s;for(let s=0;s<d;s+=1){let d=n[0]*c[s];for(let t=1;t<i;t+=1){const r=h-t&l-1;d+=n[t]*o[r],d-=e[t]*a[r]}for(let e=i;e<r;e+=1)d+=n[e]*o[h-e&l-1];for(let n=i;n<t;n+=1)d-=e[n]*a[h-n&l-1];o[h]=c[s],a[h]=d,h=h+1&l-1,u[s]=d}return h},is={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},os=e=>{const t=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=e.decodeAudioData(t.buffer,(()=>{}));return void 0!==n&&(n.catch((()=>{})),!0)}catch{}return!1},as={numberOfChannels:1},ss=(e,t,n)=>{const r=t[n];void 0!==r&&r!==e[n]&&(e[n]=r)},ls=(e,t)=>{ss(e,t,"channelCount"),ss(e,t,"channelCountMode"),ss(e,t,"channelInterpretation")},cs=e=>"function"==typeof e.getFloatTimeDomainData,us=(e,t,n)=>{const r=t[n];void 0!==r&&r!==e[n].value&&(e[n].value=r)},ds=e=>{e.start=(t=>{let n=!1;return(r=0,i=0,o)=>{if(n)throw $a();t.call(e,r,i,o),n=!0}})(e.start)},hs=e=>{var t;e.start=(t=e.start,(n=0,r=0,i)=>{if("number"==typeof i&&i<0||r<0||n<0)throw new RangeError("The parameters can't be negative.");t.call(e,n,r,i)})},fs=e=>{var t;e.stop=(t=e.stop,(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");t.call(e,n)})},ps=e=>{const{port1:t}=new MessageChannel;try{t.postMessage(e)}finally{t.close()}},ms=(e,t)=>null===e?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(e*t))))),gs=e=>new Promise(((t,n)=>{const{port1:r,port2:i}=new MessageChannel;r.onmessage=({data:e})=>{r.close(),i.close(),t(e)},r.onmessageerror=({data:e})=>{r.close(),i.close(),n(e)},i.postMessage(e)})),vs=async(e,t)=>new e(await gs(t)),bs=(e,t,n,r)=>{let i=ko.get(e);void 0===i&&(i=new WeakMap,ko.set(e,i));const o=vs(n,r);return i.set(t,o),o},ys=(e,t)=>{const n=e.createBiquadFilter();return ls(n,t),us(n,t,"Q"),us(n,t,"detune"),us(n,t,"frequency"),us(n,t,"gain"),ss(n,t,"type"),n},ws=e=>{const t=e.numberOfOutputs;Object.defineProperty(e,"channelCount",{get:()=>t,set:e=>{if(e!==t)throw $a()}}),Object.defineProperty(e,"channelCountMode",{get:()=>"explicit",set:e=>{if("explicit"!==e)throw $a()}}),Object.defineProperty(e,"channelInterpretation",{get:()=>"discrete",set:e=>{if("discrete"!==e)throw $a()}})},Ss=(e,t)=>{const n=e.createChannelSplitter(t.numberOfOutputs);return ls(n,t),ws(n),n},xs=(e,t)=>(e.connect=t.connect.bind(t),e.disconnect=t.disconnect.bind(t),e),Ms=(e,t)=>{const n=e.createDelay(t.maxDelayTime);return ls(n,t),us(n,t,"delayTime"),n},_s=(e,t)=>{const n=e.createGain();return ls(n,t),us(n,t,"gain"),n};function As(e,t){const n=t[0]*t[0]+t[1]*t[1];return[(e[0]*t[0]+e[1]*t[1])/n,(e[1]*t[0]-e[0]*t[1])/n]}function Es(e,t){let n=[0,0];for(let o=e.length-1;o>=0;o-=1)i=t,n=[(r=n)[0]*i[0]-r[1]*i[1],r[0]*i[1]+r[1]*i[0]],n[0]+=e[o];var r,i;return n}const Cs=(e,t,n,r)=>e.createScriptProcessor(t,n,r),Ts=()=>new DOMException("","NotSupportedError"),Is={numberOfChannels:1},ks={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},Rs={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},Os={disableNormalization:!1},Ps={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},Ns=()=>new DOMException("","UnknownError"),Bs={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},Ls=(e,t,n)=>void 0===e.copyFromChannel?e.getChannelData(n)[0]:(e.copyFromChannel(t,n),t[0]),Ds=e=>{if(null===e)return!1;const t=e.length;return t%2!=0?0!==e[Math.floor(t/2)]:e[t/2-1]+e[t/2]!==0},Us=(e,t,n,r)=>{let i=e;for(;!i.hasOwnProperty(t);)i=Object.getPrototypeOf(i);const{get:o,set:a}=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,{get:n(o),set:r(a)})},Fs=(e,t,n)=>{try{e.setValueAtTime(t,n)}catch(r){if(9!==r.code)throw r;Fs(e,t,n+1e-7)}},zs=e=>{const t=e.createOscillator();try{t.start(-1)}catch(e){return e instanceof RangeError}return!1},js=e=>{const t=e.createBuffer(1,1,44100),n=e.createBufferSource();n.buffer=t,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},Hs=e=>{const t=e.createOscillator();try{t.stop(-1)}catch(e){return e instanceof RangeError}return!1},Gs=(e,t)=>{const n=t.createGain();e.connect(n);const r=(i=e.disconnect,()=>{i.call(e,n),e.removeEventListener("ended",r)});var i;e.addEventListener("ended",r),xs(e,n),e.stop=(t=>{let r=!1;return(i=0)=>{if(r)try{t.call(e,i)}catch{n.gain.setValueAtTime(0,i)}else t.call(e,i),r=!0}})(e.stop)},Vs=(e,t)=>n=>{const r={value:e};return Object.defineProperties(n,{currentTarget:r,target:r}),"function"==typeof t?t.call(e,n):t.handleEvent.call(e,n)},Ws=(qs=pa,(e,t,[n,r,i],o)=>{qs(e[r],[t,n,i],(e=>e[0]===t&&e[1]===n),o)});var qs;const Ks=(e=>(t,n,[r,i,o],a)=>{const s=t.get(r);void 0===s?t.set(r,new Set([[i,n,o]])):e(s,[i,n,o],(e=>e[0]===i&&e[1]===n),a)})(pa),Js=(Qs=Uo,(e,t,n,r)=>Qs(e[r],(e=>e[0]===t&&e[1]===n)));var Qs;const Xs=new WeakMap,Ys=(Zs=Xs,e=>{var t;return null!==(t=Zs.get(e))&&void 0!==t?t:0});var Zs;const $s=(el=new Map,tl=new WeakMap,(e,t)=>{const n=tl.get(e);if(void 0!==n)return n;const r=el.get(e);if(void 0!==r)return r;try{const n=t();return n instanceof Promise?(el.set(e,n),n.catch((()=>!1)).then((t=>(el.delete(e),tl.set(e,t),t)))):(tl.set(e,n),n)}catch{return tl.set(e,!1),!1}});var el,tl;const nl="undefined"==typeof window?null:window,rl=(il=$s,ol=Jo,(e,t)=>{const n=e.createAnalyser();if(ls(n,t),!(t.maxDecibels>t.minDecibels))throw ol();return ss(n,t,"fftSize"),ss(n,t,"maxDecibels"),ss(n,t,"minDecibels"),ss(n,t,"smoothingTimeConstant"),il(cs,(()=>cs(n)))||(e=>{e.getFloatTimeDomainData=t=>{const n=new Uint8Array(t.length);e.getByteTimeDomainData(n);const r=Math.max(n.length,e.fftSize);for(let e=0;e<r;e+=1)t[e]=.0078125*(n[e]-128);return t}})(n),n});var il,ol;const al=(sl=sa,e=>{const t=sl(e);if(null===t.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return t.renderer});var sl;const ll=((e,t,n)=>async(r,i,o)=>{const a=e(r);await Promise.all(a.activeInputs.map(((e,a)=>Array.from(e).map((async([e,s])=>{const l=t(e),c=await l.render(e,i),u=r.context.destination;n(e)||r===u&&n(r)||c.connect(o,s,a)})))).reduce(((e,t)=>[...e,...t]),[]))})(sa,al,Ea),cl=(ul=rl,dl=_a,hl=ll,()=>{const e=new WeakMap;return{render(t,n){const r=e.get(n);return void 0!==r?Promise.resolve(r):(async(t,n)=>{let r=dl(t);if(!qo(r,n)){const e={channelCount:r.channelCount,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,fftSize:r.fftSize,maxDecibels:r.maxDecibels,minDecibels:r.minDecibels,smoothingTimeConstant:r.smoothingTimeConstant};r=ul(n,e)}return e.set(n,r),await hl(t,n,r),r})(t,n)}}});var ul,dl,hl;const fl=(pl=Eo,e=>{const t=pl.get(e);if(void 0===t)throw $a();return t});var pl;const ml=(e=>null===e?null:e.hasOwnProperty("OfflineAudioContext")?e.OfflineAudioContext:e.hasOwnProperty("webkitOfflineAudioContext")?e.webkitOfflineAudioContext:null)(nl),gl=(vl=ml,e=>null!==vl&&e instanceof vl);var vl;const bl=new WeakMap,yl=(wl=Vs,class{constructor(e){this._nativeEventTarget=e,this._listeners=new WeakMap}addEventListener(e,t,n){if(null!==t){let r=this._listeners.get(t);void 0===r&&(r=wl(this,t),"function"==typeof t&&this._listeners.set(t,r)),this._nativeEventTarget.addEventListener(e,r,n)}}dispatchEvent(e){return this._nativeEventTarget.dispatchEvent(e)}removeEventListener(e,t,n){const r=null===t?void 0:this._listeners.get(t);this._nativeEventTarget.removeEventListener(e,void 0===r?null:r,n)}});var wl;const Sl=(e=>null===e?null:e.hasOwnProperty("AudioContext")?e.AudioContext:e.hasOwnProperty("webkitAudioContext")?e.webkitAudioContext:null)(nl),xl=(Ml=Sl,e=>null!==Ml&&e instanceof Ml);var Ml;const _l=(e=>t=>null!==e&&"function"==typeof e.AudioNode&&t instanceof e.AudioNode)(nl),Al=(e=>t=>null!==e&&"function"==typeof e.AudioParam&&t instanceof e.AudioParam)(nl),El=(e=>null===e?null:e.hasOwnProperty("AudioWorkletNode")?e.AudioWorkletNode:null)(nl),Cl=((e,t,n,r,i,o,a,s,l,c,u,d,h,f,p,m)=>class extends c{constructor(t,r,i,o){super(i),this._context=t,this._nativeAudioNode=i;const a=u(t);d(a)&&!0!==n(Ta,(()=>Ta(a,m)))&&Ra(i),Mo.set(this,i),Co.set(this,new Set),"closed"!==t.state&&r&&jo(this),e(this,o,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(e){this._nativeAudioNode.channelCount=e}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(e){this._nativeAudioNode.channelCountMode=e}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(e){this._nativeAudioNode.channelInterpretation=e}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(e,n=0,s=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();const c=u(this._context),d=p(c);if(h(e)||f(e))throw o();if(ha(e)){const i=_a(e);try{const t=ba(this._nativeAudioNode,i,n,s),r=Ca(this);(d||r)&&this._nativeAudioNode.disconnect(...t),"closed"!==this.context.state&&!r&&Ca(e)&&jo(e)}catch(e){if(12===e.code)throw o();throw e}if(t(this,e,n,s,d)){const t=l([this],e);Ia(t,r(d))}return e}const m=Aa(e);if("playbackRate"===m.name&&1024===m.maxValue)throw a();try{this._nativeAudioNode.connect(m,n),(d||Ca(this))&&this._nativeAudioNode.disconnect(m,n)}catch(e){if(12===e.code)throw o();throw e}if(Oa(this,e,n,d)){const t=l([this],e);Ia(t,r(d))}}disconnect(e,t,n){let r;const a=u(this._context),c=p(a);if(void 0===e)r=((e,t)=>{const n=sa(e),r=[];for(const i of n.outputs)fa(i)?Pa(e,t,...i):Na(e,t,...i),r.push(i[0]);return n.outputs.clear(),r})(this,c);else if("number"==typeof e){if(e<0||e>=this.numberOfOutputs)throw i();r=((e,t,n)=>{const r=sa(e),i=[];for(const o of r.outputs)o[1]===n&&(fa(o)?Pa(e,t,...o):Na(e,t,...o),i.push(o[0]),r.outputs.delete(o));return i})(this,c,e)}else{if(void 0!==t&&(t<0||t>=this.numberOfOutputs))throw i();if(ha(e)&&void 0!==n&&(n<0||n>=e.numberOfInputs))throw i();if(r=((e,t,n,r,i)=>{const o=sa(e);return Array.from(o.outputs).filter((e=>!(e[0]!==n||void 0!==r&&e[1]!==r||void 0!==i&&e[2]!==i))).map((n=>(fa(n)?Pa(e,t,...n):Na(e,t,...n),o.outputs.delete(n),n[0])))})(this,c,e,t,n),0===r.length)throw o()}for(const e of r){const t=l([this],e);Ia(t,s)}}})((Tl=xo,(e,t,n)=>{const r=[];for(let e=0;e<n.numberOfInputs;e+=1)r.push(new Set);Tl.set(e,{activeInputs:r,outputs:new Set,passiveInputs:new WeakMap,renderer:t})}),((e,t,n,r,i,o,a,s,l,c,u,d,h)=>{const f=new WeakMap;return(p,m,g,v,b)=>{const{activeInputs:y,passiveInputs:w}=o(m),{outputs:S}=o(p),x=s(p),M=o=>{const s=l(m),c=l(p);if(o){const t=Fo(w,p,g,v);e(y,p,t,!1),b||d(p)||n(c,s,g,v),h(m)&&jo(m)}else{const e=r(y,p,g,v);t(w,v,e,!1),b||d(p)||i(c,s,g,v);const n=a(m);if(0===n)u(m)&&Vo(m,y);else{const e=f.get(m);void 0!==e&&clearTimeout(e),f.set(m,setTimeout((()=>{u(m)&&Vo(m,y)}),1e3*n))}}};return!!c(S,[m,g,v],(e=>e[0]===m&&e[1]===g&&e[2]===v),!0)&&(x.add(M),u(p)?e(y,p,[g,v,M],!0):t(w,v,[p,g,M],!0),!0)}})(Ws,Ks,ba,Js,Ma,sa,Ys,zo,_a,pa,$o,Ea,Ca),$s,((e,t,n,r,i,o)=>a=>(s,l)=>{const c=e.get(s);if(void 0===c){if(!a&&o(s)){const e=r(s),{outputs:o}=n(s);for(const n of o)if(fa(n)){const i=r(n[0]);t(e,i,n[1],n[2])}else{const t=i(n[0]);e.disconnect(t,n[1])}}e.set(s,l)}else e.set(s,c+l)})(To,Ma,sa,_a,Aa,$o),Jo,es,Ts,((e,t,n,r,i,o,a,s)=>(l,c)=>{const u=t.get(l);if(void 0===u)throw new Error("Missing the expected cycle count.");const d=o(l.context),h=s(d);if(u===c){if(t.delete(l),!h&&a(l)){const t=r(l),{outputs:o}=n(l);for(const n of o)if(fa(n)){const i=r(n[0]);e(t,i,n[1],n[2])}else{const e=i(n[0]);t.connect(e,n[1])}}}else t.set(l,u-c)})(ba,To,sa,_a,Aa,fl,$o,gl),((e,t,n)=>function r(i,o){const a=ha(o)?o:n(e,o);if(Qa(a))return[];if(i[0]===a)return[i];if(i.includes(a))return[];const{outputs:s}=t(a);return Array.from(s).map((e=>r([...i,a],e[0]))).reduce(((e,t)=>e.concat(t)),[])})(bl,sa,Do),yl,fl,xl,_l,Al,gl,El);var Tl;const Il=((e,t,n,r,i,o)=>class extends e{constructor(e,n){const a=i(e),s={...Wo,...n},l=r(a,s);super(e,!1,l,o(a)?t():null),this._nativeAnalyserNode=l}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(e){this._nativeAnalyserNode.fftSize=e}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(e){const t=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=e,!(e>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=t,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(e){const t=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=e,!(this._nativeAnalyserNode.maxDecibels>e))throw this._nativeAnalyserNode.minDecibels=t,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(e){this._nativeAnalyserNode.smoothingTimeConstant=e}getByteFrequencyData(e){this._nativeAnalyserNode.getByteFrequencyData(e)}getByteTimeDomainData(e){this._nativeAnalyserNode.getByteTimeDomainData(e)}getFloatFrequencyData(e){this._nativeAnalyserNode.getFloatFrequencyData(e)}getFloatTimeDomainData(e){this._nativeAnalyserNode.getFloatTimeDomainData(e)}})(Cl,cl,Jo,rl,fl,gl),kl=new WeakSet,Rl=(e=>null===e?null:e.hasOwnProperty("AudioBuffer")?e.AudioBuffer:null)(nl),Ol=(Pl=new Uint32Array(1),e=>(Pl[0]=e,Pl[0]));var Pl;const Nl=((e,t)=>n=>{n.copyFromChannel=(r,i,o=0)=>{const a=e(o),s=e(i);if(s>=n.numberOfChannels)throw t();const l=n.length,c=n.getChannelData(s),u=r.length;for(let e=a<0?-a:0;e+a<l&&e<u;e+=1)r[e]=c[e+a]},n.copyToChannel=(r,i,o=0)=>{const a=e(o),s=e(i);if(s>=n.numberOfChannels)throw t();const l=n.length,c=n.getChannelData(s),u=r.length;for(let e=a<0?-a:0;e+a<l&&e<u;e+=1)c[e+a]=r[e]}})(Ol,Jo),Bl=(Ll=Ol,e=>{var t,n;e.copyFromChannel=(t=e.copyFromChannel,(n,r,i=0)=>{const o=Ll(i),a=Ll(r);if(o<e.length)return t.call(e,n,a,o)}),e.copyToChannel=(n=e.copyToChannel,(t,r,i=0)=>{const o=Ll(i),a=Ll(r);if(o<e.length)return n.call(e,t,a,o)})});var Ll;const Dl=((e,t,n,r,i,o,a,s)=>{let l=null;return class c{constructor(c){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:u,numberOfChannels:d,sampleRate:h}={...Xo,...c};null===l&&(l=new i(1,1,44100));const f=null!==r&&t(o,o)?new r({length:u,numberOfChannels:d,sampleRate:h}):l.createBuffer(d,u,h);if(0===f.numberOfChannels)throw n();return"function"!=typeof f.copyFromChannel?(a(f),Qo(f)):t(Ko,(()=>Ko(f)))||s(f),e.add(f),f}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===c.prototype||e.has(t)}}})(kl,$s,Ts,Rl,ml,(Ul=Rl,()=>{if(null===Ul)return!1;try{new Ul({length:1,sampleRate:44100})}catch{return!1}return!0}),Nl,Bl);var Ul;const Fl=(zl=_s,(e,t)=>{const n=zl(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});t.connect(n).connect(e.destination);const r=()=>{t.removeEventListener("ended",r),t.disconnect(n),n.disconnect()};t.addEventListener("ended",r)});var zl;const jl=(Hl=al,Gl=la,Vl=Ea,async(e,t,n)=>{const r=Gl(e);await Promise.all(Array.from(r.activeInputs).map((async([e,r])=>{const i=Hl(e),o=await i.render(e,t);Vl(e)||o.connect(n,r)})))});var Hl,Gl,Vl;const Wl=(ql=jl,(e,t,n)=>ql(t,e,n));var ql;const Kl=((e,t,n,r,i,o,a,s,l,c,u)=>(d,h)=>{const f=d.createBufferSource();return ls(f,h),us(f,h,"playbackRate"),ss(f,h,"buffer"),ss(f,h,"loop"),ss(f,h,"loopEnd"),ss(f,h,"loopStart"),t(n,(()=>n(d)))||ds(f),t(r,(()=>r(d)))||l(f),t(i,(()=>i(d)))||c(f,d),t(o,(()=>o(d)))||hs(f),t(a,(()=>a(d)))||u(f,d),t(s,(()=>s(d)))||fs(f),e(d,f),f})(Fl,$s,(e=>{const t=e.createBufferSource();t.start();try{t.start()}catch{return!0}return!1}),(e=>{const t=e.createBufferSource(),n=e.createBuffer(1,1,44100);t.buffer=n;try{t.start(0,1)}catch{return!1}return!0}),(e=>{const t=e.createBufferSource();t.start();try{t.stop()}catch{return!1}return!0}),zs,js,Hs,(e=>{var t;e.start=(t=e.start,(n=0,r=0,i)=>{const o=e.buffer,a=null===o?r:Math.min(o.duration,r);null!==o&&a>o.duration-.5/e.context.sampleRate?t.call(e,n,0,0):t.call(e,n,a,i)})}),(Jl=Us,(e,t)=>{const n=t.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=n),Jl(e,"buffer",(t=>()=>{const r=t.call(e);return r===n?null:r}),(t=>r=>t.call(e,null===r?n:r)))}),Gs);var Jl;const Ql=((e,t)=>(n,r,i)=>(e(r).replay(i),t(r,n,i)))((e=>t=>{const n=e(t);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer})(la),jl),Xl=((e,t,n,r,i)=>()=>{const o=new WeakMap;let a=null,s=null;return{set start(e){a=e},set stop(e){s=e},render(l,c){const u=o.get(c);return void 0!==u?Promise.resolve(u):(async(l,c)=>{let u=n(l);const d=qo(u,c);if(!d){const e={buffer:u.buffer,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,loop:u.loop,loopEnd:u.loopEnd,loopStart:u.loopStart,playbackRate:u.playbackRate.value};u=t(c,e),null!==a&&u.start(...a),null!==s&&u.stop(s)}return o.set(c,u),d?await e(c,l.playbackRate,u.playbackRate):await r(c,l.playbackRate,u.playbackRate),await i(l,c,u),u})(l,c)}}})(Wl,Kl,_a,Ql,ll),Yl=((e,t,n,r,i,o,a,s,l,c,u,d,h)=>(f,p,m,g=null,v=null)=>{const b=new(0,wo.AutomationEventList)(m.defaultValue),y=p?r(b):null,w={get defaultValue(){return m.defaultValue},get maxValue(){return null===g?m.maxValue:g},get minValue(){return null===v?m.minValue:v},get value(){return m.value},set value(e){m.value=e,w.setValueAtTime(e,f.context.currentTime)},cancelAndHoldAtTime(e){if("function"==typeof m.cancelAndHoldAtTime)null===y&&b.flush(f.context.currentTime),b.add(i(e)),m.cancelAndHoldAtTime(e);else{const t=Array.from(b).pop();null===y&&b.flush(f.context.currentTime),b.add(i(e));const n=Array.from(b).pop();m.cancelScheduledValues(e),t!==n&&void 0!==n&&("exponentialRampToValue"===n.type?m.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?m.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?m.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&m.setValueCurveAtTime(n.values,n.startTime,n.duration))}return w},cancelScheduledValues:e=>(null===y&&b.flush(f.context.currentTime),b.add(o(e)),m.cancelScheduledValues(e),w),exponentialRampToValueAtTime(e,t){if(0===e)throw new RangeError;if(!Number.isFinite(t)||t<0)throw new RangeError;return null===y&&b.flush(f.context.currentTime),b.add(a(e,t)),m.exponentialRampToValueAtTime(e,t),w},linearRampToValueAtTime:(e,t)=>(null===y&&b.flush(f.context.currentTime),b.add(s(e,t)),m.linearRampToValueAtTime(e,t),w),setTargetAtTime:(e,t,n)=>(null===y&&b.flush(f.context.currentTime),b.add(l(e,t,n)),m.setTargetAtTime(e,t,n),w),setValueAtTime:(e,t)=>(null===y&&b.flush(f.context.currentTime),b.add(c(e,t)),m.setValueAtTime(e,t),w),setValueCurveAtTime(e,t,n){const r=e instanceof Float32Array?e:new Float32Array(e);if(null!==d&&"webkitAudioContext"===d.name){const e=t+n,i=f.context.sampleRate,o=Math.ceil(t*i),a=Math.floor(e*i),s=a-o,l=new Float32Array(s);for(let e=0;e<s;e+=1){const a=(r.length-1)/n*((o+e)/i-t),s=Math.floor(a),c=Math.ceil(a);l[e]=s===c?r[s]:(1-(a-s))*r[s]+(1-(c-a))*r[c]}null===y&&b.flush(f.context.currentTime),b.add(u(l,t,n)),m.setValueCurveAtTime(l,t,n);const c=a/i;c<e&&h(w,l[l.length-1],c),h(w,r[r.length-1],e)}else null===y&&b.flush(f.context.currentTime),b.add(u(r,t,n)),m.setValueCurveAtTime(r,t,n);return w}};return n.set(w,m),t.set(w,f),e(w,y),w})((Zl=_o,(e,t)=>{Zl.set(e,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:t})}),bl,Ao,(e=>({replay(t){for(const n of e)if("exponentialRampToValue"===n.type){const{endTime:e,value:r}=n;t.exponentialRampToValueAtTime(r,e)}else if("linearRampToValue"===n.type){const{endTime:e,value:r}=n;t.linearRampToValueAtTime(r,e)}else if("setTarget"===n.type){const{startTime:e,target:r,timeConstant:i}=n;t.setTargetAtTime(r,e,i)}else if("setValue"===n.type){const{startTime:e,value:r}=n;t.setValueAtTime(r,e)}else{if("setValueCurve"!==n.type)throw new Error("Can't apply an unknown automation.");{const{duration:e,startTime:r,values:i}=n;t.setValueCurveAtTime(i,r,e)}}}})),wo.createCancelAndHoldAutomationEvent,wo.createCancelScheduledValuesAutomationEvent,wo.createExponentialRampToValueAutomationEvent,wo.createLinearRampToValueAutomationEvent,wo.createSetTargetAutomationEvent,wo.createSetValueAutomationEvent,wo.createSetValueCurveAutomationEvent,Sl,Fs);var Zl;const $l=((e,t,n,r,i,o,a,s)=>class extends e{constructor(e,r){const s=o(e),l={...ea,...r},c=i(s,l),u=a(s),d=u?t():null;super(e,!1,c,d),this._audioBufferSourceNodeRenderer=d,this._isBufferNullified=!1,this._isBufferSet=null!==l.buffer,this._nativeAudioBufferSourceNode=c,this._onended=null,this._playbackRate=n(this,u,c.playbackRate,Zo,Yo)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(e){if(this._nativeAudioBufferSourceNode.buffer=e,null!==e){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(e){this._nativeAudioBufferSourceNode.loop=e}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(e){this._nativeAudioBufferSourceNode.loopEnd=e}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(e){this._nativeAudioBufferSourceNode.loopStart=e}get onended(){return this._onended}set onended(e){const t="function"==typeof e?s(this,e):null;this._nativeAudioBufferSourceNode.onended=t;const n=this._nativeAudioBufferSourceNode.onended;this._onended=null!==n&&n===t?e:n}get playbackRate(){return this._playbackRate}start(e=0,t=0,n){if(this._nativeAudioBufferSourceNode.start(e,t,n),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===n?[e,t]:[e,t,n]),"closed"!==this.context.state){jo(this);const e=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",e),$o(this)&&Go(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",e)}}stop(e=0){this._nativeAudioBufferSourceNode.stop(e),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=e)}})(Cl,Xl,Yl,$a,Kl,fl,gl,Vs),ec=((e,t,n,r,i,o,a,s)=>class extends e{constructor(e,n){const r=o(e),l=a(r),c=i(r,n,l);super(e,!1,c,l?t(s):null),this._isNodeOfNativeOfflineAudioContext=l,this._nativeAudioDestinationNode=c}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(e>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=e}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=e}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(Cl,(e=>{const t=new WeakMap;return{render(n,r){const i=t.get(r);return void 0!==i?Promise.resolve(i):(async(n,r)=>{const i=r.destination;return t.set(r,i),await e(n,r,i),i})(n,r)}}}),Jo,$a,((e,t)=>(n,r,i)=>{const o=n.destination;if(o.channelCount!==r)try{o.channelCount=r}catch{}i&&"explicit"!==o.channelCountMode&&(o.channelCountMode="explicit"),0===o.maxChannelCount&&Object.defineProperty(o,"maxChannelCount",{value:r});const a=e(n,{channelCount:r,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,gain:1});return t(a,"channelCount",(e=>()=>e.call(a)),(e=>t=>{e.call(a,t);try{o.channelCount=t}catch(e){if(t>o.maxChannelCount)throw e}})),t(a,"channelCountMode",(e=>()=>e.call(a)),(e=>t=>{e.call(a,t),o.channelCountMode=t})),t(a,"channelInterpretation",(e=>()=>e.call(a)),(e=>t=>{e.call(a,t),o.channelInterpretation=t})),Object.defineProperty(a,"maxChannelCount",{get:()=>o.maxChannelCount}),a.connect(o),a})(_s,Us),fl,gl,ll),tc=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=qo(l,s);if(!c){const e={Q:l.Q.value,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,detune:l.detune.value,frequency:l.frequency.value,gain:l.gain.value,type:l.type};l=t(s,e)}return o.set(s,l),c?(await e(s,a.Q,l.Q),await e(s,a.detune,l.detune),await e(s,a.frequency,l.frequency),await e(s,a.gain,l.gain)):(await r(s,a.Q,l.Q),await r(s,a.detune,l.detune),await r(s,a.frequency,l.frequency),await r(s,a.gain,l.gain)),await i(a,s,l),l})(a,s)}}})(Wl,ys,_a,Ql,ll),nc=(e=>(t,n)=>e.set(t,n))(Xs),rc=(ic=Cl,oc=Yl,ac=tc,sc=es,lc=ys,cc=fl,uc=gl,dc=nc,class extends ic{constructor(e,t){const n=cc(e),r={...Ha,...t},i=lc(n,r),o=uc(n);super(e,!1,i,o?ac():null),this._Q=oc(this,o,i.Q,Zo,Yo),this._detune=oc(this,o,i.detune,1200*Math.log2(Zo),-1200*Math.log2(Zo)),this._frequency=oc(this,o,i.frequency,e.sampleRate/2,0),this._gain=oc(this,o,i.gain,40*Math.log10(Zo),Yo),this._nativeBiquadFilterNode=i,dc(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(e){this._nativeBiquadFilterNode.type=e}getFrequencyResponse(e,t,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(e,t,n)}catch(e){if(11===e.code)throw sc();throw e}if(e.length!==t.length||t.length!==n.length)throw sc()}});var ic,oc,ac,sc,lc,cc,uc,dc;const hc=((e,t)=>(n,r,i)=>{const o=new Set;var a,s;return n.connect=(a=n.connect,(i,s=0,l=0)=>{const c=0===o.size;if(t(i))return a.call(n,i,s,l),e(o,[i,s,l],(e=>e[0]===i&&e[1]===s&&e[2]===l),!0),c&&r(),i;a.call(n,i,s),e(o,[i,s],(e=>e[0]===i&&e[1]===s),!0),c&&r()}),n.disconnect=(s=n.disconnect,(e,r,a)=>{const l=o.size>0;if(void 0===e)s.apply(n),o.clear();else if("number"==typeof e){s.call(n,e);for(const t of o)t[1]===e&&o.delete(t)}else{t(e)?s.call(n,e,r,a):s.call(n,e,r);for(const t of o)t[0]!==e||void 0!==r&&t[1]!==r||void 0!==a&&t[2]!==a||o.delete(t)}const c=0===o.size;l&&c&&i()}),n})(pa,_l),fc=(pc=$a,mc=hc,(e,t)=>{t.channelCount=1,t.channelCountMode="explicit",Object.defineProperty(t,"channelCount",{get:()=>1,set:()=>{throw pc()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:()=>{throw pc()}});const n=e.createBufferSource();mc(t,(()=>{const e=t.numberOfInputs;for(let r=0;r<e;r+=1)n.connect(t,0,r)}),(()=>n.disconnect(t)))});var pc,mc;const gc=((e,t)=>(n,r)=>{const i=n.createChannelMerger(r.numberOfInputs);return null!==e&&"webkitAudioContext"===e.name&&t(n,i),ls(i,r),i})(Sl,fc),vc=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!qo(a,o)){const t={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfInputs:a.numberOfInputs};a=e(o,t)}return r.set(o,a),await n(i,o,a),a})(i,o)}}})(gc,_a,ll),bc=((e,t,n,r,i)=>class extends e{constructor(e,o){const a=r(e),s={...Ga,...o};super(e,!1,n(a,s),i(a)?t():null)}})(Cl,vc,gc,fl,gl),yc=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!qo(a,o)){const t={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfOutputs:a.numberOfOutputs};a=e(o,t)}return r.set(o,a),await n(i,o,a),a})(i,o)}}})(Ss,_a,ll),wc=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=r(e),l=o({...Va,...a});super(e,!1,n(s,l),i(s)?t():null)}})(Cl,yc,Ss,fl,gl,(e=>({...e,channelCount:e.numberOfOutputs}))),Sc=((e,t,n,r)=>(i,{offset:o,...a})=>{const s=i.createBuffer(1,2,44100),l=t(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),c=n(i,{...a,gain:o}),u=s.getChannelData(0);u[0]=1,u[1]=1,l.buffer=s,l.loop=!0;const d={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(e){c.channelCount=e},get channelCountMode(){return c.channelCountMode},set channelCountMode(e){c.channelCountMode=e},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(e){c.channelInterpretation=e},get context(){return c.context},get inputs(){return[]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get offset(){return c.gain},get onended(){return l.onended},set onended(e){l.onended=e},addEventListener:(...e)=>l.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>l.dispatchEvent(e[0]),removeEventListener:(...e)=>l.removeEventListener(e[0],e[1],e[2]),start(e=0){l.start.call(l,e)},stop(e=0){l.stop.call(l,e)}};return e(i,l),r(xs(d,c),(()=>l.connect(c)),(()=>l.disconnect(c)))})(Fl,Kl,_s,hc),xc=((e,t,n,r,i)=>(o,a)=>{if(void 0===o.createConstantSource)return n(o,a);const s=o.createConstantSource();return ls(s,a),us(s,a,"offset"),t(r,(()=>r(o)))||hs(s),t(i,(()=>i(o)))||fs(s),e(o,s),s})(Fl,$s,Sc,zs,Hs),Mc=((e,t,n,r,i)=>()=>{const o=new WeakMap;let a=null,s=null;return{set start(e){a=e},set stop(e){s=e},render(l,c){const u=o.get(c);return void 0!==u?Promise.resolve(u):(async(l,c)=>{let u=n(l);const d=qo(u,c);if(!d){const e={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,offset:u.offset.value};u=t(c,e),null!==a&&u.start(a),null!==s&&u.stop(s)}return o.set(c,u),d?await e(c,l.offset,u.offset):await r(c,l.offset,u.offset),await i(l,c,u),u})(l,c)}}})(Wl,xc,_a,Ql,ll),_c=((e,t,n,r,i,o,a)=>class extends e{constructor(e,a){const s=i(e),l={...Wa,...a},c=r(s,l),u=o(s),d=u?n():null;super(e,!1,c,d),this._constantSourceNodeRenderer=d,this._nativeConstantSourceNode=c,this._offset=t(this,u,c.offset,Zo,Yo),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(e){const t="function"==typeof e?a(this,e):null;this._nativeConstantSourceNode.onended=t;const n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===t?e:n}start(e=0){if(this._nativeConstantSourceNode.start(e),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=e),"closed"!==this.context.state){jo(this);const e=()=>{this._nativeConstantSourceNode.removeEventListener("ended",e),$o(this)&&Go(this)};this._nativeConstantSourceNode.addEventListener("ended",e)}}stop(e=0){this._nativeConstantSourceNode.stop(e),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=e)}})(Cl,Yl,Mc,xc,fl,gl,Vs),Ac=((e,t)=>(n,r)=>{const i=n.createConvolver();if(ls(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),ss(i,r,"buffer"),r.channelCount>2)throw e();if(t(i,"channelCount",(e=>()=>e.call(i)),(t=>n=>{if(n>2)throw e();return t.call(i,n)})),"max"===r.channelCountMode)throw e();return t(i,"channelCountMode",(e=>()=>e.call(i)),(t=>n=>{if("max"===n)throw e();return t.call(i,n)})),i})(Ts,Us),Ec=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!qo(a,o)){const t={buffer:a.buffer,channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,disableNormalization:!a.normalize};a=e(o,t)}return r.set(o,a),va(a)?await n(i,o,a.inputs[0]):await n(i,o,a),a})(i,o)}}})(Ac,_a,ll),Cc=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=r(e),l={...qa,...a},c=n(s,l);super(e,!1,c,i(s)?t():null),this._isBufferNullified=!1,this._nativeConvolverNode=c,null!==l.buffer&&o(this,l.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(e){if(this._nativeConvolverNode.buffer=e,null===e&&null!==this._nativeConvolverNode.buffer){const e=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=e.createBuffer(1,1,e.sampleRate),this._isBufferNullified=!0,o(this,0)}else this._isBufferNullified=!1,o(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(e){this._nativeConvolverNode.normalize=e}})(Cl,Ec,Ac,fl,gl,nc),Tc=((e,t,n,r,i)=>o=>{const a=new WeakMap;return{render(s,l){const c=a.get(l);return void 0!==c?Promise.resolve(c):(async(s,l)=>{let c=n(s);const u=qo(c,l);if(!u){const e={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:o};c=t(l,e)}return a.set(l,c),u?await e(l,s.delayTime,c.delayTime):await r(l,s.delayTime,c.delayTime),await i(s,l,c),c})(s,l)}}})(Wl,Ms,_a,Ql,ll),Ic=((e,t,n,r,i,o,a)=>class extends e{constructor(e,s){const l=i(e),c={...Ja,...s},u=r(l,c),d=o(l);super(e,!1,u,d?n(c.maxDelayTime):null),this._delayTime=t(this,d,u.delayTime),a(this,c.maxDelayTime)}get delayTime(){return this._delayTime}})(Cl,Yl,Tc,Ms,fl,gl,nc),kc=(Rc=Ts,(e,t)=>{const n=e.createDynamicsCompressor();if(ls(n,t),t.channelCount>2)throw Rc();if("max"===t.channelCountMode)throw Rc();return us(n,t,"attack"),us(n,t,"knee"),us(n,t,"ratio"),us(n,t,"release"),us(n,t,"threshold"),n});var Rc;const Oc=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=qo(l,s);if(!c){const e={attack:l.attack.value,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,knee:l.knee.value,ratio:l.ratio.value,release:l.release.value,threshold:l.threshold.value};l=t(s,e)}return o.set(s,l),c?(await e(s,a.attack,l.attack),await e(s,a.knee,l.knee),await e(s,a.ratio,l.ratio),await e(s,a.release,l.release),await e(s,a.threshold,l.threshold)):(await r(s,a.attack,l.attack),await r(s,a.knee,l.knee),await r(s,a.ratio,l.ratio),await r(s,a.release,l.release),await r(s,a.threshold,l.threshold)),await i(a,s,l),l})(a,s)}}})(Wl,kc,_a,Ql,ll),Pc=((e,t,n,r,i,o,a,s)=>class extends e{constructor(e,i){const l=o(e),c={...Ya,...i},u=r(l,c),d=a(l);super(e,!1,u,d?n():null),this._attack=t(this,d,u.attack),this._knee=t(this,d,u.knee),this._nativeDynamicsCompressorNode=u,this._ratio=t(this,d,u.ratio),this._release=t(this,d,u.release),this._threshold=t(this,d,u.threshold),s(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(e){const t=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=e,e>2)throw this._nativeDynamicsCompressorNode.channelCount=t,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(e){const t=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=e,"max"===e)throw this._nativeDynamicsCompressorNode.channelCountMode=t,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}})(Cl,Yl,Oc,kc,Ts,fl,gl,nc),Nc=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=qo(l,s);if(!c){const e={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,gain:l.gain.value};l=t(s,e)}return o.set(s,l),c?await e(s,a.gain,l.gain):await r(s,a.gain,l.gain),await i(a,s,l),l})(a,s)}}})(Wl,_s,_a,Ql,ll),Bc=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=i(e),l={...Za,...a},c=r(s,l),u=o(s);super(e,!1,c,u?n():null),this._gain=t(this,u,c.gain,Zo,Yo)}get gain(){return this._gain}})(Cl,Yl,Nc,_s,fl,gl),Lc=((e,t,n,r)=>(i,o,{channelCount:a,channelCountMode:s,channelInterpretation:l,feedback:c,feedforward:u})=>{const d=ms(o,i.sampleRate),h=c instanceof Float64Array?c:new Float64Array(c),f=u instanceof Float64Array?u:new Float64Array(u),p=h.length,m=f.length,g=Math.min(p,m);if(0===p||p>20)throw r();if(0===h[0])throw t();if(0===m||m>20)throw r();if(0===f[0])throw t();if(1!==h[0]){for(let e=0;e<m;e+=1)f[e]/=h[0];for(let e=1;e<p;e+=1)h[e]/=h[0]}const v=n(i,d,a,a);v.channelCount=a,v.channelCountMode=s,v.channelInterpretation=l;const b=[],y=[],w=[];for(let e=0;e<a;e+=1){b.push(0);const e=new Float32Array(32),t=new Float32Array(32);e.fill(0),t.fill(0),y.push(e),w.push(t)}v.onaudioprocess=e=>{const t=e.inputBuffer,n=e.outputBuffer,r=t.numberOfChannels;for(let e=0;e<r;e+=1){const r=t.getChannelData(e),i=n.getChannelData(e);b[e]=rs(h,p,f,m,g,y[e],w[e],b[e],32,r,i)}};const S=i.sampleRate/2;return xs({get bufferSize(){return d},get channelCount(){return v.channelCount},set channelCount(e){v.channelCount=e},get channelCountMode(){return v.channelCountMode},set channelCountMode(e){v.channelCountMode=e},get channelInterpretation(){return v.channelInterpretation},set channelInterpretation(e){v.channelInterpretation=e},get context(){return v.context},get inputs(){return[v]},get numberOfInputs(){return v.numberOfInputs},get numberOfOutputs(){return v.numberOfOutputs},addEventListener:(...e)=>v.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>v.dispatchEvent(e[0]),getFrequencyResponse(t,n,r){if(t.length!==n.length||n.length!==r.length)throw e();const i=t.length;for(let e=0;e<i;e+=1){const i=-Math.PI*(t[e]/S),o=[Math.cos(i),Math.sin(i)],a=As(Es(f,o),Es(h,o));n[e]=Math.sqrt(a[0]*a[0]+a[1]*a[1]),r[e]=Math.atan2(a[1],a[0])}},removeEventListener:(...e)=>v.removeEventListener(e[0],e[1],e[2])},v)})(es,$a,Cs,Ts),Dc=((e,t,n,r)=>i=>e(os,(()=>os(i)))?Promise.resolve(e(r,r)).then((e=>{if(!e){const e=n(i,512,0,1);i.oncomplete=()=>{e.onaudioprocess=null,e.disconnect()},e.onaudioprocess=()=>i.currentTime,e.connect(i.destination)}return i.startRendering()})):new Promise((e=>{const n=t(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=t=>{n.disconnect(),e(t.renderedBuffer)},n.connect(i.destination),i.startRendering()})))($s,_s,Cs,((e,t)=>()=>{if(null===t)return Promise.resolve(!1);const n=new t(1,1,44100),r=e(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise((e=>{n.oncomplete=()=>{r.disconnect(),e(0!==n.currentTime)},n.startRendering()}))})(_s,ml)),Uc=((e,t,n,r,i)=>(o,a)=>{const s=new WeakMap;let l=null;const c=async(c,u)=>{let d=null,h=t(c);const f=qo(h,u);if(void 0===u.createIIRFilter?d=e(u,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):f||(h=u.createIIRFilter(a,o)),s.set(u,null===d?h:d),null!==d){if(null===l){if(null===n)throw new Error("Missing the native OfflineAudioContext constructor.");const e=new n(c.context.destination.channelCount,c.context.length,u.sampleRate);l=(async()=>{await r(c,e,e.destination);return((e,t,n,r)=>{const i=n instanceof Float64Array?n:new Float64Array(n),o=r instanceof Float64Array?r:new Float64Array(r),a=i.length,s=o.length,l=Math.min(a,s);if(1!==i[0]){for(let e=0;e<a;e+=1)o[e]/=i[0];for(let e=1;e<s;e+=1)i[e]/=i[0]}const c=new Float32Array(32),u=new Float32Array(32),d=t.createBuffer(e.numberOfChannels,e.length,e.sampleRate),h=e.numberOfChannels;for(let t=0;t<h;t+=1){const n=e.getChannelData(t),r=d.getChannelData(t);c.fill(0),u.fill(0),rs(i,a,o,s,l,c,u,0,32,n,r)}return d})(await i(e),u,o,a)})()}const e=await l;return d.buffer=e,d.start(0),d}return await r(c,u,h),h};return{render(e,t){const n=s.get(t);return void 0!==n?Promise.resolve(n):c(e,t)}}})(Kl,_a,ml,ll,Dc),Fc=(zc=Lc,(e,t,n)=>{if(void 0===e.createIIRFilter)return zc(e,t,n);const r=e.createIIRFilter(n.feedforward,n.feedback);return ls(r,n),r});var zc;const jc=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=r(e),l=i(s),c={...ns,...a},u=t(s,l?null:e.baseLatency,c);super(e,!1,u,l?n(c.feedback,c.feedforward):null),ts(u),this._nativeIIRFilterNode=u,o(this,1)}getFrequencyResponse(e,t,n){return this._nativeIIRFilterNode.getFrequencyResponse(e,t,n)}})(Cl,Fc,Uc,fl,gl,nc),Hc=((e,t,n,r,i,o,a,s)=>(l,c)=>{const u=c.listener,{forwardX:d,forwardY:h,forwardZ:f,positionX:p,positionY:m,positionZ:g,upX:v,upY:b,upZ:y}=void 0===u.forwardX?(()=>{const d=new Float32Array(1),h=t(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),f=a(c);let p=!1,m=[0,0,-1,0,1,0],g=[0,0,0];const v=()=>{if(p)return;p=!0;const e=r(c,256,9,0);e.onaudioprocess=({inputBuffer:e})=>{const t=[o(e,d,0),o(e,d,1),o(e,d,2),o(e,d,3),o(e,d,4),o(e,d,5)];t.some(((e,t)=>e!==m[t]))&&(u.setOrientation(...t),m=t);const n=[o(e,d,6),o(e,d,7),o(e,d,8)];n.some(((e,t)=>e!==g[t]))&&(u.setPosition(...n),g=n)},h.connect(e)},b=e=>t=>{t!==m[e]&&(m[e]=t,u.setOrientation(...m))},y=e=>t=>{t!==g[e]&&(g[e]=t,u.setPosition(...g))},w=(t,r,o)=>{const a=n(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:r});a.connect(h,0,t),a.start(),Object.defineProperty(a.offset,"defaultValue",{get:()=>r});const u=e({context:l},f,a.offset,Zo,Yo);var d,p,m,g,b,y,w;return s(u,"value",(e=>()=>e.call(u)),(e=>t=>{try{e.call(u,t)}catch(e){if(9!==e.code)throw e}v(),f&&o(t)})),u.cancelAndHoldAtTime=(d=u.cancelAndHoldAtTime,f?()=>{throw i()}:(...e)=>{const t=d.apply(u,e);return v(),t}),u.cancelScheduledValues=(p=u.cancelScheduledValues,f?()=>{throw i()}:(...e)=>{const t=p.apply(u,e);return v(),t}),u.exponentialRampToValueAtTime=(m=u.exponentialRampToValueAtTime,f?()=>{throw i()}:(...e)=>{const t=m.apply(u,e);return v(),t}),u.linearRampToValueAtTime=(g=u.linearRampToValueAtTime,f?()=>{throw i()}:(...e)=>{const t=g.apply(u,e);return v(),t}),u.setTargetAtTime=(b=u.setTargetAtTime,f?()=>{throw i()}:(...e)=>{const t=b.apply(u,e);return v(),t}),u.setValueAtTime=(y=u.setValueAtTime,f?()=>{throw i()}:(...e)=>{const t=y.apply(u,e);return v(),t}),u.setValueCurveAtTime=(w=u.setValueCurveAtTime,f?()=>{throw i()}:(...e)=>{const t=w.apply(u,e);return v(),t}),u};return{forwardX:w(0,0,b(0)),forwardY:w(1,0,b(1)),forwardZ:w(2,-1,b(2)),positionX:w(6,0,y(0)),positionY:w(7,0,y(1)),positionZ:w(8,0,y(2)),upX:w(3,0,b(3)),upY:w(4,1,b(4)),upZ:w(5,0,b(5))}})():u;return{get forwardX(){return d},get forwardY(){return h},get forwardZ(){return f},get positionX(){return p},get positionY(){return m},get positionZ(){return g},get upX(){return v},get upY(){return b},get upZ(){return y}}})(Yl,gc,xc,Cs,Ts,Ls,gl,Us),Gc=new WeakMap,Vc=((e,t,n,r,i,o)=>class extends n{constructor(n,o){super(n),this._nativeContext=n,Eo.set(this,n),r(n)&&i.set(n,new Set),this._destination=new e(this,o),this._listener=t(this,n),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(e){const t="function"==typeof e?o(this,e):null;this._nativeContext.onstatechange=t;const n=this._nativeContext.onstatechange;this._onstatechange=null!==n&&n===t?e:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}})(ec,Hc,yl,gl,Gc,Vs),Wc=((e,t,n,r,i,o)=>(a,s)=>{const l=a.createOscillator();return ls(l,s),us(l,s,"detune"),us(l,s,"frequency"),void 0!==s.periodicWave?l.setPeriodicWave(s.periodicWave):ss(l,s,"type"),t(n,(()=>n(a)))||hs(l),t(r,(()=>r(a)))||o(l,a),t(i,(()=>i(a)))||fs(l),e(a,l),l})(Fl,$s,zs,js,Hs,Gs),qc=((e,t,n,r,i)=>()=>{const o=new WeakMap;let a=null,s=null,l=null;return{set periodicWave(e){a=e},set start(e){s=e},set stop(e){l=e},render(c,u){const d=o.get(u);return void 0!==d?Promise.resolve(d):(async(c,u)=>{let d=n(c);const h=qo(d,u);if(!h){const e={channelCount:d.channelCount,channelCountMode:d.channelCountMode,channelInterpretation:d.channelInterpretation,detune:d.detune.value,frequency:d.frequency.value,periodicWave:null===a?void 0:a,type:d.type};d=t(u,e),null!==s&&d.start(s),null!==l&&d.stop(l)}return o.set(u,d),h?(await e(u,c.detune,d.detune),await e(u,c.frequency,d.frequency)):(await r(u,c.detune,d.detune),await r(u,c.frequency,d.frequency)),await i(c,u,d),d})(c,u)}}})(Wl,Wc,_a,Ql,ll),Kc=((e,t,n,r,i,o,a)=>class extends e{constructor(e,a){const s=i(e),l={...ks,...a},c=n(s,l),u=o(s),d=u?r():null,h=e.sampleRate/2;super(e,!1,c,d),this._detune=t(this,u,c.detune,153600,-153600),this._frequency=t(this,u,c.frequency,h,-h),this._nativeOscillatorNode=c,this._onended=null,this._oscillatorNodeRenderer=d,null!==this._oscillatorNodeRenderer&&void 0!==l.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=l.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(e){const t="function"==typeof e?a(this,e):null;this._nativeOscillatorNode.onended=t;const n=this._nativeOscillatorNode.onended;this._onended=null!==n&&n===t?e:n}get type(){return this._nativeOscillatorNode.type}set type(e){this._nativeOscillatorNode.type=e,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(e){this._nativeOscillatorNode.setPeriodicWave(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=e)}start(e=0){if(this._nativeOscillatorNode.start(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=e),"closed"!==this.context.state){jo(this);const e=()=>{this._nativeOscillatorNode.removeEventListener("ended",e),$o(this)&&Go(this)};this._nativeOscillatorNode.addEventListener("ended",e)}}stop(e=0){this._nativeOscillatorNode.stop(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=e)}})(Cl,Yl,Wc,qc,fl,gl,Vs),Jc=(Qc=Kl,(e,t)=>{const n=Qc(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),r=e.createBuffer(1,2,44100);return n.buffer=r,n.loop=!0,n.connect(t),n.start(),()=>{n.stop(),n.disconnect(t)}});var Qc;const Xc=((e,t,n,r,i)=>(o,{curve:a,oversample:s,...l})=>{const c=o.createWaveShaper(),u=o.createWaveShaper();ls(c,l),ls(u,l);const d=n(o,{...l,gain:1}),h=n(o,{...l,gain:-1}),f=n(o,{...l,gain:1}),p=n(o,{...l,gain:-1});let m=null,g=!1,v=null;const b={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(e){d.channelCount=e,h.channelCount=e,c.channelCount=e,f.channelCount=e,u.channelCount=e,p.channelCount=e},get channelCountMode(){return c.channelCountMode},set channelCountMode(e){d.channelCountMode=e,h.channelCountMode=e,c.channelCountMode=e,f.channelCountMode=e,u.channelCountMode=e,p.channelCountMode=e},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(e){d.channelInterpretation=e,h.channelInterpretation=e,c.channelInterpretation=e,f.channelInterpretation=e,u.channelInterpretation=e,p.channelInterpretation=e},get context(){return c.context},get curve(){return v},set curve(n){if(null!==n&&n.length<2)throw t();if(null===n)c.curve=n,u.curve=n;else{const e=n.length,t=new Float32Array(e+2-e%2),r=new Float32Array(e+2-e%2);t[0]=n[0],r[0]=-n[e-1];const i=Math.ceil((e+1)/2),o=(e+1)/2-1;for(let a=1;a<i;a+=1){const s=a/i*o,l=Math.floor(s),c=Math.ceil(s);t[a]=l===c?n[l]:(1-(s-l))*n[l]+(1-(c-s))*n[c],r[a]=l===c?-n[e-1-l]:-(1-(s-l))*n[e-1-l]-(1-(c-s))*n[e-1-c]}t[i]=e%2==1?n[i-1]:(n[i-2]+n[i-1])/2,c.curve=t,u.curve=r}v=n,g&&(r(v)&&null===m?m=e(o,d):null!==m&&(m(),m=null))},get inputs(){return[d]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get oversample(){return c.oversample},set oversample(e){c.oversample=e,u.oversample=e},addEventListener:(...e)=>d.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>d.dispatchEvent(e[0]),removeEventListener:(...e)=>d.removeEventListener(e[0],e[1],e[2])};null!==a&&(b.curve=a instanceof Float32Array?a:new Float32Array(a)),s!==b.oversample&&(b.oversample=s);return i(xs(b,f),(()=>{d.connect(c).connect(f),d.connect(h).connect(u).connect(p).connect(f),g=!0,r(v)&&(m=e(o,d))}),(()=>{d.disconnect(c),c.disconnect(f),d.disconnect(h),h.disconnect(u),u.disconnect(p),p.disconnect(f),g=!1,null!==m&&(m(),m=null)}))})(Jc,$a,_s,Ds,hc),Yc=((e,t,n,r,i,o,a)=>(s,l)=>{const c=s.createWaveShaper();if(null!==o&&"webkitAudioContext"===o.name&&void 0===s.createGain().gain.automationRate)return n(s,l);ls(c,l);const u=null===l.curve||l.curve instanceof Float32Array?l.curve:new Float32Array(l.curve);if(null!==u&&u.length<2)throw t();ss(c,{curve:u},"curve"),ss(c,l,"oversample");let d=null,h=!1;a(c,"curve",(e=>()=>e.call(c)),(t=>n=>(t.call(c,n),h&&(r(n)&&null===d?d=e(s,c):r(n)||null===d||(d(),d=null)),n)));return i(c,(()=>{h=!0,r(c.curve)&&(d=e(s,c))}),(()=>{h=!1,null!==d&&(d(),d=null)}))})(Jc,$a,Xc,Ds,hc,Sl,Us),Zc=((e,t,n,r,i,o,a,s,l,c)=>(u,{coneInnerAngle:d,coneOuterAngle:h,coneOuterGain:f,distanceModel:p,maxDistance:m,orientationX:g,orientationY:v,orientationZ:b,panningModel:y,positionX:w,positionY:S,positionZ:x,refDistance:M,rolloffFactor:_,...A})=>{const E=u.createPanner();if(A.channelCount>2)throw a();if("max"===A.channelCountMode)throw a();ls(E,A);const C={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},T=n(u,{...C,channelInterpretation:"speakers",numberOfInputs:6}),I=r(u,{...A,gain:1}),k=r(u,{...C,gain:1}),R=r(u,{...C,gain:0}),O=r(u,{...C,gain:0}),P=r(u,{...C,gain:0}),N=r(u,{...C,gain:0}),B=r(u,{...C,gain:0}),L=i(u,256,6,1),D=o(u,{...C,curve:new Float32Array([1,1]),oversample:"none"});let U=[g,v,b],F=[w,S,x];const z=new Float32Array(1);L.onaudioprocess=({inputBuffer:e})=>{const t=[l(e,z,0),l(e,z,1),l(e,z,2)];t.some(((e,t)=>e!==U[t]))&&(E.setOrientation(...t),U=t);const n=[l(e,z,3),l(e,z,4),l(e,z,5)];n.some(((e,t)=>e!==F[t]))&&(E.setPosition(...n),F=n)},Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(O.gain,"defaultValue",{get:()=>0}),Object.defineProperty(P.gain,"defaultValue",{get:()=>0}),Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(B.gain,"defaultValue",{get:()=>0});const j={get bufferSize(){},get channelCount(){return E.channelCount},set channelCount(e){if(e>2)throw a();I.channelCount=e,E.channelCount=e},get channelCountMode(){return E.channelCountMode},set channelCountMode(e){if("max"===e)throw a();I.channelCountMode=e,E.channelCountMode=e},get channelInterpretation(){return E.channelInterpretation},set channelInterpretation(e){I.channelInterpretation=e,E.channelInterpretation=e},get coneInnerAngle(){return E.coneInnerAngle},set coneInnerAngle(e){E.coneInnerAngle=e},get coneOuterAngle(){return E.coneOuterAngle},set coneOuterAngle(e){E.coneOuterAngle=e},get coneOuterGain(){return E.coneOuterGain},set coneOuterGain(e){if(e<0||e>1)throw t();E.coneOuterGain=e},get context(){return E.context},get distanceModel(){return E.distanceModel},set distanceModel(e){E.distanceModel=e},get inputs(){return[I]},get maxDistance(){return E.maxDistance},set maxDistance(e){if(e<0)throw new RangeError;E.maxDistance=e},get numberOfInputs(){return E.numberOfInputs},get numberOfOutputs(){return E.numberOfOutputs},get orientationX(){return k.gain},get orientationY(){return R.gain},get orientationZ(){return O.gain},get panningModel(){return E.panningModel},set panningModel(e){E.panningModel=e},get positionX(){return P.gain},get positionY(){return N.gain},get positionZ(){return B.gain},get refDistance(){return E.refDistance},set refDistance(e){if(e<0)throw new RangeError;E.refDistance=e},get rolloffFactor(){return E.rolloffFactor},set rolloffFactor(e){if(e<0)throw new RangeError;E.rolloffFactor=e},addEventListener:(...e)=>I.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>I.dispatchEvent(e[0]),removeEventListener:(...e)=>I.removeEventListener(e[0],e[1],e[2])};d!==j.coneInnerAngle&&(j.coneInnerAngle=d),h!==j.coneOuterAngle&&(j.coneOuterAngle=h),f!==j.coneOuterGain&&(j.coneOuterGain=f),p!==j.distanceModel&&(j.distanceModel=p),m!==j.maxDistance&&(j.maxDistance=m),g!==j.orientationX.value&&(j.orientationX.value=g),v!==j.orientationY.value&&(j.orientationY.value=v),b!==j.orientationZ.value&&(j.orientationZ.value=b),y!==j.panningModel&&(j.panningModel=y),w!==j.positionX.value&&(j.positionX.value=w),S!==j.positionY.value&&(j.positionY.value=S),x!==j.positionZ.value&&(j.positionZ.value=x),M!==j.refDistance&&(j.refDistance=M),_!==j.rolloffFactor&&(j.rolloffFactor=_),1===U[0]&&0===U[1]&&0===U[2]||E.setOrientation(...U),0===F[0]&&0===F[1]&&0===F[2]||E.setPosition(...F);return c(xs(j,E),(()=>{I.connect(E),e(I,D,0,0),D.connect(k).connect(T,0,0),D.connect(R).connect(T,0,1),D.connect(O).connect(T,0,2),D.connect(P).connect(T,0,3),D.connect(N).connect(T,0,4),D.connect(B).connect(T,0,5),T.connect(L).connect(u.destination)}),(()=>{I.disconnect(E),s(I,D,0,0),D.disconnect(k),k.disconnect(T),D.disconnect(R),R.disconnect(T),D.disconnect(O),O.disconnect(T),D.disconnect(P),P.disconnect(T),D.disconnect(N),N.disconnect(T),D.disconnect(B),B.disconnect(T),T.disconnect(L),L.disconnect(u.destination)}))})(ba,$a,gc,_s,Cs,Yc,Ts,Ma,Ls,hc),$c=(eu=Zc,(e,t)=>{const n=e.createPanner();return void 0===n.orientationX?eu(e,t):(ls(n,t),us(n,t,"orientationX"),us(n,t,"orientationY"),us(n,t,"orientationZ"),us(n,t,"positionX"),us(n,t,"positionY"),us(n,t,"positionZ"),ss(n,t,"coneInnerAngle"),ss(n,t,"coneOuterAngle"),ss(n,t,"coneOuterGain"),ss(n,t,"distanceModel"),ss(n,t,"maxDistance"),ss(n,t,"panningModel"),ss(n,t,"refDistance"),ss(n,t,"rolloffFactor"),n)});var eu;const tu=((e,t,n,r,i,o,a,s,l,c)=>()=>{const u=new WeakMap;let d=null;return{render(h,f){const p=u.get(f);return void 0!==p?Promise.resolve(p):(async(h,f)=>{let p=null,m=o(h);const g={channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation},v={...g,coneInnerAngle:m.coneInnerAngle,coneOuterAngle:m.coneOuterAngle,coneOuterGain:m.coneOuterGain,distanceModel:m.distanceModel,maxDistance:m.maxDistance,panningModel:m.panningModel,refDistance:m.refDistance,rolloffFactor:m.rolloffFactor},b=qo(m,f);if("bufferSize"in m)p=r(f,{...g,gain:1});else if(!b){const e={...v,orientationX:m.orientationX.value,orientationY:m.orientationY.value,orientationZ:m.orientationZ.value,positionX:m.positionX.value,positionY:m.positionY.value,positionZ:m.positionZ.value};m=i(f,e)}if(u.set(f,null===p?m:p),null!==p){if(null===d){if(null===a)throw new Error("Missing the native OfflineAudioContext constructor.");const e=new a(6,h.context.length,f.sampleRate),r=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});r.connect(e.destination),d=(async()=>{const t=await Promise.all([h.orientationX,h.orientationY,h.orientationZ,h.positionX,h.positionY,h.positionZ].map((async(t,r)=>{const i=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===r?1:0});return await s(e,t,i.offset),i})));for(let e=0;e<6;e+=1)t[e].connect(r,0,e),t[e].start(0);return c(e)})()}const e=await d,o=r(f,{...g,gain:1});await l(h,f,o);const u=[];for(let t=0;t<e.numberOfChannels;t+=1)u.push(e.getChannelData(t));let m=[u[0][0],u[1][0],u[2][0]],b=[u[3][0],u[4][0],u[5][0]],y=r(f,{...g,gain:1}),w=i(f,{...v,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:b[0],positionY:b[1],positionZ:b[2]});o.connect(y).connect(w.inputs[0]),w.connect(p);for(let t=128;t<e.length;t+=128){const e=[u[0][t],u[1][t],u[2][t]],n=[u[3][t],u[4][t],u[5][t]];if(e.some(((e,t)=>e!==m[t]))||n.some(((e,t)=>e!==b[t]))){m=e,b=n;const a=t/f.sampleRate;y.gain.setValueAtTime(0,a),y=r(f,{...g,gain:0}),w=i(f,{...v,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:b[0],positionY:b[1],positionZ:b[2]}),y.gain.setValueAtTime(1,a),o.connect(y).connect(w.inputs[0]),w.connect(p)}}return p}return b?(await e(f,h.orientationX,m.orientationX),await e(f,h.orientationY,m.orientationY),await e(f,h.orientationZ,m.orientationZ),await e(f,h.positionX,m.positionX),await e(f,h.positionY,m.positionY),await e(f,h.positionZ,m.positionZ)):(await s(f,h.orientationX,m.orientationX),await s(f,h.orientationY,m.orientationY),await s(f,h.orientationZ,m.orientationZ),await s(f,h.positionX,m.positionX),await s(f,h.positionY,m.positionY),await s(f,h.positionZ,m.positionZ)),va(m)?await l(h,f,m.inputs[0]):await l(h,f,m),m})(h,f)}}})(Wl,gc,xc,_s,$c,_a,ml,Ql,ll,Dc),nu=((e,t,n,r,i,o,a)=>class extends e{constructor(e,s){const l=i(e),c={...Rs,...s},u=n(l,c),d=o(l);super(e,!1,u,d?r():null),this._nativePannerNode=u,this._orientationX=t(this,d,u.orientationX,Zo,Yo),this._orientationY=t(this,d,u.orientationY,Zo,Yo),this._orientationZ=t(this,d,u.orientationZ,Zo,Yo),this._positionX=t(this,d,u.positionX,Zo,Yo),this._positionY=t(this,d,u.positionY,Zo,Yo),this._positionZ=t(this,d,u.positionZ,Zo,Yo),a(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(e){this._nativePannerNode.coneInnerAngle=e}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(e){this._nativePannerNode.coneOuterAngle=e}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(e){this._nativePannerNode.coneOuterGain=e}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(e){this._nativePannerNode.distanceModel=e}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(e){this._nativePannerNode.maxDistance=e}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(e){this._nativePannerNode.panningModel=e}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(e){this._nativePannerNode.refDistance=e}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(e){this._nativePannerNode.rolloffFactor=e}})(Cl,Yl,$c,tu,fl,gl,nc),ru=(e=>(t,{disableNormalization:n,imag:r,real:i})=>{const o=r instanceof Float32Array?r:new Float32Array(r),a=i instanceof Float32Array?i:new Float32Array(i),s=t.createPeriodicWave(a,o,{disableNormalization:n});if(Array.from(r).length<2)throw e();return s})(Jo),iu=((e,t,n,r)=>class i{constructor(i,o){const a=t(i),s=r({...Os,...o}),l=e(a,s);return n.add(l),l}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===i.prototype||n.has(e)}})(ru,fl,new WeakSet,(e=>{const{imag:t,real:n}=e;return void 0===t?void 0===n?{...e,imag:[0,0],real:[0,0]}:{...e,imag:Array.from(n,(()=>0)),real:n}:void 0===n?{...e,imag:t,real:Array.from(t,(()=>0))}:{...e,imag:t,real:n}})),ou=((e,t,n,r,i,o)=>{const a=16385,s=new Float32Array([1,1]),l=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},u={...c,oversample:"none"},d=(e,o,d,h,f)=>{if(1===o)return((e,t,i,o)=>{const d=new Float32Array(a),h=new Float32Array(a);for(let e=0;e<a;e+=1){const t=e/16384*l;d[e]=Math.cos(t),h[e]=Math.sin(t)}const f=n(e,{...c,gain:0}),p=r(e,{...u,curve:d}),m=r(e,{...u,curve:s}),g=n(e,{...c,gain:0}),v=r(e,{...u,curve:h});return{connectGraph(){t.connect(f),t.connect(void 0===m.inputs?m:m.inputs[0]),t.connect(g),m.connect(i),i.connect(void 0===p.inputs?p:p.inputs[0]),i.connect(void 0===v.inputs?v:v.inputs[0]),p.connect(f.gain),v.connect(g.gain),f.connect(o,0,0),g.connect(o,0,1)},disconnectGraph(){t.disconnect(f),t.disconnect(void 0===m.inputs?m:m.inputs[0]),t.disconnect(g),m.disconnect(i),i.disconnect(void 0===p.inputs?p:p.inputs[0]),i.disconnect(void 0===v.inputs?v:v.inputs[0]),p.disconnect(f.gain),v.disconnect(g.gain),f.disconnect(o,0,0),g.disconnect(o,0,1)}}})(e,d,h,f);if(2===o)return((e,i,o,d)=>{const h=new Float32Array(a),f=new Float32Array(a),p=new Float32Array(a),m=new Float32Array(a),g=Math.floor(8192.5);for(let e=0;e<a;e+=1)if(e>g){const t=(e-g)/(16384-g)*l;h[e]=Math.cos(t),f[e]=Math.sin(t),p[e]=0,m[e]=1}else{const t=e/(16384-g)*l;h[e]=1,f[e]=0,p[e]=Math.cos(t),m[e]=Math.sin(t)}const v=t(e,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),b=n(e,{...c,gain:0}),y=r(e,{...u,curve:h}),w=n(e,{...c,gain:0}),S=r(e,{...u,curve:f}),x=r(e,{...u,curve:s}),M=n(e,{...c,gain:0}),_=r(e,{...u,curve:p}),A=n(e,{...c,gain:0}),E=r(e,{...u,curve:m});return{connectGraph(){i.connect(v),i.connect(void 0===x.inputs?x:x.inputs[0]),v.connect(b,0),v.connect(w,0),v.connect(M,1),v.connect(A,1),x.connect(o),o.connect(void 0===y.inputs?y:y.inputs[0]),o.connect(void 0===S.inputs?S:S.inputs[0]),o.connect(void 0===_.inputs?_:_.inputs[0]),o.connect(void 0===E.inputs?E:E.inputs[0]),y.connect(b.gain),S.connect(w.gain),_.connect(M.gain),E.connect(A.gain),b.connect(d,0,0),M.connect(d,0,0),w.connect(d,0,1),A.connect(d,0,1)},disconnectGraph(){i.disconnect(v),i.disconnect(void 0===x.inputs?x:x.inputs[0]),v.disconnect(b,0),v.disconnect(w,0),v.disconnect(M,1),v.disconnect(A,1),x.disconnect(o),o.disconnect(void 0===y.inputs?y:y.inputs[0]),o.disconnect(void 0===S.inputs?S:S.inputs[0]),o.disconnect(void 0===_.inputs?_:_.inputs[0]),o.disconnect(void 0===E.inputs?E:E.inputs[0]),y.disconnect(b.gain),S.disconnect(w.gain),_.disconnect(M.gain),E.disconnect(A.gain),b.disconnect(d,0,0),M.disconnect(d,0,0),w.disconnect(d,0,1),A.disconnect(d,0,1)}}})(e,d,h,f);throw i()};return(t,{channelCount:r,channelCountMode:a,pan:s,...l})=>{if("max"===a)throw i();const c=e(t,{...l,channelCount:1,channelCountMode:a,numberOfInputs:2}),u=n(t,{...l,channelCount:r,channelCountMode:a,gain:1}),h=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:s});let{connectGraph:f,disconnectGraph:p}=d(t,r,u,h,c);Object.defineProperty(h.gain,"defaultValue",{get:()=>0}),Object.defineProperty(h.gain,"maxValue",{get:()=>1}),Object.defineProperty(h.gain,"minValue",{get:()=>-1});const m={get bufferSize(){},get channelCount(){return u.channelCount},set channelCount(e){u.channelCount!==e&&(g&&p(),({connectGraph:f,disconnectGraph:p}=d(t,e,u,h,c)),g&&f()),u.channelCount=e},get channelCountMode(){return u.channelCountMode},set channelCountMode(e){if("clamped-max"===e||"max"===e)throw i();u.channelCountMode=e},get channelInterpretation(){return u.channelInterpretation},set channelInterpretation(e){u.channelInterpretation=e},get context(){return u.context},get inputs(){return[u]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return u.numberOfOutputs},get pan(){return h.gain},addEventListener:(...e)=>u.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>u.dispatchEvent(e[0]),removeEventListener:(...e)=>u.removeEventListener(e[0],e[1],e[2])};let g=!1;return o(xs(m,c),(()=>{f(),g=!0}),(()=>{p(),g=!1}))}})(gc,Ss,_s,Yc,Ts,hc),au=((e,t)=>(n,r)=>{const i=r.channelCountMode;if("clamped-max"===i)throw t();if(void 0===n.createStereoPanner)return e(n,r);const o=n.createStereoPanner();return ls(o,r),us(o,r,"pan"),Object.defineProperty(o,"channelCountMode",{get:()=>i,set:e=>{if(e!==i)throw t()}}),o})(ou,Ts),su=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=qo(l,s);if(!c){const e={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,pan:l.pan.value};l=t(s,e)}return o.set(s,l),c?await e(s,a.pan,l.pan):await r(s,a.pan,l.pan),va(l)?await i(a,s,l.inputs[0]):await i(a,s,l),l})(a,s)}}})(Wl,au,_a,Ql,ll),lu=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=i(e),l={...Ps,...a},c=n(s,l),u=o(s);super(e,!1,c,u?r():null),this._pan=t(this,u,c.pan)}get pan(){return this._pan}})(Cl,Yl,au,su,fl,gl),cu=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!qo(a,o)){const t={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,curve:a.curve,oversample:a.oversample};a=e(o,t)}return r.set(o,a),va(a)?await n(i,o,a.inputs[0]):await n(i,o,a),a})(i,o)}}})(Yc,_a,ll),uu=((e,t,n,r,i,o,a)=>class extends e{constructor(e,t){const s=i(e),l={...Bs,...t},c=n(s,l);super(e,!0,c,o(s)?r():null),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,a(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(e){if(null===e)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(e.length<2)throw t();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=e}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(e){this._nativeWaveShaperNode.oversample=e}})(Cl,$a,Yc,cu,fl,gl,nc),du=(e=>null!==e&&e.isSecureContext)(nl),hu=(e=>(t,n,r)=>{Object.defineProperties(e,{currentFrame:{configurable:!0,get:()=>Math.round(t*n)},currentTime:{configurable:!0,get:()=>t}});try{return r()}finally{null!==e&&(delete e.currentFrame,delete e.currentTime)}})(nl),fu=new WeakMap,pu=((e,t)=>n=>{let r=e.get(n);if(void 0!==r)return r;if(null===t)throw new Error("Missing the native OfflineAudioContext constructor.");return r=new t(1,1,44100),e.set(n,r),r})(fu,ml),mu=du?((e,t,n,r,i,o,a,s,l,c,u,d,h)=>{let f=0;return(p,m,g={credentials:"omit"})=>{const v=u.get(p);if(void 0!==v&&v.has(m))return Promise.resolve();const b=c.get(p);if(void 0!==b){const e=b.get(m);if(void 0!==e)return e}const y=o(p),w=void 0===y.audioWorklet?i(m).then((([e,t])=>{const[r,i]=No(e,t);return n(`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}\n})})(window,'_AWGS')`)})).then((()=>{const e=h._AWGS.pop();if(void 0===e)throw new SyntaxError;r(y.currentTime,y.sampleRate,(()=>e(class{},void 0,((e,n)=>{if(""===e.trim())throw t();const r=Io.get(y);if(void 0!==r){if(r.has(e))throw t();Lo(n),Bo(n.parameterDescriptors),r.set(e,n)}else Lo(n),Bo(n.parameterDescriptors),Io.set(y,new Map([[e,n]]))}),y.sampleRate,void 0,void 0)))})):Promise.all([i(m),Promise.resolve(e(d,d))]).then((([[e,t],n])=>{const r=f+1;f=r;const[i,o]=No(e,t),c=new Blob([`${i};((AudioWorkletProcessor,registerProcessor)=>{${o}\n})(${n?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${r}',class extends AudioWorkletProcessor{process(){return !1}})`],{type:"application/javascript; charset=utf-8"}),u=URL.createObjectURL(c);return y.audioWorklet.addModule(u,g).then((()=>{if(s(y))return y;const e=a(y);return e.audioWorklet.addModule(u,g).then((()=>e))})).then((e=>{if(null===l)throw new SyntaxError;try{new l(e,`__sac${r}`)}catch{throw new SyntaxError}})).finally((()=>URL.revokeObjectURL(u)))}));return void 0===b?c.set(p,new Map([[m,w]])):b.set(m,w),w.then((()=>{const e=u.get(p);void 0===e?u.set(p,new Set([m])):e.add(m)})).finally((()=>{const e=c.get(p);void 0!==e&&e.delete(m)})),w}})($s,Ts,(e=>t=>new Promise(((n,r)=>{if(null===e)return void r(new SyntaxError);const i=e.document.head;if(null===i)r(new SyntaxError);else{const o=e.document.createElement("script"),a=new Blob([t],{type:"application/javascript"}),s=URL.createObjectURL(a),l=e.onerror,c=()=>{e.onerror=l,URL.revokeObjectURL(s)};e.onerror=(t,n,i,o,a)=>n===s||n===e.location.href&&1===i&&1===o?(c(),r(a),!1):null!==l?l(t,n,i,o,a):void 0,o.onerror=()=>{c(),r(new SyntaxError)},o.onload=()=>{c(),n()},o.src=s,o.type="module",i.appendChild(o)}})))(nl),hu,(gu=()=>new DOMException("","AbortError"),async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw gu()}),fl,pu,gl,El,new WeakMap,new WeakMap,((e,t)=>async()=>{if(null===e)return!0;if(null===t)return!1;const n=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),r=new t(1,128,44100),i=URL.createObjectURL(n);let o=!1,a=!1;try{await r.audioWorklet.addModule(i);const t=new e(r,"a",{numberOfOutputs:0}),n=r.createOscillator();t.port.onmessage=()=>o=!0,t.onprocessorerror=()=>a=!0,n.connect(t),n.start(0),await r.startRendering()}catch{}finally{URL.revokeObjectURL(i)}return o&&!a})(El,ml),nl):void 0;var gu;const vu=((e,t)=>n=>e(n)||t(n))(xl,gl),bu=((e,t,n,r,i,o,a,s,l,c,u)=>(d,h)=>{const f=a(d)?d:o(d);if(i.has(h)){const e=n();return Promise.reject(e)}try{i.add(h)}catch{}return t(l,(()=>l(f)))?f.decodeAudioData(h).then((n=>(Ka(h).catch((()=>{})),t(s,(()=>s(n)))||u(n),e.add(n),n))):new Promise(((t,n)=>{const i=async()=>{try{await Ka(h)}catch{}},o=e=>{n(e),i()};try{f.decodeAudioData(h,(n=>{"function"!=typeof n.copyFromChannel&&(c(n),Qo(n)),e.add(n),i().then((()=>t(n)))}),(e=>{o(null===e?r():e)}))}catch(e){o(e)}}))})(kl,$s,(()=>new DOMException("","DataCloneError")),(()=>new DOMException("","EncodingError")),new WeakSet,fl,vu,Ko,os,Nl,Bl),yu=(wu=mu,Su=Il,xu=Dl,Mu=$l,_u=rc,Au=bc,Eu=wc,Cu=_c,Tu=Cc,Iu=bu,ku=Ic,Ru=Pc,Ou=Bc,Pu=jc,Nu=Vc,Bu=Kc,Lu=nu,Du=iu,Uu=lu,Fu=uu,class extends Nu{constructor(e,t){super(e,t),this._nativeContext=e,this._audioWorklet=void 0===wu?void 0:{addModule:(e,t)=>wu(this,e,t)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new Su(this)}createBiquadFilter(){return new _u(this)}createBuffer(e,t,n){return new xu({length:t,numberOfChannels:e,sampleRate:n})}createBufferSource(){return new Mu(this)}createChannelMerger(e=6){return new Au(this,{numberOfInputs:e})}createChannelSplitter(e=6){return new Eu(this,{numberOfOutputs:e})}createConstantSource(){return new Cu(this)}createConvolver(){return new Tu(this)}createDelay(e=1){return new ku(this,{maxDelayTime:e})}createDynamicsCompressor(){return new Ru(this)}createGain(){return new Ou(this)}createIIRFilter(e,t){return new Pu(this,{feedback:t,feedforward:e})}createOscillator(){return new Bu(this)}createPanner(){return new Lu(this)}createPeriodicWave(e,t,n={disableNormalization:!1}){return new Du(this,{...n,imag:t,real:e})}createStereoPanner(){return new Uu(this)}createWaveShaper(){return new Fu(this)}decodeAudioData(e,t,n){return Iu(this._nativeContext,e).then((e=>("function"==typeof t&&t(e),e)),(e=>{throw"function"==typeof n&&n(e),e}))}});var wu,Su,xu,Mu,_u,Au,Eu,Cu,Tu,Iu,ku,Ru,Ou,Pu,Nu,Bu,Lu,Du,Uu,Fu;const zu=((e,t,n,r)=>class extends e{constructor(e,i){const o=n(e),a=t(o,i);if(r(o))throw TypeError();super(e,!0,a,null),this._nativeMediaElementAudioSourceNode=a}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}})(Cl,((e,t)=>e.createMediaElementSource(t.mediaElement)),fl,gl),ju=((e,t,n,r)=>class extends e{constructor(e,i){const o=n(e);if(r(o))throw new TypeError;const a={...is,...i},s=t(o,a);super(e,!1,s,null),this._nativeMediaStreamAudioDestinationNode=s}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(Cl,((e,t)=>{const n=e.createMediaStreamDestination();return ls(n,t),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n}),fl,gl),Hu=((e,t,n,r)=>class extends e{constructor(e,i){const o=n(e),a=t(o,i);if(r(o))throw new TypeError;super(e,!0,a,null),this._nativeMediaStreamAudioSourceNode=a}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}})(Cl,((e,{mediaStream:t})=>{const n=t.getAudioTracks();n.sort(((e,t)=>e.id<t.id?-1:e.id>t.id?1:0));const r=n.slice(0,1),i=e.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(i,"mediaStream",{value:t}),i}),fl,gl),Gu=((e,t)=>(n,{mediaStreamTrack:r})=>{if("function"==typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(r);const i=new MediaStream([r]),o=n.createMediaStreamSource(i);if("audio"!==r.kind)throw e();if(t(n))throw new TypeError;return o})($a,gl),Vu=((e,t,n)=>class extends e{constructor(e,r){const i=n(e);super(e,!0,t(i,r),null)}})(Cl,Gu,fl),Wu=((e,t,n,r,i,o,a,s,l)=>class extends e{constructor(e={}){if(null===l)throw new Error("Missing the native AudioContext constructor.");let t;try{t=new l(e)}catch(e){if(12===e.code&&"sampleRate is not in range"===e.message)throw n();throw e}if(null===t)throw r();if(!da(e.latencyHint))throw new TypeError(`The provided value '${e.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(void 0!==e.sampleRate&&t.sampleRate!==e.sampleRate)throw n();super(t,2);const{latencyHint:i}=e,{sampleRate:o}=t;if(this._baseLatency="number"==typeof t.baseLatency?t.baseLatency:"balanced"===i?512/o:"interactive"===i||void 0===i?256/o:"playback"===i?1024/o:128*Math.max(2,Math.min(128,Math.round(i*o/128)))/o,this._nativeAudioContext=t,"webkitAudioContext"===l.name?(this._nativeGainNode=t.createGain(),this._nativeOscillatorNode=t.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(t.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,"running"===t.state){this._state="suspended";const e=()=>{"suspended"===this._state&&(this._state=null),t.removeEventListener("statechange",e)};t.addEventListener("statechange",e)}}get baseLatency(){return this._baseLatency}get state(){return null!==this._state?this._state:this._nativeAudioContext.state}close(){return"closed"===this.state?this._nativeAudioContext.close().then((()=>{throw t()})):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then((()=>{null!==this._nativeGainNode&&null!==this._nativeOscillatorNode&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),ua(this)})))}createMediaElementSource(e){return new i(this,{mediaElement:e})}createMediaStreamDestination(){return new o(this)}createMediaStreamSource(e){return new a(this,{mediaStream:e})}createMediaStreamTrackSource(e){return new s(this,{mediaStreamTrack:e})}resume(){return"suspended"===this._state?new Promise(((e,t)=>{const n=()=>{this._nativeAudioContext.removeEventListener("statechange",n),"running"===this._nativeAudioContext.state?e():this.resume().then(e,t)};this._nativeAudioContext.addEventListener("statechange",n)})):this._nativeAudioContext.resume().catch((e=>{if(void 0===e||15===e.code)throw t();throw e}))}suspend(){return this._nativeAudioContext.suspend().catch((e=>{if(void 0===e)throw t();throw e}))}})(yu,$a,Ts,Ns,zu,ju,Hu,Vu,Sl),qu=(Ku=Gc,e=>{const t=Ku.get(e);if(void 0===t)throw new Error("The context has no set of AudioWorkletNodes.");return t});var Ku;const Ju=(Qu=qu,(e,t)=>{Qu(e).add(t)});var Qu;const Xu=(e=>(t,n,r=0,i=0)=>{const o=t[r];if(void 0===o)throw e();return ka(n)?o.connect(n,0,i):o.connect(n,0)})(Jo),Yu=(e=>(t,n)=>{e(t).delete(n)})(qu),Zu=(e=>(t,n,r,i=0)=>void 0===n?t.forEach((e=>e.disconnect())):"number"==typeof n?Xa(e,t,n).disconnect():ka(n)?void 0===r?t.forEach((e=>e.disconnect(n))):void 0===i?Xa(e,t,r).disconnect(n,0):Xa(e,t,r).disconnect(n,0,i):void 0===r?t.forEach((e=>e.disconnect(n))):Xa(e,t,r).disconnect(n,0))(Jo),$u=new WeakMap,ed=(td=$u,nd=Do,e=>nd(td,e));var td,nd;const rd=((e,t,n,r,i,o,a,s,l,c,u,d,h)=>(f,p,m,g)=>{if(0===g.numberOfInputs&&0===g.numberOfOutputs)throw l();const v=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(v.some((e=>e<1)))throw l();if(v.length!==g.numberOfOutputs)throw t();if("explicit"!==g.channelCountMode)throw l();const b=g.channelCount*g.numberOfInputs,y=v.reduce(((e,t)=>e+t),0),w=void 0===m.parameterDescriptors?0:m.parameterDescriptors.length;if(b+w>6||y>6)throw l();const S=new MessageChannel,x=[],M=[];for(let e=0;e<g.numberOfInputs;e+=1)x.push(a(f,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),M.push(i(f,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const _=[];if(void 0!==m.parameterDescriptors)for(const{defaultValue:e,maxValue:t,minValue:n,name:r}of m.parameterDescriptors){const i=o(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==g.parameterData[r]?g.parameterData[r]:void 0===e?0:e});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===e?0:e},maxValue:{get:()=>void 0===t?Zo:t},minValue:{get:()=>void 0===n?Yo:n}}),_.push(i)}const A=r(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,b+w)}),E=ms(p,f.sampleRate),C=s(f,E,b+w,Math.max(1,y)),T=i(f,{channelCount:Math.max(1,y),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,y)}),I=[];for(let e=0;e<g.numberOfOutputs;e+=1)I.push(r(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:v[e]}));for(let e=0;e<g.numberOfInputs;e+=1){x[e].connect(M[e]);for(let t=0;t<g.channelCount;t+=1)M[e].connect(A,t,e*g.channelCount+t)}const k=new Ba(void 0===m.parameterDescriptors?[]:m.parameterDescriptors.map((({name:e},t)=>{const n=_[t];return n.connect(A,0,b+t),n.start(0),[e,n.offset]})));A.connect(C);let R=g.channelInterpretation,O=null;const P=0===g.numberOfOutputs?[C]:I,N={get bufferSize(){return E},get channelCount(){return g.channelCount},set channelCount(e){throw n()},get channelCountMode(){return g.channelCountMode},set channelCountMode(e){throw n()},get channelInterpretation(){return R},set channelInterpretation(e){for(const t of x)t.channelInterpretation=e;R=e},get context(){return C.context},get inputs(){return x},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},get onprocessorerror(){return O},set onprocessorerror(e){"function"==typeof O&&N.removeEventListener("processorerror",O),O="function"==typeof e?e:null,"function"==typeof O&&N.addEventListener("processorerror",O)},get parameters(){return k},get port(){return S.port2},addEventListener:(...e)=>C.addEventListener(e[0],e[1],e[2]),connect:e.bind(null,P),disconnect:c.bind(null,P),dispatchEvent:(...e)=>C.dispatchEvent(e[0]),removeEventListener:(...e)=>C.removeEventListener(e[0],e[1],e[2])},B=new Map;var L,D;S.port1.addEventListener=(L=S.port1.addEventListener,(...e)=>{if("message"===e[0]){const t="function"==typeof e[1]?e[1]:"object"==typeof e[1]&&null!==e[1]&&"function"==typeof e[1].handleEvent?e[1].handleEvent:null;if(null!==t){const n=B.get(e[1]);void 0!==n?e[1]=n:(e[1]=e=>{u(f.currentTime,f.sampleRate,(()=>t(e)))},B.set(t,e[1]))}}return L.call(S.port1,e[0],e[1],e[2])}),S.port1.removeEventListener=(D=S.port1.removeEventListener,(...e)=>{if("message"===e[0]){const t=B.get(e[1]);void 0!==t&&(B.delete(e[1]),e[1]=t)}return D.call(S.port1,e[0],e[1],e[2])});let U=null;Object.defineProperty(S.port1,"onmessage",{get:()=>U,set:e=>{"function"==typeof U&&S.port1.removeEventListener("message",U),U="function"==typeof e?e:null,"function"==typeof U&&(S.port1.addEventListener("message",U),S.port1.start())}}),m.prototype.port=S.port1;let F=null;bs(f,N,m,g).then((e=>F=e));const z=Fa(g.numberOfInputs,g.channelCount),j=Fa(g.numberOfOutputs,v),H=void 0===m.parameterDescriptors?[]:m.parameterDescriptors.reduce(((e,{name:t})=>({...e,[t]:new Float32Array(128)})),{});let G=!0;const V=()=>{g.numberOfOutputs>0&&C.disconnect(T);for(let e=0,t=0;e<g.numberOfOutputs;e+=1){const n=I[e];for(let r=0;r<v[e];r+=1)T.disconnect(n,t+r,r);t+=v[e]}},W=new Map;C.onaudioprocess=({inputBuffer:e,outputBuffer:t})=>{if(null!==F){const n=d(N);for(let r=0;r<E;r+=128){for(let t=0;t<g.numberOfInputs;t+=1)for(let n=0;n<g.channelCount;n+=1)Da(e,z[t],n,n,r);void 0!==m.parameterDescriptors&&m.parameterDescriptors.forEach((({name:t},n)=>{Da(e,H,t,b+n,r)}));for(let e=0;e<g.numberOfInputs;e+=1)for(let t=0;t<v[e];t+=1)0===j[e][t].byteLength&&(j[e][t]=new Float32Array(128));try{const e=z.map(((e,t)=>{if(n[t].size>0)return W.set(t,E/128),e;const r=W.get(t);return void 0===r?[]:(e.every((e=>e.every((e=>0===e))))&&(1===r?W.delete(t):W.set(t,r-1)),e)})),i=u(f.currentTime+r/f.sampleRate,f.sampleRate,(()=>F.process(e,j,H)));G=i;for(let e=0,n=0;e<g.numberOfOutputs;e+=1){for(let i=0;i<v[e];i+=1)Ua(t,j[e],i,n+i,r);n+=v[e]}}catch(e){G=!1,N.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}))}if(!G){for(let e=0;e<g.numberOfInputs;e+=1){x[e].disconnect(M[e]);for(let t=0;t<g.channelCount;t+=1)M[r].disconnect(A,t,e*g.channelCount+t)}if(void 0!==m.parameterDescriptors){const e=m.parameterDescriptors.length;for(let t=0;t<e;t+=1){const e=_[t];e.disconnect(A,0,b+t),e.stop()}}A.disconnect(C),C.onaudioprocess=null,q?V():Q();break}}}};let q=!1;const K=a(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),J=()=>C.connect(K).connect(f.destination),Q=()=>{C.disconnect(K),K.disconnect()};return J(),h(N,(()=>{if(G){Q(),g.numberOfOutputs>0&&C.connect(T);for(let e=0,t=0;e<g.numberOfOutputs;e+=1){const n=I[e];for(let r=0;r<v[e];r+=1)T.connect(n,t+r,r);t+=v[e]}}q=!0}),(()=>{G&&(J(),V()),q=!1}))})(Xu,Jo,$a,gc,Ss,xc,_s,Cs,Ts,Zu,hu,ed,hc),id=((e,t,n,r,i)=>(o,a,s,l,c,u)=>{if(null!==s)try{const t=new s(o,l,u),r=new Map;let a=null;if(Object.defineProperties(t,{channelCount:{get:()=>u.channelCount,set:()=>{throw e()}},channelCountMode:{get:()=>"explicit",set:()=>{throw e()}},onprocessorerror:{get:()=>a,set:e=>{"function"==typeof a&&t.removeEventListener("processorerror",a),a="function"==typeof e?e:null,"function"==typeof a&&t.addEventListener("processorerror",a)}}}),t.addEventListener=(h=t.addEventListener,(...e)=>{if("processorerror"===e[0]){const t="function"==typeof e[1]?e[1]:"object"==typeof e[1]&&null!==e[1]&&"function"==typeof e[1].handleEvent?e[1].handleEvent:null;if(null!==t){const n=r.get(e[1]);void 0!==n?e[1]=n:(e[1]=n=>{"error"===n.type?(Object.defineProperties(n,{type:{value:"processorerror"}}),t(n)):t(new ErrorEvent(e[0],{...n}))},r.set(t,e[1]))}}return h.call(t,"error",e[1],e[2]),h.call(t,...e)}),t.removeEventListener=(d=t.removeEventListener,(...e)=>{if("processorerror"===e[0]){const t=r.get(e[1]);void 0!==t&&(r.delete(e[1]),e[1]=t)}return d.call(t,"error",e[1],e[2]),d.call(t,e[0],e[1],e[2])}),0!==u.numberOfOutputs){const e=n(o,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});t.connect(e).connect(o.destination);return i(t,(()=>e.disconnect()),(()=>e.connect(o.destination)))}return t}catch(e){if(11===e.code)throw r();throw e}var d,h;if(void 0===c)throw r();return ps(u),t(o,a,c,u)})($a,rd,_s,Ts,hc),od=((e,t,n,r,i,o,a,s,l,c,u,d,h,f,p,m)=>(g,v,b)=>{const y=new WeakMap;let w=null;return{render(S,x){s(x,S);const M=y.get(x);return void 0!==M?Promise.resolve(M):(async(s,S)=>{let x=u(s),M=null;const _=qo(x,S),A=Array.isArray(v.outputChannelCount)?v.outputChannelCount:Array.from(v.outputChannelCount);if(null===d){const e=A.reduce(((e,t)=>e+t),0),n=i(S,{channelCount:Math.max(1,e),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,e)}),o=[];for(let e=0;e<s.numberOfOutputs;e+=1)o.push(r(S,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:A[e]}));const c=a(S,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1});c.connect=t.bind(null,o),c.disconnect=l.bind(null,o),M=[n,o,c]}else _||(x=new d(S,g));if(y.set(S,null===M?x:M[2]),null!==M){if(null===w){if(void 0===b)throw new Error("Missing the processor constructor.");if(null===h)throw new Error("Missing the native OfflineAudioContext constructor.");const e=s.channelCount*s.numberOfInputs,t=void 0===b.parameterDescriptors?0:b.parameterDescriptors.length,n=e+t,l=async()=>{const l=new h(n,128*Math.ceil(s.context.length/128),S.sampleRate),c=[],u=[];for(let e=0;e<v.numberOfInputs;e+=1)c.push(a(l,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1})),u.push(i(l,{channelCount:v.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:v.channelCount}));const d=await Promise.all(Array.from(s.parameters.values()).map((async e=>{const t=o(l,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:e.value});return await f(l,e,t.offset),t}))),g=r(l,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,e+t)});for(let e=0;e<v.numberOfInputs;e+=1){c[e].connect(u[e]);for(let t=0;t<v.channelCount;t+=1)u[e].connect(g,t,e*v.channelCount+t)}for(const[t,n]of d.entries())n.connect(g,0,e+t),n.start(0);return g.connect(l.destination),await Promise.all(c.map((e=>p(s,l,e)))),m(l)};w=ja(s,0===n?null:await l(),S,v,A,b,c)}const e=await w,t=n(S,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[l,u,d]=M;null!==e&&(t.buffer=e,t.start(0)),t.connect(l);for(let e=0,t=0;e<s.numberOfOutputs;e+=1){const n=u[e];for(let r=0;r<A[e];r+=1)l.connect(n,t+r,r);t+=A[e]}return d}if(_)for(const[t,n]of s.parameters.entries())await e(S,n,x.parameters.get(t));else for(const[e,t]of s.parameters.entries())await f(S,t,x.parameters.get(e));return await p(s,S,x),x})(S,x)}}})(Wl,Xu,Kl,gc,Ss,xc,_s,Yu,Zu,hu,_a,El,ml,Ql,ll,Dc),ad=(sd=fu,e=>sd.get(e));var sd;const ld=(e=>(t,n)=>{e.set(t,n)})($u),cd=(du&&((e,t,n,r,i,o,a,s,l,c,u,d,h,f)=>{})(Ju,Cl,Yl,od,id,sa,ad,fl,gl,El,(e=>({...e,outputChannelCount:void 0!==e.outputChannelCount?e.outputChannelCount:1===e.numberOfInputs&&1===e.numberOfOutputs?[e.channelCount]:Array.from({length:e.numberOfOutputs},(()=>1))})),ld,(e=>{const{port1:t,port2:n}=new MessageChannel;try{t.postMessage(e)}finally{t.close(),n.close()}}),Vs),((e,t,n,r,i)=>{})($a,Ts,Ns,Vc,Sl),((e,t)=>(n,r,i)=>{if(null===t)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new t(n,r,i)}catch(t){if("SyntaxError"===t.name)throw e();throw t}})(Ts,ml)),ud=((e,t,n,r,i,o,a,s)=>(l,c)=>n(l).render(l,c).then((()=>Promise.all(Array.from(r(c)).map((e=>n(e).render(e,c)))))).then((()=>i(c))).then((n=>("function"!=typeof n.copyFromChannel?(a(n),Qo(n)):t(o,(()=>o(n)))||s(n),e.add(n),n))))(kl,$s,al,qu,Dc,Ko,Nl,Bl);dd=Mo,hd=_l;var dd,hd;fd=Ao,pd=Al;var fd,pd;var md={};
|
|
63
63
|
/*!
|
|
64
64
|
Copyright (c) 2018 Jed Watson.
|
|
@@ -75,4 +75,4 @@ const qb="144",Kb={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Jb={ROTATE:0,
|
|
|
75
75
|
* @license qrcode.react
|
|
76
76
|
* Copyright (c) Paul O'Shannessy
|
|
77
77
|
* SPDX-License-Identifier: ISC
|
|
78
|
-
*/function hU(e,t=0){const n=[];return e.forEach((function(e,r){let i=null;e.forEach((function(o,a){if(!o&&null!==i)return n.push(`M${i+t} ${r+t}h${a-i}v1H${i+t}z`),void(i=null);if(a!==e.length-1)o&&null===i&&(i=a);else{if(!o)return;null===i?n.push(`M${a+t},${r+t} h1v1H${a+t}z`):n.push(`M${i+t},${r+t} h${a+1-i}v1H${i+t}z`)}}))})),n.join("")}function fU(e,t){return e.slice().map(((e,n)=>n<t.y||n>=t.y+t.h?e:e.map(((e,n)=>(n<t.x||n>=t.x+t.w)&&e))))}function pU(e,t,n,r){if(null==r)return null;const i=n?4:0,o=e.length+2*i,a=Math.floor(.1*t),s=o/t,l=(r.width||a)*s,c=(r.height||a)*s,u=null==r.x?e.length/2-l/2:r.x*s,d=null==r.y?e.length/2-c/2:r.y*s;let h=null;if(r.excavate){let e=Math.floor(u),t=Math.floor(d);h={x:e,y:t,w:Math.ceil(l+u-e),h:Math.ceil(c+d-t)}}return{x:u,y:d,h:c,w:l,excavation:h}}var mU=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}();function gU(e){const t=e,{value:r,size:i=sU,level:o=lU,bgColor:a=cU,fgColor:s=uU,includeMargin:l=dU,style:u,imageSettings:d}=t,h=iU(t,["value","size","level","bgColor","fgColor","includeMargin","style","imageSettings"]),f=null==d?void 0:d.src,p=(0,c.useRef)(null),m=(0,c.useRef)(null),[g,v]=(0,c.useState)(!1);(0,c.useEffect)((()=>{if(null!=p.current){const e=p.current,t=e.getContext("2d");if(!t)return;let n=oU.QrCode.encodeText(r,aU[o]).getModules();const c=l?4:0,u=n.length+2*c,h=pU(n,i,l,d),f=m.current,g=null!=h&&null!==f&&f.complete&&0!==f.naturalHeight&&0!==f.naturalWidth;g&&null!=h.excavation&&(n=fU(n,h.excavation));const v=window.devicePixelRatio||1;e.height=e.width=i*v;const b=i/u*v;t.scale(b,b),t.fillStyle=a,t.fillRect(0,0,u,u),t.fillStyle=s,mU?t.fill(new Path2D(hU(n,c))):n.forEach((function(e,n){e.forEach((function(e,r){e&&t.fillRect(r+c,n+c,1,1)}))})),g&&t.drawImage(f,h.x+c,h.y+c,h.w,h.h)}})),(0,c.useEffect)((()=>{v(!1)}),[f]);const b=rU({height:i,width:i},u);let y=null;return null!=f&&(y=n(c).createElement("img",{src:f,key:f,style:{display:"none"},onLoad:()=>{v(!0)},ref:m})),n(c).createElement(n(c).Fragment,null,n(c).createElement("canvas",rU({style:b,height:i,width:i,ref:p},h)),y)}var vU=({url:e,title:t="",className:r,baseUrl:i,primary:o=!0,showQrCode:a=!0,align:s="right"})=>{const{t:l}=yo(),[u,d]=(0,c.useState)(e);(0,c.useEffect)((()=>{e||d(window.location.href)}),[e]);const h=[{id:"facebook",title:"Facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${u}`,icon:GD},{id:"twitter",title:"Twitter",url:`https://twitter.com/intent/tweet?url=${u}`,icon:VD},{id:"linkedin",title:"LinkedIn",url:`https://www.linkedin.com/shareArticle?mini=true&title=${t}&url=${u}`,icon:WD},{id:"whatsapp",title:"Whatsapp",url:`https://api.whatsapp.com/send?phone=&text=${u}`,icon:qD},{id:"telegram",title:"Telegram",url:`https://t.me/share/url?text=${t}&url=${u}`,icon:YD},{id:"email",title:"Email",url:`mailto:?subject=${(null==t?void 0:t.length)>0?t:e}&body=${u}`,icon:KD}];return n(c).createElement(rb,{as:"div",className:n(md)("memori-share-button",{"memori-share-button--align-left":"left"===s})},n(c).createElement(rb.Button,{className:n(md)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button",r,{"memori-button--primary":o}),title:l("widget.share")||void 0},n(c).createElement("div",{className:"memori-button--icon"},n(c).createElement(JD,null))),n(c).createElement(rb.Items,{className:"memori-share-button--overlay",as:"ul"},n(c).createElement(rb.Item,{key:"copy",as:"li",className:"memori-share-button--li"},n(c).createElement(bd,{className:"memori-share-button--link",ghost:!0,icon:n(c).createElement(lm,null),onClick:()=>{u&&navigator.clipboard.writeText(u)}},l("copyToClipboard")||void 0)),h.map((e=>{var t;return n(c).createElement(rb.Item,{key:e.id,as:"li",className:"memori-share-button--li"},n(c).createElement("a",{className:n(md)("memori-button","memori-button--with-icon","memori-button--ghost","memori-button--padded","memori-share-button--link"),href:null!==(t=e.url)&&void 0!==t?t:"",target:"_blank",rel:"noopener noreferrer"},n(c).createElement("div",{className:"memori-button--icon"},n(c).createElement(e.icon,null)),e.title))})),a&&n(c).createElement(rb.Item,{key:"qrcode",as:"li",className:"memori-share-button--li-qr-code"},n(c).createElement(gU,{id:"qr-canvas",value:null!=u?u:"",size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H",includeMargin:!1,imageSettings:{src:`${i||"https://app.twincreator.com"}/images/memori_logo.png`,x:void 0,y:void 0,height:32,width:32,excavate:!0}}),n(c).createElement("div",null,n(c).createElement(bd,{onClick:()=>{const e=document.getElementById("qr-canvas");if(console.log(),!e)return;const n=document.createElement("a");n.href=e.toDataURL(),n.download=`memori-${t}-share.png`,document.body.appendChild(n),n.click(),document.body.removeChild(n)},icon:n(c).createElement(QD,null),title:"Download QR"},"Download")))))};var bU=({className:e,memori:t,history:r,position:i,setShowPositionDrawer:o,setShowSettingsDrawer:a,speakerMuted:s,setSpeakerMuted:l,hasUserActivatedSpeak:u=!1,showShare:d=!0,showSettings:h=!0})=>{const{t:f}=yo();return n(c).createElement("div",{className:n(md)("memori-header",e)},t.needsPosition&&i&&n(c).createElement("div",{className:"memori-header--position"},n(c).createElement("span",{className:"memori-header--position-placeName"},i.placeName),n(c).createElement(bd,{icon:n(c).createElement(vD,null),shape:"circle",className:"memori-header--button",onClick:()=>o(!0)})),n(c).createElement(bd,{primary:!0,shape:"circle",className:"memori-header--button",icon:s?n(c).createElement(bD,null):n(c).createElement(wD,null),onClick:()=>l(!s),title:f("widget.sound")||"Sound"}),n(c).createElement(jD,{history:r,memori:t,className:"memori-header--button",disabled:!u||0===r.length}),h&&n(c).createElement(bd,{primary:!0,shape:"circle",className:"memori-header--button",icon:n(c).createElement(HD,null),onClick:()=>a(!0),title:f("widget.settings")||"Settings"}),d&&n(c).createElement(vU,{className:"memori-header--button",title:t.name,showQrCode:!0,align:"left"}))};c=o("85Hg2");var yU=({header:e,avatar:t,chat:r,startPanel:i,integrationStyle:o,integrationBackground:a,changeMode:s,sessionId:l,hasUserActivatedSpeak:u,showInstruct:d=!1,loading:h=!1})=>n(c).createElement(n(c).Fragment,null,o,a,n(c).createElement(Rf,{spinning:h},d&&s,e,n(c).createElement("div",{className:"memori--grid"},n(c).createElement("div",{className:"memori--grid-column memori--grid-column-left"},t),n(c).createElement("div",{className:"memori--grid-column memori--grid-column-right"},l&&u?r:i))));const wU={muteSpeaker:"@memori:muteSpeaker",continuousSpeech:"@memori:continuousSpeech",continuousSpeechTimeout:"@memori:continuousSpeechTimeout",sendOnEnter:"@memori:sendOnEnter"},SU=(e,t)=>{var n;const r=window.localStorage.getItem(null!==(n=wU[e])&&void 0!==n?n:e);if(!r)return t;try{return JSON.parse(r)}catch(e){return r}},xU=(e,t)=>{var n;window.localStorage.setItem(null!==(n=wU[e])&&void 0!==n?n:e,t.toString())},MU=new Map(Object.entries({TENANT_NOT_FOUND:-1,TENANT_REGISTRATION_DISABLED:-2,TENANT_MISSING_NAME:-3,TENANT_MAX_USERS_REACHED:-4,TENANT_MAX_ADMINS_REACHED:-5,USER_NOT_CONFIRMED:-11,USER_NOT_FOUND:-12,USER_OR_PASSWORD_INVALID:-13,USER_MUST_CHANGE_PASSWORD:-14,USER_MUST_ENTER_VERIFICATION_CODE:-15,USER_MISSING_TENANT:-21,USER_MISSING_NAME:-22,USER_MISSING_PASSWORD:-23,USER_MISSING_EMAIL:-24,USER_MISSING_VERIFICATION_CODE:-25,USER_NAME_ALREADY_USED:-26,USER_PASSWORD_NOT_CONFORMING_TO_POLICY:-27,USER_EMAIL_ALREADY_USED:-28,USER_EMAIL_INVALID:-29,USER_VERIFICATION_CODE_INVALID:-30,USER_MISSING_NAME_OR_EMAIL:-31,USER_NAME_INVALID:-32,USER_HAS_ONE_OR_MORE_MEMORI:-33,USER_MISSING_NEW_PASSWORD:-34,USER_CANT_CREATE_MEMORI:-35,USER_MAX_MEMORI_REACHED:-36,USER_CANT_EDIT_INTEGRATIONS:-37,MEMORI_NOT_FOUND:-51,MEMORI_NOT_ACCESSIBLE:-52,MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN:-53,SESSION_NOT_FOUND:-101,SESSION_IS_NOT_ADMINISTRATIVE:-102,MEMORI_MISSING_CONFIGURATION:-201,MEMORI_CONFIGURATION_NOT_FOUND:-202,MEMORI_INVALID_PRIVACY_TYPE:-203,MEMORI_MISSING_PASSWORD:-204,MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS:-205,MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS:-206,MEMORI_INVALID_VOICE_TYPE:-207,MEMORI_MISSING_NAME:-208,MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS:-209,MEMORI_INVALID_ID:-210,MEMORI_NAME_ALREADY_USED:-211,MEMORI_INVALID_PIN:-212,MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION:-213,MEMORI_NO_PASSWORD_WHEN_PUBLIC:-214,MEMORI_TRANSFER_MISSING_DESTINATION_USER:-231,MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID:-232,MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT:-233,MEMORI_TRANSFER_NOTHING_TO_DO:-234,MEMORI_CONFIGURATION_CANT_BE_CHANGED:-251,MEMORI_MISSING_NEW_PASSWORD:-252,MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT:-261,MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT:-262,INTEGRATION_NOT_FOUND:-301,INTEGRATION_INVALID_TYPE:-401,INTEGRATION_ALREADY_EXISTS:-402,INTEGRATION_MEMORI_IS_NOT_PUBLIC:-403,INTEGRATION_MISSING_INVOCATION_TEXT:-404,INTEGRATION_MISSING_DEVICE_EMAILS:-405,INTEGRATION_MEMORI_IS_EMPTY:-406,INTEGRATION_MISSING_PRIVACY_POLICY:-407,INTEGRATION_MISSING_CATEGORY:-408,INTEGRATION_MISSING_DESCRIPTION:-409,INTEGRATION_INVALID_INVOCATION_TEXT:-410,INTEGRATION_GOOGLE_NO_MORE_AVAILABLE:-411,UPLOAD_REQUIRES_MULTIPART_ENCODING:-501,UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY:-502,UPLOAD_MAX_LENGTH_EXCEEDED:-503,UPLOAD_FILE_IS_EMPTY:-504,UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE:-505,UPLOAD_MISSING_FILE_NAME:-506,UPLOAD_INVALID_MEMORY_ID:-507,UPLOAD_MISSING_FILE_CONTENT:-508,ASSET_NOT_FOUND:-601,ASSET_NOT_ACCESSIBLE:-602,ASSET_MISSING_SESSION_ID:-603,ASSET_INVALID_FILE_NAME:-604,INVITATION_NOT_FOUND:-701,INVITATION_NOT_ACCESSIBLE:-702,INVITATION_ALREADY_ACCEPTED:-703,INVITATION_ALREADY_REJECTED:-704,INVITATION_MISSING_DESTINATION_EMAIL:-705,INVITATION_DESTINATION_EMAIL_INVALID:-706,INVITATION_MISSING_TAG:-707,INVITATION_MISSING_PIN:-708,INVITATION_INVALID_PIN:-709,INVITATION_INVALID_TYPE:-710,INVITATION_MISSING_DESTINATION_NAME:-711,INVITATION_TAG_PIN_CANT_BE_CHANGED:-712,INVITATION_CANT_BE_CHANGED:-713,ACTIONLOG_INVALID_USER_ID:-801,ACTIONLOG_INVALID_DATE_FROM_FORMAT:-802,ACTIONLOG_INVALID_DATE_TO_FORMAT:-803,ACTIONLOG_INVALID_MEMORI_ID:-804,CONSUMPTIONLOG_INVALID_TYPE:-901,CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT:-902,CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT:-903,CONSUMPTIONLOG_INVALID_USER_ID:-904,CONSUMPTIONLOG_INVALID_MEMORI_ID:-905}).map((([e,t])=>[t,e]))),_U=e=>{if(!e)return"error.generic";if(401===e||403===e)return"error.unauthorized";if(404===e)return"error.notFound";if(422===e)return"error.unprocessableEntity";if(500===e)return"internal server error";let t=MU.get(e);return t?`errors.${t}`:"error.generic"},{deleteSession:AU,getStatistics:EU,initSession:CU}=Vi(),TU=new Map([[0,"🆕"],[10,"🐹"],[20,"🐇"],[30,"🐰"],[40,"💡"],[50,"🏆"],[60,"🏅"],[70,"🥉"],[80,"🥈"],[90,"🥇"],[100,"🔥"],[110,"🎓"],[120,"🤖"],[130,"👾"],[150,"🌍"],[180,"💜"],[200,"💙"],[250,"🧡"],[300,"💚"],[350,"💛"],[400,"💖"],[450,"💝"],[500,"🖤"],[550,"❤️"],[600,"🧠"]]),IU=e=>{const t=Array.from(TU.keys()).filter((t=>t<=e));if(t.length>0){const e=t[t.length-1];return TU.get(e)}return""},kU=e=>{if("🆕"===e)return{points:10,badge:"🐹"};let t,n,r=!1;for(const[i,o]of TU){if(r){t=i,n=o;break}o===e&&(r=!0)}return n&&t?{points:t,badge:n}:void 0},RU=e=>{let t=0;for(const[n,r]of TU)if(r===e){t=n;break}return t},OU=e=>{const t=Math.round(e),n=IU(t);return{points:t,badge:n,pointsForCurrentBadge:RU(n),nextBadge:kU(n)}};window.getMemoriState=e=>{var t,n,r,i,o;let a=e?document.querySelector(`.memori-widget[data-memori-integration="${e}"]`)||(null===(n=null===(t=document.querySelector("memori-client"))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector(".memori-widget[data-memori-integration]")):document.querySelector(".memori-widget")||(null===(i=null===(r=document.querySelector("memori-client"))||void 0===r?void 0:r.shadowRoot)||void 0===i?void 0:i.querySelector(".memori-widget"));if(!a)return null;let s=null===(o=a.dataset)||void 0===o?void 0:o.memoriEngineState;return s?JSON.parse(s):null},window.typeMessage=e=>{var t,n;let r=document.querySelector("fieldset#chat-fieldset textarea")||(null===(n=null===(t=document.querySelector("memori-client"))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector("fieldset#chat-fieldset textarea"));r&&(!function(e,t){var n,r,i,o;const a=null===(r=null===(n=null==Object?void 0:Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,"value"))||void 0===r?void 0:r.set,s=Object.getPrototypeOf(e),l=null===(o=null===(i=null==Object?void 0:Object.getOwnPropertyDescriptor)||void 0===i?void 0:i.call(Object,s,"value"))||void 0===o?void 0:o.set;l&&a&&a!==l?l.call(e,t):a&&a.call(e,t)}(r,e),r.dispatchEvent(new Event("input",{bubbles:!0})),setTimeout((()=>{var e,t;let n=document.querySelector("fieldset#chat-fieldset textarea + button")||(null===(t=null===(e=document.querySelector("memori-client"))||void 0===e?void 0:e.shadowRoot)||void 0===t?void 0:t.querySelector("fieldset#chat-fieldset textarea + button"));n&&n.click()}),100))};let PU,NU,BU,LU;var DU=({memori:e,memoriConfigs:t,memoriLang:r,integration:i,showInstruct:o=!1,showShare:a=!0,preview:s=!1,embed:l=!1,showInputs:u=!0,showDates:d=!1,showContextPerLine:h=!1,showSettings:f=!1,height:p="100vh",secret:m,baseUrl:g="https://app.twincreator.com",apiUrl:v="https://backend.memori.ai",initialContextVars:b,initialQuestion:y,ogImage:w,sessionID:S,tenant:x,personification:M,AZURE_COGNITIVE_SERVICES_TTS_KEY:_,onStateChange:A})=>{var E,C,T,I,k,R,O,P,N,B,L,D,U,F,z,j,H,G;const{t:V,i18n:W}=yo(),[q,K]=(0,c.useState)(!1);(0,c.useEffect)((()=>{K(!0)}),[]);const J=Vi(v),{initSession:Q,postTextEnteredEvent:X,postPlaceChangedEvent:Y,postTimeoutEvent:Z,postTagChangedEvent:$,getSession:ee,getContentQualityIndexes:te}=J,[ne,re]=(0,c.useState)(!1),[ie,oe]=(0,c.useState)(!1),[ae,se]=(0,c.useState)(!1),le=null===(I=null===(T=null===(C=null===(E=null==t?void 0:t.find((t=>t.memoriConfigID===e.memoriConfigurationID)))||void 0===E?void 0:E.culture)||void 0===C?void 0:C.split("-"))||void 0===T?void 0:T[0])||void 0===I?void 0:I.toUpperCase(),[ce,ue]=(0,c.useState)(null!==(N=null!==(P=null!==(O=null!=r?r:null===(R=null===(k=null==e?void 0:e.culture)||void 0===k?void 0:k.split("-"))||void 0===R?void 0:R[0])&&void 0!==O?O:le)&&void 0!==P?P:W.language)&&void 0!==N?N:"IT"),de=(null==i?void 0:i.customData)?JSON.parse(i.customData):null,he=!!(null==de?void 0:de.multilanguage),[fe,pe]=(0,c.useState)(!1),[me,ge]=(0,c.useState)(!1),[ve,be]=(0,c.useState)(!1),[ye,we]=(0,c.useState)(!1),[Se,xe]=(0,c.useState)(!1),[Me,_e]=(0,c.useState)(!1),[Ae,Ee]=(0,c.useState)(!1),[Ce,Te]=(0,c.useState)(!1),[Ie,ke]=(0,c.useState)(3),[Re,Oe]=(0,c.useState)(!1);(0,c.useEffect)((()=>{Oe(!!BU)}),[BU]),(0,c.useEffect)((()=>{Ee(SU("muteSpeaker",!1)),Te(SU("continuousSpeech",!1)),ke(SU("continuousSpeechTimeout",3))}),[]);const[Pe,Ne]=(0,c.useState)(m),[Be,Le]=(0,c.useState)(),[De,Ue]=(0,c.useState)(null),[Fe,ze]=(0,c.useState)(),je=async(e,t)=>{var n;const r=null!=t?t:Ze;if(e&&r){const{currentState:t,...i}=await Y({sessionId:r,placeName:e.placeName,latitude:e.latitude,longitude:e.longitude,uncertaintyKm:null!==(n=e.uncertainty)&&void 0!==n?n:0});t&&0===i.resultCode&&nt({...et,...t})}},[He,Ge]=(0,c.useState)(""),[Ve,We]=(0,c.useState)(!1),[qe,Je]=(0,c.useState)([]),Qe=e=>{Je((t=>[...t,{...e}]))},Xe=async(t,n,r,i=!0,o)=>{var a,s,l,c,u;if(!Ze||!(null==t?void 0:t.length))return;Qe({text:t,translatedText:o,fromUser:!0,media:null!=n?n:[],initial:!!r}),ge(!0);const d=null!==(c=null!==(l=null===(s=null===(a=e.culture)||void 0===a?void 0:a.split("-"))||void 0===s?void 0:s[0])&&void 0!==l?l:W.language)&&void 0!==c?c:"IT";let h=t;if(i&&!ne&&he&&ce.toUpperCase()!==d.toUpperCase()){h=(await pm(t,d,ce,g)).text}const{currentState:f,...p}=await X({sessionId:null!=r?r:Ze,text:h});if(0===p.resultCode&&f){const t=null!==(u=f.emission)&&void 0!==u?u:null==et?void 0:et.emission;if("X4"===f.state&&e.giverTag){const{currentState:t,...n}=await $(Ze,e.giverTag);0===n.resultCode?(nt(t),t.emission&&Qe({text:t.emission,media:t.media,fromUser:!1})):(console.error(p,n),gd.error(V(_U(n.resultCode),{ns:"common"})))}else if("X2d"===f.state&&e.giverTag){const{currentState:t,...n}=await X({sessionId:null!=r?r:Ze,text:Math.random().toString().substring(2,8)});if(0===n.resultCode){const{currentState:t,...n}=await $(Ze,e.giverTag);0===n.resultCode?(nt(t),t.emission&&Qe({text:t.emission,media:t.media,fromUser:!1})):(console.error(p,n),gd.error(V(_U(n.resultCode),{ns:"common"})))}else console.error(p,n),gd.error(V(_U(n.resultCode),{ns:"common"}))}else ce.toLowerCase()!==d.toLowerCase()&&t&&!ne&&he?Ye(f,ce):(nt({...f,emission:t}),t&&Qe({text:t,media:f.media,fromUser:!1}))}else 404===p.resultCode&&(Je((e=>[...e.slice(0,e.length-1)])),it(!1,Pe||e.secretToken,Be,ne&&e.giverTag?e.giverTag:void 0,ne&&e.giverPIN?e.giverPIN:void 0,b,y).then((e=>{console.info("session timeout"),e&&setTimeout((()=>{Xe(t,n,e)}),500)})));ge(!1)},Ye=async(t,n)=>{var r,i,o,a,s,l;const c=null!==(a=null!==(o=null===(i=null===(r=e.culture)||void 0===r?void 0:r.split("-"))||void 0===i?void 0:i[0])&&void 0!==o?o:W.language)&&void 0!==a?a:"IT",u=null!==(s=t.emission)&&void 0!==s?s:null==et?void 0:et.emission;let d={...t},h=null;if(u&&!ne&&c.toUpperCase()!==n.toUpperCase()&&he){const e=await pm(u,n,c,g);if(t.hints&&t.hints.length>0){const r=await Promise.all((null!==(l=t.hints)&&void 0!==l?l:[]).map((async e=>{var t;const r=await pm(e,n,c,g);return{text:null!==(t=null==r?void 0:r.text)&&void 0!==t?t:e,originalText:e}})));d={...t,emission:e.text,translatedHints:r}}else d={...t,emission:e.text};e.text.length>0&&(h={text:e.text,media:t.media,fromUser:!1})}else d={...t,emission:u},u&&(h={text:u,media:t.media,fromUser:!1});return nt(d),h&&Qe(h),d},[Ze,$e]=(0,c.useState)(S),[et,tt]=(0,c.useState)(),nt=e=>{tt(e),A&&A(e)},rt=async t=>{var n,r,i,o,a;if("PUBLIC"===e.privacyType||e.secretToken||Pe||Be){pe(!0);try{if(!e.giverTag&&(null===(n=e.receivedInvitations)||void 0===n?void 0:n.length)){let t=e.receivedInvitations.find((e=>"GIVER"===e.type&&"ACCEPTED"===e.state));t&&(e.giverTag=t.tag,e.giverPIN=t.pin)}const s=await Q(t);if((null==s?void 0:s.sessionID)&&(null==s?void 0:s.currentState)&&0===s.resultCode){$e(s.sessionID);const t=null!==(a=null!==(o=null===(i=null===(r=e.culture)||void 0===r?void 0:r.split("-"))||void 0===i?void 0:i[0])&&void 0!==o?o:W.language)&&void 0!==a?a:"IT";return!ne&&he&&ce.toLowerCase()!==t.toLowerCase()?Ye(s.currentState,ce).then((e=>{(null==e?void 0:e.emission)&&(qe.length<=1?Je([{text:e.emission,media:e.media,fromUser:!1,initial:!0}]):Qe({text:e.emission,media:e.media,fromUser:!1,initial:!0}))})):(nt(s.currentState),s.currentState.emission&&(qe.length<=1?Je([{text:s.currentState.emission,media:s.currentState.media,fromUser:!1,initial:!0}]):Qe({text:s.currentState.emission,media:s.currentState.media,fromUser:!1,initial:!0}))),Fe&&je(Fe,s.sessionID),pe(!1),{dialogState:s.currentState,sessionID:s.sessionID}}console.error(s),gd.error(V(_U(null==s?void 0:s.resultCode),{ns:"common"})),se(!0)}catch(e){console.error(e),new Error("Error fetching session")}}else Ue("password")},it=async(t=!1,n,r,i,o,a,s)=>{var l;pe(!0);try{const{sessionID:c,currentState:u,...d}=await Q({memoriID:null!==(l=e.engineMemoriID)&&void 0!==l?l:"",password:n,recoveryTokens:r,tag:i,pin:o,initialContextVars:a,initialQuestion:s});if(c&&u&&0===d.resultCode)return $e(c),t&&(nt(u),u.emission&&(qe.length<=1?Je([{text:u.emission,media:u.media,fromUser:!1}]):Qe({text:u.emission,media:u.media,fromUser:!1}))),Fe&&je(Fe,c),pe(!1),c;console.error(d),gd.error(V(_U(d.resultCode),{ns:"common"})),se(!0)}catch(e){console.error(e)}return pe(!1),null},ot=async(t,n,r,i)=>{var o;if(!t||!n)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState:t,resultCode:a}=await $(n,null!=r?r:gm);if(0===a){let s=0;if(r!==gm&&i&&("X1a"===t.state||"X1b"===t.state)){const{resultCode:e}=await X({sessionId:n,text:null!=i?i:""});s=e}if(0===s){const{currentState:e,...t}=await ee(n);if(0===t.resultCode&&e)return{currentState:e,sessionId:n,...t}}else if([400,401,403,404,500].includes(a))console.warn("[APPCONTEXT/CHANGETAG]",a),rt({memoriID:null!==(o=e.engineMemoriID)&&void 0!==o?o:"",password:m||e.secretToken,tag:e.giverTag,pin:e.giverPIN,initialContextVars:b,initialQuestion:y});else if(t)return{currentState:t,sessionId:n,resultCode:a}}}catch(e){let t=e;return console.error("[APPCONTEXT/CHANGETAG]",t),Promise.reject(t)}return null};(0,c.useEffect)((()=>()=>{et&&(null==et?void 0:et.currentTag)===e.giverTag||(async()=>{Ze&&e.giverTag&&e.giverPIN&&(Je([]),await ot(e.engineMemoriID,Ze,e.giverTag,e.giverPIN))})()}),[]);const[at,st]=(0,c.useState)(),lt=(0,c.useRef)(),ct=()=>{at&&(clearTimeout(at),st(void 0)),(null==lt?void 0:lt.current)&&(clearTimeout(lt.current),lt.current=void 0)},ut=()=>{ct(),!(null==et?void 0:et.acceptsTimeout)||BU||Re||He.length||Ve||ht()},dt=async()=>{if(BU||Re||He.length||Ve)ut();else if(Ze&&ve&&(null==et?void 0:et.acceptsTimeout)){const{currentState:e,...t}=await Z(Ze);if(0===t.resultCode&&e){const t=e.emission;!ne&&he&&ce!==(null==W?void 0:W.language)&&t&&t.length>0?Ye({...e,emission:t},ce):t&&t.length>0?(Qe({text:t,media:e.media,fromUser:!1}),nt(e)):nt({...e})}}},ht=()=>{let e=null==et?void 0:et.timeout;if(!e){let t=40,n=25;if(e=Math.floor(Math.random()*(t-n))+n,null==et?void 0:et.emission){e+=et.emission.length/26.5}}let t=setTimeout(dt,1e3*e);st(t),lt.current=t};(0,c.useEffect)((()=>{(He.length||Re)&&ct(),Ze&&!He.length&&ut()}),[null==et?void 0:et.acceptsTimeout,null==et?void 0:et.timeout,null==et?void 0:et.state,Re,Ze,qe,He]),(0,c.useEffect)((()=>()=>{be(!1),oe(!1),ct(),lt.current=void 0}),[]);(0,c.useEffect)((()=>()=>{LU&&LU.pause(),BU&&(BU.close(),BU=null)}),[]);const ft=(0,c.useCallback)((t=>{var n,r,i,o;let a="";switch((null!==(o=null!==(i=null!=t?t:null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])&&void 0!==i?i:W.language)&&void 0!==o?o:"IT").toUpperCase()){case"IT":a=""+("MALE"===e.voiceType?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":a=""+("MALE"===e.voiceType?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":a=""+("MALE"===e.voiceType?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":a=""+("MALE"===e.voiceType?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":a=""+("MALE"===e.voiceType?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":a=""+("MALE"===e.voiceType?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":a=""+("MALE"===e.voiceType?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":a=""+("MALE"===e.voiceType?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;default:a=""+("MALE"===e.voiceType?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return a}),[e.voiceType,W.language,e.culture]),pt=t=>{var n,r,i;let o="";switch((null!==(i=null!=t?t:null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])&&void 0!==i||W.language,"IT").toUpperCase()){case"IT":default:o="it-IT";break;case"DE":o="de-DE";break;case"EN":o="en-GB";break;case"ES":o="es-ES";break;case"FR":o="fr-FR";break;case"PT":o="pt-PT";break;case"UK":o="uk-UK";break;case"RU":o="ru-RU"}return o},[mt,gt]=(0,c.useState)();(0,c.useEffect)((()=>{(async()=>{try{const e=await fetch(`${g||"https://app.twincreator.com"}/api/lexiconmap`);return await e.json()}catch(e){console.error(e)}})().then((e=>{gt(e)}))}),[]);const vt=(e,t=!0)=>{if(!_)return;if(s||!ve)return;if(LU&&LU.pause(),BU&&(BU.close(),BU=null),Ae&&t)return void setTimeout((()=>{document.dispatchEvent(new Event("endSpeakStartListen"))}),3e3);if(Ae)return;LU=new jr.SpeakerAudioDestination;let n=qr.fromSpeakerOutput(LU);BU=new oi.SpeechSynthesizer(NU,n),LU.onAudioEnd=()=>{Oe(!1),t&&document.dispatchEvent(new Event("endSpeakStartListen"))},Oe(!0),BU.speakSsmlAsync(`<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" xml:lang="${pt(ce)}"><voice name="${ft(ce)}"><s>${((e,t)=>{var n;if(!mt)return e;const r={...null!==(n=mt.common)&&void 0!==n?n:{},...(null==x?void 0:x.id)&&mt[x.id]?mt[x.id]:{}},i=Object.keys(r).map((e=>{var n;return{word:e,phoneme:null!==(n=r[e][t])&&void 0!==n?n:r[e].default}}));return i.reduce(((e,{word:t,phoneme:n})=>e.replace(new RegExp(t,"gi"),`<phoneme alphabet="ipa" ph="${n}">${t}</phoneme>`)),e)})(e,ce.toLowerCase())}</s></voice></speak>`,(t=>{if(t)try{BU&&(BU.close(),BU=null)}catch(t){console.error("speak error: ",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),Oe(!1)}else Oe(!1)}),(t=>{console.error("speak:",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),Oe(!1)}))};(0,c.useEffect)((()=>{let e=document.querySelector("#chat-fieldset textarea");e&&e.focus()}),[null==et?void 0:et.emission]);const[bt,wt]=(0,c.useState)(""),St=()=>wt(""),[xt,Mt]=(0,c.useState)(null),_t=()=>{xt&&(clearTimeout(xt),Mt(null))},At=()=>{_t(),Ce&&(()=>{let e=setTimeout((async()=>{Tt();const e=rm(bt);e.length>0?(Xe(e),St(),Ge("")):Ve&&ut()}),1e3*Ie);Mt(e)})()};(0,c.useEffect)((()=>{if(At(),ut(),(null==bt?void 0:bt.length)>0){const e=rm(bt);e.length>0&&Ge(e)}}),[bt]);const Et=()=>{if(_){Tt(),wt("");try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(e){we(!0),NU||(NU=hn.fromSubscription(_,"eastus"),NU.speechRecognitionLanguage=pt(ce));const t=qr.fromDefaultMicrophoneInput();PU=new Qr.SpeechRecognizer(NU,t),We(!0),PU.recognized=(e,t)=>{var n;t.result.reason===yt.RecognizedSpeech?wt(null!==(n=t.result.text)&&void 0!==n?n:""):t.result.reason===yt.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},PU.canceled=(e,t)=>{t.reason===Ke.Error&&(console.debug(`"CANCELED: ErrorCode=${t.errorCode}`),console.debug(`"CANCELED: ErrorDetails=${t.errorDetails}`),console.debug("CANCELED: Did you set the speech resource key and region values?")),Ct()},PU.sessionStopped=(e,t)=>{PU&&PU.stopContinuousRecognitionAsync()},PU.startContinuousRecognitionAsync()})).catch(console.error)}catch(e){console.error(e)}}},Ct=()=>{PU&&(PU.stopContinuousRecognitionAsync(),PU.close(),PU=null,We(!1))},Tt=()=>{we(!1),Ct(),_t()};(0,c.useEffect)((()=>()=>Tt()),[]),(0,c.useEffect)((()=>{"Z0"===(null==et?void 0:et.state)&&Tt()}),[null==et?void 0:et.state]),(0,c.useEffect)((()=>{ve&&!s&&!Ae&&qe.length>0&&(null==et?void 0:et.emission)&&vt(et.emission,"Z0"!==et.state)}),[et,ve]);const[It,kt]=(0,c.useState)(!1),Rt=(0,c.useCallback)((e=>{Re&&BU&&(BU.close(),BU=null),!Ce||!ye&&It||(kt(!0),Et())}),[Ce,ye]);(0,c.useEffect)((()=>{!Re&&Ce&&ye?Et():Re&&Ve&&Ct()}),[Re]),(0,c.useEffect)((()=>(document.addEventListener("endSpeakStartListen",Rt),()=>{document.removeEventListener("endSpeakStartListen",Rt)})),[Rt]),(0,c.useEffect)((()=>{Ve&&(Tt(),St(),Ge(""),Et())}),[le]);const[Ot,Pt]=(0,c.useState)("keypress");(0,c.useEffect)((()=>{const e=SU("sendOnEnter","keypress");Pt(e)}),[]),(0,c.useEffect)((()=>{xU("sendOnEnter",Ot)}),[Ot]);const[Nt,Bt]=(0,c.useState)(),Lt=null==de?void 0:de.globalBackground,Dt=Lt?`url(${Lt})`:null,Ut=i?{"--memori-chat-bubble-bg":"#fff",...de&&!o?{"--memori-text-color":null!==(B=de.textColor)&&void 0!==B?B:"#000"}:{},...(null==de?void 0:de.buttonBgColor)?{"--memori-button-bg":de.buttonBgColor,"--memori-primary":de.buttonBgColor}:{},...(null==de?void 0:de.buttonTextColor)?{"--memori-button-text":de.buttonTextColor}:{},...(null==de?void 0:de.blurBackground)?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...(null==de?void 0:de.innerBgColor)?{"--memori-inner-bg":`rgba(${"dark"===de.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(L=de.innerBgAlpha)&&void 0!==L?L:.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===de.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(D=null==de?void 0:de.innerBgAlpha)&&void 0!==D?D:.4})`}:{"--memori-inner-content-pad":"0px"}}:{},Ft=`\n ${s?"#preview":":root"}, .memori-widget {\n ${Object.entries(Ut).map((([e,t])=>`${e}: ${t};`)).join("\n")}\n }\n `,[zt,jt]=(0,c.useState)(!0),[Ht,Gt]=(0,c.useState)();(0,c.useEffect)((()=>{e.engineMemoriID&&(async e=>{let t,n;try{const{contentQualityIndex:r,answerQualityIndex:i,unansweredQuestions:o,...a}=await te(e);0===a.resultCode&&(t=r,n=o)}catch(e){let t=e;console.error("[APPCONTEXT/QUERYGAMIFICATIONPOINTS]",t)}return{points:null!=t?t:0,unansweredQuestions:null!=n?n:0}})(e.engineMemoriID).then((e=>{Gt(OU(e.points))})).catch(console.error)}),[e.engineMemoriID]),(0,c.useEffect)((()=>{if(null==de?void 0:de.seoTitle){let e=document.createElement("meta");e.setAttribute("property","og:title"),e.setAttribute("content",de.seoTitle),document.head.append(e)}if(null==de?void 0:de.seoDescription){let e=document.createElement("meta");e.setAttribute("property","og:description"),e.setAttribute("content",de.seoDescription),document.head.append(e)}if(null==de?void 0:de.seoUrl){let e=document.createElement("meta");e.setAttribute("property","og:url"),e.setAttribute("content",de.seoUrl),document.head.append(e)}let t=w||e.avatarURL;if((null==de?void 0:de.seoImageShowAvatar)&&t){let e=document.createElement("meta");e.setAttribute("property","og:image"),e.setAttribute("content",t),document.head.append(e)}}),[de,e.avatarURL,w]);const Vt=async t=>{const n=(null==t?void 0:t.sessionID)||Ze,r=(null==t?void 0:t.dialogState)||et;if(oe(!0),(()=>{if(!_)return;NU=hn.fromSubscription(_,"eastus"),NU.speechSynthesisLanguage=pt(ce),NU.speechSynthesisVoiceName=ft(ce),nm()&&(NU.speechSynthesisOutputFormat=Zt.Audio16Khz32KBitRateMonoMp3);let e=document.getElementById("memori-audio");e&&window.navigator.userAgent.includes("Safari")&&(e.muted=!1,e.play().then((async()=>{try{const e=new Wu;let t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination)}catch(e){console.error(e)}})).catch((e=>{console.error("error playing intro audio",e)})))})(),!n&&"PUBLIC"!==e.privacyType&&!e.secretToken&&!Pe&&!Be||!n&&ae)return Ue("password"),void oe(!1);if(n)if(S){const{currentState:t,...r}=await ee(n);if(0!==r.resultCode||!t)return console.debug("session expired, opening new session"),se(!0),$e(void 0),oe(!1),void Vt();if(Je([]),ne&&e.giverTag&&(null==et?void 0:et.currentTag)!==e.giverTag)try{console.debug("change tag #0"),await ot(e.engineMemoriID,n,"-");const t=await ot(e.engineMemoriID,n,e.giverTag,e.giverPIN);if(!t||0!==t.resultCode)throw console.error("session #1",t),new Error("No session");Ye(t.currentState,ce).finally((()=>{be(!0)}))}catch(t){console.error("session #2",t),it(!0,null==e?void 0:e.secretToken,void 0,null==e?void 0:e.giverTag,null==e?void 0:e.giverPIN,b,y).then((()=>{be(!0)}))}else if(!ne&&M&&(null==et?void 0:et.currentTag)!==M.tag)try{console.debug("change tag #3"),await ot(e.engineMemoriID,n,"-");const t=await ot(e.engineMemoriID,n,M.tag,M.pin);if(!t||0!==t.resultCode)throw console.error("session #4",t),new Error("No session");Ye(t.currentState,ce).finally((()=>{be(!0)}))}catch(t){console.error("session #5",t),it(!0,null==e?void 0:e.secretToken,void 0,M.tag,M.pin,b,y).then((()=>{be(!0)}))}else if(ne||M||(null==et?void 0:et.currentTag)===gm)Ye(t,ce).finally((()=>{be(!0)}));else try{console.debug("change tag #6"),await ot(e.engineMemoriID,n,"-");const t=await ot(e.engineMemoriID,n,gm);if(!t||0!==t.resultCode)throw console.error("session #7",t),new Error("No session");Ye(t.currentState,ce).finally((()=>{be(!0)}))}catch(t){console.error("session #8",t),it(!0,null==e?void 0:e.secretToken,void 0,void 0,void 0,b,y).then((()=>{be(!0)}))}}else Je([]),Ye(r,ce).finally((()=>{be(!0)}));else{oe(!1),se(!1);const t=await rt({memoriID:e.engineMemoriID,password:m||e.secretToken,tag:null==M?void 0:M.tag,pin:null==M?void 0:M.pin,initialContextVars:b,initialQuestion:y});Vt(t||void 0)}},Wt=n(c).createElement(bU,{memori:e,history:qe,showShare:a,position:Fe,setShowPositionDrawer:xe,setShowSettingsDrawer:_e,speakerMuted:Ae,setSpeakerMuted:Ee,showSettings:f,hasUserActivatedSpeak:ve}),qt=n(c).createElement(mD,{memori:e,integration:i,integrationConfig:de,tenant:x,instruct:ne,avatar3dVisible:zt,setAvatar3dVisible:jt,hasUserActivatedSpeak:ve,isPlayingAudio:Re,baseUrl:g}),Kt=n(c).createElement(Fb,{memori:e,tenant:x,gamificationLevel:Ht,language:le,userLang:ce,setUserLang:ue,baseUrl:g,position:Fe,openPositionDrawer:()=>xe(!0),integrationConfig:de,instruct:ne,sessionId:Ze,clickedStart:ie,onClickStart:Vt}),Jt=Ze?n(c).createElement(Bb,{memori:e,sessionID:Ze,tenant:x,translateTo:he&&ce.toUpperCase()!==(null===(H=null!==(j=null!==(z=null===(F=null===(U=e.culture)||void 0===U?void 0:U.split("-"))||void 0===F?void 0:F[0])&&void 0!==z?z:W.language)&&void 0!==j?j:"IT")||void 0===H?void 0:H.toUpperCase())?ce:void 0,baseUrl:g,memoriTyping:me,history:qe,dialogState:et,setDialogState:nt,pushMessage:Qe,simulateUserPrompt:(e,t)=>{Ct(),Xe(e,void 0,void 0,!1,t)},showDates:d,showContextPerLine:h,client:J,selectReceiverTag:async t=>{var n;if(Ze)try{const{currentState:r,...i}=await $(Ze,t);if(0===i.resultCode)if(Qe({text:t,fromUser:!0}),"X4"===r.state&&e.giverTag){const{currentState:t,...n}=await J.postTagChangedEvent(Ze,e.giverTag);0===n.resultCode?(nt(t),t.emission&&Qe({text:t.emission,media:t.media,fromUser:!1})):(console.error(n),gd.error(V(_U(n.resultCode),{ns:"common"})))}else nt(r),r.emission&&Qe({text:r.emission,media:r.media,fromUser:!1});else console.error(i,t,null===(n=null==et?void 0:et.knownTags)||void 0===n?void 0:n[t]),gd.error(V(_U(i.resultCode),{ns:"common"}))}catch(e){let t=e;console.error(t),gd.error(t.message)}},preview:s,sendOnEnter:Ot,setSendOnEnter:Pt,attachmentsMenuOpen:Nt,setAttachmentsMenuOpen:Bt,instruct:ne,showInputs:u,showMicrophone:!!_,userMessage:He,onChangeUserMessage:e=>{if(!e||"\n"===e||""===e.trim())return Ge(""),void ut();Ge(e),ct()},sendMessage:e=>{Ct(),Xe(e),Ge(""),St()},stopListening:Tt,startListening:Et,stopAudio:()=>{BU&&(BU.close(),BU=null)},resetTranscript:St,listening:Ve,isPlayingAudio:Re}):null,Qt=i&&Dt?n(c).createElement("div",{className:"memori--global-background"},n(c).createElement("div",{className:"memori--global-background-image",style:{backgroundImage:Dt}})):null,Xt=i?n(c).createElement("style",{dangerouslySetInnerHTML:{__html:Ft}}):null,Yt=n(c).createElement(gD,{canInstruct:!!e.giverTag,instruct:ne,onChangeMode:e=>{re("instruct"===e),be(!1),oe(!1)}});return n(c).createElement("div",{className:n(md)("memori","memori-widget",{"memori--preview":s,"memori--embed":l,"memori--with-integration":i,"memori--active":ve}),"data-memori-name":null==e?void 0:e.name,"data-memori-id":null==e?void 0:e.engineMemoriID,"data-memori-secondary-id":null==e?void 0:e.memoriID,"data-memori-session-id":Ze,"data-memori-integration":null==i?void 0:i.integrationID,"data-memori-engine-state":JSON.stringify({...et,sessionID:Ze}),style:{height:p}},n(c).createElement(yU,{header:Wt,avatar:qt,chat:Jt,startPanel:Kt,integrationStyle:Xt,integrationBackground:Qt,changeMode:Yt,sessionId:Ze,hasUserActivatedSpeak:ve,showInstruct:o,loading:fe}),q&&n(c).createElement(tm,{withModal:!0,pwdOrTokens:De,openModal:!!De,setPwdOrTokens:Ue,showTokens:"SECRET"===e.privacyType,onFinish:async t=>{t.password&&Ne(t.password),t.tokens&&Le(t.tokens),it(!Ze,t.password,t.tokens,ne?e.giverTag:void 0,ne?e.giverPIN:void 0,b,y).then((()=>{Ue(null),be(!0)})).catch((()=>{Ue(null),se(!0)}))},minimumNumberOfRecoveryTokens:null!==(G=null==e?void 0:e.minimumNumberOfRecoveryTokens)&&void 0!==G?G:1}))};function UU(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FU(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,tD(r.key),r)}}function zU(e,t,n){return t&&FU(e.prototype,t),n&&FU(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function jU(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function HU(e,t){return HU=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},HU(e,t)}function GU(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&HU(e,t)}function VU(e,t){if(t&&("object"===$L(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return jU(e)}function WU(e){return WU=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},WU(e)}function qU(e){if(Array.isArray(e))return e}function KU(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function JU(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function QU(e,t){if(e){if("string"==typeof e)return JU(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?JU(e,t):void 0}}function XU(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function YU(e){return qU(e)||KU(e)||QU(e)||XU()}function ZU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ZU(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZU(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var eF={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},tF=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};UU(this,e),this.init(t,n)}return zU(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||eF,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,$U($U({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}(),nF=new tF,rF=function(){function e(){UU(this,e),this.observers={}}return zU(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){var i=[].concat(this.observers[e]);i.forEach((function(e){e.apply(void 0,n)}))}if(this.observers["*"]){var o=[].concat(this.observers["*"]);o.forEach((function(t){t.apply(t,[e].concat(n))}))}}}]),e}();function iF(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function oF(e){return null==e?"":""+e}function aF(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}function sF(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var a=r(o.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function lF(e,t,n){var r=sF(e,t,Object);r.obj[r.k]=n}function cF(e,t){var n=sF(e,t),r=n.obj,i=n.k;if(r)return r[i]}function uF(e,t,n){var r=cF(e,n);return void 0!==r?r:cF(t,n)}function dF(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):dF(e[r],t[r],n):e[r]=t[r]);return e}function hF(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var fF={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function pF(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return fF[e]})):e}var mF="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,gF=[" ",",","?","!",";"];function vF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function bF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yF(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=WU(e);if(t){var i=WU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return VU(this,n)}}function wF(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;o<r.length;++o){if(!i)return;if("string"==typeof i[r[o]]&&o+1<r.length)return;if(void 0===i[r[o]]){for(var a=2,s=r.slice(o,o+a).join(n),l=i[s];void 0===l&&r.length>o+a;)a++,l=i[s=r.slice(o,o+a).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(s)){if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s]}var c=r.slice(o+a).join(n);return c?wF(l,c,n):void 0}i=i[r[o]]}return i}}var SF=function(e){GU(n,e);var t=yF(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return UU(this,n),r=t.call(this),mF&&rF.call(jU(r)),r.data=e||{},r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),void 0===r.options.ignoreJSONStructure&&(r.options.ignoreJSONStructure=!0),r}return zU(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=cF(this.data,a);return s||!o||"string"!=typeof n?s:wF(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var a=[e,t];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),lF(this.data,a,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=cF(this.data,a)||{};r?dF(s,n,i):s=bF(bF({},s),n),lF(this.data,a,s),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?bF(bF({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(rF),xF={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))})),t}};function MF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?MF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function AF(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=WU(e);if(t){var i=WU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return VU(this,n)}}var EF={},CF=function(e){GU(n,e);var t=AF(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return UU(this,n),r=t.call(this),mF&&rF.call(jU(r)),aF(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,jU(r)),r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=nF.create("translator"),r}return zU(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=gF.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var i=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),o=!i.test(e);if(!o){var a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}(e,n,r));if(o&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:i};var l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(i=l.shift()),e=l.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,r){var i=this;if("object"!==$L(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),l=s.key,c=s.namespaces,u=c[c.length-1],d=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(h){var f=t.nsSeparator||this.options.nsSeparator;return o?(p.res="".concat(u).concat(f).concat(l),p):"".concat(u).concat(f).concat(l)}return o?(p.res=l,p):l}var p=this.resolve(e,t),m=p&&p.res,g=p&&p.usedKey||l,v=p&&p.exactUsedKey||l,b=Object.prototype.toString.apply(m),y=["[object Number]","[object Function]","[object RegExp]"],w=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject,x="string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m;if(S&&m&&x&&y.indexOf(b)<0&&("string"!=typeof w||"[object Array]"!==b)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,_F(_F({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(p.res=M,p):M}if(a){var _="[object Array]"===b,A=_?[]:{},E=_?v:g;for(var C in m)if(Object.prototype.hasOwnProperty.call(m,C)){var T="".concat(E).concat(a).concat(C);A[C]=this.translate(T,_F(_F({},t),{joinArrays:!1,ns:c})),A[C]===T&&(A[C]=m[C])}m=A}}else if(S&&"string"==typeof w&&"[object Array]"===b)(m=m.join(w))&&(m=this.extendTranslation(m,e,t,r));else{var I=!1,k=!1,R=void 0!==t.count&&"string"!=typeof t.count,O=n.hasDefaultValue(t),P=R?this.pluralResolver.getSuffix(d,t.count,t):"",N=t["defaultValue".concat(P)]||t.defaultValue;!this.isValidLookup(m)&&O&&(I=!0,m=N),this.isValidLookup(m)||(k=!0,m=l);var B=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,L=B&&k?void 0:m,D=O&&N!==m&&this.options.updateMissing;if(k||I||D){if(this.logger.log(D?"updateKey":"missingKey",d,u,l,D?N:m),a){var U=this.resolve(l,_F(_F({},t),{},{keySeparator:!1}));U&&U.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var F=[],z=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&z&&z[0])for(var j=0;j<z.length;j++)F.push(z[j]);else"all"===this.options.saveMissingTo?F=this.languageUtils.toResolveHierarchy(t.lng||this.language):F.push(t.lng||this.language);var H=function(e,n,r){var o=O&&r!==m?r:L;i.options.missingKeyHandler?i.options.missingKeyHandler(e,u,n,o,D,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,u,n,o,D,t),i.emit("missingKey",e,u,n,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?F.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(n){H([e],l+n,t["defaultValue".concat(n)]||N)}))})):H(F,l,N))}m=this.extendTranslation(m,e,t,p,r),k&&m===l&&this.options.appendNamespaceToMissingKey&&(m="".concat(u,":").concat(l)),(k||I)&&this.options.parseMissingKeyHandler&&(m="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u,":").concat(l):l,I?m:void 0):this.options.parseMissingKeyHandler(m))}return o?(p.res=m,p):m}},{key:"extendTranslation",value:function(e,t,n,r,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,_F(_F({},this.options.interpolation.defaultVariables),n),r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(_F(_F({},n),{interpolation:_F(_F({},this.options.interpolation),n.interpolation)}));var a,s="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(s){var l=e.match(this.interpolator.nestingRegexp);a=l&&l.length}var c=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(c=_F(_F({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,n.lng||this.language,n),s){var u=e.match(this.interpolator.nestingRegexp);a<(u&&u.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return i&&i[0]===r[0]&&!n.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):o.translate.apply(o,r.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var d=n.postProcess||this.options.postProcess,h="string"==typeof d?[d]:d;return null!=e&&h&&h.length&&!1!==n.applyPostProcessor&&(e=xF.handle(h,e,t,this.options&&this.options.postProcessPassResolved?_F({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,i,o,a=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),c=l.key;n=c;var u=l.namespaces;a.options.fallbackNS&&(u=u.concat(a.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,h=d&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),f=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);u.forEach((function(e){a.isValidLookup(t)||(o=e,!EF["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(o)&&(EF["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){i=n;var o,l=[c];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(l,c,n,e,s);else{var u;d&&(u=a.pluralResolver.getSuffix(n,s.count,s));var p="".concat(a.options.pluralSeparator,"zero");if(d&&(l.push(c+u),h&&l.push(c+p)),f){var m="".concat(c).concat(a.options.contextSeparator).concat(s.context);l.push(m),d&&(l.push(m+u),h&&l.push(m+p))}}for(;o=l.pop();)a.isValidLookup(t)||(r=o,t=a.getResource(n,e,o,s))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),n}(rF);function TF(e){return e.charAt(0).toUpperCase()+e.slice(1)}var IF=function(){function e(t){UU(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=nF.create("languageUtils")}return zU(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=TF(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=TF(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=TF(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach((function(e){i.indexOf(e)<0&&o(n.formatLanguageCode(e))})),i}}]),e}(),kF=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],RF={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},OF=["v1","v2","v3"],PF={zero:0,one:1,two:2,few:3,many:4,other:5};function NF(){var e={};return kF.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:RF[t.fc]}}))})),e}var BF=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};UU(this,e),this.languageUtils=t,this.options=n,this.logger=nF.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=NF()}return zU(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return PF[e]-PF[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!OF.includes(this.options.compatibilityJSON)}}]),e}();function LF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function DF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?LF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var UF=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};UU(this,e),this.logger=nF.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return zU(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:pF,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?hF(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?hF(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?hF(t.nestingPrefix):t.nestingPrefixEscaped||hF("$t("),this.nestingSuffix=t.nestingSuffix?hF(t.nestingSuffix):t.nestingSuffixEscaped||hF(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,a,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(s.formatSeparator)<0){var i=uF(t,l,e);return s.alwaysFormat?s.format(i,void 0,n,DF(DF(DF({},r),t),{},{interpolationkey:e})):i}var o=e.split(s.formatSeparator),a=o.shift().trim(),c=o.join(s.formatSeparator).trim();return s.format(uF(t,l,a),c,n,DF(DF(DF({},r),t),{},{interpolationkey:a}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?c(s.escape(e)):c(e)}}].forEach((function(t){for(a=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(o=u(n)))if("function"==typeof d){var l=d(e,i,r);o="string"==typeof l?l:""}else if(r&&r.hasOwnProperty(n))o="";else{if(h){o=i[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||s.useRawValueToEscape||(o=oF(o));var c=t.safeValue(o);if(e=e.replace(i[0],c),h?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=DF({},o);function s(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),i="{".concat(r[1]);e=r[0];var o=(i=this.interpolate(i,a)).match(/'/g),s=i.match(/"/g);(o&&o.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{a=JSON.parse(i),t&&(a=DF(DF({},t),a))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(i)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;n=this.nestingRegexp.exec(e);){var l=[],c=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var u=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=u.shift(),l=u,c=!0}if((r=t(s.call(this,n[1].trim(),a),a))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=oF(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),c&&(r=l.reduce((function(e,t){return i.format(e,t,o.lng,DF(DF({},o),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function FF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function zF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function jF(e){var t={};return function(n,r,i){var o=r+JSON.stringify(i),a=t[o];return a||(a=e(r,i),t[o]=a),a(n)}}var HF=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};UU(this,e),this.logger=nF.create("formatter"),this.options=t,this.formats={number:jF((function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}})),currency:jF((function(e,t){var n=new Intl.NumberFormat(e,zF(zF({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:jF((function(e,t){var n=new Intl.DateTimeFormat(e,zF({},t));return function(e){return n.format(e)}})),relativetime:jF((function(e,t){var n=new Intl.RelativeTimeFormat(e,zF({},t));return function(e){return n.format(e,t.range||"day")}})),list:jF((function(e,t){var n=new Intl.ListFormat(e,zF({},t));return function(e){return n.format(e)}}))},this.init(t)}return zU(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=t.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=jF(t)}},{key:"format",value:function(e,t,n,r){var i=this,o=t.split(this.formatSeparator).reduce((function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=YU(e.split(":")),r=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=i),"false"===i&&(n[r.trim()]=!1),"true"===i&&(n[r.trim()]=!0),isNaN(i)||(n[r.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:n}}(t),a=o.formatName,s=o.formatOptions;if(i.formats[a]){var l=e;try{var c=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},u=c.locale||c.lng||r.locale||r.lng||n;l=i.formats[a](e,u,zF(zF(zF({},s),r),c))}catch(e){i.logger.warn(e)}return l}return i.logger.warn("there was no format function for ".concat(a)),e}),e);return o}}]),e}();function GF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function VF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?GF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function WF(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=WU(e);if(t){var i=WU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return VU(this,n)}}var qF=function(e){GU(n,e);var t=WF(n);function n(e,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return UU(this,n),o=t.call(this),mF&&rF.call(jU(o)),o.backend=e,o.store=r,o.services=i,o.languageUtils=i.languageUtils,o.options=a,o.logger=nF.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,a.backend,a),o}return zU(n,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},a={},s={},l={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[s]=2:i.state[s]<0||(1===i.state[s]?void 0===a[s]&&(a[s]=!0):(i.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===l[t]&&(l[t]=!0)))})),r||(s[e]=!0)})),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){var r,s,l,c,u,d;r=n.loaded,s=o,c=sF(r,[i],Object),u=c.obj,d=c.k,u[d]=u[d]||[],l&&(u[d]=u[d].concat(s)),l||u[d].push(s),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;return e.length?this.readingCalls>=this.maxParallelReads?void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:o,callback:a}):(this.readingCalls++,this.backend[n](e,t,(function(s,l){if(r.readingCalls--,r.waitingReads.length>0){var c=r.waitingReads.shift();r.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}s&&l&&i<r.maxRetries?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,a)}),o):a(s,l)}))):a(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),a),t.loaded(e,r,a)}))}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,VF(VF({},o),{},{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,n,r))}}]),n}(rF);function KF(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===$L(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===$L(e[2])||"object"===$L(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function JF(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function QF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function XF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?QF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function YF(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=WU(e);if(t){var i=WU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return VU(this,n)}}function ZF(){}function $F(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var ez=function(e){GU(n,e);var t=YF(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(UU(this,n),e=t.call(this),mF&&rF.call(jU(e)),e.options=JF(r),e.services={},e.logger=nF,e.modules={external:[]},$F(jU(e)),i&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,i),VU(e,jU(e));setTimeout((function(){e.init(r,i)}),0)}return e}return zU(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var r=KF();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=XF(XF(XF({},r),this.options),JF(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=XF(XF({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var o;this.modules.logger?nF.init(i(this.modules.logger),this.options):nF.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=HF);var a=new IF(this.options);this.store=new SF(this.options.resources,this.options);var s=this.services;s.logger=nF,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new BF(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(s.formatter=i(o),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new UF(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new qF(i(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.languageDetector&&(s.languageDetector=i(this.modules.languageDetector),s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=i(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new CF(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=ZF),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var c=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];c.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));var u=["addResource","addResources","addResourceBundle","removeResourceBundle"];u.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var d=iF(),h=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),d.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),d}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ZF,r=n,i="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return r();var o=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};if(i)a(i);else{var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return a(e)})),this.services.backendConnector.load(o,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),r(e)}))}else r(null)}},{key:"reloadResources",value:function(e,t,n){var r=iF();return e||(e=this.languages),t||(t=this.options.ns),n||(n=ZF),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&xF.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=iF();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var a="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);a&&(n.language||i(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(function(e){!function(e,o){o?(i(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,a)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){var o;if("object"!==$L(i)){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];o=r.options.overloadTranslationOptionHandler([t,i].concat(s))}else o=XF({},i);o.lng=o.lng||e.lng,o.lngs=o.lngs||e.lngs,o.ns=o.ns||e.ns,o.keyPrefix=o.keyPrefix||n||e.keyPrefix;var c=r.options.keySeparator||".",u=o.keyPrefix?"".concat(o.keyPrefix).concat(c).concat(t):t;return r.t(u,o)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,i}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=iF();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=iF();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter((function(e){return r.indexOf(e)<0}));return i.length?(this.options.preload=r.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ZF,i=XF(XF(XF({},this.options),t),{isClone:!0}),o=new n(i);void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t));var a=["store","services","language"];return a.forEach((function(t){o[t]=e[t]})),o.services=XF({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new CF(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))})),o.init(i,r),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(rF);nD(ez,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new ez(e,t)}));var tz=ez.createInstance();tz.createInstance=ez.createInstance;tz.createInstance,tz.init,tz.loadResources,tz.reloadResources,tz.use,tz.changeLanguage,tz.getFixedT,tz.t,tz.exists,tz.setDefaultNamespace,tz.hasLoadedNamespace,tz.loadNamespaces,tz.loadLanguages;var nz,rz=tz;nz=JSON.parse('{"yes":"Si","no":"No","confirm":"Conferma","cancel":"Annulla","show":"Mostra","hide":"Nascondi","send":"Invia","loading":"Caricamento","copy":"Copia","copyToClipboard":"Copia negli appunti","showOriginalText":"Mostra originale","showTranslatedText":"Mostra traduzione","memoriBlockedTitle":"Bloccato","memoriBlockedUntil":"Memori bloccato fino al {{date}}","memoriBlockedAnon":"Attualmente \\"{{name}}\\" non può rispondere, torna qui il {{date}}","memoriBlockedReasonExceedChats":"perchè ha superato la soglia mensile di chat ammesse.","memoriBlockedGiverHelper":"Puoi sempre gestirlo in qualità di amministratore, ma altri utenti non potranno interrogarlo.","auth":{"useRecoveryTokens":"Utilizza i token di recupero","tokens":"Token","addToken":"Aggiungi token","usePassword":"Utilizza la password","atLeast":"Almeno"},"widget":{"instruct":"Istruisci","test":"Prova","sound":"Audio","position":"Posizione","settings":"Impostazioni","share":"Condividi","sendOnKeypress":"Premi Invio per inviare","sendOnClick":"Clicca sul bottone di invio","goToIntegrationsToCustomizeAvatar":"Per personalizzare l\'avatar, vai a Condividimi e configura la pagina pubblica"},"write_and_speak":{"micButtonPopover":"Premi il pulsante per parlare","micButtonPopoverListening":"Premi il pulsante per smettere di parlare","pageInstructExplanation":"Per insegnarmi nuove cose clicca sul pulsante ISTRUISCIMI per cominciare","pageTryMeExplanation":"Per parlare con me clicca sul pulsante INIZIAMO per cominciare","instructButton":"ISTRUISCIMI","tryMeButton":"INIZIAMO","chatHistory":"Cronologia chat","exportChatHistory":"Esporta la cronologia chat","exportChatHistoryMessage":"Vuoi esportare la cronologia chat?","chatBotButtonText":"CLICCA QUI PER APRIRE LA CHAT","conversationStartedLabel":"Conversazione avvenuta il","settingsHeaderLabel":"Configura qui il memori se vuoi impostare una conversazione continua. Setta i secondi di silenzio prima dell\'invio.","continuousSpeechLabel":"Conversazione continua","secondsLabel":"Secondi","tryMeHeaderLabel":"PROVA","unknownPosition":"Posizione sconosciuta","fieldPlace":"Indica la posizione (es \'Milano\')","showMapLinkFor":"Visualizza sulla mappa la posizione","useMyPosition":"Usa la mia posizione","myPosition":"Posizione corrente","updatingPosition":"Aggiorno la posizione...","placeNotFound":"Luogo sconosciuto!","requirePosition":"Inserisci la posizione prima di iniziare","attachmentsLabel":"Arricchisci il tuo messaggio","iWantToTalkToIn":"Voglio parlare con {{name}} in"},"gamification":{"level":"Livello","points":"punti","memoriReachedLevel":"è diventato più evoluto ed ha raggiunto il livello","levelGoToStatistics":"{{memori}} è al livello {{level}} con {{points}} punti. Clicca per andare alle statistiche.","congratulationsNewLevel":"Congratulazioni, hai raggiunto un nuovo livello!","congratulationsNewLevelDescription":"Il tuo Memori è diventato più evoluto con {{points}} punti, guarda le","statistics":"statistiche"},"success":"Operazione andata a buon fine","Error":"Errore","internal server error":"Ops, scusa... qualcosa è andato storto nel server","error":"Errore","error.loading":"Errore durante il caricamento dei contenuti.","error.notFound":"Ops, non abbiamo trovato ciò che cercavi.","error.generic":"Ops, qualcosa è andato storto.","error.serverNotResponding":"Stiamo facendo manutenzione o rilasciando aggiornamenti. Riprova più tardi.","error.unprocessableEntity":"Errore durante il salvataggio dei dati. Ricontrolla i dati inseriti.","error.goBackTo":"Prova a tornare alla","error.reloadPage":"Ricarica la pagina","error.tryAgain":"Riprova","error.unauthorized":"Non sei autorizzato a visualizzare questo contenuto.","errors":{"TENANT_NOT_FOUND":"Tenant non trovato","TENANT_REGISTRATION_DISABLED":"La registrazione su questa piattaforma è disabilitata","TENANT_MISSING_NAME":"Tenant: nome mancante","TENANT_MAX_USERS_REACHED":"Numero massimo di utenti raggiunto","TENANT_MAX_ADMINS_REACHED":"Numero massimo di utenti amministratori raggiunto","USER_NOT_CONFIRMED":"Utente ancora non confermato","USER_NOT_FOUND":"Utente non trovato","USER_OR_PASSWORD_INVALID":"Utente o password non validi","USER_MUST_CHANGE_PASSWORD":"Devi cambiare la password","USER_MUST_ENTER_VERIFICATION_CODE":"Devi inserire il codice di verifica","USER_MISSING_TENANT":"Utente: tenant mancante","USER_MISSING_NAME":"Utente: nome mancante","USER_MISSING_PASSWORD":"Utente: password mancante","USER_MISSING_EMAIL":"Utente: email mancante","USER_MISSING_VERIFICATION_CODE":"Utente: codice di verifica mancante","USER_NAME_ALREADY_USED":"Nome utente già in uso","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"La password non rispetta le regole di sicurezza","USER_EMAIL_ALREADY_USED":"Email già in uso","USER_EMAIL_INVALID":"Email non valida","USER_VERIFICATION_CODE_INVALID":"Codice di verifica non valido","USER_MISSING_NAME_OR_EMAIL":"Nome utente o email mancante","USER_NAME_INVALID":"Nome utente non valido","USER_HAS_ONE_OR_MORE_MEMORI":"L\'utente ha uno o più memori","USER_MISSING_NEW_PASSWORD":"Utente: nuova password mancante","USER_NOTHING_TO_DO":"Niente da fare","USER_CANT_CREATE_MEMORI":"Utente non abilitato a creare Memori","USER_MAX_MEMORI_REACHED":"Massimo numero di Memori raggiunto","USER_CANT_EDIT_INTEGRATIONS":"Utente non abilitato a gestire integrazioni","MEMORI_NOT_FOUND":"Memori non trovato","MEMORI_NOT_ACCESSIBLE":"Memori non accessibile","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Solo il proprietario può cambiare il tag e il pin","SESSION_NOT_FOUND":"Sessione non trovata","SESSION_IS_NOT_ADMINISTRATIVE":"Sessione non amministrativa","MEMORI_MISSING_CONFIGURATION":"Memori: configurazione mancante","MEMORI_CONFIGURATION_NOT_FOUND":"Memori: configurazione non trovata","MEMORI_INVALID_PRIVACY_TYPE":"Memori: tipo di privacy non valido","MEMORI_MISSING_PASSWORD":"Memori: password mancante","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Memori: numero totale di token di recupero non valido","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Memori: numero minimo di token di recupero non valido","MEMORI_INVALID_VOICE_TYPE":"Memori: tipo di voce non valido","MEMORI_MISSING_NAME":"Memori: nome mancante","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Memori: password o token di recupero mancanti","MEMORI_INVALID_ID":"Memori: ID non valido","MEMORI_NAME_ALREADY_USED":"Nome memori già in uso","MEMORI_INVALID_PIN":"Memori: PIN non valido","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Memori: cambio TAG e PIN richiedono operazioni separate","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Memori: password non richiesta su Memori pubblico","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Trasferimento: utente di destinazione mancante","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Trasferimento: ID utente di destinazione non valido","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Trasferimento: dati utente di destinazione non validi","MEMORI_TRANSFER_NOTHING_TO_DO":"Trasferimento: alcuna operazione da fare","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Memori: la configurazione non può essere modificata","MEMORI_MISSING_NEW_PASSWORD":"Memori: nuova password mancante","INTEGRATION_NOT_FOUND":"Integrazione non trovata","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Formato non valido data a partire da","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Formato non valido data fino a","INTEGRATION_INVALID_TYPE":"Tipo integrazione non valido","INTEGRATION_ALREADY_EXISTS":"Integrazione già esistente","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Memori non pubblici non possono essere integrati","INTEGRATION_MISSING_INVOCATION_TEXT":"Integrazione: testo di invocazione mancante","INTEGRATION_MISSING_DEVICE_EMAILS":"Integrazione: email del dispositivo mancante","INTEGRATION_MEMORI_IS_EMPTY":"Memori vuoti non possono essere integrati","INTEGRATION_MISSING_PRIVACY_POLICY":"Integrazione: privacy policy mancante","INTEGRATION_MISSING_CATEGORY":"Categoria integrazione mancante","INTEGRATION_MISSING_DESCRIPTION":"Descrizione integrazione mancante","INTEGRATION_INVALID_INVOCATION_TEXT":"Testo di invocazione non valido","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home non più disponibile","UPLOAD_REQUIRES_MULTIPART_ENCODING":"L\'upload richiede l\'encoding multipart","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: manca il content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: dimensione massima superata","UPLOAD_FILE_IS_EMPTY":"Upload: file vuoto","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: tipo di file o firma non validi","UPLOAD_MISSING_FILE_NAME":"Upload: nome file mancante","UPLOAD_INVALID_MEMORY_ID":"Upload: ID contenuto non valido","UPLOAD_MISSING_FILE_CONTENT":"Upload: contenuto file mancante","ASSET_NOT_FOUND":"Asset non trovato","ASSET_NOT_ACCESSIBLE":"Asset non accessibile","ASSET_MISSING_SESSION_ID":"Asset: ID sessione mancante","ASSET_INVALID_FILE_NAME":"Asset: nome file non valido","INVITATION_NOT_FOUND":"Invito non trovato","INVITATION_NOT_ACCESSIBLE":"Invito non accessibile","INVITATION_ALREADY_ACCEPTED":"Invito già accettato","INVITATION_ALREADY_REJECTED":"Invito già rifiutato","INVITATION_MISSING_DESTINATION_EMAIL":"Invito: email di destinazione mancante","INVITATION_DESTINATION_EMAIL_INVALID":"Invito: email di destinazione non valida","INVITATION_MISSING_TAG":"Invito: tag mancante","INVITATION_MISSING_PIN":"Invito: PIN mancante","INVITATION_INVALID_PIN":"Invito: PIN non valido","INVITATION_INVALID_TYPE":"Invito: tipo non valido","INVITATION_MISSING_DESTINATION_NAME":"Invito: nome destinatario mancante","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invito: tag e pin non possono essere cambiati","INVITATION_CANT_BE_CHANGED":"Invito: non può essere modificato","ACTIONLOG_INVALID_USER_ID":"ID utente non valido","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","ACTIONLOG_INVALID_MEMORI_ID":"ID Memori non valido","CONSUMPTIONLOG_INVALID_TYPE":"Tipo di log non valido","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","CONSUMPTIONLOG_INVALID_USER_ID":"ID utente non valido","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Memori ID non valido"}}');const iz={en:{translation:n(JSON.parse('{"yes":"Yes","no":"No","confirm":"Confirm","cancel":"Cancel","show":"Show","hide":"Hide","send":"Send","loading":"Loading","copy":"Copy","copyToClipboard":"Copy to clipboard","showOriginalText":"Show original","showTranslatedText":"Show translation","memoriBlockedTitle":"Blocked","memoriBlockedUntil":"Memori blocked until {{date}}","memoriBlockedAnon":"Currently \\"{{name}}\\" can\'t answer, come back here on {{date}}","memoriBlockedReasonExceedChats":"because it has exceeded the monthly threshold of allowed chats.","memoriBlockedGiverHelper":"You can still manage it as administrator, but other users will not be able to interact with it.","auth":{"useRecoveryTokens":"Use recovery tokens","tokens":"Tokens","addToken":"Add token","usePassword":"Use password","atLeast":"At least"},"widget":{"instruct":"Instruct","test":"Test","sound":"Sound","position":"Position","settings":"Settings","share":"Share","sendOnKeypress":"Hit Enter to send","sendOnClick":"Click on Submit","goToIntegrationsToCustomizeAvatar":"To customize the avatar, go to Share and customize the public page"},"write_and_speak":{"micButtonPopover":"Click the button to speak","micButtonPopoverListening":"Click the button to stop speak","pageInstructExplanation":"To teach me new things click on the INSTRUCT ME button to get started","pageTryMeExplanation":"To talk to me click on the START button to get started","instructButton":"INSTRUCT ME","tryMeButton":"START","chatHistory":"Chat history","exportChatHistory":"Export chat history","exportChatHistoryMessage":"Do you want to export chat history?","chatBotButtonText":"CLICK HERE TO OPEN CHATBOT","conversationStartedLabel":"Conversation started on","settingsHeaderLabel":"Setup here if you want to set the memori as continuous speech, and change the silence seconds if you want to customize them.","continuousSpeechLabel":"Continuous speech","secondsLabel":"Set seconds","tryMeHeaderLabel":"TRY","unknownPosition":"Unknown position","fieldPlace":"Write the place (eg \'Milano\')","showMapLinkFor":"Show the position on the map","useMyPosition":"Use my position","myPosition":"Your position","updatingPosition":"Updating position...","placeNotFound":"Place not found!","requirePosition":"Insert your position before start","attachmentsLabel":"Enrich your message","iWantToTalkToIn":"I want to talk to {{name}} in"},"gamification":{"level":"Level","points":"points","memoriReachedLevel":"became more evolved and reached level","levelGoToStatistics":"{{memori}} is at level {{level}} with {{points}} points. Click to go to statistics.","congratulationsNewLevel":"Congratulations, you have reached a new level!","congratulationsNewLevelDescription":"Your Memori became more evolved with {{points}} points, look at the","statistics":"statistics"},"success":"Success","Error":"Error","internal server error":"Oupsie, sorry... Something went wrong on the server","error":"Error","error.loading":"Error while loading content.","error.generic":"Oupsie, sorry... something went wrong.","error.serverNotResponding":"We are doing maintenance or releasing updates. Please try again later.","error.notFound":"Oupsie, we didn\'t find the page you were looking for.","error.goBackTo":"You can try to go back to the","error.reloadPage":"Reload the page","error.tryAgain":"Try again","error.unauthorized":"You are unauthorized to view this content.","error.unprocessableEntity":"Error while processing the request. Check the data you entered.","errors":{"TENANT_NOT_FOUND":"Tenant not found","TENANT_REGISTRATION_DISABLED":"Registration on this platform is disabled","TENANT_MISSING_NAME":"Tenant: name missing","TENANT_MAX_USERS_REACHED":"Maximum number of users reached","TENANT_MAX_ADMINS_REACHED":"Maximum number of admin users reached","USER_NOT_CONFIRMED":"User still not confirmed","USER_NOT_FOUND":"User not found","USER_OR_PASSWORD_INVALID":"Invalid user or password","USER_MUST_CHANGE_PASSWORD":"You must change your password","USER_MUST_ENTER_VERIFICATION_CODE":"You must enter the verification code","USER_MISSING_TENANT":"User: missing tenant","USER_MISSING_NAME":"User: name is missing","USER_MISSING_PASSWORD":"User: password missing","USER_MISSING_EMAIL":"User: Missing email","USER_MISSING_VERIFICATION_CODE":"User: Missing verification code","USER_NAME_ALREADY_USED":"User name already in use","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"The password does not meet the security rules","USER_EMAIL_ALREADY_USED":"Email already in use","USER_EMAIL_INVALID":"Invalid email","USER_VERIFICATION_CODE_INVALID":"Invalid verification code","USER_MISSING_NAME_OR_EMAIL":"Missing username or email","USER_NAME_INVALID":"Invalid user name","USER_HAS_ONE_OR_MORE_MEMORI":"The user has one or more memories","USER_MISSING_NEW_PASSWORD":"User: new password missing","USER_NOTHING_TO_DO":"Nothing to do","USER_CANT_CREATE_MEMORI":"User not allowed to create Memori","USER_MAX_MEMORI_REACHED":"Maximum number of Memori reached","USER_CANT_EDIT_INTEGRATIONS":"User not allowed to manage integrations","MEMORI_NOT_FOUND":"Memori not found","MEMORI_NOT_ACCESSIBLE":"Memori not accessible","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Only owner can change tag or pin","SESSION_NOT_FOUND":"Session not found","SESSION_IS_NOT_ADMINISTRATIVE":"Non-administrative session","MEMORI_MISSING_CONFIGURATION":"Memori: missing configuration","MEMORI_CONFIGURATION_NOT_FOUND":"Memories: configuration not found","MEMORI_INVALID_PRIVACY_TYPE":"Memories: invalid privacy type","MEMORI_MISSING_PASSWORD":"Memori: missing password","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Memories: total number of invalid recovery tokens","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Memories: minimum number of invalid recovery tokens","MEMORI_INVALID_VOICE_TYPE":"Memories: invalid voice type","MEMORI_MISSING_NAME":"Memories: missing name","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Memories: missing password or recovery token","MEMORI_INVALID_ID":"Memories: invalid ID","MEMORI_NAME_ALREADY_USED":"Memory name already in use","MEMORI_INVALID_PIN":"Memories: Invalid PIN","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Memories: TAG and PIN change require separate operations","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Memories: no password required when public","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Transfer: missing destination user","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Transfer: invalid destination user ID","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Transfer: invalid destination user data","MEMORI_TRANSFER_NOTHING_TO_DO":"Transfer: nothing to do","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Memories: configuration cannot be changed","MEMORI_MISSING_NEW_PASSWORD":"Memories: new password missing","INTEGRATION_NOT_FOUND":"Integration not found","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Invalid date from format","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Invalid date to format","INTEGRATION_INVALID_TYPE":"Invalid integration type","INTEGRATION_ALREADY_EXISTS":"Integration already exists","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Non-public memories cannot be integrated","INTEGRATION_MISSING_INVOCATION_TEXT":"Integration: missing invocation text","INTEGRATION_MISSING_DEVICE_EMAILS":"Integration: missing device email","INTEGRATION_MEMORI_IS_EMPTY":"Empty memories cannot be integrated","INTEGRATION_MISSING_PRIVACY_POLICY":"Integration: privacy policy missing","INTEGRATION_MISSING_CATEGORY":"Integration category missing","INTEGRATION_MISSING_DESCRIPTION":"Missing integration description","INTEGRATION_INVALID_INVOCATION_TEXT":"Invalid invocation text","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home no more available","UPLOAD_REQUIRES_MULTIPART_ENCODING":"Upload requires multipart encoding","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: missing content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: maximum size exceeded","UPLOAD_FILE_IS_EMPTY":"Upload: empty file","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: invalid file type or signature","UPLOAD_MISSING_FILE_NAME":"Upload: missing file name","UPLOAD_INVALID_MEMORY_ID":"Upload: Invalid content ID","UPLOAD_MISSING_FILE_CONTENT":"Upload: Missing file content","ASSET_NOT_FOUND":"Asset not found","ASSET_NOT_ACCESSIBLE":"Asset not accessible","ASSET_MISSING_SESSION_ID":"Asset: missing session ID","ASSET_INVALID_FILE_NAME":"Asset: invalid file name","INVITATION_NOT_FOUND":"Invitation not found","INVITATION_NOT_ACCESSIBLE":"Invitation not accessible","INVITATION_ALREADY_ACCEPTED":"Invitation already accepted","INVITATION_ALREADY_REJECTED":"Invitation already rejected","INVITATION_MISSING_DESTINATION_EMAIL":"Invitation: missing destination email","INVITATION_DESTINATION_EMAIL_INVALID":"Invitation: destination email invalid","INVITATION_MISSING_TAG":"Invitation: missing tag","INVITATION_MISSING_PIN":"Invitation: PIN missing","INVITATION_INVALID_PIN":"Invitation: invalid PIN","INVITATION_INVALID_TYPE":"Invitation: invalid type","INVITATION_MISSING_DESTINATION_NAME":"Invitation: destination name missing","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invitation: tag and pin can\'t be changed","INVITATION_CANT_BE_CHANGED":"Intation: can\'t be changed","ACTIONLOG_INVALID_USER_ID":"Invalid user ID","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","ACTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID","CONSUMPTIONLOG_INVALID_TYPE":"Invalid log type","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","CONSUMPTIONLOG_INVALID_USER_ID":"Invalid user ID","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID"}}'))},it:{translation:n(nz)}};rz.use(so).init({resources:iz,lng:"en",fallbackLng:"it",supportedLngs:["en","it"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1}});var oz=rz;const az=({ownerUserName:e,ownerUserID:t,memoriName:r,memoriID:i,integrationID:o,tenantID:a,secretToken:s,sessionID:l,showShare:u=!0,showSettings:d=!1,showInstruct:h=!1,height:f="100%",baseURL:p,apiURL:m="https://backend.memori.ai",tag:g,pin:v,context:b,initialQuestion:y,uiLang:w,spokenLang:S,AZURE_COGNITIVE_SERVICES_TTS_KEY:x,onStateChange:M})=>{var _,A,E;const[C,T]=(0,c.useState)(),{t:I}=yo();if(!(i&&t||r&&e))throw new Error("Identifier pair required: please provide either memoriID and ownerUserID or memoriName and ownerUserName");const k=Vi(m),R=(0,c.useCallback)((async()=>{if(i&&t){const{memori:e,...n}=await k.backend.getMemoriByUserAndId(a,t,i);0===n.resultCode&&e?T(e):console.error("[MEMORI]",n,e)}else if(r&&e){const{memori:t,...n}=await k.backend.getMemori(a,e,r);0===n.resultCode&&t?T(t):console.error("[MEMORI]",n,t)}}),[i,t,r,e,a]);return(0,c.useEffect)((()=>{R()}),[R,a]),(0,c.useEffect)((()=>{if(w)oz.changeLanguage(w.toLowerCase());else{const{lng:e,fallbackLng:t}=(()=>{const e=navigator.language;if(e){let t=e.split("-")[0];if(["en","it"].includes(t))return{lng:t,fallbackLng:"en"===t?"it":"en"}}return{lng:"en",fallbackLng:"it"}})();oz.changeLanguage(e).catch((()=>{oz.changeLanguage(t)}))}}),[w]),C?n(c).createElement(DU,{height:f,baseUrl:p||(a.startsWith("https://")?a:`https://${a}`),apiUrl:m,memori:{...C,secretToken:s},memoriLang:null!=S?S:null===(A=null===(_=C.culture)||void 0===_?void 0:_.split("-"))||void 0===A?void 0:A[0],tenant:{id:a,theme:"twincreator",config:{name:a,showNewUser:!1,requirePosition:!!C.needsPosition}},secret:s,sessionID:l,showShare:u,showSettings:d,showInstruct:h,integration:null===(E=null==C?void 0:C.integrations)||void 0===E?void 0:E.find((e=>o?e.integrationID===o:!!e.publish&&"LANDING_EXPERIENCE"===e.type)),initialContextVars:b,initialQuestion:y,AZURE_COGNITIVE_SERVICES_TTS_KEY:x,onStateChange:M,...g&&v?{personification:{tag:g,pin:v}}:{}}):n(c).createElement("div",null,n(c).createElement("p",{style:{textAlign:"center",margin:"2rem auto"}},I("loading"),"..."))};az.propTypes={memoriName:n(l).string,memoriID:n(l).string,ownerUserName:n(l).string,ownerUserID:n(l).string,integrationID:n(l).string,tenantID:n(l).string.isRequired,secretToken:n(l).string,showShare:n(l).bool,showSettings:n(l).bool,baseURL:n(l).string,apiURL:n(l).string,tag:n(l).string,pin:n(l).string,showInstruct:n(l).bool,context:n(l).objectOf(n(l).any),initialQuestion:n(l).string,uiLang:n(l).oneOf(["en","it"]),spokenLang:n(l).string,AZURE_COGNITIVE_SERVICES_TTS_KEY:n(l).string,onStateChange:n(l).func};var sz=az;class lz extends HTMLElement{connectedCallback(){const e=document.createElement("div"),t=document.createElement("div");t.setAttribute("id","memori-root");const r=document.createElement("style");r.innerHTML="\n @import url('https://unpkg.com/@memori.ai/memori-webcomponent/dist/memori-webcomponent.css');\n ",e.appendChild(r),e.appendChild(t),this.appendChild(e);const i=Object.keys(sz.propTypes).reduce(((e,t)=>(this.hasAttribute(t)&&(e[t]=this.getAttribute(t)),e)),{}),o=this.getAttribute("tenantId"),l=this.getAttribute("context")?.split(",")?.reduce(((e,t)=>{const[n,r]=t.split(":").map((e=>e.trim()));return{...e,[n]:r}}),{});o?n(s).render((0,a.jsx)(sz,{...i,context:l,tenantID:o}),t):console.error("No tenantId attribute found")}}customElements.define("memori-client",lz)})();
|
|
78
|
+
*/function hU(e,t=0){const n=[];return e.forEach((function(e,r){let i=null;e.forEach((function(o,a){if(!o&&null!==i)return n.push(`M${i+t} ${r+t}h${a-i}v1H${i+t}z`),void(i=null);if(a!==e.length-1)o&&null===i&&(i=a);else{if(!o)return;null===i?n.push(`M${a+t},${r+t} h1v1H${a+t}z`):n.push(`M${i+t},${r+t} h${a+1-i}v1H${i+t}z`)}}))})),n.join("")}function fU(e,t){return e.slice().map(((e,n)=>n<t.y||n>=t.y+t.h?e:e.map(((e,n)=>(n<t.x||n>=t.x+t.w)&&e))))}function pU(e,t,n,r){if(null==r)return null;const i=n?4:0,o=e.length+2*i,a=Math.floor(.1*t),s=o/t,l=(r.width||a)*s,c=(r.height||a)*s,u=null==r.x?e.length/2-l/2:r.x*s,d=null==r.y?e.length/2-c/2:r.y*s;let h=null;if(r.excavate){let e=Math.floor(u),t=Math.floor(d);h={x:e,y:t,w:Math.ceil(l+u-e),h:Math.ceil(c+d-t)}}return{x:u,y:d,h:c,w:l,excavation:h}}var mU=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}();function gU(e){const t=e,{value:r,size:i=sU,level:o=lU,bgColor:a=cU,fgColor:s=uU,includeMargin:l=dU,style:u,imageSettings:d}=t,h=iU(t,["value","size","level","bgColor","fgColor","includeMargin","style","imageSettings"]),f=null==d?void 0:d.src,p=(0,c.useRef)(null),m=(0,c.useRef)(null),[g,v]=(0,c.useState)(!1);(0,c.useEffect)((()=>{if(null!=p.current){const e=p.current,t=e.getContext("2d");if(!t)return;let n=oU.QrCode.encodeText(r,aU[o]).getModules();const c=l?4:0,u=n.length+2*c,h=pU(n,i,l,d),f=m.current,g=null!=h&&null!==f&&f.complete&&0!==f.naturalHeight&&0!==f.naturalWidth;g&&null!=h.excavation&&(n=fU(n,h.excavation));const v=window.devicePixelRatio||1;e.height=e.width=i*v;const b=i/u*v;t.scale(b,b),t.fillStyle=a,t.fillRect(0,0,u,u),t.fillStyle=s,mU?t.fill(new Path2D(hU(n,c))):n.forEach((function(e,n){e.forEach((function(e,r){e&&t.fillRect(r+c,n+c,1,1)}))})),g&&t.drawImage(f,h.x+c,h.y+c,h.w,h.h)}})),(0,c.useEffect)((()=>{v(!1)}),[f]);const b=rU({height:i,width:i},u);let y=null;return null!=f&&(y=n(c).createElement("img",{src:f,key:f,style:{display:"none"},onLoad:()=>{v(!0)},ref:m})),n(c).createElement(n(c).Fragment,null,n(c).createElement("canvas",rU({style:b,height:i,width:i,ref:p},h)),y)}var vU=({url:e,title:t="",className:r,baseUrl:i,primary:o=!0,showQrCode:a=!0,align:s="right"})=>{const{t:l}=yo(),[u,d]=(0,c.useState)(e);(0,c.useEffect)((()=>{e||d(window.location.href)}),[e]);const h=[{id:"facebook",title:"Facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${u}`,icon:GD},{id:"twitter",title:"Twitter",url:`https://twitter.com/intent/tweet?url=${u}`,icon:VD},{id:"linkedin",title:"LinkedIn",url:`https://www.linkedin.com/shareArticle?mini=true&title=${t}&url=${u}`,icon:WD},{id:"whatsapp",title:"Whatsapp",url:`https://api.whatsapp.com/send?phone=&text=${u}`,icon:qD},{id:"telegram",title:"Telegram",url:`https://t.me/share/url?text=${t}&url=${u}`,icon:YD},{id:"email",title:"Email",url:`mailto:?subject=${(null==t?void 0:t.length)>0?t:e}&body=${u}`,icon:KD}];return n(c).createElement(rb,{as:"div",className:n(md)("memori-share-button",{"memori-share-button--align-left":"left"===s})},n(c).createElement(rb.Button,{className:n(md)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button",r,{"memori-button--primary":o}),title:l("widget.share")||void 0},n(c).createElement("div",{className:"memori-button--icon"},n(c).createElement(JD,null))),n(c).createElement(rb.Items,{className:"memori-share-button--overlay",as:"ul"},n(c).createElement(rb.Item,{key:"copy",as:"li",className:"memori-share-button--li"},n(c).createElement(bd,{className:"memori-share-button--link",ghost:!0,icon:n(c).createElement(lm,null),onClick:()=>{u&&navigator.clipboard.writeText(u)}},l("copyToClipboard")||void 0)),h.map((e=>{var t;return n(c).createElement(rb.Item,{key:e.id,as:"li",className:"memori-share-button--li"},n(c).createElement("a",{className:n(md)("memori-button","memori-button--with-icon","memori-button--ghost","memori-button--padded","memori-share-button--link"),href:null!==(t=e.url)&&void 0!==t?t:"",target:"_blank",rel:"noopener noreferrer"},n(c).createElement("div",{className:"memori-button--icon"},n(c).createElement(e.icon,null)),e.title))})),a&&n(c).createElement(rb.Item,{key:"qrcode",as:"li",className:"memori-share-button--li-qr-code"},n(c).createElement(gU,{id:"qr-canvas",value:null!=u?u:"",size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H",includeMargin:!1,imageSettings:{src:`${i||"https://app.twincreator.com"}/images/memori_logo.png`,x:void 0,y:void 0,height:32,width:32,excavate:!0}}),n(c).createElement("div",null,n(c).createElement(bd,{onClick:()=>{const e=document.getElementById("qr-canvas");if(console.log(),!e)return;const n=document.createElement("a");n.href=e.toDataURL(),n.download=`memori-${t}-share.png`,document.body.appendChild(n),n.click(),document.body.removeChild(n)},icon:n(c).createElement(QD,null),title:"Download QR"},"Download")))))};var bU=({className:e,memori:t,history:r,position:i,setShowPositionDrawer:o,setShowSettingsDrawer:a,speakerMuted:s,setSpeakerMuted:l,hasUserActivatedSpeak:u=!1,showShare:d=!0,showSettings:h=!0})=>{const{t:f}=yo();return n(c).createElement("div",{className:n(md)("memori-header",e)},t.needsPosition&&i&&n(c).createElement("div",{className:"memori-header--position"},n(c).createElement("span",{className:"memori-header--position-placeName"},i.placeName),n(c).createElement(bd,{icon:n(c).createElement(vD,null),shape:"circle",className:"memori-header--button",onClick:()=>o(!0)})),n(c).createElement(bd,{primary:!0,shape:"circle",className:"memori-header--button",icon:s?n(c).createElement(bD,null):n(c).createElement(wD,null),onClick:()=>l(!s),title:f("widget.sound")||"Sound"}),n(c).createElement(jD,{history:r,memori:t,className:"memori-header--button",disabled:!u||0===r.length}),h&&n(c).createElement(bd,{primary:!0,shape:"circle",className:"memori-header--button",icon:n(c).createElement(HD,null),onClick:()=>a(!0),title:f("widget.settings")||"Settings"}),d&&n(c).createElement(vU,{className:"memori-header--button",title:t.name,showQrCode:!0,align:"left"}))};c=o("85Hg2");var yU=({header:e,avatar:t,chat:r,startPanel:i,integrationStyle:o,integrationBackground:a,changeMode:s,sessionId:l,hasUserActivatedSpeak:u,showInstruct:d=!1,loading:h=!1})=>n(c).createElement(n(c).Fragment,null,o,a,n(c).createElement(Rf,{spinning:h},d&&s,e,n(c).createElement("div",{className:"memori--grid"},n(c).createElement("div",{className:"memori--grid-column memori--grid-column-left"},t),n(c).createElement("div",{className:"memori--grid-column memori--grid-column-right"},l&&u?r:i))));const wU={muteSpeaker:"@memori:muteSpeaker",continuousSpeech:"@memori:continuousSpeech",continuousSpeechTimeout:"@memori:continuousSpeechTimeout",sendOnEnter:"@memori:sendOnEnter"},SU=(e,t)=>{var n;const r=window.localStorage.getItem(null!==(n=wU[e])&&void 0!==n?n:e);if(!r)return t;try{return JSON.parse(r)}catch(e){return r}},xU=(e,t)=>{var n;window.localStorage.setItem(null!==(n=wU[e])&&void 0!==n?n:e,t.toString())},MU=new Map(Object.entries({TENANT_NOT_FOUND:-1,TENANT_REGISTRATION_DISABLED:-2,TENANT_MISSING_NAME:-3,TENANT_MAX_USERS_REACHED:-4,TENANT_MAX_ADMINS_REACHED:-5,USER_NOT_CONFIRMED:-11,USER_NOT_FOUND:-12,USER_OR_PASSWORD_INVALID:-13,USER_MUST_CHANGE_PASSWORD:-14,USER_MUST_ENTER_VERIFICATION_CODE:-15,USER_MISSING_TENANT:-21,USER_MISSING_NAME:-22,USER_MISSING_PASSWORD:-23,USER_MISSING_EMAIL:-24,USER_MISSING_VERIFICATION_CODE:-25,USER_NAME_ALREADY_USED:-26,USER_PASSWORD_NOT_CONFORMING_TO_POLICY:-27,USER_EMAIL_ALREADY_USED:-28,USER_EMAIL_INVALID:-29,USER_VERIFICATION_CODE_INVALID:-30,USER_MISSING_NAME_OR_EMAIL:-31,USER_NAME_INVALID:-32,USER_HAS_ONE_OR_MORE_MEMORI:-33,USER_MISSING_NEW_PASSWORD:-34,USER_CANT_CREATE_MEMORI:-35,USER_MAX_MEMORI_REACHED:-36,USER_CANT_EDIT_INTEGRATIONS:-37,MEMORI_NOT_FOUND:-51,MEMORI_NOT_ACCESSIBLE:-52,MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN:-53,SESSION_NOT_FOUND:-101,SESSION_IS_NOT_ADMINISTRATIVE:-102,MEMORI_MISSING_CONFIGURATION:-201,MEMORI_CONFIGURATION_NOT_FOUND:-202,MEMORI_INVALID_PRIVACY_TYPE:-203,MEMORI_MISSING_PASSWORD:-204,MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS:-205,MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS:-206,MEMORI_INVALID_VOICE_TYPE:-207,MEMORI_MISSING_NAME:-208,MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS:-209,MEMORI_INVALID_ID:-210,MEMORI_NAME_ALREADY_USED:-211,MEMORI_INVALID_PIN:-212,MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION:-213,MEMORI_NO_PASSWORD_WHEN_PUBLIC:-214,MEMORI_TRANSFER_MISSING_DESTINATION_USER:-231,MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID:-232,MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT:-233,MEMORI_TRANSFER_NOTHING_TO_DO:-234,MEMORI_CONFIGURATION_CANT_BE_CHANGED:-251,MEMORI_MISSING_NEW_PASSWORD:-252,MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT:-261,MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT:-262,INTEGRATION_NOT_FOUND:-301,INTEGRATION_INVALID_TYPE:-401,INTEGRATION_ALREADY_EXISTS:-402,INTEGRATION_MEMORI_IS_NOT_PUBLIC:-403,INTEGRATION_MISSING_INVOCATION_TEXT:-404,INTEGRATION_MISSING_DEVICE_EMAILS:-405,INTEGRATION_MEMORI_IS_EMPTY:-406,INTEGRATION_MISSING_PRIVACY_POLICY:-407,INTEGRATION_MISSING_CATEGORY:-408,INTEGRATION_MISSING_DESCRIPTION:-409,INTEGRATION_INVALID_INVOCATION_TEXT:-410,INTEGRATION_GOOGLE_NO_MORE_AVAILABLE:-411,UPLOAD_REQUIRES_MULTIPART_ENCODING:-501,UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY:-502,UPLOAD_MAX_LENGTH_EXCEEDED:-503,UPLOAD_FILE_IS_EMPTY:-504,UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE:-505,UPLOAD_MISSING_FILE_NAME:-506,UPLOAD_INVALID_MEMORY_ID:-507,UPLOAD_MISSING_FILE_CONTENT:-508,ASSET_NOT_FOUND:-601,ASSET_NOT_ACCESSIBLE:-602,ASSET_MISSING_SESSION_ID:-603,ASSET_INVALID_FILE_NAME:-604,INVITATION_NOT_FOUND:-701,INVITATION_NOT_ACCESSIBLE:-702,INVITATION_ALREADY_ACCEPTED:-703,INVITATION_ALREADY_REJECTED:-704,INVITATION_MISSING_DESTINATION_EMAIL:-705,INVITATION_DESTINATION_EMAIL_INVALID:-706,INVITATION_MISSING_TAG:-707,INVITATION_MISSING_PIN:-708,INVITATION_INVALID_PIN:-709,INVITATION_INVALID_TYPE:-710,INVITATION_MISSING_DESTINATION_NAME:-711,INVITATION_TAG_PIN_CANT_BE_CHANGED:-712,INVITATION_CANT_BE_CHANGED:-713,ACTIONLOG_INVALID_USER_ID:-801,ACTIONLOG_INVALID_DATE_FROM_FORMAT:-802,ACTIONLOG_INVALID_DATE_TO_FORMAT:-803,ACTIONLOG_INVALID_MEMORI_ID:-804,CONSUMPTIONLOG_INVALID_TYPE:-901,CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT:-902,CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT:-903,CONSUMPTIONLOG_INVALID_USER_ID:-904,CONSUMPTIONLOG_INVALID_MEMORI_ID:-905}).map((([e,t])=>[t,e]))),_U=e=>{if(!e)return"error.generic";if(401===e||403===e)return"error.unauthorized";if(404===e)return"error.notFound";if(422===e)return"error.unprocessableEntity";if(500===e)return"internal server error";let t=MU.get(e);return t?`errors.${t}`:"error.generic"},{deleteSession:AU,getStatistics:EU,initSession:CU}=Vi(),TU=new Map([[0,"🆕"],[10,"🐹"],[20,"🐇"],[30,"🐰"],[40,"💡"],[50,"🏆"],[60,"🏅"],[70,"🥉"],[80,"🥈"],[90,"🥇"],[100,"🔥"],[110,"🎓"],[120,"🤖"],[130,"👾"],[150,"🌍"],[180,"💜"],[200,"💙"],[250,"🧡"],[300,"💚"],[350,"💛"],[400,"💖"],[450,"💝"],[500,"🖤"],[550,"❤️"],[600,"🧠"]]),IU=e=>{const t=Array.from(TU.keys()).filter((t=>t<=e));if(t.length>0){const e=t[t.length-1];return TU.get(e)}return""},kU=e=>{if("🆕"===e)return{points:10,badge:"🐹"};let t,n,r=!1;for(const[i,o]of TU){if(r){t=i,n=o;break}o===e&&(r=!0)}return n&&t?{points:t,badge:n}:void 0},RU=e=>{let t=0;for(const[n,r]of TU)if(r===e){t=n;break}return t},OU=e=>{const t=Math.round(e),n=IU(t);return{points:t,badge:n,pointsForCurrentBadge:RU(n),nextBadge:kU(n)}};window.getMemoriState=e=>{var t,n,r,i,o;let a=e?document.querySelector(`.memori-widget[data-memori-integration="${e}"]`)||(null===(n=null===(t=document.querySelector("memori-client"))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector(".memori-widget[data-memori-integration]")):document.querySelector(".memori-widget")||(null===(i=null===(r=document.querySelector("memori-client"))||void 0===r?void 0:r.shadowRoot)||void 0===i?void 0:i.querySelector(".memori-widget"));if(!a)return null;let s=null===(o=a.dataset)||void 0===o?void 0:o.memoriEngineState;return s?JSON.parse(s):null},window.typeMessage=e=>{var t,n;let r=document.querySelector("fieldset#chat-fieldset textarea")||(null===(n=null===(t=document.querySelector("memori-client"))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector("fieldset#chat-fieldset textarea"));r&&(!function(e,t){var n,r,i,o;const a=null===(r=null===(n=null==Object?void 0:Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,"value"))||void 0===r?void 0:r.set,s=Object.getPrototypeOf(e),l=null===(o=null===(i=null==Object?void 0:Object.getOwnPropertyDescriptor)||void 0===i?void 0:i.call(Object,s,"value"))||void 0===o?void 0:o.set;l&&a&&a!==l?l.call(e,t):a&&a.call(e,t)}(r,e),r.dispatchEvent(new Event("input",{bubbles:!0})),setTimeout((()=>{var e,t;let n=document.querySelector("fieldset#chat-fieldset textarea + button")||(null===(t=null===(e=document.querySelector("memori-client"))||void 0===e?void 0:e.shadowRoot)||void 0===t?void 0:t.querySelector("fieldset#chat-fieldset textarea + button"));n&&n.click()}),100))};let PU,NU,BU,LU;var DU=({memori:e,memoriConfigs:t,memoriLang:r,integration:i,showInstruct:o=!1,showShare:a=!0,preview:s=!1,embed:l=!1,showInputs:u=!0,showDates:d=!1,showContextPerLine:h=!1,showSettings:f=!1,height:p="100vh",secret:m,baseUrl:g="https://app.twincreator.com",apiUrl:v="https://backend.memori.ai",initialContextVars:b,initialQuestion:y,ogImage:w,sessionID:S,tenant:x,personification:M,AZURE_COGNITIVE_SERVICES_TTS_KEY:_,onStateChange:A})=>{var E,C,T,I,k,R,O,P,N,B,L,D,U,F,z,j,H,G;const{t:V,i18n:W}=yo(),[q,K]=(0,c.useState)(!1);(0,c.useEffect)((()=>{K(!0)}),[]);const J=Vi(v),{initSession:Q,postTextEnteredEvent:X,postPlaceChangedEvent:Y,postTimeoutEvent:Z,postTagChangedEvent:$,getSession:ee,getContentQualityIndexes:te}=J,[ne,re]=(0,c.useState)(!1),[ie,oe]=(0,c.useState)(!1),[ae,se]=(0,c.useState)(!1),le=null===(I=null===(T=null===(C=null===(E=null==t?void 0:t.find((t=>t.memoriConfigID===e.memoriConfigurationID)))||void 0===E?void 0:E.culture)||void 0===C?void 0:C.split("-"))||void 0===T?void 0:T[0])||void 0===I?void 0:I.toUpperCase(),[ce,ue]=(0,c.useState)(null!==(N=null!==(P=null!==(O=null!=r?r:null===(R=null===(k=null==e?void 0:e.culture)||void 0===k?void 0:k.split("-"))||void 0===R?void 0:R[0])&&void 0!==O?O:le)&&void 0!==P?P:W.language)&&void 0!==N?N:"IT"),de=(null==i?void 0:i.customData)?JSON.parse(i.customData):null,he=!!(null==de?void 0:de.multilanguage),[fe,pe]=(0,c.useState)(!1),[me,ge]=(0,c.useState)(!1),[ve,be]=(0,c.useState)(!1),[ye,we]=(0,c.useState)(!1),[Se,xe]=(0,c.useState)(!1),[Me,_e]=(0,c.useState)(!1),[Ae,Ee]=(0,c.useState)(!1),[Ce,Te]=(0,c.useState)(!1),[Ie,ke]=(0,c.useState)(3),[Re,Oe]=(0,c.useState)(!1);(0,c.useEffect)((()=>{Oe(!!BU)}),[BU]),(0,c.useEffect)((()=>{Ee(SU("muteSpeaker",!1)),Te(SU("continuousSpeech",!1)),ke(SU("continuousSpeechTimeout",3))}),[]);const[Pe,Ne]=(0,c.useState)(m),[Be,Le]=(0,c.useState)(),[De,Ue]=(0,c.useState)(null),[Fe,ze]=(0,c.useState)(),je=async(e,t)=>{var n;const r=null!=t?t:Ze;if(e&&r){const{currentState:t,...i}=await Y({sessionId:r,placeName:e.placeName,latitude:e.latitude,longitude:e.longitude,uncertaintyKm:null!==(n=e.uncertainty)&&void 0!==n?n:0});t&&0===i.resultCode&&nt({...et,...t})}},[He,Ge]=(0,c.useState)(""),[Ve,We]=(0,c.useState)(!1),[qe,Je]=(0,c.useState)([]),Qe=e=>{Je((t=>[...t,{...e}]))},Xe=async(t,n,r,i=!0,o)=>{var a,s,l,c,u;if(!Ze||!(null==t?void 0:t.length))return;Qe({text:t,translatedText:o,fromUser:!0,media:null!=n?n:[],initial:!!r}),ge(!0);const d=null!==(c=null!==(l=null===(s=null===(a=e.culture)||void 0===a?void 0:a.split("-"))||void 0===s?void 0:s[0])&&void 0!==l?l:W.language)&&void 0!==c?c:"IT";let h=t;if(i&&!ne&&he&&ce.toUpperCase()!==d.toUpperCase()){h=(await pm(t,d,ce,g)).text}const{currentState:f,...p}=await X({sessionId:null!=r?r:Ze,text:h});if(0===p.resultCode&&f){const t=null!==(u=f.emission)&&void 0!==u?u:null==et?void 0:et.emission;if("X4"===f.state&&e.giverTag){const{currentState:t,...n}=await $(Ze,e.giverTag);0===n.resultCode?(nt(t),t.emission&&Qe({text:t.emission,media:t.media,fromUser:!1})):(console.error(p,n),gd.error(V(_U(n.resultCode),{ns:"common"})))}else if("X2d"===f.state&&e.giverTag){const{currentState:t,...n}=await X({sessionId:null!=r?r:Ze,text:Math.random().toString().substring(2,8)});if(0===n.resultCode){const{currentState:t,...n}=await $(Ze,e.giverTag);0===n.resultCode?(nt(t),t.emission&&Qe({text:t.emission,media:t.media,fromUser:!1})):(console.error(p,n),gd.error(V(_U(n.resultCode),{ns:"common"})))}else console.error(p,n),gd.error(V(_U(n.resultCode),{ns:"common"}))}else ce.toLowerCase()!==d.toLowerCase()&&t&&!ne&&he?Ye(f,ce):(nt({...f,emission:t}),t&&Qe({text:t,media:f.media,fromUser:!1}))}else 404===p.resultCode&&(Je((e=>[...e.slice(0,e.length-1)])),it(!1,Pe||e.secretToken,Be,ne&&e.giverTag?e.giverTag:void 0,ne&&e.giverPIN?e.giverPIN:void 0,b,y).then((e=>{console.info("session timeout"),e&&setTimeout((()=>{Xe(t,n,e)}),500)})));ge(!1)},Ye=async(t,n)=>{var r,i,o,a,s,l;const c=null!==(a=null!==(o=null===(i=null===(r=e.culture)||void 0===r?void 0:r.split("-"))||void 0===i?void 0:i[0])&&void 0!==o?o:W.language)&&void 0!==a?a:"IT",u=null!==(s=t.emission)&&void 0!==s?s:null==et?void 0:et.emission;let d={...t},h=null;if(u&&!ne&&c.toUpperCase()!==n.toUpperCase()&&he){const e=await pm(u,n,c,g);if(t.hints&&t.hints.length>0){const r=await Promise.all((null!==(l=t.hints)&&void 0!==l?l:[]).map((async e=>{var t;const r=await pm(e,n,c,g);return{text:null!==(t=null==r?void 0:r.text)&&void 0!==t?t:e,originalText:e}})));d={...t,emission:e.text,translatedHints:r}}else d={...t,emission:e.text};e.text.length>0&&(h={text:e.text,media:t.media,fromUser:!1})}else d={...t,emission:u},u&&(h={text:u,media:t.media,fromUser:!1});return nt(d),h&&Qe(h),d},[Ze,$e]=(0,c.useState)(S),[et,tt]=(0,c.useState)(),nt=e=>{tt(e),A&&A(e)},rt=async t=>{var n,r,i,o,a;if("PUBLIC"===e.privacyType||e.secretToken||Pe||Be){pe(!0);try{if(!e.giverTag&&(null===(n=e.receivedInvitations)||void 0===n?void 0:n.length)){let t=e.receivedInvitations.find((e=>"GIVER"===e.type&&"ACCEPTED"===e.state));t&&(e.giverTag=t.tag,e.giverPIN=t.pin)}const s=await Q(t);if((null==s?void 0:s.sessionID)&&(null==s?void 0:s.currentState)&&0===s.resultCode){$e(s.sessionID);const t=null!==(a=null!==(o=null===(i=null===(r=e.culture)||void 0===r?void 0:r.split("-"))||void 0===i?void 0:i[0])&&void 0!==o?o:W.language)&&void 0!==a?a:"IT";return!ne&&he&&ce.toLowerCase()!==t.toLowerCase()?Ye(s.currentState,ce).then((e=>{(null==e?void 0:e.emission)&&(qe.length<=1?Je([{text:e.emission,media:e.media,fromUser:!1,initial:!0}]):Qe({text:e.emission,media:e.media,fromUser:!1,initial:!0}))})):(nt(s.currentState),s.currentState.emission&&(qe.length<=1?Je([{text:s.currentState.emission,media:s.currentState.media,fromUser:!1,initial:!0}]):Qe({text:s.currentState.emission,media:s.currentState.media,fromUser:!1,initial:!0}))),Fe&&je(Fe,s.sessionID),pe(!1),{dialogState:s.currentState,sessionID:s.sessionID}}console.error(s),gd.error(V(_U(null==s?void 0:s.resultCode),{ns:"common"})),se(!0)}catch(e){console.error(e),new Error("Error fetching session")}}else Ue("password")},it=async(t=!1,n,r,i,o,a,s)=>{var l;pe(!0);try{const{sessionID:c,currentState:u,...d}=await Q({memoriID:null!==(l=e.engineMemoriID)&&void 0!==l?l:"",password:n,recoveryTokens:r,tag:i,pin:o,initialContextVars:a,initialQuestion:s});if(c&&u&&0===d.resultCode)return $e(c),t&&(nt(u),u.emission&&(qe.length<=1?Je([{text:u.emission,media:u.media,fromUser:!1}]):Qe({text:u.emission,media:u.media,fromUser:!1}))),Fe&&je(Fe,c),pe(!1),c;console.error(d),gd.error(V(_U(d.resultCode),{ns:"common"})),se(!0)}catch(e){console.error(e)}return pe(!1),null},ot=async(t,n,r,i)=>{var o;if(!t||!n)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState:t,resultCode:a}=await $(n,null!=r?r:gm);if(0===a){let s=0;if(r!==gm&&i&&("X1a"===t.state||"X1b"===t.state)){const{resultCode:e}=await X({sessionId:n,text:null!=i?i:""});s=e}if(0===s){const{currentState:e,...t}=await ee(n);if(0===t.resultCode&&e)return{currentState:e,sessionId:n,...t}}else if([400,401,403,404,500].includes(a))console.warn("[APPCONTEXT/CHANGETAG]",a),rt({memoriID:null!==(o=e.engineMemoriID)&&void 0!==o?o:"",password:m||e.secretToken,tag:e.giverTag,pin:e.giverPIN,initialContextVars:b,initialQuestion:y});else if(t)return{currentState:t,sessionId:n,resultCode:a}}}catch(e){let t=e;return console.error("[APPCONTEXT/CHANGETAG]",t),Promise.reject(t)}return null};(0,c.useEffect)((()=>()=>{et&&(null==et?void 0:et.currentTag)===e.giverTag||(async()=>{Ze&&e.giverTag&&e.giverPIN&&(Je([]),await ot(e.engineMemoriID,Ze,e.giverTag,e.giverPIN))})()}),[]);const[at,st]=(0,c.useState)(),lt=(0,c.useRef)(),ct=()=>{at&&(clearTimeout(at),st(void 0)),(null==lt?void 0:lt.current)&&(clearTimeout(lt.current),lt.current=void 0)},ut=()=>{ct(),!(null==et?void 0:et.acceptsTimeout)||BU||Re||He.length||Ve||ht()},dt=async()=>{if(BU||Re||He.length||Ve)ut();else if(Ze&&ve&&(null==et?void 0:et.acceptsTimeout)){const{currentState:e,...t}=await Z(Ze);if(0===t.resultCode&&e){const t=e.emission;!ne&&he&&ce!==(null==W?void 0:W.language)&&t&&t.length>0?Ye({...e,emission:t},ce):t&&t.length>0?(Qe({text:t,media:e.media,fromUser:!1}),nt(e)):nt({...e})}}},ht=()=>{let e=null==et?void 0:et.timeout;if(!e){let t=40,n=25;if(e=Math.floor(Math.random()*(t-n))+n,null==et?void 0:et.emission){e+=et.emission.length/26.5}}let t=setTimeout(dt,1e3*e);st(t),lt.current=t};(0,c.useEffect)((()=>{(He.length||Re)&&ct(),Ze&&!He.length&&ut()}),[null==et?void 0:et.acceptsTimeout,null==et?void 0:et.timeout,null==et?void 0:et.state,Re,Ze,qe,He]),(0,c.useEffect)((()=>()=>{be(!1),oe(!1),ct(),lt.current=void 0}),[]);(0,c.useEffect)((()=>()=>{LU&&LU.pause(),BU&&(BU.close(),BU=null)}),[]);const ft=(0,c.useCallback)((t=>{var n,r,i,o;let a="";switch((null!==(o=null!==(i=null!=t?t:null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])&&void 0!==i?i:W.language)&&void 0!==o?o:"IT").toUpperCase()){case"IT":a=""+("MALE"===e.voiceType?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":a=""+("MALE"===e.voiceType?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":a=""+("MALE"===e.voiceType?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":a=""+("MALE"===e.voiceType?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":a=""+("MALE"===e.voiceType?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":a=""+("MALE"===e.voiceType?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":a=""+("MALE"===e.voiceType?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":a=""+("MALE"===e.voiceType?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;default:a=""+("MALE"===e.voiceType?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return a}),[e.voiceType,W.language,e.culture]),pt=t=>{var n,r,i;let o="";switch((null!==(i=null!=t?t:null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])&&void 0!==i||W.language,"IT").toUpperCase()){case"IT":default:o="it-IT";break;case"DE":o="de-DE";break;case"EN":o="en-GB";break;case"ES":o="es-ES";break;case"FR":o="fr-FR";break;case"PT":o="pt-PT";break;case"UK":o="uk-UK";break;case"RU":o="ru-RU"}return o},[mt,gt]=(0,c.useState)();(0,c.useEffect)((()=>{(async()=>{try{const e=await fetch(`${g||"https://app.twincreator.com"}/api/lexiconmap`);return await e.json()}catch(e){console.error(e)}})().then((e=>{gt(e)}))}),[]);const vt=(e,t=!0)=>{if(!_)return;if(s||!ve)return;if(LU&&LU.pause(),BU&&(BU.close(),BU=null),Ae&&t)return void setTimeout((()=>{document.dispatchEvent(new Event("endSpeakStartListen"))}),3e3);if(Ae)return;LU=new jr.SpeakerAudioDestination;let n=qr.fromSpeakerOutput(LU);BU=new oi.SpeechSynthesizer(NU,n),LU.onAudioEnd=()=>{Oe(!1),t&&document.dispatchEvent(new Event("endSpeakStartListen"))},Oe(!0),BU.speakSsmlAsync(`<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" xml:lang="${pt(ce)}"><voice name="${ft(ce)}"><s>${((e,t)=>{var n;if(!mt)return e;const r={...null!==(n=mt.common)&&void 0!==n?n:{},...(null==x?void 0:x.id)&&mt[x.id]?mt[x.id]:{}},i=Object.keys(r).map((e=>{var n;return{word:e,phoneme:null!==(n=r[e][t])&&void 0!==n?n:r[e].default}}));return i.reduce(((e,{word:t,phoneme:n})=>e.replace(new RegExp(t,"gi"),`<phoneme alphabet="ipa" ph="${n}">${t}</phoneme>`)),e)})(e,ce.toLowerCase())}</s></voice></speak>`,(t=>{if(t)try{BU&&(BU.close(),BU=null)}catch(t){console.error("speak error: ",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),Oe(!1)}else Oe(!1)}),(t=>{console.error("speak:",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),Oe(!1)}))};(0,c.useEffect)((()=>{let e=document.querySelector("#chat-fieldset textarea");e&&e.focus()}),[null==et?void 0:et.emission]);const[bt,wt]=(0,c.useState)(""),St=()=>wt(""),[xt,Mt]=(0,c.useState)(null),_t=()=>{xt&&(clearTimeout(xt),Mt(null))},At=()=>{_t(),Ce&&(()=>{let e=setTimeout((async()=>{Tt();const e=rm(bt);e.length>0?(Xe(e),St(),Ge("")):Ve&&ut()}),1e3*Ie);Mt(e)})()};(0,c.useEffect)((()=>{if(At(),ut(),(null==bt?void 0:bt.length)>0){const e=rm(bt);e.length>0&&Ge(e)}}),[bt]);const Et=()=>{if(_){Tt(),wt("");try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(e){we(!0),NU||(NU=hn.fromSubscription(_,"eastus"),NU.speechRecognitionLanguage=pt(ce),NU.speechSynthesisLanguage=pt(ce),NU.speechSynthesisVoiceName=ft(ce));const t=qr.fromDefaultMicrophoneInput();PU=new Qr.SpeechRecognizer(NU,t),We(!0),PU.recognized=(e,t)=>{var n;t.result.reason===yt.RecognizedSpeech?wt(null!==(n=t.result.text)&&void 0!==n?n:""):t.result.reason===yt.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},PU.canceled=(e,t)=>{t.reason===Ke.Error&&(console.debug(`"CANCELED: ErrorCode=${t.errorCode}`),console.debug(`"CANCELED: ErrorDetails=${t.errorDetails}`),console.debug("CANCELED: Did you set the speech resource key and region values?")),Ct()},PU.sessionStopped=(e,t)=>{PU&&PU.stopContinuousRecognitionAsync()},PU.startContinuousRecognitionAsync()})).catch(console.error)}catch(e){console.error(e)}}},Ct=()=>{PU&&(PU.stopContinuousRecognitionAsync(),PU.close(),PU=null,We(!1))},Tt=()=>{we(!1),Ct(),_t()};(0,c.useEffect)((()=>()=>Tt()),[]),(0,c.useEffect)((()=>{"Z0"===(null==et?void 0:et.state)&&Tt()}),[null==et?void 0:et.state]),(0,c.useEffect)((()=>{ve&&!s&&!Ae&&qe.length>0&&(null==et?void 0:et.emission)&&vt(et.emission,"Z0"!==et.state)}),[et,ve]);const[It,kt]=(0,c.useState)(!1),Rt=(0,c.useCallback)((e=>{Re&&BU&&(BU.close(),BU=null),!Ce||!ye&&It||(kt(!0),Et())}),[Ce,ye]);(0,c.useEffect)((()=>{!Re&&Ce&&ye?Et():Re&&Ve&&Ct()}),[Re]),(0,c.useEffect)((()=>(document.addEventListener("endSpeakStartListen",Rt),()=>{document.removeEventListener("endSpeakStartListen",Rt)})),[Rt]),(0,c.useEffect)((()=>{Ve&&(Tt(),St(),Ge(""),Et())}),[le]);const[Ot,Pt]=(0,c.useState)("keypress");(0,c.useEffect)((()=>{const e=SU("sendOnEnter","keypress");Pt(e)}),[]),(0,c.useEffect)((()=>{xU("sendOnEnter",Ot)}),[Ot]);const[Nt,Bt]=(0,c.useState)(),Lt=null==de?void 0:de.globalBackground,Dt=Lt?`url(${Lt})`:null,Ut=i?{"--memori-chat-bubble-bg":"#fff",...de&&!o?{"--memori-text-color":null!==(B=de.textColor)&&void 0!==B?B:"#000"}:{},...(null==de?void 0:de.buttonBgColor)?{"--memori-button-bg":de.buttonBgColor,"--memori-primary":de.buttonBgColor}:{},...(null==de?void 0:de.buttonTextColor)?{"--memori-button-text":de.buttonTextColor}:{},...(null==de?void 0:de.blurBackground)?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...(null==de?void 0:de.innerBgColor)?{"--memori-inner-bg":`rgba(${"dark"===de.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(L=de.innerBgAlpha)&&void 0!==L?L:.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===de.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(D=null==de?void 0:de.innerBgAlpha)&&void 0!==D?D:.4})`}:{"--memori-inner-content-pad":"0px"}}:{},Ft=`\n ${s?"#preview":":root"}, .memori-widget {\n ${Object.entries(Ut).map((([e,t])=>`${e}: ${t};`)).join("\n")}\n }\n `,[zt,jt]=(0,c.useState)(!0),[Ht,Gt]=(0,c.useState)();(0,c.useEffect)((()=>{e.engineMemoriID&&(async e=>{let t,n;try{const{contentQualityIndex:r,answerQualityIndex:i,unansweredQuestions:o,...a}=await te(e);0===a.resultCode&&(t=r,n=o)}catch(e){let t=e;console.error("[APPCONTEXT/QUERYGAMIFICATIONPOINTS]",t)}return{points:null!=t?t:0,unansweredQuestions:null!=n?n:0}})(e.engineMemoriID).then((e=>{Gt(OU(e.points))})).catch(console.error)}),[e.engineMemoriID]),(0,c.useEffect)((()=>{if(null==de?void 0:de.seoTitle){let e=document.createElement("meta");e.setAttribute("property","og:title"),e.setAttribute("content",de.seoTitle),document.head.append(e)}if(null==de?void 0:de.seoDescription){let e=document.createElement("meta");e.setAttribute("property","og:description"),e.setAttribute("content",de.seoDescription),document.head.append(e)}if(null==de?void 0:de.seoUrl){let e=document.createElement("meta");e.setAttribute("property","og:url"),e.setAttribute("content",de.seoUrl),document.head.append(e)}let t=w||e.avatarURL;if((null==de?void 0:de.seoImageShowAvatar)&&t){let e=document.createElement("meta");e.setAttribute("property","og:image"),e.setAttribute("content",t),document.head.append(e)}}),[de,e.avatarURL,w]);const Vt=async t=>{const n=(null==t?void 0:t.sessionID)||Ze,r=(null==t?void 0:t.dialogState)||et;if(oe(!0),(()=>{if(!_)return;NU=hn.fromSubscription(_,"eastus"),NU.speechSynthesisLanguage=pt(ce),NU.speechSynthesisVoiceName=ft(ce),NU.speechRecognitionLanguage=pt(ce),nm()&&(NU.speechSynthesisOutputFormat=Zt.Audio16Khz32KBitRateMonoMp3);let e=document.getElementById("memori-audio");e&&window.navigator.userAgent.includes("Safari")&&(e.muted=!1,e.play().then((async()=>{try{const e=new Wu;let t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination)}catch(e){console.error(e)}})).catch((e=>{console.error("error playing intro audio",e)})))})(),!n&&"PUBLIC"!==e.privacyType&&!e.secretToken&&!Pe&&!Be||!n&&ae)return Ue("password"),void oe(!1);if(n)if(S){const{currentState:t,...r}=await ee(n);if(0!==r.resultCode||!t)return console.debug("session expired, opening new session"),se(!0),$e(void 0),oe(!1),void Vt();if(Je([]),ne&&e.giverTag&&(null==et?void 0:et.currentTag)!==e.giverTag)try{console.debug("change tag #0"),await ot(e.engineMemoriID,n,"-");const t=await ot(e.engineMemoriID,n,e.giverTag,e.giverPIN);if(!t||0!==t.resultCode)throw console.error("session #1",t),new Error("No session");Ye(t.currentState,ce).finally((()=>{be(!0)}))}catch(t){console.error("session #2",t),it(!0,null==e?void 0:e.secretToken,void 0,null==e?void 0:e.giverTag,null==e?void 0:e.giverPIN,b,y).then((()=>{be(!0)}))}else if(!ne&&M&&(null==et?void 0:et.currentTag)!==M.tag)try{console.debug("change tag #3"),await ot(e.engineMemoriID,n,"-");const t=await ot(e.engineMemoriID,n,M.tag,M.pin);if(!t||0!==t.resultCode)throw console.error("session #4",t),new Error("No session");Ye(t.currentState,ce).finally((()=>{be(!0)}))}catch(t){console.error("session #5",t),it(!0,null==e?void 0:e.secretToken,void 0,M.tag,M.pin,b,y).then((()=>{be(!0)}))}else if(ne||M||(null==et?void 0:et.currentTag)===gm)Ye(t,ce).finally((()=>{be(!0)}));else try{console.debug("change tag #6"),await ot(e.engineMemoriID,n,"-");const t=await ot(e.engineMemoriID,n,gm);if(!t||0!==t.resultCode)throw console.error("session #7",t),new Error("No session");Ye(t.currentState,ce).finally((()=>{be(!0)}))}catch(t){console.error("session #8",t),it(!0,null==e?void 0:e.secretToken,void 0,void 0,void 0,b,y).then((()=>{be(!0)}))}}else Je([]),Ye(r,ce).finally((()=>{be(!0)}));else{oe(!1),se(!1);const t=await rt({memoriID:e.engineMemoriID,password:m||e.secretToken,tag:null==M?void 0:M.tag,pin:null==M?void 0:M.pin,initialContextVars:b,initialQuestion:y});Vt(t||void 0)}},Wt=n(c).createElement(bU,{memori:e,history:qe,showShare:a,position:Fe,setShowPositionDrawer:xe,setShowSettingsDrawer:_e,speakerMuted:Ae,setSpeakerMuted:Ee,showSettings:f,hasUserActivatedSpeak:ve}),qt=n(c).createElement(mD,{memori:e,integration:i,integrationConfig:de,tenant:x,instruct:ne,avatar3dVisible:zt,setAvatar3dVisible:jt,hasUserActivatedSpeak:ve,isPlayingAudio:Re,baseUrl:g}),Kt=n(c).createElement(Fb,{memori:e,tenant:x,gamificationLevel:Ht,language:le,userLang:ce,setUserLang:ue,baseUrl:g,position:Fe,openPositionDrawer:()=>xe(!0),integrationConfig:de,instruct:ne,sessionId:Ze,clickedStart:ie,onClickStart:Vt}),Jt=Ze?n(c).createElement(Bb,{memori:e,sessionID:Ze,tenant:x,translateTo:he&&ce.toUpperCase()!==(null===(H=null!==(j=null!==(z=null===(F=null===(U=e.culture)||void 0===U?void 0:U.split("-"))||void 0===F?void 0:F[0])&&void 0!==z?z:W.language)&&void 0!==j?j:"IT")||void 0===H?void 0:H.toUpperCase())?ce:void 0,baseUrl:g,memoriTyping:me,history:qe,dialogState:et,setDialogState:nt,pushMessage:Qe,simulateUserPrompt:(e,t)=>{Ct(),Xe(e,void 0,void 0,!1,t)},showDates:d,showContextPerLine:h,client:J,selectReceiverTag:async t=>{var n;if(Ze)try{const{currentState:r,...i}=await $(Ze,t);if(0===i.resultCode)if(Qe({text:t,fromUser:!0}),"X4"===r.state&&e.giverTag){const{currentState:t,...n}=await J.postTagChangedEvent(Ze,e.giverTag);0===n.resultCode?(nt(t),t.emission&&Qe({text:t.emission,media:t.media,fromUser:!1})):(console.error(n),gd.error(V(_U(n.resultCode),{ns:"common"})))}else nt(r),r.emission&&Qe({text:r.emission,media:r.media,fromUser:!1});else console.error(i,t,null===(n=null==et?void 0:et.knownTags)||void 0===n?void 0:n[t]),gd.error(V(_U(i.resultCode),{ns:"common"}))}catch(e){let t=e;console.error(t),gd.error(t.message)}},preview:s,sendOnEnter:Ot,setSendOnEnter:Pt,attachmentsMenuOpen:Nt,setAttachmentsMenuOpen:Bt,instruct:ne,showInputs:u,showMicrophone:!!_,userMessage:He,onChangeUserMessage:e=>{if(!e||"\n"===e||""===e.trim())return Ge(""),void ut();Ge(e),ct()},sendMessage:e=>{Ct(),Xe(e),Ge(""),St()},stopListening:Tt,startListening:Et,stopAudio:()=>{BU&&(BU.close(),BU=null)},resetTranscript:St,listening:Ve,isPlayingAudio:Re}):null,Qt=i&&Dt?n(c).createElement("div",{className:"memori--global-background"},n(c).createElement("div",{className:"memori--global-background-image",style:{backgroundImage:Dt}})):null,Xt=i?n(c).createElement("style",{dangerouslySetInnerHTML:{__html:Ft}}):null,Yt=n(c).createElement(gD,{canInstruct:!!e.giverTag,instruct:ne,onChangeMode:e=>{re("instruct"===e),be(!1),oe(!1)}});return n(c).createElement("div",{className:n(md)("memori","memori-widget",{"memori--preview":s,"memori--embed":l,"memori--with-integration":i,"memori--active":ve}),"data-memori-name":null==e?void 0:e.name,"data-memori-id":null==e?void 0:e.engineMemoriID,"data-memori-secondary-id":null==e?void 0:e.memoriID,"data-memori-session-id":Ze,"data-memori-integration":null==i?void 0:i.integrationID,"data-memori-engine-state":JSON.stringify({...et,sessionID:Ze}),style:{height:p}},n(c).createElement(yU,{header:Wt,avatar:qt,chat:Jt,startPanel:Kt,integrationStyle:Xt,integrationBackground:Qt,changeMode:Yt,sessionId:Ze,hasUserActivatedSpeak:ve,showInstruct:o,loading:fe}),q&&n(c).createElement(tm,{withModal:!0,pwdOrTokens:De,openModal:!!De,setPwdOrTokens:Ue,showTokens:"SECRET"===e.privacyType,onFinish:async t=>{t.password&&Ne(t.password),t.tokens&&Le(t.tokens),it(!Ze,t.password,t.tokens,ne?e.giverTag:void 0,ne?e.giverPIN:void 0,b,y).then((()=>{Ue(null),be(!0)})).catch((()=>{Ue(null),se(!0)}))},minimumNumberOfRecoveryTokens:null!==(G=null==e?void 0:e.minimumNumberOfRecoveryTokens)&&void 0!==G?G:1}))};function UU(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FU(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,tD(r.key),r)}}function zU(e,t,n){return t&&FU(e.prototype,t),n&&FU(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function jU(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function HU(e,t){return HU=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},HU(e,t)}function GU(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&HU(e,t)}function VU(e,t){if(t&&("object"===$L(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return jU(e)}function WU(e){return WU=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},WU(e)}function qU(e){if(Array.isArray(e))return e}function KU(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function JU(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function QU(e,t){if(e){if("string"==typeof e)return JU(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?JU(e,t):void 0}}function XU(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function YU(e){return qU(e)||KU(e)||QU(e)||XU()}function ZU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ZU(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZU(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var eF={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},tF=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};UU(this,e),this.init(t,n)}return zU(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||eF,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,$U($U({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}(),nF=new tF,rF=function(){function e(){UU(this,e),this.observers={}}return zU(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){var i=[].concat(this.observers[e]);i.forEach((function(e){e.apply(void 0,n)}))}if(this.observers["*"]){var o=[].concat(this.observers["*"]);o.forEach((function(t){t.apply(t,[e].concat(n))}))}}}]),e}();function iF(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function oF(e){return null==e?"":""+e}function aF(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}function sF(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var a=r(o.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function lF(e,t,n){var r=sF(e,t,Object);r.obj[r.k]=n}function cF(e,t){var n=sF(e,t),r=n.obj,i=n.k;if(r)return r[i]}function uF(e,t,n){var r=cF(e,n);return void 0!==r?r:cF(t,n)}function dF(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):dF(e[r],t[r],n):e[r]=t[r]);return e}function hF(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var fF={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function pF(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return fF[e]})):e}var mF="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,gF=[" ",",","?","!",";"];function vF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function bF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yF(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=WU(e);if(t){var i=WU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return VU(this,n)}}function wF(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;o<r.length;++o){if(!i)return;if("string"==typeof i[r[o]]&&o+1<r.length)return;if(void 0===i[r[o]]){for(var a=2,s=r.slice(o,o+a).join(n),l=i[s];void 0===l&&r.length>o+a;)a++,l=i[s=r.slice(o,o+a).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(s)){if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s]}var c=r.slice(o+a).join(n);return c?wF(l,c,n):void 0}i=i[r[o]]}return i}}var SF=function(e){GU(n,e);var t=yF(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return UU(this,n),r=t.call(this),mF&&rF.call(jU(r)),r.data=e||{},r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),void 0===r.options.ignoreJSONStructure&&(r.options.ignoreJSONStructure=!0),r}return zU(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=cF(this.data,a);return s||!o||"string"!=typeof n?s:wF(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var a=[e,t];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),lF(this.data,a,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=cF(this.data,a)||{};r?dF(s,n,i):s=bF(bF({},s),n),lF(this.data,a,s),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?bF(bF({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(rF),xF={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))})),t}};function MF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?MF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function AF(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=WU(e);if(t){var i=WU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return VU(this,n)}}var EF={},CF=function(e){GU(n,e);var t=AF(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return UU(this,n),r=t.call(this),mF&&rF.call(jU(r)),aF(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,jU(r)),r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=nF.create("translator"),r}return zU(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=gF.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var i=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),o=!i.test(e);if(!o){var a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}(e,n,r));if(o&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:i};var l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(i=l.shift()),e=l.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,r){var i=this;if("object"!==$L(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),l=s.key,c=s.namespaces,u=c[c.length-1],d=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(h){var f=t.nsSeparator||this.options.nsSeparator;return o?(p.res="".concat(u).concat(f).concat(l),p):"".concat(u).concat(f).concat(l)}return o?(p.res=l,p):l}var p=this.resolve(e,t),m=p&&p.res,g=p&&p.usedKey||l,v=p&&p.exactUsedKey||l,b=Object.prototype.toString.apply(m),y=["[object Number]","[object Function]","[object RegExp]"],w=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject,x="string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m;if(S&&m&&x&&y.indexOf(b)<0&&("string"!=typeof w||"[object Array]"!==b)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,_F(_F({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(p.res=M,p):M}if(a){var _="[object Array]"===b,A=_?[]:{},E=_?v:g;for(var C in m)if(Object.prototype.hasOwnProperty.call(m,C)){var T="".concat(E).concat(a).concat(C);A[C]=this.translate(T,_F(_F({},t),{joinArrays:!1,ns:c})),A[C]===T&&(A[C]=m[C])}m=A}}else if(S&&"string"==typeof w&&"[object Array]"===b)(m=m.join(w))&&(m=this.extendTranslation(m,e,t,r));else{var I=!1,k=!1,R=void 0!==t.count&&"string"!=typeof t.count,O=n.hasDefaultValue(t),P=R?this.pluralResolver.getSuffix(d,t.count,t):"",N=t["defaultValue".concat(P)]||t.defaultValue;!this.isValidLookup(m)&&O&&(I=!0,m=N),this.isValidLookup(m)||(k=!0,m=l);var B=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,L=B&&k?void 0:m,D=O&&N!==m&&this.options.updateMissing;if(k||I||D){if(this.logger.log(D?"updateKey":"missingKey",d,u,l,D?N:m),a){var U=this.resolve(l,_F(_F({},t),{},{keySeparator:!1}));U&&U.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var F=[],z=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&z&&z[0])for(var j=0;j<z.length;j++)F.push(z[j]);else"all"===this.options.saveMissingTo?F=this.languageUtils.toResolveHierarchy(t.lng||this.language):F.push(t.lng||this.language);var H=function(e,n,r){var o=O&&r!==m?r:L;i.options.missingKeyHandler?i.options.missingKeyHandler(e,u,n,o,D,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,u,n,o,D,t),i.emit("missingKey",e,u,n,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?F.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(n){H([e],l+n,t["defaultValue".concat(n)]||N)}))})):H(F,l,N))}m=this.extendTranslation(m,e,t,p,r),k&&m===l&&this.options.appendNamespaceToMissingKey&&(m="".concat(u,":").concat(l)),(k||I)&&this.options.parseMissingKeyHandler&&(m="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u,":").concat(l):l,I?m:void 0):this.options.parseMissingKeyHandler(m))}return o?(p.res=m,p):m}},{key:"extendTranslation",value:function(e,t,n,r,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,_F(_F({},this.options.interpolation.defaultVariables),n),r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(_F(_F({},n),{interpolation:_F(_F({},this.options.interpolation),n.interpolation)}));var a,s="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(s){var l=e.match(this.interpolator.nestingRegexp);a=l&&l.length}var c=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(c=_F(_F({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,n.lng||this.language,n),s){var u=e.match(this.interpolator.nestingRegexp);a<(u&&u.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return i&&i[0]===r[0]&&!n.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):o.translate.apply(o,r.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var d=n.postProcess||this.options.postProcess,h="string"==typeof d?[d]:d;return null!=e&&h&&h.length&&!1!==n.applyPostProcessor&&(e=xF.handle(h,e,t,this.options&&this.options.postProcessPassResolved?_F({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,i,o,a=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),c=l.key;n=c;var u=l.namespaces;a.options.fallbackNS&&(u=u.concat(a.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,h=d&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),f=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);u.forEach((function(e){a.isValidLookup(t)||(o=e,!EF["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(o)&&(EF["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){i=n;var o,l=[c];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(l,c,n,e,s);else{var u;d&&(u=a.pluralResolver.getSuffix(n,s.count,s));var p="".concat(a.options.pluralSeparator,"zero");if(d&&(l.push(c+u),h&&l.push(c+p)),f){var m="".concat(c).concat(a.options.contextSeparator).concat(s.context);l.push(m),d&&(l.push(m+u),h&&l.push(m+p))}}for(;o=l.pop();)a.isValidLookup(t)||(r=o,t=a.getResource(n,e,o,s))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),n}(rF);function TF(e){return e.charAt(0).toUpperCase()+e.slice(1)}var IF=function(){function e(t){UU(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=nF.create("languageUtils")}return zU(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=TF(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=TF(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=TF(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach((function(e){i.indexOf(e)<0&&o(n.formatLanguageCode(e))})),i}}]),e}(),kF=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],RF={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},OF=["v1","v2","v3"],PF={zero:0,one:1,two:2,few:3,many:4,other:5};function NF(){var e={};return kF.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:RF[t.fc]}}))})),e}var BF=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};UU(this,e),this.languageUtils=t,this.options=n,this.logger=nF.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=NF()}return zU(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return PF[e]-PF[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!OF.includes(this.options.compatibilityJSON)}}]),e}();function LF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function DF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?LF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var UF=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};UU(this,e),this.logger=nF.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return zU(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:pF,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?hF(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?hF(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?hF(t.nestingPrefix):t.nestingPrefixEscaped||hF("$t("),this.nestingSuffix=t.nestingSuffix?hF(t.nestingSuffix):t.nestingSuffixEscaped||hF(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,a,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(s.formatSeparator)<0){var i=uF(t,l,e);return s.alwaysFormat?s.format(i,void 0,n,DF(DF(DF({},r),t),{},{interpolationkey:e})):i}var o=e.split(s.formatSeparator),a=o.shift().trim(),c=o.join(s.formatSeparator).trim();return s.format(uF(t,l,a),c,n,DF(DF(DF({},r),t),{},{interpolationkey:a}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?c(s.escape(e)):c(e)}}].forEach((function(t){for(a=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(o=u(n)))if("function"==typeof d){var l=d(e,i,r);o="string"==typeof l?l:""}else if(r&&r.hasOwnProperty(n))o="";else{if(h){o=i[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||s.useRawValueToEscape||(o=oF(o));var c=t.safeValue(o);if(e=e.replace(i[0],c),h?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=DF({},o);function s(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),i="{".concat(r[1]);e=r[0];var o=(i=this.interpolate(i,a)).match(/'/g),s=i.match(/"/g);(o&&o.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{a=JSON.parse(i),t&&(a=DF(DF({},t),a))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(i)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;n=this.nestingRegexp.exec(e);){var l=[],c=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var u=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=u.shift(),l=u,c=!0}if((r=t(s.call(this,n[1].trim(),a),a))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=oF(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),c&&(r=l.reduce((function(e,t){return i.format(e,t,o.lng,DF(DF({},o),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function FF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function zF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function jF(e){var t={};return function(n,r,i){var o=r+JSON.stringify(i),a=t[o];return a||(a=e(r,i),t[o]=a),a(n)}}var HF=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};UU(this,e),this.logger=nF.create("formatter"),this.options=t,this.formats={number:jF((function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}})),currency:jF((function(e,t){var n=new Intl.NumberFormat(e,zF(zF({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:jF((function(e,t){var n=new Intl.DateTimeFormat(e,zF({},t));return function(e){return n.format(e)}})),relativetime:jF((function(e,t){var n=new Intl.RelativeTimeFormat(e,zF({},t));return function(e){return n.format(e,t.range||"day")}})),list:jF((function(e,t){var n=new Intl.ListFormat(e,zF({},t));return function(e){return n.format(e)}}))},this.init(t)}return zU(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=t.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=jF(t)}},{key:"format",value:function(e,t,n,r){var i=this,o=t.split(this.formatSeparator).reduce((function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=YU(e.split(":")),r=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=i),"false"===i&&(n[r.trim()]=!1),"true"===i&&(n[r.trim()]=!0),isNaN(i)||(n[r.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:n}}(t),a=o.formatName,s=o.formatOptions;if(i.formats[a]){var l=e;try{var c=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},u=c.locale||c.lng||r.locale||r.lng||n;l=i.formats[a](e,u,zF(zF(zF({},s),r),c))}catch(e){i.logger.warn(e)}return l}return i.logger.warn("there was no format function for ".concat(a)),e}),e);return o}}]),e}();function GF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function VF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?GF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function WF(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=WU(e);if(t){var i=WU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return VU(this,n)}}var qF=function(e){GU(n,e);var t=WF(n);function n(e,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return UU(this,n),o=t.call(this),mF&&rF.call(jU(o)),o.backend=e,o.store=r,o.services=i,o.languageUtils=i.languageUtils,o.options=a,o.logger=nF.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,a.backend,a),o}return zU(n,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},a={},s={},l={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[s]=2:i.state[s]<0||(1===i.state[s]?void 0===a[s]&&(a[s]=!0):(i.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===l[t]&&(l[t]=!0)))})),r||(s[e]=!0)})),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){var r,s,l,c,u,d;r=n.loaded,s=o,c=sF(r,[i],Object),u=c.obj,d=c.k,u[d]=u[d]||[],l&&(u[d]=u[d].concat(s)),l||u[d].push(s),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;return e.length?this.readingCalls>=this.maxParallelReads?void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:o,callback:a}):(this.readingCalls++,this.backend[n](e,t,(function(s,l){if(r.readingCalls--,r.waitingReads.length>0){var c=r.waitingReads.shift();r.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}s&&l&&i<r.maxRetries?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,a)}),o):a(s,l)}))):a(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),a),t.loaded(e,r,a)}))}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,VF(VF({},o),{},{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,n,r))}}]),n}(rF);function KF(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===$L(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===$L(e[2])||"object"===$L(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function JF(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function QF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function XF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?QF(Object(n),!0).forEach((function(t){nD(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QF(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function YF(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=WU(e);if(t){var i=WU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return VU(this,n)}}function ZF(){}function $F(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var ez=function(e){GU(n,e);var t=YF(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(UU(this,n),e=t.call(this),mF&&rF.call(jU(e)),e.options=JF(r),e.services={},e.logger=nF,e.modules={external:[]},$F(jU(e)),i&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,i),VU(e,jU(e));setTimeout((function(){e.init(r,i)}),0)}return e}return zU(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var r=KF();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=XF(XF(XF({},r),this.options),JF(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=XF(XF({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var o;this.modules.logger?nF.init(i(this.modules.logger),this.options):nF.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=HF);var a=new IF(this.options);this.store=new SF(this.options.resources,this.options);var s=this.services;s.logger=nF,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new BF(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(s.formatter=i(o),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new UF(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new qF(i(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.languageDetector&&(s.languageDetector=i(this.modules.languageDetector),s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=i(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new CF(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=ZF),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var c=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];c.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));var u=["addResource","addResources","addResourceBundle","removeResourceBundle"];u.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var d=iF(),h=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),d.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),d}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ZF,r=n,i="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return r();var o=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};if(i)a(i);else{var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return a(e)})),this.services.backendConnector.load(o,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),r(e)}))}else r(null)}},{key:"reloadResources",value:function(e,t,n){var r=iF();return e||(e=this.languages),t||(t=this.options.ns),n||(n=ZF),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&xF.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=iF();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var a="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);a&&(n.language||i(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(function(e){!function(e,o){o?(i(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,a)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){var o;if("object"!==$L(i)){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];o=r.options.overloadTranslationOptionHandler([t,i].concat(s))}else o=XF({},i);o.lng=o.lng||e.lng,o.lngs=o.lngs||e.lngs,o.ns=o.ns||e.ns,o.keyPrefix=o.keyPrefix||n||e.keyPrefix;var c=r.options.keySeparator||".",u=o.keyPrefix?"".concat(o.keyPrefix).concat(c).concat(t):t;return r.t(u,o)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,i}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=iF();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=iF();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter((function(e){return r.indexOf(e)<0}));return i.length?(this.options.preload=r.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ZF,i=XF(XF(XF({},this.options),t),{isClone:!0}),o=new n(i);void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t));var a=["store","services","language"];return a.forEach((function(t){o[t]=e[t]})),o.services=XF({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new CF(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))})),o.init(i,r),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(rF);nD(ez,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new ez(e,t)}));var tz=ez.createInstance();tz.createInstance=ez.createInstance;tz.createInstance,tz.init,tz.loadResources,tz.reloadResources,tz.use,tz.changeLanguage,tz.getFixedT,tz.t,tz.exists,tz.setDefaultNamespace,tz.hasLoadedNamespace,tz.loadNamespaces,tz.loadLanguages;var nz,rz=tz;nz=JSON.parse('{"yes":"Si","no":"No","confirm":"Conferma","cancel":"Annulla","show":"Mostra","hide":"Nascondi","send":"Invia","loading":"Caricamento","copy":"Copia","copyToClipboard":"Copia negli appunti","showOriginalText":"Mostra originale","showTranslatedText":"Mostra traduzione","memoriBlockedTitle":"Bloccato","memoriBlockedUntil":"Memori bloccato fino al {{date}}","memoriBlockedAnon":"Attualmente \\"{{name}}\\" non può rispondere, torna qui il {{date}}","memoriBlockedReasonExceedChats":"perchè ha superato la soglia mensile di chat ammesse.","memoriBlockedGiverHelper":"Puoi sempre gestirlo in qualità di amministratore, ma altri utenti non potranno interrogarlo.","auth":{"useRecoveryTokens":"Utilizza i token di recupero","tokens":"Token","addToken":"Aggiungi token","usePassword":"Utilizza la password","atLeast":"Almeno"},"widget":{"instruct":"Istruisci","test":"Prova","sound":"Audio","position":"Posizione","settings":"Impostazioni","share":"Condividi","sendOnKeypress":"Premi Invio per inviare","sendOnClick":"Clicca sul bottone di invio","goToIntegrationsToCustomizeAvatar":"Per personalizzare l\'avatar, vai a Condividimi e configura la pagina pubblica"},"write_and_speak":{"micButtonPopover":"Premi il pulsante per parlare","micButtonPopoverListening":"Premi il pulsante per smettere di parlare","pageInstructExplanation":"Per insegnarmi nuove cose clicca sul pulsante ISTRUISCIMI per cominciare","pageTryMeExplanation":"Per parlare con me clicca sul pulsante INIZIAMO per cominciare","instructButton":"ISTRUISCIMI","tryMeButton":"INIZIAMO","chatHistory":"Cronologia chat","exportChatHistory":"Esporta la cronologia chat","exportChatHistoryMessage":"Vuoi esportare la cronologia chat?","chatBotButtonText":"CLICCA QUI PER APRIRE LA CHAT","conversationStartedLabel":"Conversazione avvenuta il","settingsHeaderLabel":"Configura qui il memori se vuoi impostare una conversazione continua. Setta i secondi di silenzio prima dell\'invio.","continuousSpeechLabel":"Conversazione continua","secondsLabel":"Secondi","tryMeHeaderLabel":"PROVA","unknownPosition":"Posizione sconosciuta","fieldPlace":"Indica la posizione (es \'Milano\')","showMapLinkFor":"Visualizza sulla mappa la posizione","useMyPosition":"Usa la mia posizione","myPosition":"Posizione corrente","updatingPosition":"Aggiorno la posizione...","placeNotFound":"Luogo sconosciuto!","requirePosition":"Inserisci la posizione prima di iniziare","attachmentsLabel":"Arricchisci il tuo messaggio","iWantToTalkToIn":"Voglio parlare con {{name}} in"},"gamification":{"level":"Livello","points":"punti","memoriReachedLevel":"è diventato più evoluto ed ha raggiunto il livello","levelGoToStatistics":"{{memori}} è al livello {{level}} con {{points}} punti. Clicca per andare alle statistiche.","congratulationsNewLevel":"Congratulazioni, hai raggiunto un nuovo livello!","congratulationsNewLevelDescription":"Il tuo Memori è diventato più evoluto con {{points}} punti, guarda le","statistics":"statistiche"},"success":"Operazione andata a buon fine","Error":"Errore","internal server error":"Ops, scusa... qualcosa è andato storto nel server","error":"Errore","error.loading":"Errore durante il caricamento dei contenuti.","error.notFound":"Ops, non abbiamo trovato ciò che cercavi.","error.generic":"Ops, qualcosa è andato storto.","error.serverNotResponding":"Stiamo facendo manutenzione o rilasciando aggiornamenti. Riprova più tardi.","error.unprocessableEntity":"Errore durante il salvataggio dei dati. Ricontrolla i dati inseriti.","error.goBackTo":"Prova a tornare alla","error.reloadPage":"Ricarica la pagina","error.tryAgain":"Riprova","error.unauthorized":"Non sei autorizzato a visualizzare questo contenuto.","errors":{"TENANT_NOT_FOUND":"Tenant non trovato","TENANT_REGISTRATION_DISABLED":"La registrazione su questa piattaforma è disabilitata","TENANT_MISSING_NAME":"Tenant: nome mancante","TENANT_MAX_USERS_REACHED":"Numero massimo di utenti raggiunto","TENANT_MAX_ADMINS_REACHED":"Numero massimo di utenti amministratori raggiunto","USER_NOT_CONFIRMED":"Utente ancora non confermato","USER_NOT_FOUND":"Utente non trovato","USER_OR_PASSWORD_INVALID":"Utente o password non validi","USER_MUST_CHANGE_PASSWORD":"Devi cambiare la password","USER_MUST_ENTER_VERIFICATION_CODE":"Devi inserire il codice di verifica","USER_MISSING_TENANT":"Utente: tenant mancante","USER_MISSING_NAME":"Utente: nome mancante","USER_MISSING_PASSWORD":"Utente: password mancante","USER_MISSING_EMAIL":"Utente: email mancante","USER_MISSING_VERIFICATION_CODE":"Utente: codice di verifica mancante","USER_NAME_ALREADY_USED":"Nome utente già in uso","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"La password non rispetta le regole di sicurezza","USER_EMAIL_ALREADY_USED":"Email già in uso","USER_EMAIL_INVALID":"Email non valida","USER_VERIFICATION_CODE_INVALID":"Codice di verifica non valido","USER_MISSING_NAME_OR_EMAIL":"Nome utente o email mancante","USER_NAME_INVALID":"Nome utente non valido","USER_HAS_ONE_OR_MORE_MEMORI":"L\'utente ha uno o più memori","USER_MISSING_NEW_PASSWORD":"Utente: nuova password mancante","USER_NOTHING_TO_DO":"Niente da fare","USER_CANT_CREATE_MEMORI":"Utente non abilitato a creare Memori","USER_MAX_MEMORI_REACHED":"Massimo numero di Memori raggiunto","USER_CANT_EDIT_INTEGRATIONS":"Utente non abilitato a gestire integrazioni","MEMORI_NOT_FOUND":"Memori non trovato","MEMORI_NOT_ACCESSIBLE":"Memori non accessibile","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Solo il proprietario può cambiare il tag e il pin","SESSION_NOT_FOUND":"Sessione non trovata","SESSION_IS_NOT_ADMINISTRATIVE":"Sessione non amministrativa","MEMORI_MISSING_CONFIGURATION":"Memori: configurazione mancante","MEMORI_CONFIGURATION_NOT_FOUND":"Memori: configurazione non trovata","MEMORI_INVALID_PRIVACY_TYPE":"Memori: tipo di privacy non valido","MEMORI_MISSING_PASSWORD":"Memori: password mancante","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Memori: numero totale di token di recupero non valido","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Memori: numero minimo di token di recupero non valido","MEMORI_INVALID_VOICE_TYPE":"Memori: tipo di voce non valido","MEMORI_MISSING_NAME":"Memori: nome mancante","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Memori: password o token di recupero mancanti","MEMORI_INVALID_ID":"Memori: ID non valido","MEMORI_NAME_ALREADY_USED":"Nome memori già in uso","MEMORI_INVALID_PIN":"Memori: PIN non valido","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Memori: cambio TAG e PIN richiedono operazioni separate","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Memori: password non richiesta su Memori pubblico","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Trasferimento: utente di destinazione mancante","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Trasferimento: ID utente di destinazione non valido","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Trasferimento: dati utente di destinazione non validi","MEMORI_TRANSFER_NOTHING_TO_DO":"Trasferimento: alcuna operazione da fare","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Memori: la configurazione non può essere modificata","MEMORI_MISSING_NEW_PASSWORD":"Memori: nuova password mancante","INTEGRATION_NOT_FOUND":"Integrazione non trovata","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Formato non valido data a partire da","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Formato non valido data fino a","INTEGRATION_INVALID_TYPE":"Tipo integrazione non valido","INTEGRATION_ALREADY_EXISTS":"Integrazione già esistente","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Memori non pubblici non possono essere integrati","INTEGRATION_MISSING_INVOCATION_TEXT":"Integrazione: testo di invocazione mancante","INTEGRATION_MISSING_DEVICE_EMAILS":"Integrazione: email del dispositivo mancante","INTEGRATION_MEMORI_IS_EMPTY":"Memori vuoti non possono essere integrati","INTEGRATION_MISSING_PRIVACY_POLICY":"Integrazione: privacy policy mancante","INTEGRATION_MISSING_CATEGORY":"Categoria integrazione mancante","INTEGRATION_MISSING_DESCRIPTION":"Descrizione integrazione mancante","INTEGRATION_INVALID_INVOCATION_TEXT":"Testo di invocazione non valido","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home non più disponibile","UPLOAD_REQUIRES_MULTIPART_ENCODING":"L\'upload richiede l\'encoding multipart","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: manca il content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: dimensione massima superata","UPLOAD_FILE_IS_EMPTY":"Upload: file vuoto","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: tipo di file o firma non validi","UPLOAD_MISSING_FILE_NAME":"Upload: nome file mancante","UPLOAD_INVALID_MEMORY_ID":"Upload: ID contenuto non valido","UPLOAD_MISSING_FILE_CONTENT":"Upload: contenuto file mancante","ASSET_NOT_FOUND":"Asset non trovato","ASSET_NOT_ACCESSIBLE":"Asset non accessibile","ASSET_MISSING_SESSION_ID":"Asset: ID sessione mancante","ASSET_INVALID_FILE_NAME":"Asset: nome file non valido","INVITATION_NOT_FOUND":"Invito non trovato","INVITATION_NOT_ACCESSIBLE":"Invito non accessibile","INVITATION_ALREADY_ACCEPTED":"Invito già accettato","INVITATION_ALREADY_REJECTED":"Invito già rifiutato","INVITATION_MISSING_DESTINATION_EMAIL":"Invito: email di destinazione mancante","INVITATION_DESTINATION_EMAIL_INVALID":"Invito: email di destinazione non valida","INVITATION_MISSING_TAG":"Invito: tag mancante","INVITATION_MISSING_PIN":"Invito: PIN mancante","INVITATION_INVALID_PIN":"Invito: PIN non valido","INVITATION_INVALID_TYPE":"Invito: tipo non valido","INVITATION_MISSING_DESTINATION_NAME":"Invito: nome destinatario mancante","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invito: tag e pin non possono essere cambiati","INVITATION_CANT_BE_CHANGED":"Invito: non può essere modificato","ACTIONLOG_INVALID_USER_ID":"ID utente non valido","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","ACTIONLOG_INVALID_MEMORI_ID":"ID Memori non valido","CONSUMPTIONLOG_INVALID_TYPE":"Tipo di log non valido","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","CONSUMPTIONLOG_INVALID_USER_ID":"ID utente non valido","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Memori ID non valido"}}');const iz={en:{translation:n(JSON.parse('{"yes":"Yes","no":"No","confirm":"Confirm","cancel":"Cancel","show":"Show","hide":"Hide","send":"Send","loading":"Loading","copy":"Copy","copyToClipboard":"Copy to clipboard","showOriginalText":"Show original","showTranslatedText":"Show translation","memoriBlockedTitle":"Blocked","memoriBlockedUntil":"Memori blocked until {{date}}","memoriBlockedAnon":"Currently \\"{{name}}\\" can\'t answer, come back here on {{date}}","memoriBlockedReasonExceedChats":"because it has exceeded the monthly threshold of allowed chats.","memoriBlockedGiverHelper":"You can still manage it as administrator, but other users will not be able to interact with it.","auth":{"useRecoveryTokens":"Use recovery tokens","tokens":"Tokens","addToken":"Add token","usePassword":"Use password","atLeast":"At least"},"widget":{"instruct":"Instruct","test":"Test","sound":"Sound","position":"Position","settings":"Settings","share":"Share","sendOnKeypress":"Hit Enter to send","sendOnClick":"Click on Submit","goToIntegrationsToCustomizeAvatar":"To customize the avatar, go to Share and customize the public page"},"write_and_speak":{"micButtonPopover":"Click the button to speak","micButtonPopoverListening":"Click the button to stop speak","pageInstructExplanation":"To teach me new things click on the INSTRUCT ME button to get started","pageTryMeExplanation":"To talk to me click on the START button to get started","instructButton":"INSTRUCT ME","tryMeButton":"START","chatHistory":"Chat history","exportChatHistory":"Export chat history","exportChatHistoryMessage":"Do you want to export chat history?","chatBotButtonText":"CLICK HERE TO OPEN CHATBOT","conversationStartedLabel":"Conversation started on","settingsHeaderLabel":"Setup here if you want to set the memori as continuous speech, and change the silence seconds if you want to customize them.","continuousSpeechLabel":"Continuous speech","secondsLabel":"Set seconds","tryMeHeaderLabel":"TRY","unknownPosition":"Unknown position","fieldPlace":"Write the place (eg \'Milano\')","showMapLinkFor":"Show the position on the map","useMyPosition":"Use my position","myPosition":"Your position","updatingPosition":"Updating position...","placeNotFound":"Place not found!","requirePosition":"Insert your position before start","attachmentsLabel":"Enrich your message","iWantToTalkToIn":"I want to talk to {{name}} in"},"gamification":{"level":"Level","points":"points","memoriReachedLevel":"became more evolved and reached level","levelGoToStatistics":"{{memori}} is at level {{level}} with {{points}} points. Click to go to statistics.","congratulationsNewLevel":"Congratulations, you have reached a new level!","congratulationsNewLevelDescription":"Your Memori became more evolved with {{points}} points, look at the","statistics":"statistics"},"success":"Success","Error":"Error","internal server error":"Oupsie, sorry... Something went wrong on the server","error":"Error","error.loading":"Error while loading content.","error.generic":"Oupsie, sorry... something went wrong.","error.serverNotResponding":"We are doing maintenance or releasing updates. Please try again later.","error.notFound":"Oupsie, we didn\'t find the page you were looking for.","error.goBackTo":"You can try to go back to the","error.reloadPage":"Reload the page","error.tryAgain":"Try again","error.unauthorized":"You are unauthorized to view this content.","error.unprocessableEntity":"Error while processing the request. Check the data you entered.","errors":{"TENANT_NOT_FOUND":"Tenant not found","TENANT_REGISTRATION_DISABLED":"Registration on this platform is disabled","TENANT_MISSING_NAME":"Tenant: name missing","TENANT_MAX_USERS_REACHED":"Maximum number of users reached","TENANT_MAX_ADMINS_REACHED":"Maximum number of admin users reached","USER_NOT_CONFIRMED":"User still not confirmed","USER_NOT_FOUND":"User not found","USER_OR_PASSWORD_INVALID":"Invalid user or password","USER_MUST_CHANGE_PASSWORD":"You must change your password","USER_MUST_ENTER_VERIFICATION_CODE":"You must enter the verification code","USER_MISSING_TENANT":"User: missing tenant","USER_MISSING_NAME":"User: name is missing","USER_MISSING_PASSWORD":"User: password missing","USER_MISSING_EMAIL":"User: Missing email","USER_MISSING_VERIFICATION_CODE":"User: Missing verification code","USER_NAME_ALREADY_USED":"User name already in use","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"The password does not meet the security rules","USER_EMAIL_ALREADY_USED":"Email already in use","USER_EMAIL_INVALID":"Invalid email","USER_VERIFICATION_CODE_INVALID":"Invalid verification code","USER_MISSING_NAME_OR_EMAIL":"Missing username or email","USER_NAME_INVALID":"Invalid user name","USER_HAS_ONE_OR_MORE_MEMORI":"The user has one or more memories","USER_MISSING_NEW_PASSWORD":"User: new password missing","USER_NOTHING_TO_DO":"Nothing to do","USER_CANT_CREATE_MEMORI":"User not allowed to create Memori","USER_MAX_MEMORI_REACHED":"Maximum number of Memori reached","USER_CANT_EDIT_INTEGRATIONS":"User not allowed to manage integrations","MEMORI_NOT_FOUND":"Memori not found","MEMORI_NOT_ACCESSIBLE":"Memori not accessible","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Only owner can change tag or pin","SESSION_NOT_FOUND":"Session not found","SESSION_IS_NOT_ADMINISTRATIVE":"Non-administrative session","MEMORI_MISSING_CONFIGURATION":"Memori: missing configuration","MEMORI_CONFIGURATION_NOT_FOUND":"Memories: configuration not found","MEMORI_INVALID_PRIVACY_TYPE":"Memories: invalid privacy type","MEMORI_MISSING_PASSWORD":"Memori: missing password","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Memories: total number of invalid recovery tokens","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Memories: minimum number of invalid recovery tokens","MEMORI_INVALID_VOICE_TYPE":"Memories: invalid voice type","MEMORI_MISSING_NAME":"Memories: missing name","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Memories: missing password or recovery token","MEMORI_INVALID_ID":"Memories: invalid ID","MEMORI_NAME_ALREADY_USED":"Memory name already in use","MEMORI_INVALID_PIN":"Memories: Invalid PIN","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Memories: TAG and PIN change require separate operations","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Memories: no password required when public","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Transfer: missing destination user","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Transfer: invalid destination user ID","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Transfer: invalid destination user data","MEMORI_TRANSFER_NOTHING_TO_DO":"Transfer: nothing to do","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Memories: configuration cannot be changed","MEMORI_MISSING_NEW_PASSWORD":"Memories: new password missing","INTEGRATION_NOT_FOUND":"Integration not found","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Invalid date from format","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Invalid date to format","INTEGRATION_INVALID_TYPE":"Invalid integration type","INTEGRATION_ALREADY_EXISTS":"Integration already exists","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Non-public memories cannot be integrated","INTEGRATION_MISSING_INVOCATION_TEXT":"Integration: missing invocation text","INTEGRATION_MISSING_DEVICE_EMAILS":"Integration: missing device email","INTEGRATION_MEMORI_IS_EMPTY":"Empty memories cannot be integrated","INTEGRATION_MISSING_PRIVACY_POLICY":"Integration: privacy policy missing","INTEGRATION_MISSING_CATEGORY":"Integration category missing","INTEGRATION_MISSING_DESCRIPTION":"Missing integration description","INTEGRATION_INVALID_INVOCATION_TEXT":"Invalid invocation text","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home no more available","UPLOAD_REQUIRES_MULTIPART_ENCODING":"Upload requires multipart encoding","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: missing content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: maximum size exceeded","UPLOAD_FILE_IS_EMPTY":"Upload: empty file","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: invalid file type or signature","UPLOAD_MISSING_FILE_NAME":"Upload: missing file name","UPLOAD_INVALID_MEMORY_ID":"Upload: Invalid content ID","UPLOAD_MISSING_FILE_CONTENT":"Upload: Missing file content","ASSET_NOT_FOUND":"Asset not found","ASSET_NOT_ACCESSIBLE":"Asset not accessible","ASSET_MISSING_SESSION_ID":"Asset: missing session ID","ASSET_INVALID_FILE_NAME":"Asset: invalid file name","INVITATION_NOT_FOUND":"Invitation not found","INVITATION_NOT_ACCESSIBLE":"Invitation not accessible","INVITATION_ALREADY_ACCEPTED":"Invitation already accepted","INVITATION_ALREADY_REJECTED":"Invitation already rejected","INVITATION_MISSING_DESTINATION_EMAIL":"Invitation: missing destination email","INVITATION_DESTINATION_EMAIL_INVALID":"Invitation: destination email invalid","INVITATION_MISSING_TAG":"Invitation: missing tag","INVITATION_MISSING_PIN":"Invitation: PIN missing","INVITATION_INVALID_PIN":"Invitation: invalid PIN","INVITATION_INVALID_TYPE":"Invitation: invalid type","INVITATION_MISSING_DESTINATION_NAME":"Invitation: destination name missing","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invitation: tag and pin can\'t be changed","INVITATION_CANT_BE_CHANGED":"Intation: can\'t be changed","ACTIONLOG_INVALID_USER_ID":"Invalid user ID","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","ACTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID","CONSUMPTIONLOG_INVALID_TYPE":"Invalid log type","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","CONSUMPTIONLOG_INVALID_USER_ID":"Invalid user ID","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID"}}'))},it:{translation:n(nz)}};rz.use(so).init({resources:iz,lng:"en",fallbackLng:"it",supportedLngs:["en","it"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1}});var oz=rz;const az=({ownerUserName:e,ownerUserID:t,memoriName:r,memoriID:i,integrationID:o,tenantID:a,secretToken:s,sessionID:l,showShare:u=!0,showSettings:d=!1,showInstruct:h=!1,height:f="100%",baseURL:p,apiURL:m="https://backend.memori.ai",tag:g,pin:v,context:b,initialQuestion:y,uiLang:w,spokenLang:S,AZURE_COGNITIVE_SERVICES_TTS_KEY:x,onStateChange:M})=>{var _,A,E;const[C,T]=(0,c.useState)(),{t:I}=yo();if(!(i&&t||r&&e))throw new Error("Identifier pair required: please provide either memoriID and ownerUserID or memoriName and ownerUserName");const k=Vi(m),R=(0,c.useCallback)((async()=>{if(i&&t){const{memori:e,...n}=await k.backend.getMemoriByUserAndId(a,t,i);0===n.resultCode&&e?T(e):console.error("[MEMORI]",n,e)}else if(r&&e){const{memori:t,...n}=await k.backend.getMemori(a,e,r);0===n.resultCode&&t?T(t):console.error("[MEMORI]",n,t)}}),[i,t,r,e,a]);return(0,c.useEffect)((()=>{R()}),[R,a]),(0,c.useEffect)((()=>{if(w)oz.changeLanguage(w.toLowerCase());else{const{lng:e,fallbackLng:t}=(()=>{const e=navigator.language;if(e){let t=e.split("-")[0];if(["en","it"].includes(t))return{lng:t,fallbackLng:"en"===t?"it":"en"}}return{lng:"en",fallbackLng:"it"}})();oz.changeLanguage(e).catch((()=>{oz.changeLanguage(t)}))}}),[w]),C?n(c).createElement(DU,{height:f,baseUrl:p||(a.startsWith("https://")?a:`https://${a}`),apiUrl:m,memori:{...C,secretToken:s},memoriLang:null!=S?S:null===(A=null===(_=C.culture)||void 0===_?void 0:_.split("-"))||void 0===A?void 0:A[0],tenant:{id:a,theme:"twincreator",config:{name:a,showNewUser:!1,requirePosition:!!C.needsPosition}},secret:s,sessionID:l,showShare:u,showSettings:d,showInstruct:h,integration:null===(E=null==C?void 0:C.integrations)||void 0===E?void 0:E.find((e=>o?e.integrationID===o:!!e.publish&&"LANDING_EXPERIENCE"===e.type)),initialContextVars:b,initialQuestion:y,AZURE_COGNITIVE_SERVICES_TTS_KEY:x,onStateChange:M,...g&&v?{personification:{tag:g,pin:v}}:{}}):n(c).createElement("div",null,n(c).createElement("p",{style:{textAlign:"center",margin:"2rem auto"}},I("loading"),"..."))};az.propTypes={memoriName:n(l).string,memoriID:n(l).string,ownerUserName:n(l).string,ownerUserID:n(l).string,integrationID:n(l).string,tenantID:n(l).string.isRequired,secretToken:n(l).string,showShare:n(l).bool,showSettings:n(l).bool,baseURL:n(l).string,apiURL:n(l).string,tag:n(l).string,pin:n(l).string,showInstruct:n(l).bool,context:n(l).objectOf(n(l).any),initialQuestion:n(l).string,uiLang:n(l).oneOf(["en","it"]),spokenLang:n(l).string,AZURE_COGNITIVE_SERVICES_TTS_KEY:n(l).string,onStateChange:n(l).func};var sz=az;class lz extends HTMLElement{connectedCallback(){const e=document.createElement("div"),t=document.createElement("div");t.setAttribute("id","memori-root");const r=document.createElement("style");r.innerHTML="\n @import url('https://unpkg.com/@memori.ai/memori-webcomponent/dist/memori-webcomponent.css');\n ",e.appendChild(r),e.appendChild(t),this.appendChild(e);const i=Object.keys(sz.propTypes).reduce(((e,t)=>(this.hasAttribute(t)&&(e[t]=this.getAttribute(t)),e)),{}),o=this.getAttribute("tenantId"),l=this.getAttribute("context")?.split(",")?.reduce(((e,t)=>{const[n,r]=t.split(":").map((e=>e.trim()));return{...e,[n]:r}}),{});o?n(s).render((0,a.jsx)(sz,{...i,context:l,tenantID:o}),t):console.error("No tenantId attribute found")}}customElements.define("memori-client",lz)})();
|