!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.PersonaClient=e():t.PersonaClient=e()}(self,(()=>(()=>{var t={486:function(t,e,n){var r; /** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */t=n.nmd(t),function(){var i,o="Expected a function",s="__lodash_hash_undefined__",u="__lodash_placeholder__",a=16,c=32,f=64,h=128,l=256,p=1/0,d=9007199254740991,v=NaN,y=4294967295,g=[["ary",h],["bind",1],["bindKey",2],["curry",8],["curryRight",a],["flip",512],["partial",c],["partialRight",f],["rearg",l]],_="[object Arguments]",m="[object Array]",b="[object Boolean]",w="[object Date]",k="[object Error]",x="[object Function]",A="[object GeneratorFunction]",S="[object Map]",E="[object Number]",O="[object Object]",j="[object Promise]",C="[object RegExp]",R="[object Set]",L="[object String]",I="[object Symbol]",T="[object WeakMap]",P="[object ArrayBuffer]",B="[object DataView]",N="[object Float32Array]",M="[object Float64Array]",z="[object Int8Array]",F="[object Int16Array]",D="[object Int32Array]",q="[object Uint8Array]",U="[object Uint8ClampedArray]",W="[object Uint16Array]",Q="[object Uint32Array]",K=/\b__p \+= '';/g,$=/\b(__p \+=) '' \+/g,V=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,Y=/[&<>"']/g,H=RegExp(G.source),J=RegExp(Y.source),Z=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(it.source),st=/^\s+/,ut=/\s/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ct=/\{\n\/\* \[wrapped with (.+)\] \*/,ft=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lt=/[()=,{}\[\]\/\s]/,pt=/\\(\\)?/g,dt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vt=/\w*$/,yt=/^[-+]0x[0-9a-f]+$/i,gt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,bt=/^(?:0|[1-9]\d*)$/,wt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,kt=/($^)/,xt=/['\n\r\u2028\u2029\\]/g,At="\\ud800-\\udfff",St="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Et="\\u2700-\\u27bf",Ot="a-z\\xdf-\\xf6\\xf8-\\xff",jt="A-Z\\xc0-\\xd6\\xd8-\\xde",Ct="\\ufe0e\\ufe0f",Rt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Lt="['’]",It="["+At+"]",Tt="["+Rt+"]",Pt="["+St+"]",Bt="\\d+",Nt="["+Et+"]",Mt="["+Ot+"]",zt="[^"+At+Rt+Bt+Et+Ot+jt+"]",Ft="\\ud83c[\\udffb-\\udfff]",Dt="[^"+At+"]",qt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ut="[\\ud800-\\udbff][\\udc00-\\udfff]",Wt="["+jt+"]",Qt="\\u200d",Kt="(?:"+Mt+"|"+zt+")",$t="(?:"+Wt+"|"+zt+")",Vt="(?:['’](?:d|ll|m|re|s|t|ve))?",Gt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Yt="(?:"+Pt+"|"+Ft+")"+"?",Ht="["+Ct+"]?",Jt=Ht+Yt+("(?:"+Qt+"(?:"+[Dt,qt,Ut].join("|")+")"+Ht+Yt+")*"),Zt="(?:"+[Nt,qt,Ut].join("|")+")"+Jt,Xt="(?:"+[Dt+Pt+"?",Pt,qt,Ut,It].join("|")+")",te=RegExp(Lt,"g"),ee=RegExp(Pt,"g"),ne=RegExp(Ft+"(?="+Ft+")|"+Xt+Jt,"g"),re=RegExp([Wt+"?"+Mt+"+"+Vt+"(?="+[Tt,Wt,"$"].join("|")+")",$t+"+"+Gt+"(?="+[Tt,Wt+Kt,"$"].join("|")+")",Wt+"?"+Kt+"+"+Vt,Wt+"+"+Gt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bt,Zt].join("|"),"g"),ie=RegExp("["+Qt+At+St+Ct+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ue=-1,ae={};ae[N]=ae[M]=ae[z]=ae[F]=ae[D]=ae[q]=ae[U]=ae[W]=ae[Q]=!0,ae[_]=ae[m]=ae[P]=ae[b]=ae[B]=ae[w]=ae[k]=ae[x]=ae[S]=ae[E]=ae[O]=ae[C]=ae[R]=ae[L]=ae[T]=!1;var ce={};ce[_]=ce[m]=ce[P]=ce[B]=ce[b]=ce[w]=ce[N]=ce[M]=ce[z]=ce[F]=ce[D]=ce[S]=ce[E]=ce[O]=ce[C]=ce[R]=ce[L]=ce[I]=ce[q]=ce[U]=ce[W]=ce[Q]=!0,ce[k]=ce[x]=ce[T]=!1;var fe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},he=parseFloat,le=parseInt,pe="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,de="object"==typeof self&&self&&self.Object===Object&&self,ve=pe||de||Function("return this")(),ye=e&&!e.nodeType&&e,ge=ye&&t&&!t.nodeType&&t,_e=ge&&ge.exports===ye,me=_e&&pe.process,be=function(){try{var t=ge&&ge.require&&ge.require("util").types;return t||me&&me.binding&&me.binding("util")}catch(t){}}(),we=be&&be.isArrayBuffer,ke=be&&be.isDate,xe=be&&be.isMap,Ae=be&&be.isRegExp,Se=be&&be.isSet,Ee=be&&be.isTypedArray;function Oe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function je(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i-1}function Pe(t,e,n){for(var r=-1,i=null==t?0:t.length;++r-1;);return n}function rn(t,e){for(var n=t.length;n--&&We(e,t[n],0)>-1;);return n}var on=Ge({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),sn=Ge({"&":"&","<":"<",">":">",'"':""","'":"'"});function un(t){return"\\"+fe[t]}function an(t){return ie.test(t)}function cn(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function fn(t,e){return function(n){return t(e(n))}}function hn(t,e){for(var n=-1,r=t.length,i=0,o=[];++n",""":'"',"'":"'"});var _n=function t(e){var n,r=(e=null==e?ve:_n.defaults(ve.Object(),e,_n.pick(ve,se))).Array,ut=e.Date,At=e.Error,St=e.Function,Et=e.Math,Ot=e.Object,jt=e.RegExp,Ct=e.String,Rt=e.TypeError,Lt=r.prototype,It=St.prototype,Tt=Ot.prototype,Pt=e["__core-js_shared__"],Bt=It.toString,Nt=Tt.hasOwnProperty,Mt=0,zt=(n=/[^.]+$/.exec(Pt&&Pt.keys&&Pt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ft=Tt.toString,Dt=Bt.call(Ot),qt=ve._,Ut=jt("^"+Bt.call(Nt).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wt=_e?e.Buffer:i,Qt=e.Symbol,Kt=e.Uint8Array,$t=Wt?Wt.allocUnsafe:i,Vt=fn(Ot.getPrototypeOf,Ot),Gt=Ot.create,Yt=Tt.propertyIsEnumerable,Ht=Lt.splice,Jt=Qt?Qt.isConcatSpreadable:i,Zt=Qt?Qt.iterator:i,Xt=Qt?Qt.toStringTag:i,ne=function(){try{var t=lo(Ot,"defineProperty");return t({},"",{}),t}catch(t){}}(),ie=e.clearTimeout!==ve.clearTimeout&&e.clearTimeout,fe=ut&&ut.now!==ve.Date.now&&ut.now,pe=e.setTimeout!==ve.setTimeout&&e.setTimeout,de=Et.ceil,ye=Et.floor,ge=Ot.getOwnPropertySymbols,me=Wt?Wt.isBuffer:i,be=e.isFinite,De=Lt.join,Ge=fn(Ot.keys,Ot),mn=Et.max,bn=Et.min,wn=ut.now,kn=e.parseInt,xn=Et.random,An=Lt.reverse,Sn=lo(e,"DataView"),En=lo(e,"Map"),On=lo(e,"Promise"),jn=lo(e,"Set"),Cn=lo(e,"WeakMap"),Rn=lo(Ot,"create"),Ln=Cn&&new Cn,In={},Tn=Fo(Sn),Pn=Fo(En),Bn=Fo(On),Nn=Fo(jn),Mn=Fo(Cn),zn=Qt?Qt.prototype:i,Fn=zn?zn.valueOf:i,Dn=zn?zn.toString:i;function qn(t){if(nu(t)&&!Ks(t)&&!(t instanceof Kn)){if(t instanceof Qn)return t;if(Nt.call(t,"__wrapped__"))return Do(t)}return new Qn(t)}var Un=function(){function t(){}return function(e){if(!eu(e))return{};if(Gt)return Gt(e);t.prototype=e;var n=new t;return t.prototype=i,n}}();function Wn(){}function Qn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function Kn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=y,this.__views__=[]}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function cr(t,e,n,r,o,s){var u,a=1&e,c=2&e,f=4&e;if(n&&(u=o?n(t,r,o,s):n(t)),u!==i)return u;if(!eu(t))return t;var h=Ks(t);if(h){if(u=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&Nt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!a)return Ri(t,u)}else{var l=yo(t),p=l==x||l==A;if(Ys(t))return Ai(t,a);if(l==O||l==_||p&&!o){if(u=c||p?{}:_o(t),!a)return c?function(t,e){return Li(t,vo(t),e)}(t,function(t,e){return t&&Li(e,Tu(e),t)}(u,t)):function(t,e){return Li(t,po(t),e)}(t,or(u,t))}else{if(!ce[l])return o?t:{};u=function(t,e,n){var r=t.constructor;switch(e){case P:return Si(t);case b:case w:return new r(+t);case B:return function(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case N:case M:case z:case F:case D:case q:case U:case W:case Q:return Ei(t,n);case S:return new r;case E:case L:return new r(t);case C:return function(t){var e=new t.constructor(t.source,vt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case R:return new r;case I:return i=t,Fn?Ot(Fn.call(i)):{}}var i}(t,l,a)}}s||(s=new Hn);var d=s.get(t);if(d)return d;s.set(t,u),uu(t)?t.forEach((function(r){u.add(cr(r,e,n,r,t,s))})):ru(t)&&t.forEach((function(r,i){u.set(i,cr(r,e,n,i,t,s))}));var v=h?i:(f?c?oo:io:c?Tu:Iu)(t);return Ce(v||t,(function(r,i){v&&(r=t[i=r]),nr(u,i,cr(r,e,n,i,t,s))})),u}function fr(t,e,n){var r=n.length;if(null==t)return!r;for(t=Ot(t);r--;){var o=n[r],s=e[o],u=t[o];if(u===i&&!(o in t)||!s(u))return!1}return!0}function hr(t,e,n){if("function"!=typeof t)throw new Rt(o);return Io((function(){t.apply(i,n)}),e)}function lr(t,e,n,r){var i=-1,o=Te,s=!0,u=t.length,a=[],c=e.length;if(!u)return a;n&&(e=Be(e,Xe(n))),r?(o=Pe,s=!1):e.length>=200&&(o=en,s=!1,e=new Yn(e));t:for(;++i-1},Vn.prototype.set=function(t,e){var n=this.__data__,r=rr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Gn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(En||Vn),string:new $n}},Gn.prototype.delete=function(t){var e=fo(this,t).delete(t);return this.size-=e?1:0,e},Gn.prototype.get=function(t){return fo(this,t).get(t)},Gn.prototype.has=function(t){return fo(this,t).has(t)},Gn.prototype.set=function(t,e){var n=fo(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Yn.prototype.add=Yn.prototype.push=function(t){return this.__data__.set(t,s),this},Yn.prototype.has=function(t){return this.__data__.has(t)},Hn.prototype.clear=function(){this.__data__=new Vn,this.size=0},Hn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Hn.prototype.get=function(t){return this.__data__.get(t)},Hn.prototype.has=function(t){return this.__data__.has(t)},Hn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Vn){var r=n.__data__;if(!En||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Gn(r)}return n.set(t,e),this.size=n.size,this};var pr=Pi(wr),dr=Pi(kr,!0);function vr(t,e){var n=!0;return pr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function yr(t,e,n){for(var r=-1,o=t.length;++r0&&n(u)?e>1?_r(u,e-1,n,r,i):Ne(i,u):r||(i[i.length]=u)}return i}var mr=Bi(),br=Bi(!0);function wr(t,e){return t&&mr(t,e,Iu)}function kr(t,e){return t&&br(t,e,Iu)}function xr(t,e){return Ie(e,(function(e){return Zs(t[e])}))}function Ar(t,e){for(var n=0,r=(e=bi(e,t)).length;null!=t&&ne}function jr(t,e){return null!=t&&Nt.call(t,e)}function Cr(t,e){return null!=t&&e in Ot(t)}function Rr(t,e,n){for(var o=n?Pe:Te,s=t[0].length,u=t.length,a=u,c=r(u),f=1/0,h=[];a--;){var l=t[a];a&&e&&(l=Be(l,Xe(e))),f=bn(l.length,f),c[a]=!n&&(e||s>=120&&l.length>=120)?new Yn(a&&l):i}l=t[0];var p=-1,d=c[0];t:for(;++p=u?a:a*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}))}function $r(t,e,n){for(var r=-1,i=e.length,o={};++r-1;)u!==t&&Ht.call(u,a,1),Ht.call(t,a,1);return t}function Gr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;bo(i)?Ht.call(t,i,1):li(t,i)}}return t}function Yr(t,e){return t+ye(xn()*(e-t+1))}function Hr(t,e){var n="";if(!t||e<1||e>d)return n;do{e%2&&(n+=t),(e=ye(e/2))&&(t+=t)}while(e);return n}function Jr(t,e){return To(jo(t,e,ia),t+"")}function Zr(t){return Zn(qu(t))}function Xr(t,e){var n=qu(t);return No(n,ar(e,0,n.length))}function ti(t,e,n,r){if(!eu(t))return t;for(var o=-1,s=(e=bi(e,t)).length,u=s-1,a=t;null!=a&&++oo?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=r(o);++i>>1,s=t[o];null!==s&&!cu(s)&&(n?s<=e:s=200){var c=e?null:Hi(t);if(c)return ln(c);s=!1,i=en,a=new Yn}else a=e?[]:u;t:for(;++r=r?t:ii(t,e,n)}var xi=ie||function(t){return ve.clearTimeout(t)};function Ai(t,e){if(e)return t.slice();var n=t.length,r=$t?$t(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new Kt(e).set(new Kt(t)),e}function Ei(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Oi(t,e){if(t!==e){var n=t!==i,r=null===t,o=t==t,s=cu(t),u=e!==i,a=null===e,c=e==e,f=cu(e);if(!a&&!f&&!s&&t>e||s&&u&&c&&!a&&!f||r&&u&&c||!n&&c||!o)return 1;if(!r&&!s&&!f&&t1?n[o-1]:i,u=o>2?n[2]:i;for(s=t.length>3&&"function"==typeof s?(o--,s):i,u&&wo(n[0],n[1],u)&&(s=o<3?i:s,o=1),e=Ot(e);++r-1?o[s?e[u]:u]:i}}function Di(t){return ro((function(e){var n=e.length,r=n,s=Qn.prototype.thru;for(t&&e.reverse();r--;){var u=e[r];if("function"!=typeof u)throw new Rt(o);if(s&&!a&&"wrapper"==uo(u))var a=new Qn([],!0)}for(r=a?r:n;++r1&&b.reverse(),p&&fa))return!1;var f=s.get(t),h=s.get(e);if(f&&h)return f==e&&h==t;var l=-1,p=!0,d=2&n?new Yn:i;for(s.set(t,e),s.set(e,t);++l-1&&t%1==0&&t1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(at,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Ce(g,(function(n){var r="_."+n[0];e&n[1]&&!Te(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(ct);return e?e[1].split(ft):[]}(r),n)))}function Bo(t){var e=0,n=0;return function(){var r=wn(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function No(t,e){var n=-1,r=t.length,o=r-1;for(e=e===i?r:e;++n1?t[e-1]:i;return n="function"==typeof n?(t.pop(),n):i,ss(t,n)}));function ps(t){var e=qn(t);return e.__chain__=!0,e}function ds(t,e){return e(t)}var vs=ro((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,o=function(e){return ur(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Kn&&bo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:ds,args:[o],thisArg:i}),new Qn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(o)}));var ys=Ii((function(t,e,n){Nt.call(t,n)?++t[n]:sr(t,n,1)}));var gs=Fi(Qo),_s=Fi(Ko);function ms(t,e){return(Ks(t)?Ce:pr)(t,co(e,3))}function bs(t,e){return(Ks(t)?Re:dr)(t,co(e,3))}var ws=Ii((function(t,e,n){Nt.call(t,n)?t[n].push(e):sr(t,n,[e])}));var ks=Jr((function(t,e,n){var i=-1,o="function"==typeof e,s=Vs(t)?r(t.length):[];return pr(t,(function(t){s[++i]=o?Oe(e,t,n):Lr(t,e,n)})),s})),xs=Ii((function(t,e,n){sr(t,n,e)}));function As(t,e){return(Ks(t)?Be:Dr)(t,co(e,3))}var Ss=Ii((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Es=Jr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&wo(t,e[0],e[1])?e=[]:n>2&&wo(e[0],e[1],e[2])&&(e=[e[0]]),Kr(t,_r(e,1),[])})),Os=fe||function(){return ve.Date.now()};function js(t,e,n){return e=n?i:e,e=t&&null==e?t.length:e,Zi(t,h,i,i,i,i,e)}function Cs(t,e){var n;if("function"!=typeof e)throw new Rt(o);return t=vu(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=i),n}}var Rs=Jr((function(t,e,n){var r=1;if(n.length){var i=hn(n,ao(Rs));r|=c}return Zi(t,r,e,n,i)})),Ls=Jr((function(t,e,n){var r=3;if(n.length){var i=hn(n,ao(Ls));r|=c}return Zi(e,r,t,n,i)}));function Is(t,e,n){var r,s,u,a,c,f,h=0,l=!1,p=!1,d=!0;if("function"!=typeof t)throw new Rt(o);function v(e){var n=r,o=s;return r=s=i,h=e,a=t.apply(o,n)}function y(t){var n=t-f;return f===i||n>=e||n<0||p&&t-h>=u}function g(){var t=Os();if(y(t))return _(t);c=Io(g,function(t){var n=e-(t-f);return p?bn(n,u-(t-h)):n}(t))}function _(t){return c=i,d&&r?v(t):(r=s=i,a)}function m(){var t=Os(),n=y(t);if(r=arguments,s=this,f=t,n){if(c===i)return function(t){return h=t,c=Io(g,e),l?v(t):a}(f);if(p)return xi(c),c=Io(g,e),v(f)}return c===i&&(c=Io(g,e)),a}return e=gu(e)||0,eu(n)&&(l=!!n.leading,u=(p="maxWait"in n)?mn(gu(n.maxWait)||0,e):u,d="trailing"in n?!!n.trailing:d),m.cancel=function(){c!==i&&xi(c),h=0,r=f=s=c=i},m.flush=function(){return c===i?a:_(Os())},m}var Ts=Jr((function(t,e){return hr(t,1,e)})),Ps=Jr((function(t,e,n){return hr(t,gu(e)||0,n)}));function Bs(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Rt(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Bs.Cache||Gn),n}function Ns(t){if("function"!=typeof t)throw new Rt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Bs.Cache=Gn;var Ms=wi((function(t,e){var n=(e=1==e.length&&Ks(e[0])?Be(e[0],Xe(co())):Be(_r(e,1),Xe(co()))).length;return Jr((function(r){for(var i=-1,o=bn(r.length,n);++i=e})),Qs=Ir(function(){return arguments}())?Ir:function(t){return nu(t)&&Nt.call(t,"callee")&&!Yt.call(t,"callee")},Ks=r.isArray,$s=we?Xe(we):function(t){return nu(t)&&Er(t)==P};function Vs(t){return null!=t&&tu(t.length)&&!Zs(t)}function Gs(t){return nu(t)&&Vs(t)}var Ys=me||ga,Hs=ke?Xe(ke):function(t){return nu(t)&&Er(t)==w};function Js(t){if(!nu(t))return!1;var e=Er(t);return e==k||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ou(t)}function Zs(t){if(!eu(t))return!1;var e=Er(t);return e==x||e==A||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Xs(t){return"number"==typeof t&&t==vu(t)}function tu(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=d}function eu(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function nu(t){return null!=t&&"object"==typeof t}var ru=xe?Xe(xe):function(t){return nu(t)&&yo(t)==S};function iu(t){return"number"==typeof t||nu(t)&&Er(t)==E}function ou(t){if(!nu(t)||Er(t)!=O)return!1;var e=Vt(t);if(null===e)return!0;var n=Nt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Bt.call(n)==Dt}var su=Ae?Xe(Ae):function(t){return nu(t)&&Er(t)==C};var uu=Se?Xe(Se):function(t){return nu(t)&&yo(t)==R};function au(t){return"string"==typeof t||!Ks(t)&&nu(t)&&Er(t)==L}function cu(t){return"symbol"==typeof t||nu(t)&&Er(t)==I}var fu=Ee?Xe(Ee):function(t){return nu(t)&&tu(t.length)&&!!ae[Er(t)]};var hu=Vi(Fr),lu=Vi((function(t,e){return t<=e}));function pu(t){if(!t)return[];if(Vs(t))return au(t)?vn(t):Ri(t);if(Zt&&t[Zt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Zt]());var e=yo(t);return(e==S?cn:e==R?ln:qu)(t)}function du(t){return t?(t=gu(t))===p||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function vu(t){var e=du(t),n=e%1;return e==e?n?e-n:e:0}function yu(t){return t?ar(vu(t),0,y):0}function gu(t){if("number"==typeof t)return t;if(cu(t))return v;if(eu(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=eu(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ze(t);var n=gt.test(t);return n||mt.test(t)?le(t.slice(2),n?2:8):yt.test(t)?v:+t}function _u(t){return Li(t,Tu(t))}function mu(t){return null==t?"":fi(t)}var bu=Ti((function(t,e){if(So(e)||Vs(e))Li(e,Iu(e),t);else for(var n in e)Nt.call(e,n)&&nr(t,n,e[n])})),wu=Ti((function(t,e){Li(e,Tu(e),t)})),ku=Ti((function(t,e,n,r){Li(e,Tu(e),t,r)})),xu=Ti((function(t,e,n,r){Li(e,Iu(e),t,r)})),Au=ro(ur);var Su=Jr((function(t,e){t=Ot(t);var n=-1,r=e.length,o=r>2?e[2]:i;for(o&&wo(e[0],e[1],o)&&(r=1);++n1),e})),Li(t,oo(t),n),r&&(n=cr(n,7,eo));for(var i=e.length;i--;)li(n,e[i]);return n}));var Mu=ro((function(t,e){return null==t?{}:function(t,e){return $r(t,e,(function(e,n){return ju(t,n)}))}(t,e)}));function zu(t,e){if(null==t)return{};var n=Be(oo(t),(function(t){return[t]}));return e=co(e),$r(t,n,(function(t,n){return e(t,n[0])}))}var Fu=Ji(Iu),Du=Ji(Tu);function qu(t){return null==t?[]:tn(t,Iu(t))}var Uu=Mi((function(t,e,n){return e=e.toLowerCase(),t+(n?Wu(e):e)}));function Wu(t){return Ju(mu(t).toLowerCase())}function Qu(t){return(t=mu(t))&&t.replace(wt,on).replace(ee,"")}var Ku=Mi((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),$u=Mi((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Vu=Ni("toLowerCase");var Gu=Mi((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Yu=Mi((function(t,e,n){return t+(n?" ":"")+Ju(e)}));var Hu=Mi((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ju=Ni("toUpperCase");function Zu(t,e,n){return t=mu(t),(e=n?i:e)===i?function(t){return oe.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(ht)||[]}(t):t.match(e)||[]}var Xu=Jr((function(t,e){try{return Oe(t,i,e)}catch(t){return Js(t)?t:new At(t)}})),ta=ro((function(t,e){return Ce(e,(function(e){e=zo(e),sr(t,e,Rs(t[e],t))})),t}));function ea(t){return function(){return t}}var na=Di(),ra=Di(!0);function ia(t){return t}function oa(t){return Nr("function"==typeof t?t:cr(t,1))}var sa=Jr((function(t,e){return function(n){return Lr(n,t,e)}})),ua=Jr((function(t,e){return function(n){return Lr(t,n,e)}}));function aa(t,e,n){var r=Iu(e),i=xr(e,r);null!=n||eu(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=xr(e,Iu(e)));var o=!(eu(n)&&"chain"in n&&!n.chain),s=Zs(t);return Ce(i,(function(n){var r=e[n];t[n]=r,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Ri(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Ne([this.value()],arguments))})})),t}function ca(){}var fa=Qi(Be),ha=Qi(Le),la=Qi(Fe);function pa(t){return ko(t)?Ve(zo(t)):function(t){return function(e){return Ar(e,t)}}(t)}var da=$i(),va=$i(!0);function ya(){return[]}function ga(){return!1}var _a=Wi((function(t,e){return t+e}),0),ma=Yi("ceil"),ba=Wi((function(t,e){return t/e}),1),wa=Yi("floor");var ka,xa=Wi((function(t,e){return t*e}),1),Aa=Yi("round"),Sa=Wi((function(t,e){return t-e}),0);return qn.after=function(t,e){if("function"!=typeof e)throw new Rt(o);return t=vu(t),function(){if(--t<1)return e.apply(this,arguments)}},qn.ary=js,qn.assign=bu,qn.assignIn=wu,qn.assignInWith=ku,qn.assignWith=xu,qn.at=Au,qn.before=Cs,qn.bind=Rs,qn.bindAll=ta,qn.bindKey=Ls,qn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ks(t)?t:[t]},qn.chain=ps,qn.chunk=function(t,e,n){e=(n?wo(t,e,n):e===i)?1:mn(vu(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var s=0,u=0,a=r(de(o/e));so?0:o+n),(r=r===i||r>o?o:vu(r))<0&&(r+=o),r=n>r?0:yu(r);n>>0)?(t=mu(t))&&("string"==typeof e||null!=e&&!su(e))&&!(e=fi(e))&&an(t)?ki(vn(t),0,n):t.split(e,n):[]},qn.spread=function(t,e){if("function"!=typeof t)throw new Rt(o);return e=null==e?0:mn(vu(e),0),Jr((function(n){var r=n[e],i=ki(n,0,e);return r&&Ne(i,r),Oe(t,this,i)}))},qn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},qn.take=function(t,e,n){return t&&t.length?ii(t,0,(e=n||e===i?1:vu(e))<0?0:e):[]},qn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?ii(t,(e=r-(e=n||e===i?1:vu(e)))<0?0:e,r):[]},qn.takeRightWhile=function(t,e){return t&&t.length?di(t,co(e,3),!1,!0):[]},qn.takeWhile=function(t,e){return t&&t.length?di(t,co(e,3)):[]},qn.tap=function(t,e){return e(t),t},qn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new Rt(o);return eu(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Is(t,e,{leading:r,maxWait:e,trailing:i})},qn.thru=ds,qn.toArray=pu,qn.toPairs=Fu,qn.toPairsIn=Du,qn.toPath=function(t){return Ks(t)?Be(t,zo):cu(t)?[t]:Ri(Mo(mu(t)))},qn.toPlainObject=_u,qn.transform=function(t,e,n){var r=Ks(t),i=r||Ys(t)||fu(t);if(e=co(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:eu(t)&&Zs(o)?Un(Vt(t)):{}}return(i?Ce:wr)(t,(function(t,r,i){return e(n,t,r,i)})),n},qn.unary=function(t){return js(t,1)},qn.union=ns,qn.unionBy=rs,qn.unionWith=is,qn.uniq=function(t){return t&&t.length?hi(t):[]},qn.uniqBy=function(t,e){return t&&t.length?hi(t,co(e,2)):[]},qn.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?hi(t,i,e):[]},qn.unset=function(t,e){return null==t||li(t,e)},qn.unzip=os,qn.unzipWith=ss,qn.update=function(t,e,n){return null==t?t:pi(t,e,mi(n))},qn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:i,null==t?t:pi(t,e,mi(n),r)},qn.values=qu,qn.valuesIn=function(t){return null==t?[]:tn(t,Tu(t))},qn.without=us,qn.words=Zu,qn.wrap=function(t,e){return zs(mi(e),t)},qn.xor=as,qn.xorBy=cs,qn.xorWith=fs,qn.zip=hs,qn.zipObject=function(t,e){return gi(t||[],e||[],nr)},qn.zipObjectDeep=function(t,e){return gi(t||[],e||[],ti)},qn.zipWith=ls,qn.entries=Fu,qn.entriesIn=Du,qn.extend=wu,qn.extendWith=ku,aa(qn,qn),qn.add=_a,qn.attempt=Xu,qn.camelCase=Uu,qn.capitalize=Wu,qn.ceil=ma,qn.clamp=function(t,e,n){return n===i&&(n=e,e=i),n!==i&&(n=(n=gu(n))==n?n:0),e!==i&&(e=(e=gu(e))==e?e:0),ar(gu(t),e,n)},qn.clone=function(t){return cr(t,4)},qn.cloneDeep=function(t){return cr(t,5)},qn.cloneDeepWith=function(t,e){return cr(t,5,e="function"==typeof e?e:i)},qn.cloneWith=function(t,e){return cr(t,4,e="function"==typeof e?e:i)},qn.conformsTo=function(t,e){return null==e||fr(t,e,Iu(e))},qn.deburr=Qu,qn.defaultTo=function(t,e){return null==t||t!=t?e:t},qn.divide=ba,qn.endsWith=function(t,e,n){t=mu(t),e=fi(e);var r=t.length,o=n=n===i?r:ar(vu(n),0,r);return(n-=e.length)>=0&&t.slice(n,o)==e},qn.eq=qs,qn.escape=function(t){return(t=mu(t))&&J.test(t)?t.replace(Y,sn):t},qn.escapeRegExp=function(t){return(t=mu(t))&&ot.test(t)?t.replace(it,"\\$&"):t},qn.every=function(t,e,n){var r=Ks(t)?Le:vr;return n&&wo(t,e,n)&&(e=i),r(t,co(e,3))},qn.find=gs,qn.findIndex=Qo,qn.findKey=function(t,e){return qe(t,co(e,3),wr)},qn.findLast=_s,qn.findLastIndex=Ko,qn.findLastKey=function(t,e){return qe(t,co(e,3),kr)},qn.floor=wa,qn.forEach=ms,qn.forEachRight=bs,qn.forIn=function(t,e){return null==t?t:mr(t,co(e,3),Tu)},qn.forInRight=function(t,e){return null==t?t:br(t,co(e,3),Tu)},qn.forOwn=function(t,e){return t&&wr(t,co(e,3))},qn.forOwnRight=function(t,e){return t&&kr(t,co(e,3))},qn.get=Ou,qn.gt=Us,qn.gte=Ws,qn.has=function(t,e){return null!=t&&go(t,e,jr)},qn.hasIn=ju,qn.head=Vo,qn.identity=ia,qn.includes=function(t,e,n,r){t=Vs(t)?t:qu(t),n=n&&!r?vu(n):0;var i=t.length;return n<0&&(n=mn(i+n,0)),au(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&We(t,e,n)>-1},qn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:vu(n);return i<0&&(i=mn(r+i,0)),We(t,e,i)},qn.inRange=function(t,e,n){return e=du(e),n===i?(n=e,e=0):n=du(n),function(t,e,n){return t>=bn(e,n)&&t=-9007199254740991&&t<=d},qn.isSet=uu,qn.isString=au,qn.isSymbol=cu,qn.isTypedArray=fu,qn.isUndefined=function(t){return t===i},qn.isWeakMap=function(t){return nu(t)&&yo(t)==T},qn.isWeakSet=function(t){return nu(t)&&"[object WeakSet]"==Er(t)},qn.join=function(t,e){return null==t?"":De.call(t,e)},qn.kebabCase=Ku,qn.last=Jo,qn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=vu(n))<0?mn(r+o,0):bn(o,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Ue(t,Ke,o,!0)},qn.lowerCase=$u,qn.lowerFirst=Vu,qn.lt=hu,qn.lte=lu,qn.max=function(t){return t&&t.length?yr(t,ia,Or):i},qn.maxBy=function(t,e){return t&&t.length?yr(t,co(e,2),Or):i},qn.mean=function(t){return $e(t,ia)},qn.meanBy=function(t,e){return $e(t,co(e,2))},qn.min=function(t){return t&&t.length?yr(t,ia,Fr):i},qn.minBy=function(t,e){return t&&t.length?yr(t,co(e,2),Fr):i},qn.stubArray=ya,qn.stubFalse=ga,qn.stubObject=function(){return{}},qn.stubString=function(){return""},qn.stubTrue=function(){return!0},qn.multiply=xa,qn.nth=function(t,e){return t&&t.length?Qr(t,vu(e)):i},qn.noConflict=function(){return ve._===this&&(ve._=qt),this},qn.noop=ca,qn.now=Os,qn.pad=function(t,e,n){t=mu(t);var r=(e=vu(e))?dn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Ki(ye(i),n)+t+Ki(de(i),n)},qn.padEnd=function(t,e,n){t=mu(t);var r=(e=vu(e))?dn(t):0;return e&&re){var r=t;t=e,e=r}if(n||t%1||e%1){var o=xn();return bn(t+o*(e-t+he("1e-"+((o+"").length-1))),e)}return Yr(t,e)},qn.reduce=function(t,e,n){var r=Ks(t)?Me:Ye,i=arguments.length<3;return r(t,co(e,4),n,i,pr)},qn.reduceRight=function(t,e,n){var r=Ks(t)?ze:Ye,i=arguments.length<3;return r(t,co(e,4),n,i,dr)},qn.repeat=function(t,e,n){return e=(n?wo(t,e,n):e===i)?1:vu(e),Hr(mu(t),e)},qn.replace=function(){var t=arguments,e=mu(t[0]);return t.length<3?e:e.replace(t[1],t[2])},qn.result=function(t,e,n){var r=-1,o=(e=bi(e,t)).length;for(o||(o=1,t=i);++rd)return[];var n=y,r=bn(t,y);e=co(e),t-=y;for(var i=Je(r,e);++n=s)return t;var a=n-dn(r);if(a<1)return r;var c=u?ki(u,0,a).join(""):t.slice(0,a);if(o===i)return c+r;if(u&&(a+=c.length-a),su(o)){if(t.slice(a).search(o)){var f,h=c;for(o.global||(o=jt(o.source,mu(vt.exec(o))+"g")),o.lastIndex=0;f=o.exec(h);)var l=f.index;c=c.slice(0,l===i?a:l)}}else if(t.indexOf(fi(o),a)!=a){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+r},qn.unescape=function(t){return(t=mu(t))&&H.test(t)?t.replace(G,gn):t},qn.uniqueId=function(t){var e=++Mt;return mu(t)+e},qn.upperCase=Hu,qn.upperFirst=Ju,qn.each=ms,qn.eachRight=bs,qn.first=Vo,aa(qn,(ka={},wr(qn,(function(t,e){Nt.call(qn.prototype,e)||(ka[e]=t)})),ka),{chain:!1}),qn.VERSION="4.17.21",Ce(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){qn[t].placeholder=qn})),Ce(["drop","take"],(function(t,e){Kn.prototype[t]=function(n){n=n===i?1:mn(vu(n),0);var r=this.__filtered__&&!e?new Kn(this):this.clone();return r.__filtered__?r.__takeCount__=bn(n,r.__takeCount__):r.__views__.push({size:bn(n,y),type:t+(r.__dir__<0?"Right":"")}),r},Kn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Ce(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Kn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:co(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),Ce(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Kn.prototype[t]=function(){return this[n](1).value()[0]}})),Ce(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Kn.prototype[t]=function(){return this.__filtered__?new Kn(this):this[n](1)}})),Kn.prototype.compact=function(){return this.filter(ia)},Kn.prototype.find=function(t){return this.filter(t).head()},Kn.prototype.findLast=function(t){return this.reverse().find(t)},Kn.prototype.invokeMap=Jr((function(t,e){return"function"==typeof t?new Kn(this):this.map((function(n){return Lr(n,t,e)}))})),Kn.prototype.reject=function(t){return this.filter(Ns(co(t)))},Kn.prototype.slice=function(t,e){t=vu(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Kn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==i&&(n=(e=vu(e))<0?n.dropRight(-e):n.take(e-t)),n)},Kn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Kn.prototype.toArray=function(){return this.take(y)},wr(Kn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),o=qn[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);o&&(qn.prototype[e]=function(){var e=this.__wrapped__,u=r?[1]:arguments,a=e instanceof Kn,c=u[0],f=a||Ks(e),h=function(t){var e=o.apply(qn,Ne([t],u));return r&&l?e[0]:e};f&&n&&"function"==typeof c&&1!=c.length&&(a=f=!1);var l=this.__chain__,p=!!this.__actions__.length,d=s&&!l,v=a&&!p;if(!s&&f){e=v?e:new Kn(this);var y=t.apply(e,u);return y.__actions__.push({func:ds,args:[h],thisArg:i}),new Qn(y,l)}return d&&v?t.apply(this,u):(y=this.thru(h),d?r?y.value()[0]:y.value():y)})})),Ce(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Lt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);qn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(Ks(i)?i:[],t)}return this[n]((function(n){return e.apply(Ks(n)?n:[],t)}))}})),wr(Kn.prototype,(function(t,e){var n=qn[e];if(n){var r=n.name+"";Nt.call(In,r)||(In[r]=[]),In[r].push({name:e,func:n})}})),In[qi(i,2).name]=[{name:"wrapper",func:i}],Kn.prototype.clone=function(){var t=new Kn(this.__wrapped__);return t.__actions__=Ri(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ri(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ri(this.__views__),t},Kn.prototype.reverse=function(){if(this.__filtered__){var t=new Kn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Kn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Ks(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},qn.prototype.plant=function(t){for(var e,n=this;n instanceof Wn;){var r=Do(n);r.__index__=0,r.__values__=i,e?o.__wrapped__=r:e=r;var o=r;n=n.__wrapped__}return o.__wrapped__=t,e},qn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Kn){var e=t;return this.__actions__.length&&(e=new Kn(this)),(e=e.reverse()).__actions__.push({func:ds,args:[es],thisArg:i}),new Qn(e,this.__chain__)}return this.thru(es)},qn.prototype.toJSON=qn.prototype.valueOf=qn.prototype.value=function(){return vi(this.__wrapped__,this.__actions__)},qn.prototype.first=qn.prototype.head,Zt&&(qn.prototype[Zt]=function(){return this}),qn}();ve._=_n,(r=function(){return _n}.call(e,n,e,t))===i||(t.exports=r)}.call(this)}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};return(()=>{"use strict";n.d(r,{default:()=>Ht});var t={};n.r(t),n.d(t,{Decoder:()=>ct,Encoder:()=>at,PacketType:()=>ut,protocol:()=>st});const e=Object.create(null);e.open="0",e.close="1",e.ping="2",e.pong="3",e.message="4",e.upgrade="5",e.noop="6";const i=Object.create(null);Object.keys(e).forEach((t=>{i[e[t]]=t}));const o={type:"error",data:"parser error"},s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),u="function"==typeof ArrayBuffer,a=(t,e)=>{const n=new FileReader;return n.onload=function(){const t=n.result.split(",")[1];e("b"+(t||""))},n.readAsDataURL(t)},c=({type:t,data:n},r,i)=>{return s&&n instanceof Blob?r?i(n):a(n,i):u&&(n instanceof ArrayBuffer||(o=n,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(o):o&&o.buffer instanceof ArrayBuffer))?r?i(n):a(new Blob([n]),i):i(e[t]+(n||""));var o},f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<64;t++)h[f.charCodeAt(t)]=t;const l="function"==typeof ArrayBuffer,p=(t,e)=>{if(l){const n=(t=>{let e,n,r,i,o,s=.75*t.length,u=t.length,a=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);const c=new ArrayBuffer(s),f=new Uint8Array(c);for(e=0;e>4,f[a++]=(15&r)<<4|i>>2,f[a++]=(3&i)<<6|63&o;return c})(t);return d(n,e)}return{base64:!0,data:t}},d=(t,e)=>"blob"===e&&t instanceof ArrayBuffer?new Blob([t]):t,v=(t,e)=>{if("string"!=typeof t)return{type:"message",data:d(t,e)};const n=t.charAt(0);if("b"===n)return{type:"message",data:p(t.substring(1),e)};return i[n]?t.length>1?{type:i[n],data:t.substring(1)}:{type:i[n]}:o},y=String.fromCharCode(30);function g(t){if(t)return function(t){for(var e in g.prototype)t[e]=g.prototype[e];return t}(t)}g.prototype.on=g.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},g.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},g.prototype.off=g.prototype.removeListener=g.prototype.removeAllListeners=g.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i(t.hasOwnProperty(n)&&(e[n]=t[n]),e)),{})}const b=_.setTimeout,w=_.clearTimeout;function k(t,e){e.useNativeTimers?(t.setTimeoutFn=b.bind(_),t.clearTimeoutFn=w.bind(_)):(t.setTimeoutFn=_.setTimeout.bind(_),t.clearTimeoutFn=_.clearTimeout.bind(_))}class x extends Error{constructor(t,e,n){super(t),this.description=e,this.context=n,this.type="TransportError"}}class A extends g{constructor(t){super(),this.writable=!1,k(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,e,n){return super.emitReserved("error",new x(t,e,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=v(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}}const S="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),E=64,O={};let j,C=0,R=0;function L(t){let e="";do{e=S[t%E]+e,t=Math.floor(t/E)}while(t>0);return e}function I(){const t=L(+new Date);return t!==j?(C=0,j=t):t+"."+L(C++)}for(;R{4===e.readyState&&(200===e.status||1223===e.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof e.status?e.status:0)}),0))},e.send(this.data)}catch(t){return void this.setTimeoutFn((()=>{this.onError(t)}),0)}"undefined"!=typeof document&&(this.index=F.requestsCount++,F.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=M,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete F.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(F.requestsCount=0,F.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",D);else if("function"==typeof addEventListener){addEventListener("onpagehide"in _?"pagehide":"unload",D,!1)}function D(){for(let t in F.requests)F.requests.hasOwnProperty(t)&&F.requests[t].abort()}const q="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),U=_.WebSocket||_.MozWebSocket,W="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();const Q={websocket:class extends A{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),e=this.opts.protocols,n=W?{}:m(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=W?new U(t,e,n):e?new U(t,e):new U(t)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e{try{this.ws.send(t)}catch(t){}r&&q((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let t=this.query||{};const e=this.opts.secure?"wss":"ws";let n="";this.opts.port&&("wss"===e&&443!==Number(this.opts.port)||"ws"===e&&80!==Number(this.opts.port))&&(n=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=I()),this.supportsBinary||(t.b64=1);const r=T(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(r.length?"?"+r:"")}check(){return!!U}},polling:class extends A{constructor(t){if(super(t),this.polling=!1,"undefined"!=typeof location){const e="https:"===location.protocol;let n=location.port;n||(n=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||n!==t.port,this.xs=t.secure!==e}const e=t&&t.forceBase64;this.supportsBinary=z&&!e}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let t=0;this.polling&&(t++,this.once("pollComplete",(function(){--t||e()}))),this.writable||(t++,this.once("drain",(function(){--t||e()})))}else e()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){((t,e)=>{const n=t.split(y),r=[];for(let t=0;t{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){this.writable=!1,((t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach(((t,o)=>{c(t,!1,(t=>{r[o]=t,++i===n&&e(r.join(y))}))}))})(t,(t=>{this.doWrite(t,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){let t=this.query||{};const e=this.opts.secure?"https":"http";let n="";!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=I()),this.supportsBinary||t.sid||(t.b64=1),this.opts.port&&("https"===e&&443!==Number(this.opts.port)||"http"===e&&80!==Number(this.opts.port))&&(n=":"+this.opts.port);const r=T(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(r.length?"?"+r:"")}request(t={}){return Object.assign(t,{xd:this.xd,xs:this.xs},this.opts),new F(this.uri(),t)}doWrite(t,e){const n=this.request({method:"POST",data:t});n.on("success",e),n.on("error",((t,e)=>{this.onError("xhr post error",t,e)}))}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",((t,e)=>{this.onError("xhr poll error",t,e)})),this.pollXhr=t}}},K=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,$=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function V(t){const e=t,n=t.indexOf("["),r=t.indexOf("]");-1!=n&&-1!=r&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=K.exec(t||""),o={},s=14;for(;s--;)o[$[s]]=i[s]||"";return-1!=n&&-1!=r&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");"/"!=e.slice(0,1)&&0!==e.length||r.splice(0,1);"/"==e.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,r){e&&(n[e]=r)})),n}(0,o.query),o}class G extends g{constructor(t,e={}){super(),this.writeBuffer=[],t&&"object"==typeof t&&(e=t,t=null),t?(t=V(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=V(e.host).host),k(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},n=t.split("&");for(let t=0,r=n.length;t{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const n=Object.assign({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new Q[t](n)}open(){let t;if(this.opts.rememberUpgrade&&G.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(t=>this.onClose("transport close",t)))}probe(t){let e=this.createTransport(t),n=!1;G.priorWebsocketSuccess=!1;const r=()=>{n||(e.send([{type:"ping",data:"probe"}]),e.once("packet",(t=>{if(!n)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;G.priorWebsocketSuccess="websocket"===e.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())}))}else{const t=new Error("probe error");t.transport=e.name,this.emitReserved("upgradeError",t)}})))};function i(){n||(n=!0,c(),e.close(),e=null)}const o=t=>{const n=new Error("probe error: "+t);n.transport=e.name,i(),this.emitReserved("upgradeError",n)};function s(){o("transport closed")}function u(){o("socket closed")}function a(t){e&&t.name!==e.name&&i()}const c=()=>{e.removeListener("open",r),e.removeListener("error",o),e.removeListener("close",s),this.off("close",u),this.off("upgrading",a)};e.once("open",r),e.once("error",o),e.once("close",s),this.once("close",u),this.once("upgrading",a),e.open()}onOpen(){if(this.readyState="open",G.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let t=0;const e=this.upgrades.length;for(;t{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let n=0;n=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))),n>0&&t>this.maxPayload)return this.writeBuffer.slice(0,n);t+=2}var e;return this.writeBuffer}write(t,e,n){return this.sendPacket("message",t,e,n),this}send(t,e,n){return this.sendPacket("message",t,e,n),this}sendPacket(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:t,data:e,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},n=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():t()})):this.upgrading?n():t()),this}onError(t){G.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let n=0;const r=t.length;for(;n"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,J=Object.prototype.toString,Z="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===J.call(Blob),X="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===J.call(File);function tt(t){return Y&&(t instanceof ArrayBuffer||H(t))||Z&&t instanceof Blob||X&&t instanceof File}function et(t,e){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let e=0,n=t.length;e=0&&t.num0;case ut.ACK:case ut.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ft{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const t=it(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function ht(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const lt=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class pt extends g{constructor(t,e,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[ht(t,"open",this.onopen.bind(this)),ht(t,"packet",this.onpacket.bind(this)),ht(t,"error",this.onerror.bind(this)),ht(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){if(lt.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const n={type:ut.EVENT,data:e,options:{}};if(n.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){const t=this.ids++,r=e.pop();this._registerAckCallback(t,r),n.id=t}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(t,e){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[t]=e);const i=this.io.setTimeoutFn((()=>{delete this.acks[t];for(let e=0;e{this.io.clearTimeoutFn(i),e.apply(this,[null,...t])}}emitWithAck(t,...e){const n=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((r,i)=>{e.push(((t,e)=>n?t?i(t):r(e):r(t))),this.emit(t,...e)}))}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push(((t,...r)=>{if(n!==this._queue[0])return;return null!==t?n.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...r)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;const e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth((t=>{this._sendConnectPacket(t)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ut.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ut.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ut.EVENT:case ut.BINARY_EVENT:this.onevent(t);break;case ut.ACK:case ut.BINARY_ACK:this.onack(t);break;case ut.DISCONNECT:this.ondisconnect();break;case ut.CONNECT_ERROR:this.destroy();const e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){const e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const n of e)n.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let n=!1;return function(...r){n||(n=!0,e.packet({type:ut.ACK,id:t,data:r}))}}onack(t){const e=this.acks[t.id];"function"==typeof e&&(e.apply(this,t.data),delete this.acks[t.id])}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((t=>this.emitEvent(t))),this.receiveBuffer=[],this.sendBuffer.forEach((t=>{this.notifyOutgoingListeners(t),this.packet(t)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((t=>t())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ut.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let n=0;n0&&t.jitter<=1?t.jitter:0,this.attempts=0}dt.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},dt.prototype.reset=function(){this.attempts=0},dt.prototype.setMin=function(t){this.ms=t},dt.prototype.setMax=function(t){this.max=t},dt.prototype.setJitter=function(t){this.jitter=t};class vt extends g{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(n=e,e=void 0),(n=n||{}).path=n.path||"/socket.io",this.opts=n,k(this,n),this.reconnection(!1!==n.reconnection),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=n.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new dt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==n.timeout?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||t;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==n.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new G(this.uri,this.opts);const e=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=ht(e,"open",(function(){n.onopen(),t&&t()})),i=ht(e,"error",(e=>{n.cleanup(),n._readyState="closed",this.emitReserved("error",e),t?t(e):n.maybeReconnectOnOpen()}));if(!1!==this._timeout){const t=this._timeout;0===t&&r();const n=this.setTimeoutFn((()=>{r(),e.close(),e.emit("error",new Error("timeout"))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((function(){clearTimeout(n)}))}return this.subs.push(r),this.subs.push(i),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(ht(t,"ping",this.onping.bind(this)),ht(t,"data",this.ondata.bind(this)),ht(t,"error",this.onerror.bind(this)),ht(t,"close",this.onclose.bind(this)),ht(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}ondecoded(t){q((()=>{this.emitReserved("packet",t)}),this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let n=this.nsps[t];return n?this._autoConnect&&!n.active&&n.connect():(n=new pt(this,t,e),this.nsps[t]=n),n}_destroy(t){const e=Object.keys(this.nsps);for(const t of e){if(this.nsps[t].active)return}this._close()}_packet(t){const e=this.encoder.encode(t);for(let n=0;nt())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,e){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open((e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()})))}),e);this.opts.autoUnref&&n.unref(),this.subs.push((function(){clearTimeout(n)}))}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const yt={};function gt(t,e){"object"==typeof t&&(e=t,t=void 0);const n=function(t,e="",n){let r=t;n=n||"undefined"!=typeof location&&location,null==t&&(t=n.protocol+"//"+n.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?n.protocol+t:n.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==n?n.protocol+"//"+t:"https://"+t),r=V(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(t,(e=e||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=yt[i]&&o in yt[i].nsps;let u;return e.forceNew||e["force new connection"]||!1===e.multiplex||s?u=new vt(r,e):(yt[i]||(yt[i]=new vt(r,e)),u=yt[i]),n.query&&!e.query&&(e.query=n.queryKey),u.socket(n.path,e)}function _t(t){return _t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_t(t)}function mt(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{}});this.elem.dispatchEvent(e)}}],n&&mt(e.prototype,n),r&&mt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),kt=n(486),xt=n.n(kt);function At(t){return At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},At(t)}function St(){St=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var o=e&&e.prototype instanceof l?e:l,s=Object.create(o.prototype),u=new S(i||[]);return r(s,"_invoke",{value:w(t,n,u)}),s}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h={};function l(){}function p(){}function d(){}var v={};a(v,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&n.call(g,o)&&(v=g);var _=d.prototype=l.prototype=Object.create(v);function m(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function i(r,o,s,u){var a=f(t[r],t,o);if("throw"!==a.type){var c=a.arg,h=c.value;return h&&"object"==At(h)&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,s,u)}),(function(t){i("throw",t,s,u)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return i("throw",t,s,u)}))}u(a.arg)}var o;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}})}function w(t,e,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 O()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var u=k(s,n);if(u){if(u===h)continue;return u}}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 a=f(t,e,n);if("normal"===a.type){if(r=n.done?"completed":"suspendedYield",a.arg===h)continue;return{value:a.arg,done:n.done}}"throw"===a.type&&(r="completed",n.method="throw",n.arg=a.arg)}}}function k(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var i=f(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),a=n.call(o,"finallyLoc");if(u&&a){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),A(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function Et(t,e,n,r,i,o,s){try{var u=t[o](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,i)}function Ot(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){Et(o,r,i,s,u,"next",t)}function u(t){Et(o,r,i,s,u,"throw",t)}s(void 0)}))}}function jt(t,e){for(var n=0;n0)){t.next=5;break}return e=this.audioQueue.shift(),this.sourceBuffer.appendBuffer(e),t.next=5,this._waitForBufferUpdateEnd();case 5:case"end":return t.stop()}}),t,this)}))),function(){return v.apply(this,arguments)})},{key:"updateWebAudioBuffer",value:(d=Ot(St().mark((function t(){var e,n,r,i,o,s,u=this;return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(this.audioQueue.length>0)){t.next=22;break}if(e=this.audioQueue.shift(),t.prev=2,!(this.chunksBufferedthis.nextStartTimeForAudioPlayback&&(this.nextStartTimeForAudioPlayback=this.playingAudioContext.currentTime),s=++this.webAudioSourceIndex,this.webAudioSources[s]=o,o.start(this.nextStartTimeForAudioPlayback||0),this.nextStartTimeForAudioPlayback=this.nextStartTimeForAudioPlayback?this.nextStartTimeForAudioPlayback+n.duration:this.playingAudioContext.currentTime+n.duration,o.onended=function(){delete u.webAudioSources[s]}}catch(t){console.error("Decoding audio data failed",t)}case 22:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(){return d.apply(this,arguments)})},{key:"_waitForBufferUpdateEnd",value:(p=Ot(St().mark((function t(){var e;return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this,t.abrupt("return",new Promise((function(t){e.sourceBuffer.addEventListener("updateend",t,{once:!0})})));case 2:case"end":return t.stop()}}),t,this)}))),function(){return p.apply(this,arguments)})},{key:"_initializeSourceBuffer",value:(l=Ot(St().mark((function t(){var e,n=this;return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._initializingSourceBuffer=!0,this.sourceBuffer=this.mediaSource.addSourceBuffer("audio/mpeg"),this.sourceBuffer.mode="sequence",this.sourceBuffer.addEventListener("updatestart",(function(){})),e=this,this.sourceBuffer.addEventListener("updateend",(function(){e.updateSourceBuffer.bind(e)(),n._initializingSourceBuffer=!1}));case 6:case"end":return t.stop()}}),t,this)}))),function(){return l.apply(this,arguments)})},{key:"_initializeAudioPlayer",value:(h=Ot(St().mark((function t(){var e,n,r,i,o,s=this;return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.isMediaSourceSupported){t.next=19;break}return this.mediaSource=new MediaSource,this.audio.src=URL.createObjectURL(this.mediaSource),e=this,this.mediaSource.addEventListener("sourceopen",(function(){e._initializeSourceBuffer()})),n=new Blob(["\n class AudioProcessor extends AudioWorkletProcessor {\n process(inputs, outputs, parameters) {\n const input = inputs[0];\n const output = outputs[0];\n\n for (let channel = 0; channel < input.length; ++channel) {\n const inputChannel = input[channel];\n const outputChannel = output[channel];\n\n if (!outputChannel) {\n console.warn('WARNING: Output channel ' + channel + ' not found');\n // for some reason, we need to just let this worklet crash\n // if we try to gracefully recover from this, the worklet just keeps looping and never recovers\n }\n\n // Copy input data to output\n for (let i = 0; i < inputChannel.length; ++i) {\n outputChannel[i] = inputChannel[i];\n }\n }\n\n this.port.postMessage(input);\n return true;\n }\n }\n\n registerProcessor(\"audio-processor\", AudioProcessor);\n "],{type:"text/javascript"}),r=URL.createObjectURL(n),t.next=10,this.playingAudioContext.audioWorklet.addModule(r);case 10:i=new AudioWorkletNode(this.playingAudioContext,"audio-processor"),(o=this.playingAudioContext.createMediaElementSource(this.audio)).connect(this.playingAudioContext.destination),o.connect(i),i.port.onmessage=function(t){var e=t.data[0];Array.isArray(e)?0===e[0]&&0===e[10]?s._setIsAISpeaking(!1):s._setIsAISpeaking(!0):s._setIsAISpeaking(!1)},this._startPlaying=Ot(St().mark((function t(){return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!s._stopPromise){t.next=4;break}return t.next=3,s._stopPromise;case 3:s._stopPromise=null;case 4:if("open"===s.mediaSource.readyState){t.next=7;break}return s.mediaSource.addEventListener("sourceopen",s._startPlaying,{once:!0}),t.abrupt("return");case 7:return t.next=9,s.audio.play();case 9:return t.next=11,s.updateSourceBuffer();case 11:s._isPlaying=!0;case 12:case"end":return t.stop()}}),t)}))),this._stopPlaying=Ot(St().mark((function t(){var e,n=arguments;return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=!(n.length>0&&void 0!==n[0])||n[0],s.audioQueue=[],t.next=4,s.audio.pause();case 4:return"open"===s.mediaSource.readyState&&s.sourceBuffer&&s.sourceBuffer.abort(),clearTimeout(s.timeout),s._isAISpeaking&&e&&s.emit("AIStoppedSpeaking",{duration:Date.now()-300-s.speechStartedTime}),s.speechStartedTime=0,s._isAISpeaking=!1,t.next=11,s._reinitializeMediaSource();case 11:s._isPlaying=!1;case 12:case"end":return t.stop()}}),t)}))),t.next=23;break;case 19:return t.next=21,bt.ready;case 21:this._startPlaying=Ot(St().mark((function t(){return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(console.log("calling start playing",s._stopPromise),!s._stopPromise){t.next=6;break}return t.next=4,s._stopPromise;case 4:console.log("stop promise resolved"),s._stopPromise=null;case 6:s._isPlaying=!0;case 7:case"end":return t.stop()}}),t)}))),this._stopPlaying=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return console.log("calling stop playing"),new Promise((function(e){s.audioQueue=[],s.currentAudioSource&&(s.currentAudioSource.stop(),s.currentAudioSource.disconnect(),s.currentAudioSource=null),s.nextStartTimeForAudioPlayback=0,s.chunksBuffered=0,xt().forEach(s.webAudioSources,(function(t,e){t.stop(),t.disconnect(),delete s.webAudioSources[e]})),s._isAISpeaking&&t&&s.emit("AIStoppedSpeaking",{duration:Date.now()-300-s.speechStartedTime}),s._isPlaying=!1,console.log("stop playing resolve"),e()})).then((function(){s._stopPromise=null}))};case 23:case"end":return t.stop()}}),t,this)}))),function(){return h.apply(this,arguments)})},{key:"_reinitializeMediaSource",value:(f=Ot(St().mark((function t(){var e=this;return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.mediaSource&&("open"===this.mediaSource.readyState&&this.mediaSource.endOfStream(),this.audio.src="",URL.revokeObjectURL(this.audio.src)),this.mediaSource=new MediaSource,this.audio.src=URL.createObjectURL(this.mediaSource),t.next=5,new Promise((function(t){e.mediaSource.addEventListener("sourceopen",(function(){e._initializeSourceBuffer(),t()}),{once:!0})}));case 5:case"end":return t.stop()}}),t,this)}))),function(){return f.apply(this,arguments)})},{key:"_initializeAudioRecorder",value:(c=Ot(St().mark((function t(){var e,n,r,i,o;return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this,t.next=3,navigator.mediaDevices.getUserMedia({audio:{sampleRate:16e3,sampleSize:16,channelCount:1,echoCancellation:!0}});case 3:n=t.sent,e.microphoneStream=n,r=new(window.AudioContext||window.webkitAudioContext)({sampleRate:16e3}),this.recordingSampleRate=16e3,i=r.createScriptProcessor(1024,1,1),o=r.createMediaStreamSource(n),e._startRecording=function(){o.connect(i),i.connect(r.destination),i.onaudioprocess=function(t){for(var n=t.inputBuffer,r=t.outputBuffer,i=0;i=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),a=n.call(o,"finallyLoc");if(u&&a){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),A(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function Ut(t,e,n,r,i,o,s){try{var u=t[o](s),a=u.value}catch(t){return void n(t)}u.done?e(a):Promise.resolve(a).then(r,i)}function Wt(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){Ut(o,r,i,s,u,"next",t)}function u(t){Ut(o,r,i,s,u,"throw",t)}s(void 0)}))}}function Qt(t,e){for(var n=0;ni.end-200;i&&(o||(e.messages=e.messages.filter((function(t){return!("user"===t.source&&t.messageId===n.messageId)})))),r?r.content=n.message:e.messages.push({source:"user",type:"temporary_message",messageId:n.messageId,content:n.message}),e.emit("messages_update",e.messages)})),e.socket.on("final_user_transcript",(function(t){console.log("final_user_transcript",t);var n=JSON.parse(t);e.messages=e.messages.filter((function(t){return!("user"===t.source&&"temporary_message"===t.type&&t.messageId===n.messageId)}));var r=e.messages.find((function(t){return"user"===t.source&&t.messageId===n.messageId})),i=r&&n.start>r.end-200;r&&(i||(e.messages=e.messages.filter((function(t){return!("user"===t.source&&t.messageId===n.messageId)})))),e.messages.push({source:"user",type:"message",messageId:n.messageId,content:n.message,start:n.start,end:n.end}),e.emit("messages_update",e.messages)})),e.socket.on("final_ai_transcript",(function(t){var n=JSON.parse(t);e.messages.push({source:"ai",type:"message",messageId:n.messageId,content:n.message}),e.emit("messages_update",e.messages)})),e.socket.on("reply_json",(function(t){})),e.socket.on("conversation_trigger",(function(t){var n=JSON.parse(t);n.stop_playing?(e.emit("ai_speech_stopped"),e.audioQueueManager.stopAISpeech()):n.start_playing?(e.emit("ai_speech_started"),e.audioQueueManager.restartAISpeech()):n.speech_started?e.emit("user_speech_started"):n.speech_ended&&e.emit("user_speech_ended")})),e.socket.on("actions",(function(t){var n=JSON.parse(t);e.messages.push({action:n}),e.emit("action",n),e.emit("messages_update",e.messages)})),e.socket.on("state_updated",(function(t){var n=JSON.parse(t);e.emit("state_updated",n)})),e.socket.on("debug_event",(function(t){var n=JSON.parse(t);n.forEach((function(t){console.log(),e.messages.push({source:"system",level:t.level,content:t.message,category:t.category,details:t.details})})),e.emit("debug_event",n),e.emit("messages_update",e.messages)})),e.socket.on("snapshot",(function(t){var n=JSON.parse(t);e.emit("snapshot",n)})),e.socket.on("connect_error",(function(t){e.emit("connect_error",t)})),e.socket.on("disconnect",(function(){console.log("Disconnected from server"),e.emit("disconnected")})),e.socket.on("reply_chunk",function(){var t=Wt(qt().mark((function t(n){return qt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.audioQueueManager.canAIAcceptNewInput()?(e.audioQueueManager.enqueue(n),e.audioQueueManager.playAudio()):console.log("****REPLY CHUNK REJECTED");case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e.socket.on("reply_end",Wt(qt().mark((function t(){return qt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)})))),e.conversationId=s.id,t.next=20,e.audioQueueManager.startChatting();case 20:console.log("Connected to server"),e.emit("ready"),r(),t.next=28;break;case 25:console.log("Failed to connect to server"),e.emit("error",s),i(s);case 28:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e.socket.emit("init",{apiKey:e.apiKey,personaName:s,personaId:u,details:a,userId:o,metadata:f,personaConfig:c,inputAudioFormat:"pcm",inputAudioSampleRate:e.audioQueueManager.recordingSampleRate,outputAudioFormat:"mp3",outputAudioSampleRate:e.audioQueueManager.sampleRate,shouldNotSaveConversation:!!h.shouldNotSaveConversation,debugMode:!!h.debugMode,streamTranscripts:!!h.streamTranscripts});case 14:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}())}},{key:"end",value:(s=Wt(qt().mark((function t(){return qt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.audioQueueManager.stopChatting();case 2:this.audioQueueManager=null,this.socket.disconnect(),this.socket=null;case 5:case"end":return t.stop()}}),t,this)}))),function(){return s.apply(this,arguments)})},{key:"pause",value:(o=Wt(qt().mark((function t(){return qt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.messages.push({source:"system",level:Yt,content:"Conversation paused."}),t.next=3,this.audioQueueManager.stopChatting();case 3:this.audioQueueManager=null,this.emit("messages_update",this.messages);case 5:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"resume",value:(i=Wt(qt().mark((function t(){return qt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.conversationId&&this.socket){t.next=2;break}throw new Error("Conversation not initialized");case 2:return this.audioQueueManager=new Nt,t.next=5,this.audioQueueManager.initializeChat();case 5:return t.next=7,this.audioQueueManager.startChatting();case 7:this._registerAudioQueueListeners(),this.messages.push({source:"system",level:Yt,content:"Conversation resumed."}),this.emit("messages_update",this.messages);case 10:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"_registerAudioQueueListeners",value:function(){var t=this;this.audioQueueManager.on("AIStartedSpeaking",(function(){t.socket.emit("ai_start",{conversationId:t.conversationId,apiKey:t.apiKey})})),this.audioQueueManager.on("AIStoppedSpeaking",(function(){t.socket.emit("ai_stop",{conversationId:t.conversationId,apiKey:t.apiKey}),t.emit("ai_speech_stopped")})),this.audioQueueManager.on("UserSpeechChunk",(function(e){var n=e.detail,r=n.fileBuffer;n.mimeType,t.socket.emit("audio_chunk_continuous",{conversationId:t.conversationId,fileBuffer:r})}))}},{key:"updateState",value:function(t){this.socket.emit("update_state",{apiKey:this.apiKey,conversationId:this.conversationId,newState:t})}},{key:"sayText",value:function(t){this.socket.emit("say_text",{conversationId:this.conversationId,text:t})}},{key:"reactTo",value:function(t){this.socket.emit("event_text",{conversationId:this.conversationId,text:t})}}],n&&Qt(e.prototype,n),r&&Qt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),c}(wt)})(),r=r.default})()));