vendor: 8,896 bytes, line 1
1import{i as e,n as t,r as n,t as r}from"./rolldown-runtime-B0Z9INg1.js";var i=r(((e,t)=>{var n=function(e){return e&&e.Math===Math&&e};t.exports=n(typeof globalThis==`object`&&globalThis)||n(typeof window==`object`&&window)||n(typeof self==`object`&&self)||n(typeof global==`object`&&global)||n(typeof e==`object`&&e)||(function(){return this})()||Function(`return this`)()})),a=r(((e,t)=>{t.exports=function(e){try{return!!e()}catch{return!0}}})),o=r(((e,t)=>{t.exports=!a()(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})})),s=r(((e,t)=>{t.exports=!a()(function(){var e=(function(){}).bind();return typeof e!=`function`||e.hasOwnProperty(`prototype`)})})),c=r(((e,t)=>{var n=s(),r=Function.prototype.call;t.exports=n?r.bind(r):function(){return r.apply(r,arguments)}})),l=r((e=>{var t={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor;e.f=n&&!t.call({1:2},1)?function(e){var t=n(this,e);return!!t&&t.enumerable}:t})),u=r(((e,t)=>{t.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}})),d=r(((e,t)=>{var n=s(),r=Function.prototype,i=r.call,a=n&&r.bind.bind(i,i);t.exports=n?a:function(e){return function(){return i.apply(e,arguments)}}})),f=r(((e,t)=>{var n=d(),r=n({}.toString),i=n(``.slice);t.exports=function(e){return i(r(e),8,-1)}})),p=r(((e,t)=>{var n=d(),r=a(),i=f(),o=Object,s=n(``.split);t.exports=r(function(){return!o(`z`).propertyIsEnumerable(0)})?function(e){return i(e)===`String`?s(e,``):o(e)}:o})),m=r(((e,t)=>{t.exports=function(e){return e==null}})),h=r(((e,t)=>{var n=m(),r=TypeError;t.exports=function(e){if(n(e))throw new r(`Can't call method on `+e);return e}})),g=r(((e,t)=>{var n=p(),r=h();t.exports=function(e){return n(r(e))}})),_=r(((e,t)=>{var n=typeof document==`object`&&document.all;t.exports=n===void 0&&n!==void 0?function(e){return typeof e==`function`||e===n}:function(e){return typeof e==`function`}})),v=r(((e,t)=>{var n=_();t.exports=function(e){return typeof e==`object`?e!==null:n(e)}})),y=r(((e,t)=>{var n=i(),r=_(),a=function(e){return r(e)?e:void 0};t.exports=function(e,t){return arguments.length<2?a(n[e]):n[e]&&n[e][t]}})),b=r(((e,t)=>{t.exports=d()({}.isPrototypeOf)})),x=r(((e,t)=>{var n=i().navigator,r=n&&n.userAgent;t.exports=r?String(r):``})),S=r(((e,t)=>{var n=i(),r=x(),a=n.process,o=n.Deno,s=a&&a.versions||o&&o.version,c=s&&s.v8,l,u;c&&(l=c.split(`.`),u=l[0]>0&&l[0]<4?1:+(l[0]+l[1])),!u&&r&&(l=r.match(/Edge\/(\d+)/),(!l||l[1]>=74)&&(l=r.match(/Chrome\/(\d+)/),l&&(u=+l[1]))),t.exports=u})),C=r(((e,t)=>{var n=S(),r=a(),o=i().String;t.exports=!!Object.getOwnPropertySymbols&&!r(function(){var e=Symbol(`symbol detection`);return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41})})),w=r(((e,t)=>{t.exports=C()&&!Symbol.sham&&typeof Symbol.iterator==`symbol`})),T=r(((e,t)=>{var n=y(),r=_(),i=b(),a=w(),o=Object;t.exports=a?function(e){return typeof e==`symbol`}:function(e){var t=n(`Symbol`);return r(t)&&i(t.prototype,o(e))}})),E=r(((e,t)=>{var n=String;t.exports=function(e){try{return n(e)}catch{return`Object`}}})),D=r(((e,t)=>{var n=_(),r=E(),i=TypeError;t.exports=function(e){if(n(e))return e;throw new i(r(e)+` is not a function`)}})),O=r(((e,t)=>{var n=D(),r=m();t.exports=function(e,t){var i=e[t];return r(i)?void 0:n(i)}})),k=r(((e,t)=>{var n=c(),r=_(),i=v(),a=TypeError;t.exports=function(e,t){var o,s;if(t===`string`&&r(o=e.toString)&&!i(s=n(o,e))||r(o=e.valueOf)&&!i(s=n(o,e))||t!==`string`&&r(o=e.toString)&&!i(s=n(o,e)))return s;throw new a(`Can't convert object to primitive value`)}})),A=r(((e,t)=>{t.exports=!1})),j=r(((e,t)=>{var n=i(),r=Object.defineProperty;t.exports=function(e,t){try{r(n,e,{value:t,configurable:!0,writable:!0})}catch{n[e]=t}return t}})),M=r(((e,t)=>{var n=A(),r=i(),a=j(),o=`__core-js_shared__`,s=t.exports=r[o]||a(o,{});(s.versions||=[]).push({version:`3.40.0`,mode:n?`pure`:`global`,copyright:`© 2014-2025 Denis Pushkarev (zloirock.ru)`,license:`https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE`,source:`https://github.com/zloirock/core-js`})})),N=r(((e,t)=>{var n=M();t.exports=function(e,t){return n[e]||(n[e]=t||{})}})),P=r(((e,t)=>{var n=h(),r=Object;t.exports=function(e){return r(n(e))}})),F=r(((e,t)=>{var n=d(),r=P(),i=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(e,t){return i(r(e),t)}})),I=r(((e,t)=>{var n=d(),r=0,i=Math.random(),a=n(1 .toString);t.exports=function(e){return`Symbol(`+(e===void 0?``:e)+`)_`+a(++r+i,36)}})),L=r(((e,t)=>{var n=i(),r=N(),a=F(),o=I(),s=C(),c=w(),l=n.Symbol,u=r(`wks`),d=c?l.for||l:l&&l.withoutSetter||o;t.exports=function(e){return a(u,e)||(u[e]=s&&a(l,e)?l[e]:d(`Symbol.`+e)),u[e]}})),R=r(((e,t)=>{var n=c(),r=v(),i=T(),a=O(),o=k(),s=L(),l=TypeError,u=s(`toPrimitive`);t.exports=function(e,t){if(!r(e)||i(e))return e;var s=a(e,u),c;if(s){if(t===void 0&&(t=`default`),c=n(s,e,t),!r(c)||i(c))return c;throw new l(`Can't convert object to primitive value`)}return t===void 0&&(t=`number`),o(e,t)}})),z=r(((e,t)=>{var n=R(),r=T();t.exports=function(e){var t=n(e,`string`);return r(t)?t:t+``}})),B=r(((e,t)=>{var n=i(),r=v(),a=n.document,o=r(a)&&r(a.createElement);t.exports=function(e){return o?a.createElement(e):{}}})),V=r(((e,t)=>{var n=o(),r=a(),i=B();t.exports=!n&&!r(function(){return Object.defineProperty(i(`div`),"a",{get:function(){return 7}}).a!==7})})),H=r((e=>{var t=o(),n=c(),r=l(),i=u(),a=g(),s=z(),d=F(),f=V(),p=Object.getOwnPropertyDescriptor;e.f=t?p:function(e,t){if(e=a(e),t=s(t),f)try{return p(e,t)}catch{}if(d(e,t))return i(!n(r.f,e,t),e[t])}})),U=r(((e,t)=>{var n=o(),r=a();t.exports=n&&r(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})})),W=r(((e,t)=>{var n=v(),r=String,i=TypeError;t.exports=function(e){if(n(e))return e;throw new i(r(e)+` is not an object`)}})),ee=r((e=>{var t=o(),n=V(),r=U(),i=W(),a=z(),s=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=`enumerable`,d=`configurable`,f=`writable`;e.f=t?r?function(e,t,n){if(i(e),t=a(t),i(n),typeof e==`function`&&t===`prototype`&&`value`in n&&f in n&&!n[f]){var r=l(e,t);r&&r[f]&&(e[t]=n.value,n={configurable:d in n?n[d]:r[d],enumerable:u in n?n[u]:r[u],writable:!1})}return c(e,t,n)}:c:function(e,t,r){if(i(e),t=a(t),i(r),n)try{return c(e,t,r)}catch{}if(`get`in r||`set`in r)throw new s(`Accessors not supported`);return`value`in r&&(e[t]=r.value),e}})),G=r(((e,t)=>{var n=o(),r=ee(),i=u();t.exports=n?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}})),K=r(((e,t)=>{var n=o(),r=F(),i=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=r(i,`name`);t.exports={EXISTS:s,PROPER:s&&(function(){}).name===`something`,CONFIGURABLE:s&&(!n||n&&a(i,`name`).configurable)}})),te=r(((e,t)=>{var n=d(),r=_(),i=M(),a=n(Function.toString);r(i.inspectSource)||(i.inspectSource=function(e){return a(e)}),t.exports=i.inspectSource})),ne=r(((e,t)=>{var n=i(),r=_(),a=n.WeakMap;t.exports=r(a)&&/native code/.test(String(a))})),re=r(((e,t)=>{var n=N(),r=I(),i=n(`keys`);t.exports=function(e){return i[e]||(i[e]=r(e))}})),ie=r(((e,t)=>{t.exports={}})),ae=r(((e,t)=>{var n=ne(),r=i(),a=v(),o=G(),s=F(),c=M(),l=re(),u=ie(),d=`Object already initialized`,f=r.TypeError,p=r.WeakMap,m,h,g,_=function(e){return g(e)?h(e):m(e,{})},y=function(e){return function(t){var n;if(!a(t)||(n=h(t)).type!==e)throw new f(`Incompatible receiver, `+e+` required`);return n}};if(n||c.state){var b=c.state||=new p;b.get=b.get,b.has=b.has,b.set=b.set,m=function(e,t){if(b.has(e))throw new f(d);return t.facade=e,b.set(e,t),t},h=function(e){return b.get(e)||{}},g=function(e){return b.has(e)}}else{var x=l(`state`);u[x]=!0,m=function(e,t){if(s(e,x))throw new f(d);return t.facade=e,o(e,x,t),t},h=function(e){return s(e,x)?e[x]:{}},g=function(e){return s(e,x)}}t.exports={set:m,get:h,has:g,enforce:_,getterFor:y}})),oe=r(((e,t)=>{var n=d(),r=a(),i=_(),s=F(),c=o(),l=K().CONFIGURABLE,u=te(),f=ae(),p=f.enforce,m=f.get,h=String,g=Object.defineProperty,v=n(``.slice),y=n(``.replace),b=n([].join),x=c&&!r(function(){return g(function(){},`length`,{value:8}).length!==8}),S=String(String).split(`String`),C=t.exports=function(e,t,n){v(h(t),0,7)===`Symbol(`&&(t=`[`+y(h(t),/^Symbol\(([^)]*)\).*$/,`$1`)+`]`),n&&n.getter&&(t=`get `+t),n&&n.setter&&(t=`set `+t),(!s(e,`name`)||l&&e.name!==t)&&(c?g(e,`name`,{value:t,configurable:!0}):e.name=t),x&&n&&s(n,`arity`)&&e.length!==n.arity&&g(e,`length`,{value:n.arity});try{n&&s(n,`constructor`)&&n.constructor?c&&g(e,`prototype`,{writable:!1}):e.prototype&&=void 0}catch{}var r=p(e);return s(r,`source`)||(r.source=b(S,typeof t==`string`?t:``)),e};Function.prototype.toString=C(function(){return i(this)&&m(this).source||u(this)},`toString`)})),q=r(((e,t)=>{var n=_(),r=ee(),i=oe(),a=j();t.exports=function(e,t,o,s){s||={};var c=s.enumerable,l=s.name===void 0?t:s.name;if(n(o)&&i(o,l,s),s.global)c?e[t]=o:a(t,o);else{try{s.unsafe?e[t]&&(c=!0):delete e[t]}catch{}
vendor: 8,608 bytes, line 1
1c?e[t]=o:r.f(e,t,{value:o,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}})),se=r(((e,t)=>{var n=Math.ceil,r=Math.floor;t.exports=Math.trunc||function(e){var t=+e;return(t>0?r:n)(t)}})),ce=r(((e,t)=>{var n=se();t.exports=function(e){var t=+e;return t!==t||t===0?0:n(t)}})),le=r(((e,t)=>{var n=ce(),r=Math.max,i=Math.min;t.exports=function(e,t){var a=n(e);return a<0?r(a+t,0):i(a,t)}})),ue=r(((e,t)=>{var n=ce(),r=Math.min;t.exports=function(e){var t=n(e);return t>0?r(t,9007199254740991):0}})),de=r(((e,t)=>{var n=ue();t.exports=function(e){return n(e.length)}})),fe=r(((e,t)=>{var n=g(),r=le(),i=de(),a=function(e){return function(t,a,o){var s=n(t),c=i(s);if(c===0)return!e&&-1;var l=r(o,c),u;if(e&&a!==a){for(;c>l;)if(u=s[l++],u!==u)return!0}else for(;c>l;l++)if((e||l in s)&&s[l]===a)return e||l||0;return!e&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}})),pe=r(((e,t)=>{var n=d(),r=F(),i=g(),a=fe().indexOf,o=ie(),s=n([].push);t.exports=function(e,t){var n=i(e),c=0,l=[],u;for(u in n)!r(o,u)&&r(n,u)&&s(l,u);for(;t.length>c;)r(n,u=t[c++])&&(~a(l,u)||s(l,u));return l}})),me=r(((e,t)=>{t.exports=[`constructor`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`,`toString`,`valueOf`]})),J=r((e=>{var t=pe(),n=me().concat(`length`,`prototype`);e.f=Object.getOwnPropertyNames||function(e){return t(e,n)}})),he=r((e=>{e.f=Object.getOwnPropertySymbols})),ge=r(((e,t)=>{var n=y(),r=d(),i=J(),a=he(),o=W(),s=r([].concat);t.exports=n(`Reflect`,`ownKeys`)||function(e){var t=i.f(o(e)),n=a.f;return n?s(t,n(e)):t}})),_e=r(((e,t)=>{var n=F(),r=ge(),i=H(),a=ee();t.exports=function(e,t,o){for(var s=r(t),c=a.f,l=i.f,u=0;u<s.length;u++){var d=s[u];!n(e,d)&&!(o&&n(o,d))&&c(e,d,l(t,d))}}})),ve=r(((e,t)=>{var n=a(),r=_(),i=/#|\.prototype\./,o=function(e,t){var i=c[s(e)];return i===u?!0:i===l?!1:r(t)?n(t):!!t},s=o.normalize=function(e){return String(e).replace(i,`.`).toLowerCase()},c=o.data={},l=o.NATIVE=`N`,u=o.POLYFILL=`P`;t.exports=o})),Y=r(((e,t)=>{var n=i(),r=H().f,a=G(),o=q(),s=j(),c=_e(),l=ve();t.exports=function(e,t){var i=e.target,u=e.global,d=e.stat,f,p=u?n:d?n[i]||s(i,{}):n[i]&&n[i].prototype,m,h,g,_;if(p)for(m in t){if(g=t[m],e.dontCallGetSet?(_=r(p,m),h=_&&_.value):h=p[m],f=l(u?m:i+(d?`.`:`#`)+m,e.forced),!f&&h!==void 0){if(typeof g==typeof h)continue;c(g,h)}(e.sham||h&&h.sham)&&a(g,`sham`,!0),o(p,m,g,e)}}})),ye=r(((e,t)=>{var n=ee().f,r=F(),i=L()(`toStringTag`);t.exports=function(e,t,a){e&&!a&&(e=e.prototype),e&&!r(e,i)&&n(e,i,{configurable:!0,value:t})}})),be=r((()=>{var e=Y(),t=i(),n=ye();e({global:!0},{Reflect:{}}),n(t.Reflect,`Reflect`,!0)})),xe=r(((e,t)=>{var n=s(),r=Function.prototype,i=r.apply,a=r.call;t.exports=typeof Reflect==`object`&&Reflect.apply||(n?a.bind(i):function(){return a.apply(i,arguments)})})),Se=r(((e,t)=>{t.exports=d()([].slice)})),Ce=r(((e,t)=>{var n=d(),r=D(),i=v(),a=F(),o=Se(),c=s(),l=Function,u=n([].concat),f=n([].join),p={},m=function(e,t,n){if(!a(p,t)){for(var r=[],i=0;i<t;i++)r[i]=`a[`+i+`]`;p[t]=l(`C,a`,`return new C(`+f(r,`,`)+`)`)}return p[t](e,n)};t.exports=c?l.bind:function(e){var t=r(this),n=t.prototype,a=o(arguments,1),s=function(){var n=u(a,o(arguments));return this instanceof s?m(t,n.length,n):t.apply(e,n)};return i(n)&&(s.prototype=n),s}})),we=r(((e,t)=>{var n=L()(`toStringTag`),r={};r[n]=`z`,t.exports=String(r)===`[object z]`})),Te=r(((e,t)=>{var n=we(),r=_(),i=f(),a=L()(`toStringTag`),o=Object,s=i(function(){return arguments}())===`Arguments`,c=function(e,t){try{return e[t]}catch{}};t.exports=n?i:function(e){var t,n,l;return e===void 0?`Undefined`:e===null?`Null`:typeof(n=c(t=o(e),a))==`string`?n:s?i(t):(l=i(t))===`Object`&&r(t.callee)?`Arguments`:l}})),Ee=r(((e,t)=>{var n=d(),r=a(),i=_(),o=Te(),s=y(),c=te(),l=function(){},u=s(`Reflect`,`construct`),f=/^\s*(?:class|function)\b/,p=n(f.exec),m=!f.test(l),h=function(e){if(!i(e))return!1;try{return u(l,[],e),!0}catch{return!1}},g=function(e){if(!i(e))return!1;switch(o(e)){case`AsyncFunction`:case`GeneratorFunction`:case`AsyncGeneratorFunction`:return!1}try{return m||!!p(f,c(e))}catch{return!0}};g.sham=!0,t.exports=!u||r(function(){var e;return h(h.call)||!h(Object)||!h(function(){e=!0})||e})?g:h})),De=r(((e,t)=>{var n=Ee(),r=E(),i=TypeError;t.exports=function(e){if(n(e))return e;throw new i(r(e)+` is not a constructor`)}})),Oe=r(((e,t)=>{var n=pe(),r=me();t.exports=Object.keys||function(e){return n(e,r)}})),ke=r((e=>{var t=o(),n=U(),r=ee(),i=W(),a=g(),s=Oe();e.f=t&&!n?Object.defineProperties:function(e,t){i(e);for(var n=a(t),o=s(t),c=o.length,l=0,u;c>l;)r.f(e,u=o[l++],n[u]);return e}})),Ae=r(((e,t)=>{t.exports=y()(`document`,`documentElement`)})),je=r(((e,t)=>{var n=W(),r=ke(),i=me(),a=ie(),o=Ae(),s=B(),c=re(),l=`>`,u=`<`,d=`prototype`,f=`script`,p=c(`IE_PROTO`),m=function(){},h=function(e){return u+f+l+e+u+`/`+f+l},g=function(e){e.write(h(``)),e.close();var t=e.parentWindow.Object;return e=null,t},_=function(){var e=s(`iframe`),t=`java`+f+`:`,n;return e.style.display=`none`,o.appendChild(e),e.src=String(t),n=e.contentWindow.document,n.open(),n.write(h(`document.F=Object`)),n.close(),n.F},v,y=function(){try{v=new ActiveXObject(`htmlfile`)}catch{}y=typeof document<`u`?document.domain&&v?g(v):_():g(v);for(var e=i.length;e--;)delete y[d][i[e]];return y()};a[p]=!0,t.exports=Object.create||function(e,t){var i;return e===null?i=y():(m[d]=n(e),i=new m,m[d]=null,i[p]=e),t===void 0?i:r.f(i,t)}})),Me=r((()=>{var e=Y(),t=y(),n=xe(),r=Ce(),i=De(),o=W(),s=v(),c=je(),l=a(),u=t(`Reflect`,`construct`),d=Object.prototype,f=[].push,p=l(function(){function e(){}return!(u(function(){},[],e)instanceof e)}),m=!l(function(){u(function(){})}),h=p||m;e({target:`Reflect`,stat:!0,forced:h,sham:h},{construct:function(e,t){i(e),o(t);var a=arguments.length<3?e:i(arguments[2]);if(m&&!p)return u(e,t,a);if(e===a){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var l=[null];return n(f,l,t),new(n(r,e,l))}var h=a.prototype,g=c(s(h)?h:d),_=n(e,g,t);return s(_)?_:g}})})),Ne=r((()=>{var e=Y(),t=P(),n=Oe();e({target:`Object`,stat:!0,forced:a()(function(){n(1)})},{keys:function(e){return n(t(e))}})})),Pe=r(((e,t)=>{var n=Te(),r=String;t.exports=function(e){if(n(e)===`Symbol`)throw TypeError(`Cannot convert a Symbol value to a string`);return r(e)}})),Fe=r(((e,t)=>{var n=f(),r=g(),i=J().f,a=Se(),o=typeof window==`object`&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(e){try{return i(e)}catch{return a(o)}};t.exports.f=function(e){return o&&n(e)===`Window`?s(e):i(r(e))}})),Ie=r(((e,t)=>{var n=oe(),r=ee();t.exports=function(e,t,i){return i.get&&n(i.get,t,{getter:!0}),i.set&&n(i.set,t,{setter:!0}),r.f(e,t,i)}})),Le=r((e=>{e.f=L()})),Re=r(((e,t)=>{t.exports=i()})),ze=r(((e,t)=>{var n=Re(),r=F(),i=Le(),a=ee().f;t.exports=function(e){var t=n.Symbol||={};r(t,e)||a(t,e,{value:i.f(e)})}})),Be=r(((e,t)=>{var n=c(),r=y(),i=L(),a=q();t.exports=function(){var e=r(`Symbol`),t=e&&e.prototype,o=t&&t.valueOf,s=i(`toPrimitive`);t&&!t[s]&&a(t,s,function(e){return n(o,this)},{arity:1})}})),Ve=r(((e,t)=>{var n=f(),r=d();t.exports=function(e){if(n(e)===`Function`)return r(e)}})),He=r(((e,t)=>{var n=Ve(),r=D(),i=s(),a=n(n.bind);t.exports=function(e,t){return r(e),t===void 0?e:i?a(e,t):function(){return e.apply(t,arguments)}}})),Ue=r(((e,t)=>{var n=f();t.exports=Array.isArray||function(e){return n(e)===`Array`}})),We=r(((e,t)=>{var n=Ue(),r=Ee(),i=v(),a=L()(`species`),o=Array;t.exports=function(e){var t;return n(e)&&(t=e.constructor,r(t)&&(t===o||n(t.prototype))?t=void 0:i(t)&&(t=t[a],t===null&&(t=void 0))),t===void 0?o:t}})),Ge=r(((e,t)=>{var n=We();t.exports=function(e,t){return new(n(e))(t===0?0:t)}})),Ke=r(((e,t)=>{var n=He(),r=d(),i=p(),a=P(),o=de(),s=Ge(),c=r([].push),l=function(e){var t=e===1,r=e===2,l=e===3,u=e===4,d=e===6,f=e===7,p=e===5||d;return function(m,h,g,_){for(var v=a(m),y=i(v),b=o(y),x=n(h,g),S=0,C=_||s,w=t?C(m,b):r||f?C(m,0):void 0,T,E;b>S;S++)if((p||S in y)&&(T=y[S],E=x(T,S,v),e)){if(t)w[S]=E;else if(E)switch(e){case 3:return!0;case 5:return T;case 6:return S;case 2:c(w,T)}else switch(e){case 4:return!1;case 7:c(w,T)}}return d?-1:l||u?u:w}};t.exports={forEach:l(0),map:l(1),filter:l(2),some:l(3),every:l(4),find:l(5),findIndex:l(6),filterReject:l(7)}})),qe=r((()=>{var e=Y(),t=i(),n=c(),r=d(),s=A(),f=o(),p=C(),m=a(),h=F(),_=b(),v=W(),y=g(),x=z(),S=Pe(),w=u(),T=je(),E=Oe(),D=J(),O=Fe(),k=he(),j=H(),M=ee(),P=ke(),R=l(),B=q(),V=Ie(),U=N(),G=re(),K=ie(),te=I(),ne=L(),oe=Le(),se=ze(),ce=Be(),le=ye(),ue=ae(),de=Ke().forEac
1h,fe=G(`hidden`),pe=`Symbol`,me=`prototype`,ge=ue.set,_e=ue.getterFor(pe),ve=Object[me],be=t.Symbol,xe=be&&be[me],Se=t.RangeError,Ce=t.TypeError,we=t.QObject,Te=j.f,Ee=M.f,De=O.f,Ae=R.f,Me=r([].push),Ne=U(`symbols`),Re=U(`op-symbols`),Ve=U(`wks`),He=!we||!we[me]||!we[me].findChild,Ue=function(e,t,n){var r=Te(ve,t);r&&delete ve[t],Ee(e,t,n),r&&e!==ve&&Ee(ve,t,r)},We=f&&m(function(){return T(Ee({},`a`,{get:function(){return Ee(this,`a`,{value:7}).a}})).a!==7})?Ue:Ee,Ge=function(e,t){var n=Ne[e]=T(xe);return ge(n,{type:pe,tag:e,description:t}),f||(n.description=t),n},qe=function(e,t,n){e===ve&&qe(Re,t,n),v(e);var r=x(t);return v(n),h(Ne,r)?(n.enumerable?(h(e,fe)&&e[fe][r]&&(e[fe][r]=!1),n=T(n,{enumerable:w(0,!1)})):(h(e,fe)||Ee(e,fe,w(1,T(null))),e[fe][r]=!0),We(e,r,n)):Ee(e,r,n)},Je=function(e,t){v(e);var r=y(t);return de(E(r).concat($e(r)),function(t){(!f||n(Xe,r,t))&&qe(e,t,r[t])}),e},Ye=function(e,t){return t===void 0?T(e):Je(T(e),t)},Xe=function(e){var t=x(e),r=n(Ae,this,t);return this===ve&&h(Ne,t)&&!h(Re,t)?!1:r||!h(this,t)||!h(Ne,t)||h(this,fe)&&this[fe][t]?r:!0},Ze=function(e,t){var n=y(e),r=x(t);
1if(!(n===ve&&h(Ne,r)&&!h(Re,r))){var i=Te(n,r);return i&&h(Ne,r)&&!(h(n,fe)&&n[fe][r])&&(i.enumerable=!0),i}},Qe=function(e){var t=De(y(e)),n=[];return de(t,function(e){!h(Ne,e)&&!h(K,e)&&Me(n,e)}),n},$e=function(e){var t=e===ve,n=De(t?Re:y(e)),r=[];return de(n,function(e){h(Ne,e)&&(!t||h(ve,e))&&Me(r,Ne[e])}),r};p||(be=function(){if(_(xe,this))throw new Ce(`Symbol is not a constructor`);var e=!arguments.length||arguments[0]===void 0?void 0:S(arguments[0]),r=te(e),i=function(e){var a=this===void 0?t:this;a===ve&&n(i,Re,e),h(a,fe)&&h(a[fe],r)&&(a[fe][r]=!1);var o=w(1,e);try{We(a,r,o)}catch(e){if(!(e instanceof Se))throw e;Ue(a,r,o)}};return f&&He&&We(ve,r,{configurable:!0,set:i}),Ge(r,e)},xe=be[me],B(xe,`toString`,function(){return _e(this).tag}),B(be,`withoutSetter`,function(e){return Ge(te(e),e)}),R.f=Xe,M.f=qe,P.f=Je,j.f=Ze,D.f=O.f=Qe,k.f=$e,oe.f=function(e){return Ge(ne(e),e)},f&&(V(xe,`description`,{configurable:!0,get:function(){return _e(this).description}}),s||B(ve,`propertyIsEnumerable`,Xe,{unsafe:!0}))),e({global:!0,constructor:!0,wrap:!0,forced:!p,sham:!p},{Symbol:be}),de(E(Ve),function(e){se(e)}),e({target:pe,stat:!0,forced:!p},{useSetter:function(){He=!0},useSimple:function(){He=!1}}),e({target:`Object`,stat:!0,forced:!p,sham:!f},{create:Ye,defineProperty:qe,defineProperties:Je,getOwnPropertyDescriptor:Ze}),e({target:`Object`,stat:!0,forced:!p},{getOwnPropertyNames:Qe}),ce(),le(be,pe),K[fe]=!0})),Je=r(((e,t)=>{t.exports=C()&&!!Symbol.for&&!!Symbol.keyFor})),Ye=r((()=>{var e=Y(),t=y(),n=F(),r=Pe(),i=N(),a=Je(),o=i(`string-to-symbol-registry`),s=i(`symbol-to-string-registry`);e({target:`Symbol`,stat:!0,forced:!a},{for:function(e){var i=r(e);if(n(o,i))return o[i];var a=t(`Symbol`)(i);return o[i]=a,s[a]=i,a}})})),Xe=r((()=>{var e=Y(),t=F(),n=T(),r=E(),i=N(),a=Je(),o=i(`symbol-to-string-registry`);e({target:`Symbol`,stat:!0,forced:!a},{keyFor:function(e){if(!n(e))throw TypeError(r(e)+` is not a symbol`);if(t(o,e))return o[e]}})})),Ze=r(((e,t)=>{var n=d(),r=Ue(),i=_(),a=f(),o=Pe(),s=n([].push);t.exports=function(e){if(i(e))return e;if(r(e)){for(var t=e.length,n=[],c=0;c<t;c++){var l=e[c];typeof l==`string`?s(n,l):(typeof l==`number`||a(l)===`Number`||a(l)===`String`)&&s(n,o(l))}var u=n.length,d=!0;return function(e,t){if(d)return d=!1,t;if(r(this))return t;for(var i=0;i<u;i++)if(n[i]===e)return t}}}})),Qe=r((()=>{var e=Y(),t=y(),n=xe(),r=c(),i=d(),o=a(),s=_(),l=T(),u=Se(),f=Ze(),p=C(),m=String,h=t(`JSON`,`stringify`),g=i(/./.exec),v=i(``.charAt),b=i(``.charCodeAt),x=i(``.replace),S=i(1 .toString),w=/[\uD800-\uDFFF]/g,E=/^[\uD800-\uDBFF]$/,D=/^[\uDC00-\uDFFF]$/,O=!p||o(function(){var e=t(`Symbol`)(`stringify detection`);return h([e])!==`[null]`||h({a:e})!==`{}`||h(Object(e))!==`{}`}),k=o(function(){return h(`\udf06\ud834`)!==`"\\udf06\\ud834"`||h(`\udead`)!==`"\\udead"`}),A=function(e,t){var i=u(arguments),a=f(t);if(!(!s(a)&&(e===void 0||l(e))))return i[1]=function(e,t){if(s(a)&&(t=r(a,this,m(e),t)),!l(t))return t},n(h,null,i)},j=function(e,t,n){var r=v(n,t-1),i=v(n,t+1);return g(E,e)&&!g(D,i)||g(D,e)&&!g(E,r)?`\\u`+S(b(e,0),16):e};h&&e({target:`JSON`,stat:!0,arity:3,forced:O||k},{stringify:function(e,t,r){var i=u(arguments),a=n(O?A:h,null,i);return k&&typeof a==`string`?x(a,w,j):a}})})),$e=r((()=>{var e=Y(),t=C(),n=a(),r=he(),i=P();e({target:`Object`,stat:!0,forced:!t||n(function(){r.f(1)})},{getOwnPropertySymbols:function(e){var t=r.f;return t?t(i(e)):[]}})})),et=r((()=>{qe(),Ye(),Xe(),Qe(),$e()})),tt=r(((e,t)=>{var n=a(),r=L(),i=S(),o=r(`species`);t.exports=function(e){return i>=51||!n(function(){var t=[],n=t.constructor={};return n[o]=function(){return{foo:1}},t[e](Boolean).foo!==1})}})),nt=r((()=>{var e=Y(),t=Ke().filter;e({target:`Array`,proto:!0,forced:!tt()(`filter`)},{filter:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}})})),rt=r((()=>{var e=Y(),t=a(),n=g(),r=H().f,i=o();e({target:`Object`,stat:!0,forced:!i||t(function(){r(1)}),sham:!i},{getOwnPropertyDescriptor:function(e,t){return r(n(e),t)}})})),it=r(((e,t)=>{var n=o(),r=ee(),i=u();t.exports=function(e,t,a){n?r.f(e,t,i(0,a)):e[t]=a}})),at=r((()=>
1{var e=Y(),t=o(),n=ge(),r=g(),i=H(),a=it();e({target:`Object`,stat:!0,sham:!t},{getOwnPropertyDescriptors:function(e){for(var t=r(e),o=i.f,s=n(t),c={},l=0,u,d;s.length>l;)d=o(t,u=s[l++]),d!==void 0&&a(c,u,d);return c}})})),ot=r(((e,t)=>{function n(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function r(e){return function(){var t=this,r=arguments;return new Promise(function(i,a){var o=e.apply(t,r);function s(e){n(o,i,a,s,c,`next`,e)}function c(e){n(o,i,a,s,c,`throw`,e)}s(void 0)})}}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),st=r(((e,t)=>{function n(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),ct=r(((e,t)=>{function n(e,r){return t.exports=n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e,r)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),lt=r(((e,t)=>{var n=ct();function r(e,t){if(typeof t!=`function`&&t!==null)throw 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&&n(e,t)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),ut=r(((e,t)=>{function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),dt=r(((e,t)=>{var n=ut().default,r=st();function i(e,t){if(t&&(n(t)==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return r(e)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),ft=r(((e,t)=>{function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),pt=r(((e,t)=>{var n=ut().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),mt=r(((e,t)=>{var n=ut().default,r=pt();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),ht=r(((e,t)=>{var n=mt();function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),gt=r(((e,t)=>{var n=mt();function r(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,`value`in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),_t=r(((e,t)=>{function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),vt=r((()=>{var e=Y(),t=Ke().map;e({target:`Array`,proto:!0,forced:!tt()(`map`)},{map:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}})})),yt=r(((e,t)=>{var n=we(),r=Te();t.exports=n?{}.toString:function(){return`[object `+r(this)+`]`}})),bt=r((()=>{var e=we(),t=q(),n=yt();e||t(Object.prototype,`toString`,n,{unsafe:!0})})),xt=r(((e,t)=>{t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}})),St=r(((e,t)=>
vendor: 1,350 bytes, line 1
1{var n=B()(`span`).classList,r=n&&n.constructor&&n.constructor.prototype;t.exports=r===Object.prototype?void 0:r})),Ct=r(((e,t)=>{var n=a();t.exports=function(e,t){var r=[][e];return!!r&&n(function(){r.call(null,t||function(){return 1},1)})}})),wt=r(((e,t)=>{var n=Ke().forEach;t.exports=Ct()(`forEach`)?[].forEach:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}})),Tt=r((()=>{var e=i(),t=xt(),n=St(),r=wt(),a=G(),o=function(e){if(e&&e.forEach!==r)try{a(e,`forEach`,r)}catch{e.forEach=r}};for(var s in t)t[s]&&o(e[s]&&e[s].prototype);o(n)})),Et=r(((e,t)=>{var n=i(),r=x(),a=f(),o=function(e){return r.slice(0,e.length)===e};t.exports=(function(){return o(`Bun/`)?`BUN`:o(`Cloudflare-Workers`)?`CLOUDFLARE`:o(`Deno/`)?`DENO`:o(`Node.js/`)?`NODE`:n.Bun&&typeof Bun.version==`string`?`BUN`:n.Deno&&typeof Deno.version==`object`?`DENO`:a(n.process)===`process`?`NODE`:n.window&&n.document?`BROWSER`:`REST`})()})),Dt=r(((e,t)=>{t.exports=Et()===`NODE`})),Ot=r(((e,t)=>{var n=d(),r=D();t.exports=function(e,t,i){try{return n(r(Object.getOwnPropertyDescriptor(e,t)[i]))}catch{}}})),kt=r(((e,t)=>{var n=v();t.exports=function(e){return n(e)||e===null}})),At=r(((e,t)=>{var n=kt(),r=String,i=TypeError;t.exports=function(e){if(n(e))return e;throw new i(`Can't set `+r(e)+` as a prototype`)}})),jt=r(((e,t)=>{var n=Ot(),r=v(),i=h(),a=At();
vendor: 10,315 bytes, line 1
1t.exports=Object.setPrototypeOf||(`__proto__`in{}?function(){var e=!1,t={},o;try{o=n(Object.prototype,`__proto__`,`set`),o(t,[]),e=t instanceof Array}catch{}return function(t,n){return i(t),a(n),r(t)&&(e?o(t,n):t.__proto__=n),t}}():void 0)})),Mt=r(((e,t)=>{var n=y(),r=Ie(),i=L(),a=o(),s=i(`species`);t.exports=function(e){var t=n(e);a&&t&&!t[s]&&r(t,s,{configurable:!0,get:function(){return this}})}})),X=r(((e,t)=>{var n=b(),r=TypeError;t.exports=function(e,t){if(n(t,e))return e;throw new r(`Incorrect invocation`)}})),Nt=r(((e,t)=>{var n=W(),r=De(),i=m(),a=L()(`species`);t.exports=function(e,t){var o=n(e).constructor,s;return o===void 0||i(s=n(o)[a])?t:r(s)}})),Pt=r(((e,t)=>{var n=TypeError;t.exports=function(e,t){if(e<t)throw new n(`Not enough arguments`);return e}})),Ft=r(((e,t)=>{var n=x();t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(n)})),It=r(((e,t)=>{var n=i(),r=xe(),o=He(),s=_(),c=F(),l=a(),u=Ae(),d=Se(),f=B(),p=Pt(),m=Ft(),h=Dt(),g=n.setImmediate,v=n.clearImmediate,y=n.process,b=n.Dispatch,x=n.Function,S=n.MessageChannel,C=n.String,w=0,T={},E=`onreadystatechange`,D,O,k,A;l(function(){D=n.location});var j=function(e){if(c(T,e)){var t=T[e];delete T[e],t()}},M=function(e){return function(){j(e)}},N=function(e){j(e.data)},P=function(e){n.postMessage(C(e),D.protocol+`//`+D.host)};(!g||!v)&&(g=function(e){p(arguments.length,1);var t=s(e)?e:x(e),n=d(arguments,1);return T[++w]=function(){r(t,void 0,n)},O(w),w},v=function(e){delete T[e]},h?O=function(e){y.nextTick(M(e))}:b&&b.now?O=function(e){b.now(M(e))}:S&&!m?(k=new S,A=k.port2,k.port1.onmessage=N,O=o(A.postMessage,A)):n.addEventListener&&s(n.postMessage)&&!n.importScripts&&D&&D.protocol!==`file:`&&!l(P)?(O=P,n.addEventListener(`message`,N,!1)):O=E in f(`script`)?function(e){u.appendChild(f(`script`))[E]=function(){u.removeChild(this),j(e)}}:function(e){setTimeout(M(e),0)}),t.exports={set:g,clear:v}})),Lt=r(((e,t)=>{var n=i(),r=o(),a=Object.getOwnPropertyDescriptor;t.exports=function(e){if(!r)return n[e];var t=a(n,e);return t&&t.value}})),Rt=r(((e,t)=>{var n=function(){this.head=null,this.tail=null};n.prototype={add:function(e){var t={item:e,next:null},n=this.tail;n?n.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return(this.head=e.next)===null&&(this.tail=null),e.item}},t.exports=n})),zt=r(((e,t)=>{var n=x();t.exports=/ipad|iphone|ipod/i.test(n)&&typeof Pebble<`u`})),Bt=r(((e,t)=>{var n=x();t.exports=/web0s(?!.*chrome)/i.test(n)})),Vt=r(((e,t)=>{var n=i(),r=Lt(),a=He(),o=It().set,s=Rt(),c=Ft(),l=zt(),u=Bt(),d=Dt(),f=n.MutationObserver||n.WebKitMutationObserver,p=n.document,m=n.process,h=n.Promise,g=r(`queueMicrotask`),_,v,y,b,x;if(!g){var S=new s,C=function(){var e,t;for(d&&(e=m.domain)&&e.exit();t=S.get();)try{t()}catch(e){throw S.head&&_(),e}e&&e.enter()};!c&&!d&&!u&&f&&p?(v=!0,y=p.createTextNode(``),new f(C).observe(y,{characterData:!0}),_=function(){y.data=v=!v}):!l&&h&&h.resolve?(b=h.resolve(void 0),b.constructor=h,x=a(b.then,b),_=function(){x(C)}):d?_=function(){m.nextTick(C)}:(o=a(o,n),_=function(){o(C)}),g=function(e){S.head||_(),S.add(e)}}t.exports=g})),Z=r(((e,t)=>{t.exports=function(e,t){try{arguments.length===1?console.error(e):console.error(e,t)}catch{}}})),Ht=r(((e,t)=>{t.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}})),Ut=r(((e,t)=>{t.exports=i().Promise})),Wt=r(((e,t)=>{var n=i(),r=Ut(),a=_(),o=ve(),s=te(),c=L(),l=Et(),u=A(),d=S(),f=r&&r.prototype,p=c(`species`),m=!1,h=a(n.PromiseRejectionEvent);t.exports={CONSTRUCTOR:o(`Promise`,function(){var e=s(r),t=e!==String(r);if(!t&&d===66||u&&!(f.catch&&f.finally))return!0;if(!d||d<51||!/native code/.test(e)){var n=new r(function(e){e(1)}),i=function(e){e(function(){},function(){})},a=n.constructor={};if(a[p]=i,m=n.then(function(){})instanceof i,!m)return!0}return!t&&(l===`BROWSER`||l===`DENO`)&&!h}),REJECTION_EVENT:h,SUBCLASSING:m}})),Gt=r(((e,t)=>{var n=D(),r=TypeError,i=function(e){var t,i;this.promise=new e(function(e,n){if(t!==void 0||i!==void 0)throw new r(`Bad Promise constructor`);t=e,i=n}),this.resolve=n(t),this.reject=n(i)};t.exports.f=function(e){return new i(e)}})),Kt=r((()=>{var e=Y(),t=A(),n=Dt(),r=i(),a=c(),o=q(),s=jt(),l=ye(),u=Mt(),d=D(),f=_(),p=v(),m=X(),h=Nt(),g=It().set,y=Vt(),b=Z(),x=Ht(),S=Rt(),C=ae(),w=Ut(),T=Wt(),E=Gt(),O=`Promise`,k=T.CONSTRUCTOR,j=T.REJECTION_EVENT,M=T.SUBCLASSING,N=C.getterFor(O),P=C.set,F=w&&w.prototype,I=w,L=F,R=r.TypeError,z=r.document,B=r.process,V=E.f,H=V,U=!!(z&&z.createEvent&&r.dispatchEvent),W=`unhandledrejection`,ee=`rejectionhandled`,G=0,K=1,te=2,ne=1,re=2,ie,oe,se,ce,le=function(e){var t;return p(e)&&f(t=e.then)?t:!1},ue=function(e,t){var n=t.value,r=t.state===K,i=r?e.ok:e.fail,o=e.resolve,s=e.reject,c=e.domain,l,u,d;try{i?(r||(t.rejection===re&&J(t),t.rejection=ne),i===!0?l=n:(c&&c.enter(),l=i(n),c&&(c.exit(),d=!0)),l===e.promise?s(new R(`Promise-chain cycle`)):(u=le(l))?a(u,l,o,s):o(l)):s(n)}catch(e){c&&!d&&c.exit(),s(e)}},de=function(e,t){e.notified||(e.notified=!0,y(function(){for(var n=e.reactions,r;r=n.get();)ue(r,e);e.notified=!1,t&&!e.rejection&&pe(e)}))},fe=function(e,t,n){var i,a;U?(i=z.createEvent(`Event`),i.promise=t,i.reason=n,i.initEvent(e,!1,!0),r.dispatchEvent(i)):i={promise:t,reason:n},!j&&(a=r[`on`+e])?a(i):e===W&&b(`Unhandled promise rejection`,n)},pe=function(e){a(g,r,function(){var t=e.facade,r=e.value,i=me(e),a;if(i&&(a=x(function(){n?B.emit(`unhandledRejection`,r,t):fe(W,t,r)}),e.rejection=n||me(e)?re:ne,a.error))throw a.value})},me=function(e){return e.rejection!==ne&&!e.parent},J=function(e){a(g,r,function(){var t=e.facade;n?B.emit(`rejectionHandled`,t):fe(ee,t,e.value)})},he=function(e,t,n){return function(r){e(t,r,n)}},ge=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=te,de(e,!0))},_e=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw new R(`Promise can't be resolved itself`);var r=le(t);r?y(function(){var n={done:!1};try{a(r,t,he(_e,n,e),he(ge,n,e))}catch(t){ge(n,t,e)}}):(e.value=t,e.state=K,de(e,!1))}catch(t){ge({done:!1},t,e)}}};if(k&&(I=function(e){m(this,L),d(e),a(ie,this);var t=N(this);try{e(he(_e,t),he(ge,t))}catch(e){ge(t,e)}},L=I.prototype,ie=function(e){P(this,{type:O,done:!1,notified:!1,parent:!1,reactions:new S,rejection:!1,state:G,value:null})},ie.prototype=o(L,`then`,function(e,t){var r=N(this),i=V(h(this,I));return r.parent=!0,i.ok=!f(e)||e,i.fail=f(t)&&t,i.domain=n?B.domain:void 0,r.state===G?r.reactions.add(i):y(function(){ue(i,r)}),i.promise}),oe=function(){var e=new ie,t=N(e);this.promise=e,this.resolve=he(_e,t),this.reject=he(ge,t)},E.f=V=function(e){return e===I||e===se?new oe(e):H(e)},!t&&f(w)&&F!==Object.prototype)){ce=F.then,M||o(F,`then`,function(e,t){var n=this;return new I(function(e,t){a(ce,n,e,t)}).then(e,t)},{unsafe:!0});try{delete F.constructor}catch{}s&&s(F,L)}e({global:!0,constructor:!0,wrap:!0,forced:k},{Promise:I}),l(I,O,!1,!0),u(O)})),qt=r(((e,t)=>{t.exports={}})),Jt=r(((e,t)=>{var n=L(),r=qt(),i=n(`iterator`),a=Array.prototype;t.exports=function(e){return e!==void 0&&(r.Array===e||a[i]===e)}})),Yt=r(((e,t)=>{var n=Te(),r=O(),i=m(),a=qt(),o=L()(`iterator`);t.exports=function(e){if(!i(e))return r(e,o)||r(e,`@@iterator`)||a[n(e)]}})),Xt=r(((e,t)=>{var n=c(),r=D(),i=W(),a=E(),o=Yt(),s=TypeError;t.exports=function(e,t){var c=arguments.length<2?o(e):t;if(r(c))return i(n(c,e));throw new s(a(e)+` is not iterable`)}})),Zt=r(((e,t)=>{var n=c(),r=W(),i=O();t.exports=function(e,t,a){var o,s;r(e);try{if(o=i(e,`return`),!o){if(t===`throw`)throw a;return a}o=n(o,e)}catch(e){s=!0,o=e}if(t===`throw`)throw a;if(s)throw o;return r(o),a}})),Qt=r(((e,t)=>{var n=He(),r=c(),i=W(),a=E(),o=Jt(),s=de(),l=b(),u=Xt(),d=Yt(),f=Zt(),p=TypeError,m=function(e,t){this.stopped=e,this.result=t},h=m.prototype;t.exports=function(e,t,c){var g=c&&c.that,_=!!(c&&c.AS_ENTRIES),v=!!(c&&c.IS_RECORD),y=!!(c&&c.IS_ITERATOR),b=!!(c&&c.INTERRUPTED),x=n(t,g),S,C,w,T,E,D,O,k=function(e){return S&&f(S,`normal`,e),new m(!0,e)},A=function(e){return _?(i(e),b?x(e[0],e[1],k):x(e[0],e[1])):b?x(e,k):x(e)};if(v)S=e.iterator;else if(y)S=e;else{if(C=d(e),!C)throw new p(a(e)+` is not iterable`);if(o(C)){for(w=0,T=s(e);T>w;w++)if(E=A(e[w]),E&&l(h,E))return E;return new m(!1)}S=u(e,C)}for(D=v?e.next:S.next;!(O=r(D,S)).done;){try{E=A(O.value)}catch(e){f(S,`throw`,e)}if(typeof E==`object`&&E&&l(h,E))return E}return new m(!1)}})),$t=r(((e,t)=>{var n=L()(`iterator`),r=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){r=!0}};a[n]=function(){return this},Array.from(a,function(){throw 2})}catch{}t.exports=function(e,t){try{if(!t&&!r)return!1}catch{return!1}var i=!1;try{var a={};a[n]=function(){return{next:function(){return{done:i=!0}}}},e(a)}catch{}return i}})),en=r(((e,t)=>{var n=Ut(),r=$t();t.exports=Wt().CONSTRUCTOR||!r(function(e){n.all(e).then(void 0,function(){})})})),tn=r((()=>{var e=Y(),t=c(),n=D(),r=Gt(),i=Ht(),a=Qt();e({target:`Promise`,stat:!0,forced:en()},{all:function(e){var o=this,s=r.f(o),c=s.resolve,l=s.reject,u=i(function(){var r=n(o.resolve),i=[],s=0,u=1;a(e,function(e){var n=s++,a=!1;u++,t(r,o,e).then(function(e){a||(a=!0,i[n]=e,--u||c(i))},l)}),--u||c(i)});return u.error&&l(u.value),s.promise}})})),nn=r((()=>{var e=Y(),t=A(),n=Wt().CONSTRUCTOR,r=Ut(),i=y(),a=_(),o=q(),s=r&&r.prototype;if(e({target:`Promise`,proto:!0,forced:n,real:!0},{catch:function(e){return this.then(void 0,e)}}),!t&&a(r)){var c=i(`Promise`).prototype.catch;s.catch!==c&&o(s,`catch`,c,{unsafe:!0})}})),rn=r((()=>{var e=Y(),t=c(),n=D(),r=Gt(),i=Ht(),a=Qt();e({target:`Promise`,stat:!0,forced:en()},{race:function(e){var o=this,s=r.f(o),c=s.reject,l=i(function(){var r=n(o.resolve);a(e,function(e){t(r,o,e).then(s.resolve,c)})});return l.error&&c(l.value),s.promise}})})),an=r((()=>{var e=Y(),t=Gt(),n=Wt().CONSTRUCTOR;e({target:`Promise`,stat:!0,forced:n},{reject:function(e){var n=t.f(this),r=n.reject;return r(e),n.promise}})})),on=r(((e,t)=>{var n=W(),r=v(),i=Gt();t.exports=function(e,t){if(n(e),r(t)&&t.constructor===e)return t;var a=i.f(e),o=a.resolve;return o(t),a.promise}})),sn=r((()=>{var e=Y(),t=y(),n=A(),r=Ut(),i=Wt().CONSTRUCTOR,a=on(),o=t(`Promise`),s=n&&!i;e({target:`Promise`,stat:!0,forced:n||i},{resolve:function(e){return a(s&&this===o?r:this,e)}})})),cn=r((()=>{Kt(),tn(),nn(),rn(),an(),sn()})),ln=r(((e,t)=>{function n(e,t){this.v=e,this.k=t}
vendor: 4,108 bytes, line 1
1t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),un=r(((e,t)=>{function n(e,r,i,a){var o=Object.defineProperty;try{o({},``,{})}catch{o=0}t.exports=n=function(e,t,r,i){function a(t,r){n(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a(`next`,0),a(`throw`,1),a(`return`,2))},t.exports.__esModule=!0,t.exports.default=t.exports,n(e,r,i,a)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),dn=r(((e,t)=>{var n=un();function r(){var e,i,a=typeof Symbol==`function`?Symbol:{},o=a.iterator||`@@iterator`,s=a.toStringTag||`@@toStringTag`;function c(t,r,a,o){var s=r&&r.prototype instanceof u?r:u,c=Object.create(s.prototype);return n(c,`_invoke`,function(t,n,r){var a,o,s,c=0,u=r||[],d=!1,f={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,o=0,s=e,f.n=n,l}};function p(t,n){for(o=t,s=n,i=0;!d&&c&&!r&&i<u.length;i++){var r,a=u[i],p=f.p,m=a[2];t>3?(r=m===n)&&(s=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=e):a[0]<=p&&((r=t<2&&p<a[1])?(o=0,f.v=n,f.n=a[1]):p<m&&(r=t<3||a[0]>n||n>m)&&(a[4]=t,a[5]=n,f.n=m,o=0))}if(r||t>1)return l;throw d=!0,n}return function(r,u,m){if(c>1)throw TypeError(`Generator is already running`);for(d&&u===1&&p(u,m),o=u,s=m;(i=o<2?e:s)||!d;){a||(o?o<3?(o>1&&(f.n=-1),p(o,s)):f.n=s:f.v=s);try{if(c=2,a){if(o||(r=`next`),i=a[r]){if(!(i=i.call(a,s)))throw TypeError(`iterator result is not an object`);if(!i.done)return i;s=i.value,o<2&&(o=0)}else o===1&&(i=a.return)&&i.call(a),o<2&&(s=TypeError(`The iterator does not provide a '`+r+`' method`),o=1);a=e}else if((i=(d=f.n<0)?s:t.call(n,f))!==l)break}catch(t){a=e,o=1,s=t}finally{c=1}}return{value:i,done:d}}}(t,a,o),!0),c}var l={};function u(){}function d(){}function f(){}i=Object.getPrototypeOf;var p=[][o]?i(i([][o]())):(n(i={},o,function(){return this}),i),m=f.prototype=u.prototype=Object.create(p);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,n(e,s,`GeneratorFunction`)),e.prototype=Object.create(m),e}return d.prototype=f,n(m,`constructor`,f),n(f,`constructor`,d),d.displayName=`GeneratorFunction`,n(f,s,`GeneratorFunction`),n(m),n(m,s,`Generator`),n(m,o,function(){return this}),n(m,`toString`,function(){return`[object Generator]`}),(t.exports=r=function(){return{w:c,m:h}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),fn=r(((e,t)=>{var n=ln(),r=un();function i(e,t){function a(r,i,o,s){try{var c=e[r](i),l=c.value;return l instanceof n?t.resolve(l.v).then(function(e){a(`next`,e,o,s)},function(e){a(`throw`,e,o,s)}):t.resolve(l).then(function(e){c.value=e,o(c)},function(e){return a(`throw`,e,o,s)})}catch(e){s(e)}}var o;this.next||(r(i.prototype),r(i.prototype,typeof Symbol==`function`&&Symbol.asyncIterator||`@asyncIterator`,function(){return this})),r(this,`_invoke`,function(e,n,r){function i(){return new t(function(t,n){a(e,r,t,n)})}return o=o?o.then(i,i):i()},!0)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),pn=r(((e,t)=>{var n=dn(),r=fn();function i(e,t,i,a,o){return new r(n().w(e,t,i,a),o||Promise)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),mn=r(((e,t)=>{var n=pn();function r(e,t,r,i,a){var o=n(e,t,r,i,a);return o.next().then(function(e){return e.done?e.value:o.next()})}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),hn=r(((e,t)=>{function n(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),gn=r(((e,t)=>{var n=ut().default;function r(e){if(e!=null){var t=e[typeof Symbol==`function`&&Symbol.iterator||`@@iterator`],r=0;if(t)return t.call(e);if(typeof e.next==`function`)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw TypeError(n(e)+` is not iterable`)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),_n=r(((e,t)=>{var n=ln(),r=dn(),i=mn(),a=pn(),o=fn(),s=hn(),c=gn();
1function l(){var e=r(),u=e.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(u):u.__proto__).constructor;function f(e){var t=typeof e==`function`&&e.constructor;return!!t&&(t===d||(t.displayName||t.name)===`GeneratorFunction`)}var p={throw:1,return:2,break:3,continue:3};function m(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,p[e],t)},delegateYield:function(e,i,a){return t.resultName=i,n(r.d,c(e),a)},finish:function(e){return n(r.f,e)}},n=function(e,n,i){r.p=t.prev,r.n=t.next;try{return e(n,i)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(t.exports=l=function(){return{wrap:function(t,n,r,i){return e.w(m(t),n,r,i&&i.reverse())},isGeneratorFunction:f,mark:e.m,awrap:function(e,t){return new n(e,t)},AsyncIterator:o,async:function(e,t,n,r,o){return(f(t)?a:i)(m(e),t,n,r,o)},keys:s,values:c}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=l,t.exports.__esModule=!0,t.exports.default=t.exports})),vn=r(((e,t)=>{var n=_n()();t.exports=n;try{regeneratorRuntime=n}catch{typeof globalThis==`object`?globalThis.regeneratorRuntime=n:Function(`r`,`regeneratorRuntime = r`)(n)}})),yn=r(((e,t)=>{var n=TypeError,r=9007199254740991;t.exports=function(e){if(e>r)throw n(`Maximum allowed index exceeded`);return e}})),bn=r((()=>{var e=Y(),t=a(),n=Ue(),r=v(),i=P(),o=de(),s=yn(),c=it(),l=Ge(),u=tt(),d=L(),f=S(),p=d(`isConcatSpreadable`),m=f>=51||!t(function(){var e=[];return e[p]=!1,e.concat()[0]!==e}),h=function(e){if(!r(e))return!1;var t=e[p];return t===void 0?n(e):!!t};e({target:`Array`,proto:!0,arity:1,forced:!m||!u(`concat`)},{concat:function(e){var t=i(this),n=l(t,0),r=0,a,u,d,f,p;for(a=-1,d=arguments.length;a<d;a++)if(p=a===-1?t:arguments[a],h(p))for(f=o(p),s(r+f),u=0;u<f;u++,r++)u in p&&c(n,r,p[u]);else s(r+1),c(n,r++,p);return n.length=r,n}})})),xn=r(((e,t)=>{var n=W(),r=Zt();t.exports=function(e,t,i,a){try{return a?t(n(i)[0],i[1]):t(i)}catch(t){r(e,`throw`,t)}}})),Sn=r(((e,t)=>{var n=He(),r=c(),i=P(),a=xn(),o=Jt(),s=Ee(),l=de(),u=it(),d=Xt(),f=Yt(),p=Array;t.exports=function(e){var t=i(e),c=s(this),m=arguments.length,h=m>1?arguments[1]:void 0,g=h!==void 0;g&&(h=n(h,m>2?arguments[2]:void 0));var _=f(t),v=0,y,b,x,S,C,w;if(_&&!(this===p&&o(_)))for(b=c?new this:[],S=d(t,_),C=S.next;!(x=r(C,S)).done;v++)w=g?a(S,h,[x.value,v],!0):x.value,u(b,v,w);else for(y=l(t),b=c?new this(y):p(y);y>v;v++)w=g?h(t[v],v):t[v],u(b,v,w);return b.length=v,b}})),Cn=r((()=>{var e=Y(),t=Sn();e({target:`Array`,stat:!0,forced:!$t()(function(e){Array.from(e)})},{from:t})})),wn=r(((e,t)=>{var n=d(),r=ce(),i=Pe(),a=h(),o=n(``.charAt),s=n(``.charCodeAt),c=n(``.slice),l=function(e){return function(t,n){var l=i(a(t)),u=r(n),d=l.length,f,p;return u<0||u>=d?e?``:void 0:(f=s(l,u),f<55296||f>56319||u+1===d||(p=s(l,u+1))<56320||p>57343?e?o(l,u):f:e?c(l,u,u+2):(f-55296<<10)+(p-56320)+65536)}};t.exports={codeAt:l(!1),charAt:l(!0)}})),Tn=r(((e,t)=>{t.exports=!a()(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})})),En=r(((e,t)=>{var n=F(),r=_(),i=P(),a=re(),o=Tn(),s=a(`IE_PROTO`),c=Object,l=c.prototype;t.exports=o?c.getPrototypeOf:function(e){var t=i(e);if(n(t,s))return t[s];var a=t.constructor;return r(a)&&t instanceof a?a.prototype:t instanceof c?l:null}})),Dn=r(((e,t)=>{var n=a(),r=_(),i=v(),o=je(),s=En(),c=q(),l=L(),u=A(),d=l(`iterator`),f=!1,p,m,h;[].keys&&(h=[].keys(),`next`in h?(m=s(s(h)),m!==Object.prototype&&(p=m)):f=!0),!i(p)||n(function(){var e={};return p[d].call(e)!==e})?p={}:u&&(p=o(p)),r(p[d])||c(p,d,function(){return this}),t.exports={IteratorPrototype:p,BUGGY_SAFARI_ITERATORS:f}})),On=r(((e,t)=>{var n=Dn().IteratorPrototype,r=je(),i=u(),a=ye(),o=qt(),s=function(){return this};t.exports=function(e,t,c,l){var u=t+` Iterator`;return e.prototype=r(n,{next:i(+!l,c)}),a(e,u,!1,!0),o[u]=s,e}})),kn=r(((e,t)=>{var n=Y(),r=c(),i=A(),a=K(),o=_(),s=On(),l=En(),u=jt(),d=ye(),f=G(),p=q(),m=L(),h=qt(),g=Dn(),v=a.PROPER,y=a.CONFIGURABLE,b=g.IteratorPrototype,x=g.BUGGY_SAFARI_ITERATORS,S=m(`iterator`),C=`keys`,w=`values`,T=`entries`,E=function(){return this};t.exports=function(e,t,a,c,m,g,_){s(a,t,c);var D=function(e){if(e===m&&M)return M;if(!x&&e&&e in A)return A[e];switch(e){case C:return function(){return new a(this,e)};case w:return function(){return new a(this,e)};case T:return function(){return new a(this,e)}}return function(){return new a(this)}},O=t+` Iterator`,k=!1,A=e.prototype,j=A[S]||A[`@@iterator`]||m&&A[m],M=!x&&j||D(m),N=t===`Array`&&A.entries||j,P,F,I;if(N&&(P=l(N.call(new e)),P!==Object.prototype&&P.next&&(!i&&l(P)!==b&&(u?u(P,b):o(P[S])||p(P,S,E)),d(P,O,!0,!0),i&&(h[O]=E))),v&&m===w&&j&&j.name!==w&&(!i&&y?f(A,`name`,w):(k=!0,M=function(){return r(j,this)}
1)),m){if(F={values:D(w),keys:g?M:D(C),entries:D(T)},_)for(I in F)(x||k||!(I in A))&&p(A,I,F[I]);else n({target:t,proto:!0,forced:x||k},F)}return(!i||_)&&A[S]!==M&&p(A,S,M,{name:m}),h[t]=M,F}})),An=r(((e,t)=>{t.exports=function(e,t){return{value:e,done:t}}})),jn=r((()=>{var e=wn().charAt,t=Pe(),n=ae(),r=kn(),i=An(),a=`String Iterator`,o=n.set,s=n.getterFor(a);r(String,`String`,function(e){o(this,{type:a,string:t(e),index:0})},function(){var t=s(this),n=t.string,r=t.index,a;return r>=n.length?i(void 0,!0):(a=e(n,r),t.index+=a.length,i(a,!1))})})),Mn=r(((e,t)=>{(function(e,n){typeof define==`function`&&define.amd?define(n):typeof t==`object`&&t.exports?t.exports=n():e.log=n()})(e,function(){var e=function(){},t=`undefined`,n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=[`trace`,`debug`,`info`,`warn`,`error`],i={},a=null;function o(e,t){var n=e[t];if(typeof n.bind==`function`)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch{return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(r){return r===`debug`&&(r=`log`),typeof console===t?!1:r===`trace`&&n?s:console[r]===void 0?console.log===void 0?e:o(console,`log`):o(console,r)}function l(){for(var n=this.getLevel(),i=0;i<r.length;i++){var a=r[i];this[a]=i<n?e:this.methodFactory(a,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return`No console available for logging`}function u(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function d(e,t,n){return c(e)||u.apply(this,arguments)}function f(e,n){var o=this,s,c,u,f=`loglevel`;typeof e==`string`?f+=`:`+e:typeof e==`symbol`&&(f=void 0);function p(e){var n=(r[e]||`silent`).toUpperCase();if(!(typeof window===t||!f)){try{window.localStorage[f]=n;return}catch{}try{window.document.cookie=encodeURIComponent(f)+`=`+n+`;`}catch{}}}function m(){var e;if(!(typeof window===t||!f)){try{e=window.localStorage[f]}catch{}if(typeof e===t)try{var n=window.document.cookie,r=encodeURIComponent(f),i=n.indexOf(r+`=`);i!==-1&&(e=/^([^;]+)/.exec(n.slice(i+r.length+1))[1])}catch{}return o.levels[e]===void 0&&(e=void 0),e}}function h(){if(!(typeof window===t||!f)){try{window.localStorage.removeItem(f)}catch{}try{window.document.cookie=encodeURIComponent(f)+`=; expires=Thu, 01 Jan 1970 00:00:00 UTC`}catch{}}}function g(e){var t=e;if(typeof t==`string`&&o.levels[t.toUpperCase()]!==void 0&&(t=o.levels[t.toUpperCase()]),typeof t==`number`&&t>=0&&t<=o.levels.SILENT)return t;throw TypeError(`log.setLevel() called with invalid level: `+e)}o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=n||d,o.getLevel=function(){return u??c??s},o.setLevel=function(e,t){return u=g(e),t!==!1&&p(u),l.call(o)},o.setDefaultLevel=function(e){c=g(e),m()||o.setLevel(e,!1)},o.resetLevel=function(){u=null,h(),l.call(o)},o.enableAll=function(e){o.setLevel(o.levels.TRACE,e)},o.disableAll=function(e){o.setLevel(o.levels.SILENT,e)},o.rebuild=function(){if(a!==o&&(s=g(a.getLevel())),l.call(o),a===o)for(var e in i)i[e].rebuild()},s=g(a?a.getLevel():`WARN`);var _=m();_!=null&&(u=g(_)),l.call(o)}a=new f,a.getLogger=function(e){if(typeof e!=`symbol`&&typeof e!=`string`||e===``)throw TypeError(`You must supply a name when creating a logger.`);var t=i[e];return t||=i[e]=new f(e,a.methodFactory),t};var p=typeof window===t?void 0:window.log;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=p),a},a.getLoggers=function(){return i},a.default=a,a})})),Nn=n({default:()=>Vn,end:()=>zn,parse:()=>Rn,pattern:()=>Ln,toSeconds:()=>Bn}),Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn=t((()=>{Pn=`\\d+(?:[\\.,]\\d+)?`,Fn=`P(?:${`(${Pn}W)`}|${`(${Pn}Y)?(${Pn}M)?(${Pn}D)?`}(?:${`T(${Pn}H)?(${Pn}M)?(${Pn}S)?`})?)`,In=[`weeks`,`years`,`months`,`days`,`hours`,`minutes`,`seconds`],Ln=new RegExp(Fn),Rn=e=>
1e.match(Ln).slice(1).reduce((e,t,n)=>(e[In[n]]=parseFloat(t)||0,e),{}),zn=(e,t)=>{let n=t?t.getTime():Date.now(),r=new Date(n);return r.setFullYear(r.getFullYear()+e.years),r.setMonth(r.getMonth()+e.months),r.setDate(r.getDate()+e.days),r.setHours(r.getHours()+e.hours),r.setMinutes(r.getMinutes()+e.minutes),r.setMilliseconds(r.getMilliseconds()+e.seconds*1e3),r.setDate(r.getDate()+e.weeks*7),r},Bn=(e,t)=>{let n=t?t.getTime():Date.now(),r=new Date(n);return(zn(e,r).getTime()-r.getTime())/1e3},Vn={end:zn,toSeconds:Bn,pattern:Ln,parse:Rn}})),Un=r(((e,t)=>{var n=L(),r=je(),i=ee().f,a=n(`unscopables`),o=Array.prototype;o[a]===void 0&&i(o,a,{configurable:!0,value:r(null)}),t.exports=function(e){o[a][e]=!0}})),Wn=r(((e,t)=>{var n=g(),r=Un(),i=qt(),a=ae(),s=ee().f,c=kn(),l=An(),u=A(),d=o(),f=`Array Iterator`,p=a.set,m=a.getterFor(f);t.exports=c(Array,`Array`,function(e,t){p(this,{type:f,target:n(e),index:0,kind:t})},function(){var e=m(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=null,l(void 0,!0);switch(e.kind){case`keys`:return l(n,!1);case`values`:return l(t[n],!1)}return l([n,t[n]],!1)},`values`);var h=i.Arguments=i.Array;if(r(`keys`),r(`values`),r(`entries`),!u&&d&&h.name!==`values`)try{s(h,`name`,{value:`values`})}catch{}})),Gn=r((()=>{var e=i(),t=xt(),n=St(),r=Wn(),a=G(),o=ye(),s=L()(`iterator`),c=r.values,l=function(e,n){if(e){if(e[s]!==c)try{a(e,s,c)}catch{e[s]=c}if(o(e,n,!0),t[n]){for(var i in r)if(e[i]!==r[i])try{a(e,i,r[i])}catch{e[i]=r[i]}}}};for(var u in t)l(e[u]&&e[u].prototype,u);l(n,`DOMTokenList`)})),Kn=r(((e,t)=>{var n=_(),r=v(),i=jt();t.exports=function(e,t,a){var o,s;return i&&n(o=t.constructor)&&o!==a&&r(s=o.prototype)&&s!==a.prototype&&i(e,s),e}})),qn=r(((e,t)=>{t.exports=d()(1 .valueOf)})),Jn=r(((e,t)=>{t.exports=` 2\v\f\r \xA0áââââââ ââââââ¯âã\u2028\u2029`})),Yn=r(((e,t)=>{var n=d(),r=h(),i=Pe(),a=Jn(),o=n(``.replace),s=RegExp(`^[`+a+`]+`),c=RegExp(`(^|[^`+a+`])[`+a+`]+$`),l=function(e){return function(t){var n=i(r(t));return e&1&&(n=o(n,s,``)),e&2&&(n=o(n,c,`$1`)),n}};t.exports={start:l(1),end:l(2),trim:l(3)}})),Xn=r((()=>{var e=Y(),t=A(),n=o(),r=i(),s=Re(),c=d(),l=ve(),u=F(),f=Kn(),p=b(),m=T(),h=R(),g=a(),_=J().f,v=H().f,y=ee().f,x=qn(),S=Yn().trim,C=`Number`,w=r[C],E=s[C],D=w.prototype,O=r.TypeError,k=c(``.slice),j=c(``.charCodeAt),M=function(e){var t=h(e,`number`);return typeof t==`bigint`?t:N(t)},N=function(e){var t=h(e,`number`),n,r,i,a,o,s,c,l;if(m(t))throw new O(`Cannot convert a Symbol value to a number`);if(typeof t==`string`&&t.length>2){if(t=S(t),n=j(t,0),n===43||n===45){if(r=j(t,2),r===88||r===120)return NaN}else if(n===48){switch(j(t,1)){case 66:case 98:i=2,a=49;break;case 79:case 111:i=8,a=55;break;default:return+t}for(o=k(t,2),s=o.length,c=0;c<s;c++)if(l=j(o,c),l<48||l>a)return NaN;return parseInt(o,i)}}return+t},P=l(C,!w(` 0o1`)||!w(`0b1`)||w(`+0x1`)),I=function(e){return p(D,e)&&g(function(){x(e)})},L=function(e){var t=arguments.length<1?0:w(M(e));return I(this)?f(Object(t),this,L):t};L.prototype=D,P&&!t&&(D.constructor=L),e({global:!0,constructor:!0,wrap:!0,forced:P},{Number:L});var z=function(e,t){for(var r=n?_(t):`MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range`.split(`,`),i=0,a;r.length>i;i++)u(t,a=r[i])&&!u(e,a)&&y(e,a,v(t,a))};t&&E&&z(s[C],E),(P||t)&&z(s[C],w)})),Zn=r(((e,t)=>{var n=W();t.exports=function(){var e=n(this),t=``;return e.hasIndices&&(t+=`d`),e.global&&(t+=`g`),e.ignoreCase&&(t+=`i`),e.multiline&&(t+=`m`),e.dotAll&&(t+=`s`),e.unicode&&(t+=`u`),e.unicodeSets&&(t+=`v`),e.sticky&&(t+=`y`),t}})),Qn=r(((e,t)=>{var n=a(),r=i().RegExp,o=n(function(){var e=r(`a`,`y`);return e.lastIndex=2,e.exec(`abcd`)!==null}),s=o||n(function(){return!r(`a`,`y`).sticky});t.exports={BROKEN_CARET:o||n(function(){var e=r(`^r`,`gy`);return e.lastIndex=2,e.exec(`str`)!==null}),MISSED_STICKY:s,UNSUPPORTED_Y:o}})),$n=r(((e,t)=>{var n=a(),r=i().RegExp;t.exports=n(function(){var e=r(`.`,`s`);return!(e.dotAll&&e.test(` 3`)&&e.flags===`s`)}
3)})),er=r(((e,t)=>{var n=a(),r=i().RegExp;t.exports=n(function(){var e=r(`(?<a>b)`,`g`);return e.exec(`b`).groups.a!==`b`||`b`.replace(e,`$<a>c`)!==`bc`})})),tr=r(((e,t)=>{var n=c(),r=d(),i=Pe(),a=Zn(),o=Qn(),s=N(),l=je(),u=ae().get,f=$n(),p=er(),m=s(`native-string-replace`,String.prototype.replace),h=RegExp.prototype.exec,g=h,_=r(``.charAt),v=r(``.indexOf),y=r(``.replace),b=r(``.slice),x=(function(){var e=/a/,t=/b*/g;return n(h,e,`a`),n(h,t,`a`),e.lastIndex!==0||t.lastIndex!==0})(),S=o.BROKEN_CARET,C=/()??/.exec(``)[1]!==void 0;(x||C||S||f||p)&&(g=function(e){var t=this,r=u(t),o=i(e),s=r.raw,c,d,f,p,w,T,E;if(s)return s.lastIndex=t.lastIndex,c=n(g,s,o),t.lastIndex=s.lastIndex,c;var D=r.groups,O=S&&t.sticky,k=n(a,t),A=t.source,j=0,M=o;if(O&&(k=y(k,`y`,``),v(k,`g`)===-1&&(k+=`g`),M=b(o,t.lastIndex),t.lastIndex>0&&(!t.multiline||t.multiline&&_(o,t.lastIndex-1)!==` 4`)&&(A=`(?: `+A+`)`,M=` `+M,j++),d=RegExp(`^(?:`+A+`)`,k)),C&&(d=RegExp(`^`+A+`$(?!\\s)`,k)),x&&(f=t.lastIndex),p=n(h,O?d:t,M),O?p?(p.input=b(p.input,j),p[0]=b(p[0],j),p.index=t.lastIndex,t.lastIndex+=p[0].length):t.lastIndex=0:x&&p&&(t.lastIndex=t.global?p.index+p[0].length:f),C&&p&&p.length>1&&n(m,p[0],d,function(){for(w=1;w<arguments.length-2;w++)arguments[w]===void 0&&(p[w]=void 0)}),p&&D)for(p.groups=T=l(null),w=0;w<D.length;w++)E=D[w],T[E[0]]=p[E[1]];return p}),t.exports=g})),nr=r((()=>{var e=Y(),t=tr();e({target:`RegExp`,proto:!0,forced:/./.exec!==t},{exec:t})})),rr=r(((e,t)=>{nr();var n=c(),r=q(),i=tr(),o=a(),s=L(),l=G(),u=s(`species`),d=RegExp.prototype;t.exports=function(e,t,a,c){var f=s(e),p=!o(function(){var t={};return t[f]=function(){return 7},``[e](t)!==7}),m=p&&!o(function(){var t=!1,n=/a/;return e===`split`&&(n={},n.constructor={},n.constructor[u]=function(){return n},n.flags=``,n[f]=/./[f]),n.exec=function(){return t=!0,null},n[f](``),!t});if(!p||!m||a){var h=/./[f],g=t(f,``[e],function(e,t,r,a,o){var s=t.exec;return s===i||s===d.exec?p&&!o?{done:!0,value:n(h,t,r,a)}:{done:!0,value:n(e,r,t,a)}:{done:!1}});r(String.prototype,e,g[0]),r(d,f,g[1])}c&&l(d[f],`sham`,!0)}})),ir=r(((e,t)=>{var n=wn().charAt;t.exports=function(e,t,r){return t+(r?n(e,t).length:1)}})),ar=r(((e,t)=>{var n=d(),r=P(),i=Math.floor,a=n(``.charAt),o=n(``.replace),s=n(``.slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,l=/\$([$&'`]|\d{1,2})/g;t.exports=function(e,t,n,u,d,f){var p=n+e.length,m=u.length,h=l;return d!==void 0&&(d=r(d),h=c),o(f,h,function(r,o){var c;switch(a(o,0)){case`$`:return`$`;case`&`:return e;case"`":return s(t,0,n);case`'`:return s(t,p);case`<`:c=d[s(o,1,-1)];break;default:var l=+o;if(l===0)return r;if(l>m){var f=i(l/10);return f===0?r:f<=m?u[f-1]===void 0?a(o,1):u[f-1]+a(o,1):r}c=u[l-1]}return c===void 0?``:c})}})),or=r(((e,t)=>{var n=c(),r=W(),i=_(),a=f(),o=tr(),s=TypeError;t.exports=function(e,t){var c=e.exec;if(i(c)){var l=n(c,e,t);return l!==null&&r(l),l}if(a(e)===`RegExp`)return n(o,e,t);throw new s(`RegExp#exec called on incompatible receiver`)}})),sr=r((()=>{var e=xe(),t=c(),n=d(),r=rr(),i=a(),o=W(),s=_(),l=m(),u=ce(),f=ue(),p=Pe(),g=h(),v=ir(),y=O(),b=ar(),x=or(),S=L()(`replace`),C=Math.max,w=Math.min,T=n([].concat),E=n([].push),D=n(``.indexOf),k=n(``.slice),A=function(e){return e===void 0?e:String(e)},j=(function(){return`a`.replace(/./,`$0`)===`$0`})(),M=(function(){return/./[S]?/./[S](`a`,`$0`)===``:!1})();r(`replace`,function(n,r,i){var a=M?`$`:`$0`;return[function(e,n){var i=g(this),a=l(e)?void 0:y(e,S);return a?t(a,e,i,n):t(r,p(i),e,n)},function(t,n){var c=o(this),l=p(t);if(typeof n==`string`&&D(n,a)===-1&&D(n,`$<`)===-1){var d=i(r,c,l,n);if(d.done)return d.value}var m=s(n);m||(n=p(n));var h=c.global,g;h&&(g=c.unicode,c.lastIndex=0);for(var _=[],y;y=x(c,l),!(y===null||(E(_,y),!h));)p(y[0])===``&&(c.lastIndex=v(l,f(c.lastIndex),g));for(var S=``,O=0,j=0;j<_.length;j++){y=_[j];for(var M=p(y[0]),N=C(w(u(y.index),l.length),0),P=[],F,I=1;I<y.length;I++)E(P,A(y[I]));var L=y.groups;if(m){var R=T([M],P,N,l);L!==void 0&&E(R,L),F=p(e(n,void 0,R))}else F=b(M,l,N,P,L,n);N>=O&&(S+=k(l,O,N)+F,O=N+M.length)}return S+k(l,O)}]},!!i(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:`7`},e},``.replace(e,`$<a>`)!==`7`})||!j||M)})),Q=r((()=>{var e=Y(),t=d(),n=p(),r=g(),i=Ct(),a=t([].join);e({target:`Array`,proto:!0,forced:n!==Object||!i(`join`,`,`)},{join:function(e){return a(r(this),e===void 0?`,`:e)}})})),cr=r((()=>{var e=o(),t=K().EXISTS,n=d(),r=Ie(),i=Function.prototype,a=n(i.toString),s=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,c=n(s.exec);e&&!t&&r(i,`name`,{configurable:!0,get:function(){try{return c(s,a(this))[1]}catch{return``}}})})),lr=r(((e,t)=>{function n(e){if(Array.isArray(e))return e}
4t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),ur=r(((e,t)=>{function n(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),dr=r(((e,t)=>{function n(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),fr=r(((e,t)=>{var n=dr();function r(e,t){if(e){if(typeof e==`string`)return n(e,t);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),pr=r(((e,t)=>{function n(){throw TypeError(`Invalid attempt to destructure non-iterable instance. 5In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),mr=r(((e,t)=>{var n=lr(),r=ur(),i=fr(),a=pr();function o(e,t){return n(e)||r(e,t)||i(e,t)||a()}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports})),hr=r((()=>{var e=Y(),t=Ue(),n=Ee(),r=v(),i=le(),a=de(),o=g(),s=it(),c=L(),l=tt(),u=Se(),d=l(`slice`),f=c(`species`),p=Array,m=Math.max;e({target:`Array`,proto:!0,forced:!d},{slice:function(e,c){var l=o(this),d=a(l),h=i(e,d),g=i(c===void 0?d:c,d),_,v,y;if(t(l)&&(_=l.constructor,n(_)&&(_===p||t(_.prototype))?_=void 0:r(_)&&(_=_[f],_===null&&(_=void 0)),_===p||_===void 0))return u(l,h,g);for(v=new(_===void 0?p:_)(m(g-h,0)),y=0;h<g;h++,y++)h in l&&s(v,y,l[h]);return v.length=y,v}})})),gr=r((()=>{nr();var e=Y(),t=c(),n=_(),r=W(),i=Pe(),a=function(){var e=!1,t=/[ac]/;return t.exec=function(){return e=!0,/./.exec.apply(this,arguments)},t.test(`abc`)===!0&&e}(),o=/./.test;e({target:`RegExp`,proto:!0,forced:!a},{test:function(e){var a=r(this),s=i(e),c=a.exec;if(!n(c))return t(o,a,s);var l=t(c,a,s);return l!==null&&(r(l),!0)}})})),_r=r((()=>{var e=Y(),t=o(),n=i(),r=d(),a=F(),s=_(),c=b(),l=Pe(),u=Ie(),f=_e(),p=n.Symbol,m=p&&p.prototype;if(t&&s(p)&&(!(`description`in m)||p().description!==void 0)){var h={},g=function(){var e=arguments.length<1||arguments[0]===void 0?void 0:l(arguments[0]),t=c(m,this)?new p(e):e===void 0?p():p(e);return e===``&&(h[t]=!0),t};f(g,p),g.prototype=m,m.constructor=g;var v=String(p(`description detection`))===`Symbol(description detection)`,y=r(m.valueOf),x=r(m.toString),S=/^Symbol\((.*)\)[^)]+$/,C=r(``.replace),w=r(``.slice);u(m,`description`,{configurable:!0,get:function(){var e=y(this);if(a(h,e))return``;var t=x(e),n=v?w(t,7,-1):C(t,S,`$1`);return n===``?void 0:n}}),e({global:!0,constructor:!0,forced:!0},{Symbol:g})}})),vr=r((()=>{ze()(`iterator`)})),yr=r(((e,t)=>{var n=dr();function r(e){if(Array.isArray(e))return n(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),br=r(((e,t)=>{function n(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),xr=r(((e,t)=>{function n(){throw TypeError(`Invalid attempt to spread non-iterable instance. 6In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Sr=r(((e,t)=>{var n=yr(),r=br(),i=fr(),a=xr();function o(e){return n(e)||r(e)||i(e)||a()}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports})),Cr=r((()=>{var e=Y(),t=fe().includes,n=a(),r=Un();e({target:`Array`,proto:!0,forced:n(function(){return![,].includes()})},{includes:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}}),r(`includes`)})),wr=r(((e,t)=>{var n=v(),r=Math.floor;t.exports=Number.isInteger||function(e){return!n(e)&&isFinite(e)&&r(e)===e}})),Tr=r((()=>{Y()({target:`Number`,stat:!0},{isInteger:wr()})})),Er=r(((e,t)=>{var n=o(),r=a(),i=d(),s=En(),c=Oe(),u=g(),f=l().f,p=i(f),m=i([].push),h=n&&r(function(){var e=Object.create(null);return e[2]=2,!p(e,2)}),_=function(e){return function(t){for(var r=u(t),i=c(r),a=h&&s(r)===null,o=i.length,l=0,d=[],f;o>l;)f=i[l++],(!n||(a?f in r:p(r,f)))&&m(d,e?[f,r[f]]:r[f]);return d}};t.exports={entries:_(!0),values:_(!1)}})),Dr=r((()=>
6{var e=Y(),t=Er().entries;e({target:`Object`,stat:!0},{entries:function(e){return t(e)}})})),Or=r((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ut();cr();var n=mr();Wn(),bt(),Gn(),bn(),hr(),Cn(),jn(),nr(),gr(),et(),_r(),vr(),be(),Me();var r=Sr(),i=gt(),a=_t(),o=lt(),s=dt(),c=ft();Cr(),cn(),Q(),Tr(),Xn(),Dr();function l(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var u=l(t),d=l(n),f=l(r),p=l(i),m=l(a),h=l(o),g=l(s),_=l(c),v=function(){return{checks:[...arguments]}},y=function(){var e=[...arguments];return v(function(t){for(var n=!1,r=[],i=0,a=e;i<a.length;i++){var o=a[i];if(typeof o==`string`){n||=u.default(t)===o,r.push(`of type ${o}`);continue}n||=t instanceof o,r.push(`an instance of ${o.name}`)}return[n,r]})},b=function(){var e=[...arguments];return v(function(t){for(var n=!1,r=[],i=0,a=e;i<a.length;i++){var o=a[i];n||=t===o,r.push(typeof o==`string`?`"${o}"`:`${o}`)}return[n,r]})};function x(e){var t=S();return function(){var n=_.default(e),r;if(t){var i=_.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return g.default(this,r)}}function S(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function C(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=w(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 7In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function w(e,t){if(e){if(typeof e==`string`)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T(e,t)}}function T(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var E=function(e,t){if(t.length>e.length)throw Error(`Expected at most ${e.length} argument(s), but got ${t.length}`);for(;t.length<e.length;)t.push(void 0);var n=C(t.entries()),r;try{for(n.s();!(r=n.n()).done;){var i=d.default(r.value,2),a=i[0],o=i[1],s=N(e[a],o),c=d.default(s,4),l=c[0],u=c[1],f=c[2],p=c[3];if(!l){var m=a+1;throw Error(`Argument ${m} is expected to be ${f}${p} but got ${u}`)}}}catch(e){n.e(e)}finally{n.f()}},D=function(e){var t;return[`undefined`,`boolean`,`number`,`bigint`,`string`].includes(u.default(e))&&(t=typeof e==`string`?`"${e}"`:`${e}`),u.default(e)===`object`&&e?.constructor?.name!==`Object`&&(t=e===null?`null`:`instance of ${e?.constructor?.name}`),t||=u.default(e),t},O=function(){var e=j([...arguments]);return function(t){return function(t){h.default(r,t);var n=x(r);function r(){m.default(this,r);var t=[...arguments];return E(e,t),n.call.apply(n,[this].concat(t))}return p.default(r)}(t)}},k=function(){var e=j([...arguments]);return function(t,n,r){if(typeof r.value!=`function`)throw Error(`The validateTypes decorator can only be applied to methods`);var i=r.value;r.value=function(){var t=[...arguments];return E(e,t),i.apply(this,t)}}},A=function(){var e=j([...arguments]);return function(t,n,r){if(typeof r.value!=`function`)throw Error(`The validateTypesAsync decorator can only be applied to methods`);var i=r.value;r.value=function(){var t=[...arguments];try{E(e,t)}catch(e){return Promise.reject(e)}return i.apply(this,t)}}},j=function(e){var t=[],n=C(e),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;t.push(M(i))}}catch(e){n.e(e)}finally{n.f()}return t},M=function(e){var t=[],n=C(Array.isArray(e)?e:[e]),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(typeof i==`string`||typeof i==`function`){t.push(y(i));continue}t.push(i)}}catch(e){n.e(e)}finally{n.f()}return t},N=function(e,t){var n=[],r,i=!1,a=C(e),o;try{for(a.s();!(o=a.n()).done;){var s=o.value,c=C(s.checks),l;
7try{for(c.s();!(l=c.n()).done;){var u=l.value,p=u(t),m=d.default(p,3),h=m[0],g=m[1],_=m[2];i||=h,!r&&_&&(r=_),g&&(n=typeof g==`string`?[].concat(f.default(n),[g]):[].concat(f.default(n),f.default(g)))}}catch(e){c.e(e)}finally{c.f()}}}catch(e){a.e(e)}finally{a.f()}if(i)return[!0];var v=r||D(t),y=n.length-1;return[!1,v,y>0?`${n.slice(0,y).join(`, `)} or ${n[y]}`:n.join(`, `),y>1?`;`:`,`]};function P(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=F(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 8In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function F(e,t){if(e){if(typeof e==`string`)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,t)}}function I(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var L=function(e,t){return v(function(n){if(!Array.isArray(n)||n.length<1)return[!1,`a non-empty array of ${e}`];var r=P(n.entries()),i;try{for(r.s();!(i=r.n()).done;){var a=d.default(i.value,2),o=a[0],s=a[1],c=N(M(t),s),l=d.default(c,3),u=l[0],f=l[1],p=l[2];if(!u)return[!1,`a valid non-empty array of ${e} (index ${o} should be ${p})`,`malformed array of ${e} (index ${o} is ${f})`]}}catch(e){r.e(e)}finally{r.f()}return[!0]})},R=v(function(e){return[typeof e==`string`&&e.length>0,`a non-empty string`]}),z=v(function(e){return[typeof e==`number`&&Number.isInteger(e)&&e>=0,`a non-negative integer`]}),B=v(function(e){return[u.default(e)===`object`&&e!==null&&!Array.isArray(e),`a pure object (non-null and non-array)`]}),V=function(e,t){return v(function(n){if(u.default(n)!==`object`||n===null||Array.isArray(n))return[!1,`valid ${e} (should be a pure object)`];for(var r=0,i=Object.entries(t);r<i.length;r++){var a=d.default(i[r],2),o=a[0],s=a[1],c=N(M(s),n[o]),l=d.default(c,3),f=l[0],p=l[1],m=l[2];if(!f)return[!1,`valid ${e} (key "${o}" should be ${m})`,`malformed ${e} (key "${o}" is ${p})`]}return[!0]})};function H(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=U(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 9In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function U(e,t){if(e){if(typeof e==`string`)return W(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return W(e,t)}}function W(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}e.array=function(e,t){return v(function(n){if(!Array.isArray(n))return[!1,`an array of ${e}`];var r=H(n.entries()),i;try{for(r.s();!(i=r.n()).done;){var a=d.default(i.value,2),o=a[0],s=a[1],c=N(M(t),s),l=d.default(c,3),u=l[0],f=l[1],p=l[2];if(!u)return[!1,`a valid array of ${e} (index ${o} should be ${p})`,`malformed array of ${e} (index ${o} is ${f})`]}}catch(e){r.e(e)}finally{r.f()}return[!0]})},e.custom=v,e.literal=b,e.nonEmptyArray=L,e.nonEmptyString=R,e.nonNegativeInteger=z,e.objectSchema=V,e.pureObject=B,e.runtimeTypeValidation=E,e.stringifyReceivedType=D,e.type=y,e.validateConstructorTypes=O,e.validateTypes=k,e.validateTypesAsync=A})),kr=r(((e,t)=>{var n=ft();function r(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=n(e))!==null;);return e}
9t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),Ar=r(((e,t)=>{var n=kr();function r(){return t.exports=r=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,r){var i=n(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(arguments.length<3?e:r):a.value}},t.exports.__esModule=!0,t.exports.default=t.exports,r.apply(null,arguments)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),jr=r((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Sr(),n=_t(),r=gt(),i=st(),a=Ar(),o=lt(),s=dt(),c=ft(),l=ht();function u(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var d=u(t),f=u(n),p=u(r),m=u(i),h=u(a),g=u(o),_=u(s),v=u(c),y=u(l),b;function x(){}x.prototype=Object.create(null);function S(){S.init.call(this)}S.EventEmitter=S,S.usingDomains=!1,S.prototype.domain=void 0,S.prototype._events=void 0,S.prototype._maxListeners=void 0,S.defaultMaxListeners=10,S.init=function(){this.domain=null,S.usingDomains&&b.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new x,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},S.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||isNaN(e))throw TypeError(`"n" argument must be a positive number`);return this._maxListeners=e,this};function C(e){return e._maxListeners===void 0?S.defaultMaxListeners:e._maxListeners}S.prototype.getMaxListeners=function(){return C(this)};function w(e,t,n){if(t)e.call(n);else for(var r=e.length,i=P(e,r),a=0;a<r;++a)i[a].call(n)}function T(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,a=P(e,i),o=0;o<i;++o)a[o].call(n,r)}function E(e,t,n,r,i){if(t)e.call(n,r,i);else for(var a=e.length,o=P(e,a),s=0;s<a;++s)o[s].call(n,r,i)}function D(e,t,n,r,i,a){if(t)e.call(n,r,i,a);else for(var o=e.length,s=P(e,o),c=0;c<o;++c)s[c].call(n,r,i,a)}function O(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,a=P(e,i),o=0;o<i;++o)a[o].apply(n,r)}S.prototype.emit=function(e){var t,n,r,i,a,o,s,c=e===`error`;if(o=this._events,o)c&&=o.error==null;else if(!c)return!1;if(s=this.domain,c){if(t=arguments[1],s)t||=Error(`Uncaught, unspecified "error" event`),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit(`error`,t);else if(t instanceof Error)throw t;else{var l=Error(`Uncaught, unspecified "error" event. (`+t+`)`);throw l.context=t,l}return!1}if(n=o[e],!n)return!1;var u=typeof n==`function`;switch(r=arguments.length,r){case 1:w(n,u,this);break;case 2:T(n,u,this,arguments[1]);break;case 3:E(n,u,this,arguments[1],arguments[2]);break;case 4:D(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=Array(r-1),a=1;a<r;a++)i[a-1]=arguments[a];O(n,u,this,i)}return!0};function k(e,t,n,r){var i,a,o;if(typeof n!=`function`)throw TypeError(`"listener" argument must be a function`);if(a=e._events,a?(a.newListener&&(e.emit(`newListener`,t,n.listener?n.listener:n),a=e._events),o=a[t]):(a=e._events=new x,e._eventsCount=0),!o)o=a[t]=n,++e._eventsCount;else if(typeof o==`function`?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=C(e),i&&i>0&&o.length>i)){o.warned=!0;var s=Error(`Possible EventEmitter memory leak detected. `+o.length+` `+t+` listeners added. Use emitter.setMaxListeners() to increase limit`);s.name=`MaxListenersExceededWarning`,s.emitter=e,s.type=t,s.count=o.length,A(s)}return e}function A(e){typeof console.warn==`function`?console.warn(e):console.log(e)}S.prototype.addListener=function(e,t){return k(this,e,t,!1)},S.prototype.on=S.prototype.addListener,S.prototype.prependListener=function(e,t){return k(this,e,t,!0)};function j(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}S.prototype.once=function(e,t){if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);return this.on(e,j(this,e,t)),this},S.prototype.prependOnceListener=function(e,t){if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);return this.prependListener(e,j(this,e,t)),this},S.prototype.removeListener=function(e,t){var n,r,i,a,o;if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);if(r=this._events,!r||(n=r[e],!n))return this;if(n===t||n.listener&&n.listener===t)--this._eventsCount===0?this._events=new x:(delete r[e],r.removeListener&&this.emit
9(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length;a-->0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount===0)return this._events=new x,this;delete r[e]}else N(n,i);r.removeListener&&this.emit(`removeListener`,e,o||t)}return this},S.prototype.off=function(e,t){return this.removeListener(e,t)},S.prototype.removeAllListeners=function(e){var t,n=this._events;if(!n)return this;if(!n.removeListener)return arguments.length===0?(this._events=new x,this._eventsCount=0):n[e]&&(--this._eventsCount===0?this._events=new x:delete n[e]),this;if(arguments.length===0){for(var r=Object.keys(n),i=0,a;i<r.length;++i)a=r[i],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=new x,this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t)do this.removeListener(e,t[t.length-1]);while(t[0]);return this},S.prototype.listeners=function(e){var t,n,r=this._events;return r?(t=r[e],n=t?typeof t==`function`?[t.listener||t]:F(t):[]):n=[],n},S.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):M.call(e,t)},S.prototype.listenerCount=M;function M(e){var t=this._events;if(t){var n=t[e];if(typeof n==`function`)return 1;if(n)return n.length}return 0}S.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function N(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}function P(e,t){for(var n=Array(t);t--;)n[t]=e[t];return n}function F(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function I(e){var t=L();return function(){var n=v.default(e),r;if(t){var i=v.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _.default(this,r)}}function L(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}e.ReplayEventEmitter=function(e){g.default(n,e);var t=I(n);function n(){var e;return f.default(this,n),e=t.call(this),y.default(m.default(e),`eventHistory`,new Map),e}return p.default(n,[{key:`on`,value:function(e,t){return h.default(v.default(n.prototype),`on`,this).call(this,e,t)}},{key:`once`,value:function(e,t){return h.default(v.default(n.prototype),`once`,this).call(this,e,t)}},{key:`off`,value:function(e,t){return h.default(v.default(n.prototype),`off`,this).call(this,e,t)}},{key:`emit`,value:function(e){var t,r=[...arguments].slice(1);return this.eventHistory.set(e,r),(t=h.default(v.default(n.prototype),`emit`,this)).call.apply(t,[this,e].concat(r))}},{key:`addListener`,value:function(e,t){return h.default(v.default(n.prototype),`addListener`,this).call(this,e,t)}},{key:`removeListener`,value:function(e,t){return h.default(v.default(n.prototype),`removeListener`,this).call(this,e,t)}},{key:`addListenerWithReplay`,value:function(e,t){var n=this.eventHistory.get(e);return n!==void 0&&t.apply(void 0,d.default(n)),this.addListener(e,t)}},{key:`onWithReplay`,value:function(e,t){return this.addListenerWithReplay(e,t)}},{key:`onceWithReplay`,value:function(e,t){var r=this.eventHistory.get(e);return r===void 0?h.default(v.default(n.prototype),`once`,this).call(this,e,t):(t.apply(void 0,d.default(r)),this)}}]),n}(S)})),Mr=r(((e,t)=>{t.exports=a()(function(){if(typeof ArrayBuffer==`function`){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})})),Nr=r(((e,t)=>{var n=a(),r=v(),i=f(),o=Mr(),s=Object.isExtensible;t.exports=n(function(){s(1)})||o?function(e){return!r(e)||o&&i(e)===`ArrayBuffer`?!1:!s||s(e)}:s})),Pr=r(((e,t)=>{t.exports=!a()(function(){return Object.isExtensible(Object.preventExtensions({}))})})),Fr=r(((e,t)=>{var n=Y(),r=d(),i=ie(),a=v(),o=F(),s=ee().f,c=J(),l=Fe(),u=Nr(),f=I(),p=Pr(),m=!1,h=f(`meta`),g=0,_=function(e){s(e,h,{value:{objectID:`O`+g++,weakData:{}}})},y=t.exports={enable:function(){y.enable=function(){},m=!0;var e=c.f,t=r([].splice),i={};i[h]=1,e(i).length&&(c.f=function(n){for(var r=e(n),i=0,a=r.length;i<a;i++)if(r[i]===h){t(r,i,1);break}return r},n({target:`Object`,stat:!0,forced:!0},{getOwnPropertyNames:l.f}))},fastKey:function(e,t){if(!a(e))return typeof e==`symbol`?e:(typeof e==`string`?`S`:`P`)+e;if(!o(e,h)){if(!u(e))return`F`;if(!t)return`E`;_(e)}return e[h].objectID},getWeakData:function(e,t){if(!o(e,h)){if(!u(e))return!0;
9if(!t)return!1;_(e)}return e[h].weakData},onFreeze:function(e){return p&&m&&u(e)&&!o(e,h)&&_(e),e}};i[h]=!0})),Ir=r(((e,t)=>{var n=Y(),r=i(),o=d(),s=ve(),c=q(),l=Fr(),u=Qt(),f=X(),p=_(),h=m(),g=v(),y=a(),b=$t(),x=ye(),S=Kn();t.exports=function(e,t,i){var a=e.indexOf(`Map`)!==-1,d=e.indexOf(`Weak`)!==-1,m=a?`set`:`add`,_=r[e],v=_&&_.prototype,C=_,w={},T=function(e){var t=o(v[e]);c(v,e,e===`add`?function(e){return t(this,e===0?0:e),this}:e===`delete`?function(e){return d&&!g(e)?!1:t(this,e===0?0:e)}:e===`get`?function(e){return d&&!g(e)?void 0:t(this,e===0?0:e)}:e===`has`?function(e){return d&&!g(e)?!1:t(this,e===0?0:e)}:function(e,n){return t(this,e===0?0:e,n),this})};if(s(e,!p(_)||!(d||v.forEach&&!y(function(){new _().entries().next()}))))C=i.getConstructor(t,e,a,m),l.enable();else if(s(e,!0)){var E=new C,D=E[m](d?{}:-0,1)!==E,O=y(function(){E.has(1)}),k=b(function(e){new _(e)}),A=!d&&y(function(){for(var e=new _,t=5;t--;)e[m](t,t);return!e.has(-0)});k||(C=t(function(e,t){f(e,v);var n=S(new _,e,C);return h(t)||u(t,n[m],{that:n,AS_ENTRIES:a}),n}),C.prototype=v,v.constructor=C),(O||A)&&(T(`delete`),T(`has`),a&&T(`get`)),(A||D)&&T(m),d&&v.clear&&delete v.clear}return w[e]=C,n({global:!0,constructor:!0,forced:C!==_},w),x(C,e),d||i.setStrong(C,e,a),C}})),Lr=r(((e,t)=>{var n=q();t.exports=function(e,t,r){for(var i in t)n(e,i,t[i],r);return e}})),Rr=r(((e,t)=>{var n=je(),r=Ie(),i=Lr(),a=He(),s=X(),c=m(),l=Qt(),u=kn(),d=An(),f=Mt(),p=o(),h=Fr().fastKey,g=ae(),_=g.set,v=g.getterFor;t.exports={getConstructor:function(e,t,o,u){var d=e(function(e,r){s(e,f),_(e,{type:t,index:n(null),first:null,last:null,size:0}),p||(e.size=0),c(r)||l(r,e[u],{that:e,AS_ENTRIES:o})}),f=d.prototype,m=v(t),g=function(e,t,n){var r=m(e),i=y(e,t),a,o;return i?i.value=n:(r.last=i={index:o=h(t,!0),key:t,value:n,previous:a=r.last,next:null,removed:!1},r.first||=i,a&&(a.next=i),p?r.size++:e.size++,o!==`F`&&(r.index[o]=i)),e},y=function(e,t){var n=m(e),r=h(t),i;if(r!==`F`)return n.index[r];for(i=n.first;i;i=i.next)if(i.key===t)return i};return i(f,{clear:function(){for(var e=this,t=m(e),r=t.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=null),r=r.next;t.first=t.last=null,t.index=n(null),p?t.size=0:e.size=0},delete:function(e){var t=this,n=m(t),r=y(t,e);if(r){var i=r.next,a=r.previous;delete n.index[r.index],r.removed=!0,a&&(a.next=i),i&&(i.previous=a),n.first===r&&(n.first=i),n.last===r&&(n.last=a),p?n.size--:t.size--}return!!r},forEach:function(e){for(var t=m(this),n=a(e,arguments.length>1?arguments[1]:void 0),r;r=r?r.next:t.first;)for(n(r.value,r.key,this);r&&r.removed;)r=r.previous},has:function(e){return!!y(this,e)}}),i(f,o?{get:function(e){var t=y(this,e);return t&&t.value},set:function(e,t){return g(this,e===0?0:e,t)}}:{add:function(e){return g(this,e=e===0?0:e,e)}}),p&&r(f,`size`,{configurable:!0,get:function(){return m(this).size}}),d},setStrong:function(e,t,n){var r=t+` Iterator`,i=v(t),a=v(r);u(e,t,function(e,t){_(this,{type:r,target:e,state:i(e),kind:t,last:null})},function(){for(var e=a(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return!e.target||!(e.last=n=n?n.next:e.state.first)?(e.target=null,d(void 0,!0)):d(t===`keys`?n.key:t===`values`?n.value:[n.key,n.value],!1)},n?`entries`:`values`,!n,!0),f(t)}}})),zr=r((()=>{Ir()(`Map`,function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},Rr())})),Br=r((()=>{zr()})),Vr=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),be(),Me();var t=_t(),n=gt(),r=st(),i=lt(),a=dt(),o=ft(),s=ht();bt(),cn();function c(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var l=c(t),u=c(n),d=c(r),f=c(i),p=c(a),m=c(o),h=c(s),g;function _(){}_.prototype=Object.create(null);function v(){v.init.call(this)}v.EventEmitter=v,v.usingDomains=!1,v.prototype.domain=void 0,v.prototype._events=void 0,v.prototype._maxListeners=void 0,v.defaultMaxListeners=10,v.init=function(){this.domain=null,v.usingDomains&&g.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new _,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},v.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||isNaN(e))throw TypeError(`"n" argument must be a positive number`);return this._maxListeners=e,this};function y(e){return e._maxListeners===void 0?v.defaultMaxListeners:e._maxListeners}v.prototype.getMaxListeners=function(){return y(this)};function b(e,t,n){if(t)e.call(n);else for(var r=e.length,i=A(e,r),a=0;a<r;++a)i[a].call(n)}function x(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,a=A(e,i),o=0;o<i;++o)a[o].call(n,r)}function S(e,t,n,r,i){if(t)e.call(n,r,i);else for(var a=e.length,o=A(e,a),s=0;s<a;++s)o[s].call(n,r,i)}function C(e,t,n,r,i,a){if(t)e.call(n,r,i,a);else for(var o=e.length,s=A(e,o),c=0;c<o;++c)s[c].call(n,r,i,a)}function w(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,a=A(e,i),o=0;o<i;++o)a[o].apply(n,r)}v.prototype.emit=function(e){var t,n,r,i,a,o,s,c=e===`error`;if(o=this._events,o)c&&=o.error==null;else if(!c)return!1;if(s=this.domain,c){if(t=arguments[1],s)t||=Error(`Uncaught, unspecified "error" event`),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit(`error`,t);else if(t instanceof Error)throw t;else{var l=Error(`Uncaught, unspecified "error" event. (`+t+`)`);throw l.context=t,l}return!1}if(n=o[e],!n)return!1;var u=typeof n==`function`;switch(r=arguments.length,r){case 1:b(n,u,this);break;case 2:x(n,u,this,arguments[1]);break;case 3:S(n,u,this,arguments[1],arguments[2]);break;case 4:C(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=Array(r-1),a=1;a<r;a++)i[a-1]=arguments[a];w(n,u,this,i)}return!0};function T(e,t,n,r){var i,a,o;if(typeof n!=`function`)throw TypeError(`"listener" argument must be a function`);if(a=e._events,a?(a.newListener&&(e.emit(`newListener`,t,n.listener?n.listener:n),a=e._events),o=a[t]):(a=e._events=new _,e._eventsCount=0),!o)o=a[t]=n,++e._eventsCount;else if(typeof o==`function`?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=y(e),i&&i>0&&o.length>i)){o.warned=!0;var s=Error(`Possible EventEmitter memory leak detected. `+o.length+` `+t+` listeners added. Use emitter.setMaxListeners() to increase limit`);s.name=`MaxListenersExceededWarning`,s.emitter=e,s.type=t,s.count=o.length,E(s)}return e}function E(e){typeof console.warn==`function`?console.warn(e):console.log(e)}v.prototype.addListener=function(e,t){return T(this,e,t,!1)},v.prototype.on=v.prototype.addListener,v.prototype.prependListener=function(e,t){return T(this,e,t,!0)};function D(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}v.prototype.once=function(e,t){if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);return this.on(e,D(this,e,t)),this},v.prototype.prependOnceListener=function(e,t){if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);return this.prependListener(e,D(this,e,t)),this},v.prototype.removeListener=function(e,t){var n,r,i,a,o;if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);if(r=this._events,!r||(n=r[e],!n))return this;if(n===t||n.listener&&n.listener===t)--this._eventsCount===0?this._events=new _:(delete r[e],r.removeListener&&this.emit
9(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length;a-->0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount===0)return this._events=new _,this;delete r[e]}else k(n,i);r.removeListener&&this.emit(`removeListener`,e,o||t)}return this},v.prototype.off=function(e,t){return this.removeListener(e,t)},v.prototype.removeAllListeners=function(e){var t,n=this._events;if(!n)return this;if(!n.removeListener)return arguments.length===0?(this._events=new _,this._eventsCount=0):n[e]&&(--this._eventsCount===0?this._events=new _:delete n[e]),this;if(arguments.length===0){for(var r=Object.keys(n),i=0,a;i<r.length;++i)a=r[i],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=new _,this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t)do this.removeListener(e,t[t.length-1]);while(t[0]);return this},v.prototype.listeners=function(e){var t,n,r=this._events;return r?(t=r[e],n=t?typeof t==`function`?[t.listener||t]:j(t):[]):n=[],n},v.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):O.call(e,t)},v.prototype.listenerCount=O;function O(e){var t=this._events;if(t){var n=t[e];if(typeof n==`function`)return 1;if(n)return n.length}return 0}v.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function k(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}function A(e,t){for(var n=Array(t);t--;)n[t]=e[t];return n}function j(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function M(e){var t=N();return function(){var n=m.default(e),r;if(t){var i=m.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p.default(this,r)}}function N(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var P=function(e){f.default(n,e);var t=M(n);function n(e){var r;return l.default(this,n),r=t.call(this),h.default(d.default(r),`timeout`,null),h.default(d.default(r),`startTimestamp`,-1),r.minDelay=e.min,r.maxDelay=e.max,r.initialDelay=e.initial||0,r.maxAttemptsCount=e.maxAttemptsCount||0,r.maxAttemptsTime=e.maxAttemptsTime||0,r.randomness=e.randomness||0,r.inProgress=!1,r.attemptNum=0,r.prevDelay=0,r.currDelay=0,r}return u.default(n,[{key:`attempt`,value:function(){this.timeout&&=(clearTimeout(this.timeout),null),this.attemptNum++,this.emit(`attempt`,this)}},{key:`nextDelay`,value:function(e){if(typeof e==`number`)return this.prevDelay=0,this.currDelay=e,e;if(this.attemptNum==0)return this.initialDelay;if(this.attemptNum==1)return this.currDelay=this.minDelay,this.currDelay;this.prevDelay=this.currDelay;var t=this.currDelay+this.prevDelay;return this.maxDelay&&t>this.maxDelay&&(this.currDelay=this.maxDelay,t=this.maxDelay),this.currDelay=t,t}},{key:`randomize`,value:function(e){var t=e*this.randomness,n=Math.round(Math.random()*t*2-t);return Math.max(0,e+n)}},{key:`scheduleAttempt`,value:function(e){var t=this;if(this.maxAttemptsCount&&this.attemptNum>=this.maxAttemptsCount){this.cleanup(),this.emit(`failed`,Error(`Maximum attempt count limit reached`));return}var n=this.nextDelay(e);if(n=this.randomize(n),this.maxAttemptsTime&&this.startTimestamp+this.maxAttemptsTime<Date.now()+n){this.cleanup(),this.emit(`failed`,Error(`Maximum attempt time limit reached`));return}this.timeout=setTimeout(function(){return t.attempt()},n)}},{key:`cleanup`,value:function(){this.timeout&&=(clearTimeout(this.timeout),null),this.inProgress=!1,this.attemptNum=0,this.prevDelay=0,this.currDelay=0}},{key:`start`,value:function(){if(this.inProgress)throw Error(`Retrier is already in progress`);this.inProgress=!0,this.startTimestamp=Date.now(),this.scheduleAttempt(this.initialDelay)}},{key:`cancel`,value:function(){this.timeout&&(clearTimeout(this.timeout),this.timeout=null,this.inProgress=!1,this.emit
9(`cancelled`))}},{key:`succeeded`,value:function(e){this.emit(`succeeded`,e)}},{key:`failed`,value:function(e,t){if(this.timeout)throw Error(`Retrier attempt is already in progress`);this.scheduleAttempt(t)}}]),n}(v),F=function(e){f.default(n,e);var t=M(n);function n(e){var r;return l.default(this,n),r=t.call(this),h.default(d.default(r),`resolve`,function(){}),h.default(d.default(r),`reject`,function(){}),r.retrier=new P(e),r}return u.default(n,[{key:`run`,value:function(e){var t=this;return this.retrier.on(`attempt`,function(){e().then(function(e){return t.retrier.succeeded(e)}).catch(function(e){return t.retrier.failed(e)})}),this.retrier.on(`succeeded`,function(e){return t.resolve(e)}),this.retrier.on(`cancelled`,function(){return t.reject(Error(`Cancelled`))}),this.retrier.on(`failed`,function(e){return t.reject(e)}),new Promise(function(e,n){t.resolve=e,t.reject=n,t.retrier.start()})}},{key:`cancel`,value:function(){this.retrier.cancel()}}]),n}(v);function I(e){var t=L();return function(){var n=m.default(e),r;if(t){var i=m.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p.default(this,r)}}function L(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function R(e){return e!=null}var z=function(e){f.default(n,e);var t=I(n);function n(e){var r;l.default(this,n),r=t.call(this),h.default(d.default(r),`backoffDelay`,0),h.default(d.default(r),`nextBackoffDelay`,0),h.default(d.default(r),`backoffNumber`,0),h.default(d.default(r),`timeoutID`,null),h.default(d.default(r),`maxNumberOfRetry`,-1),e||={};var i=e,a=i.initialDelay,o=i.maxDelay,s=i.randomisationFactor,c=i.factor;if(R(a)&&a<1)throw Error(`The initial timeout must be equal to or greater than 1.`);if(R(o)&&o<=1)throw Error(`The maximal timeout must be greater than 1.`);if(R(s)&&(s<0||s>1))throw Error(`The randomisation factor must be between 0 and 1.`);if(R(c)&&c<=1)throw Error(`Exponential factor should be greater than 1.`);if(r.initialDelay=a||100,r.maxDelay=o||1e4,r.maxDelay<=r.initialDelay)throw Error(`The maximal backoff delay must be greater than the initial backoff delay.`);return r.randomisationFactor=s||0,r.factor=c||2,r.reset(),r}return u.default(n,[{key:`backoff`,value:function(e){this.timeoutID??(this.backoffNumber===this.maxNumberOfRetry?(this.emit(`fail`,e),this.reset()):(this.backoffDelay=this.next(),this.timeoutID=setTimeout(this.onBackoff.bind(this),this.backoffDelay),this.emit(`backoff`,this.backoffNumber,this.backoffDelay,e)))}},{key:`reset`,value:function(){this.backoffDelay=0,this.nextBackoffDelay=this.initialDelay,this.backoffNumber=0,this.timeoutID&&clearTimeout(this.timeoutID),this.timeoutID=null}},{key:`failAfter`,value:function(e){if(e<=0)throw Error(`Expected a maximum number of retry greater than 0 but got ${e}`);this.maxNumberOfRetry=e}},{key:`next`,value:function(){this.backoffDelay=Math.min(this.nextBackoffDelay,this.maxDelay),this.nextBackoffDelay=this.backoffDelay*this.factor;var e=1+Math.random()*this.randomisationFactor;return Math.min(this.maxDelay,Math.round(this.backoffDelay*e))}},{key:`onBackoff`,value:function(){this.timeoutID=null,this.emit(`ready`,this.backoffNumber,this.backoffDelay),this.backoffNumber++}}],[{key:`exponential`,value:function(e){return new n(e)}}]),n}(v);e.AsyncRetrier=F,e.Backoff=z,e.Retrier=P})),Hr=r(((e,t)=>{var n=c(),r=F(),i=b(),a=Zn(),o=RegExp.prototype;t.exports=function(e){var t=e.flags;return t===void 0&&!(`flags`in o)&&!r(e,`flags`)&&i(o,e)?n(a,e):t}})),Ur=r((()=>{var e=K().PROPER,t=q(),n=W(),r=Pe(),i=a(),o=Hr(),s=`toString`,c=RegExp.prototype,l=c[s],u=i(function(){return l.call({source:`a`,flags:`b`})!==`/a/b`}),d=e&&l.name!==s;(u||d)&&t(c,s,function(){var e=n(this),t=r(e.source),i=r(o(e));return`/`+t+`/`+i},{unsafe:!0})})),Wr=r((()=>{Ir()(`Set`,function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},Rr())})),Gr=r((()=>{Wr()})),Kr=r(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`StateMachine`,[],r):typeof e==`object`?e.StateMachine=r():n.StateMachine=r()})(e,function(){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})}
vendor: 6,326 bytes, line 9
9,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=5)})([(function(e,t,n){e.exports=function(e,t){var n,r,i;for(n=1;n<arguments.length;n++)for(i in r=arguments[n],r)r.hasOwnProperty(i)&&(e[i]=r[i]);return e}}),(function(e,t,n){var r=n(0);e.exports={build:function(e,t){var n,i,a,o=t.plugins;for(n=0,i=o.length;n<i;n++)a=o[n],a.methods&&r(e,a.methods),a.properties&&Object.defineProperties(e,a.properties)},hook:function(e,t,n){var r,i,a,o,s=e.config.plugins,c=[e.context];for(n&&(c=c.concat(n)),r=0,i=s.length;r<i;r++)o=s[r],a=s[r][t],a&&a.apply(o,c)}}}),(function(e,t,n){function r(e){if(e.length===0)return e;var t,n,r=e.split(/[_-]/);if(r.length===1&&r[0][0].toLowerCase()===r[0][0])return e;for(n=r[0].toLowerCase(),t=1;t<r.length;t++)n=n+r[t].charAt(0).toUpperCase()+r[t].substring(1).toLowerCase();return n}r.prepended=function(e,t){return t=r(t),e+t[0].toUpperCase()+t.substring(1)},e.exports=r}),(function(e,t,n){var r=n(0),i=n(2);function a(e,t){e||={},this.options=e,this.defaults=t.defaults,this.states=[],this.transitions=[],this.map={},this.lifecycle=this.configureLifecycle(),this.init=this.configureInitTransition(e.init),this.data=this.configureData(e.data),this.methods=this.configureMethods(e.methods),this.map[this.defaults.wildcard]={},this.configureTransitions(e.transitions||[]),this.plugins=this.configurePlugins(e.plugins,t.plugin)}r(a.prototype,{addState:function(e){this.map[e]||(this.states.push(e),this.addStateLifecycleNames(e),this.map[e]={})},addStateLifecycleNames:function(e){this.lifecycle.onEnter[e]=i.prepended(`onEnter`,e),this.lifecycle.onLeave[e]=i.prepended(`onLeave`,e),this.lifecycle.on[e]=i.prepended(`on`,e)},addTransition:function(e){this.transitions.indexOf(e)<0&&(this.transitions.push(e),this.addTransitionLifecycleNames(e))},addTransitionLifecycleNames:function(e){this.lifecycle.onBefore[e]=i.prepended(`onBefore`,e),this.lifecycle.onAfter[e]=i.prepended(`onAfter`,e),this.lifecycle.on[e]=i.prepended(`on`,e)},mapTransition:function(e){var t=e.name,n=e.from,r=e.to;return this.addState(n),typeof r!=`function`&&this.addState(r),this.addTransition(t),this.map[n][t]=e,e},configureLifecycle:function(){return{onBefore:{transition:`onBeforeTransition`},onAfter:{transition:`onAfterTransition`},onEnter:{state:`onEnterState`},onLeave:{state:`onLeaveState`},on:{transition:`onTransition`}}},configureInitTransition:function(e){return typeof e==`string`?this.mapTransition(r({},this.defaults.init,{to:e,active:!0})):typeof e==`object`?this.mapTransition(r({},this.defaults.init,e,{active:!0})):(this.addState(this.defaults.init.from),this.defaults.init)},configureData:function(e){return typeof e==`function`?e:typeof e==`object`?function(){return e}:function(){return{}}},configureMethods:function(e){return e||{}},configurePlugins:function(e,t){e||=[];var n,r,i;for(n=0,r=e.length;n<r;n++)i=e[n],typeof i==`function`&&(e[n]=i=i()),i.configure&&i.configure(this);return e},configureTransitions:function(e){var t,n,r,i,a,o=this.defaults.wildcard;for(n=0;n<e.length;n++)for(r=e[n],i=Array.isArray(r.from)?r.from:[r.from||o],a=r.to||o,t=0;t<i.length;t++)this.mapTransition({name:r.name,from:i[t],to:a})},transitionFor:function(e,t){var n=this.defaults.wildcard;return this.map[e][t]||this.map[n][t]},transitionsFor:function(e){var t=this.defaults.wildcard;return Object.keys(this.map[e]).concat(Object.keys(this.map[t]))},allStates:function(){return this.states},allTransitions:function(){return this.transitions}}),e.exports=a}),(function(e,t,n){var r=n(0),i=n(6),a=n(1),o=[null,[]];function s(e,t){this.context=e,this.config=t,this.state=t.init.from,this.observers=[e]}r(s.prototype,{init:function(e){if(r(this.context,this.config.data.apply(this.context,e)),a.hook(this,`init`),this.config.init.active)return this.fire(this.config.init.name,[])},is:function(e){return Array.isArray(e)?e.indexOf(this.state)>=0:this.state===e},isPending:function(){return this.pending},can:function(e){return!this.isPending()&&!!this.seek(e)},cannot:function(e){return!this.can(e)},allStates:function(){return this.config.allStates()},allTransitions:function(){return this.config.allTransitions()},transitions:function(){return this.config.transitionsFor(this.state)},seek:function(e,t){var n=this.config.defaults.wildcard,r=this.config.transitionFor(this.state,e),i=r&&r.to;return typeof i==`function`?i.apply(this.context,t):i===n?this.state:i},fire:function(e,t){return this.transit(e,this.state,this.seek(e,t),t)},transit:function(e,t,n,r){var i=this.config.lifecycle,a=this.config.options.observeUnchangedState||t!==n;return n?this.isPending()?this.context.onPendingTransition(e,t,n):(this.config.addState(n),this.beginTransit(),r.unshift({transition:e,from:t,to:n,fsm:this.context}),this.observeEvents([this.observersForEvent(i.onBefore.transition),this.observersForEvent(i.onBefore[e]),a?this.observersForEvent(i.onLeave.state):o,a?this.observersForEvent(i.onLeave[t]):o,this.observersForEvent(i.on.transition),a?[`doTransit`,[this]]:o,a?this.observersForEvent(i.onEnter.state):o,a?this.observersForEvent(i.onEnter[n]):o,a?this.observersForEvent(i.on[n]):o,this.observersForEvent(i.onAfter.transition),this.observersForEvent(i.onAfter[e]),this.observersForEvent(i.on[e])],r)):this.context.onInvalidTransition(e,t,n)},beginTransit:function(){this.pending=!0},endTransit:function(e){return this.pending=!1,e},failTransit:function(e){throw this.pending=!1,e},doTransit:function(e){this.state=e.to},observe:function(e){if(e.length===2){var t={};t[e[0]]=e[1],this.observers.push(t)}else this.observers.push(e[0])},observersForEvent:function(e){for(var t=0,n=this.observers.length,r,i=[];t<n;t++)r=this.observers[t],r[e]&&i.push(r);return[e,i,!0]},observeEvents:function(e,t,n,r){if(e.length===0)return this.endTransit(r===void 0||r);var i=e[0][0],o=e[0][1],s=e[0][2];if(t[0].event=i,i&&s&&i!==n&&a.hook(this,`lifecycle`,t),o.length===0)return e.shift(),this.observeEvents(e,t,i,r);var c=o.shift(),l=c[i].apply(c,t);return l&&typeof l.then==`function`?l.then(this.observeEvents.bind(this,e,t,i)).catch(this.failTransit.bind(this)):l===!1?this.endTransit(!1):this.observeEvents(e,t,i,l)},onInvalidTransition:function(e,t,n){throw new i(`transition is invali
9d in current state`,e,t,n,this.state)},onPendingTransition:function(e,t,n){throw new i(`transition is invalid while previous transition is still in progress`,e,t,n,this.state)}}),e.exports=s}),(function(e,t,n){var r=n(0),i=n(2),a=n(1),o=n(3),s=n(4),c={is:function(e){return this._fsm.is(e)},can:function(e){return this._fsm.can(e)},cannot:function(e){return this._fsm.cannot(e)},observe:function(){return this._fsm.observe(arguments)},transitions:function(){return this._fsm.transitions()},allTransitions:function(){return this._fsm.allTransitions()},allStates:function(){return this._fsm.allStates()},onInvalidTransition:function(e,t,n){return this._fsm.onInvalidTransition(e,t,n)},onPendingTransition:function(e,t,n){return this._fsm.onPendingTransition(e,t,n)}},l={state:{configurable:!1,enumerable:!0,get:function(){return this._fsm.state},set:function(e){throw Error(`use transitions to change state`)}}};function u(e){return f(this||{},e)}function d(){var e,t;typeof arguments[0]==`function`?(e=arguments[0],t=arguments[1]||{}):(e=function(){this._fsm.apply(this,arguments)},t=arguments[0]||{});var n=new o(t,u);return p(e.prototype,n),e.prototype._fsm.config=n,e}function f(e,t){return p(e,new o(t,u)),e._fsm(),e}function p(e,t){if(typeof e!=`object`||Array.isArray(e))throw Error(`StateMachine can only be applied to objects`);a.build(e,t),Object.defineProperties(e,l),r(e,c),r(e,t.methods),t.allTransitions().forEach(function(t){e[i(t)]=function(){return this._fsm.fire(t,[].slice.call(arguments))}}),e._fsm=function(){this._fsm=new s(this,t),this._fsm.init(arguments)}}u.version=`3.0.1`,u.factory=d,u.apply=f,u.defaults={wildcard:`*`,init:{name:`init`,from:`none`}},e.exports=u}),(function(e,t,n){e.exports=function(e,t,n,r,i){this.message=e,this.transition=t,this.from=n,this.to=r,this.current=i}})])})})),qr=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var t,n=new Uint8Array(16);function r(){if(!t&&(t=typeof crypto<`u`&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!t))throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);return t(n)}})),Jr=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=/^(?:[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})),Yr=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=n(Jr());function n(e){return e&&e.__esModule?e:{default:e}}function r(e){return typeof e==`string`&&t.default.test(e)}e.default=r})),Xr=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.unsafeStringify=i;var t=n(Yr());function n(e){return e&&e.__esModule?e:{default:e}}var r=[];for(let e=0;e<256;++e)r.push((e+256).toString(16).slice(1));function i(e,t=0){return r[e[t+0]]+r[e[t+1]]+r[e[t+2]]+r[e[t+3]]+`-`+r[e[t+4]]+r[e[t+5]]+`-`+r[e[t+6]]+r[e[t+7]]+`-`+r[e[t+8]]+r[e[t+9]]+`-`+r[e[t+10]]+r[e[t+11]]+r[e[t+12]]+r[e[t+13]]+r[e[t+14]]+r[e[t+15]]}function a(e,n=0){let r=i(e,n);if(!(0,t.default)(r))throw TypeError(`Stringified UUID is invalid`);return r}e.default=a})),Zr=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=r(qr()),n=Xr();function r(e){return e&&e.__esModule?e:{default:e}}var i,a,o=0,s=0;function c(e,r,c){let l=r&&c||0,u=r||Array(16);e||={};let d=e.node||i,f=e.clockseq===void 0?a:e.clockseq;if(d==null||f==null){let n=e.random||(e.rng||t.default)();d??=i=[n[0]|1,n[1],n[2],n[3],n[4],n[5]],f??=a=(n[6]<<8|n[7])&16383}let p=e.msecs===void 0?Date.now():e.msecs,m=e.nsecs===void 0?s+1:e.nsecs,h=p-o+(m-s)/1e4;if(h<0&&e.clockseq===void 0&&(f=f+1&16383),(h<0||p>o)&&e.nsecs===void 0&&(m=0),m>=1e4)throw Error(`uuid.v1(): Can't create more than 10M uuids/sec`);o=p,s=m,a=f,p+=0xb1d069b5400;let g=((p&268435455)*1e4+m)%4294967296;u[l++]=g>>>24&255,u[l++]=g>>>16&255,u[l++]=g>>>8&255,u[l++]=g&255;let _=p/4294967296*1e4&268435455;u[l++]=_>>>8&255,u[l++]=_&255,u[l++]=_>>>24&15|16,u[l++]=_>>>16&255,u[l++]=f>>>8|128,u[l++]=f&255;for(let e=0;e<6;++e)u[l+e]=d[e];return r||(0,n.unsafeStringify)(u)}e.default=c})),Qr=r((e=>
9{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=n(Yr());function n(e){return e&&e.__esModule?e:{default:e}}function r(e){if(!(0,t.default)(e))throw TypeError(`Invalid UUID`);let n,r=new Uint8Array(16);return r[0]=(n=parseInt(e.slice(0,8),16))>>>24,r[1]=n>>>16&255,r[2]=n>>>8&255,r[3]=n&255,r[4]=(n=parseInt(e.slice(9,13),16))>>>8,r[5]=n&255,r[6]=(n=parseInt(e.slice(14,18),16))>>>8,r[7]=n&255,r[8]=(n=parseInt(e.slice(19,23),16))>>>8,r[9]=n&255,r[10]=(n=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=n/4294967296&255,r[12]=n>>>24&255,r[13]=n>>>16&255,r[14]=n>>>8&255,r[15]=n&255,r}e.default=r})),$r=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.URL=e.DNS=void 0,e.default=s;var t=Xr(),n=r(Qr());function r(e){return e&&e.__esModule?e:{default:e}}function i(e){e=unescape(encodeURIComponent(e));let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}var a=`6ba7b810-9dad-11d1-80b4-00c04fd430c8`;e.DNS=a;var o=`6ba7b811-9dad-11d1-80b4-00c04fd430c8`;e.URL=o;function s(e,r,s){function c(e,a,o,c){if(typeof e==`string`&&(e=i(e)),typeof a==`string`&&(a=(0,n.default)(a)),a?.length!==16)throw TypeError(`Namespace must be array-like (16 iterable integer values, 0-255)`);let l=new Uint8Array(16+e.length);if(l.set(a),l.set(e,a.length),l=s(l),l[6]=l[6]&15|r,l[8]=l[8]&63|128,o){c||=0;for(let e=0;e<16;++e)o[c+e]=l[e];return o}return(0,t.unsafeStringify)(l)}try{c.name=e}catch{}return c.DNS=a,c.URL=o,c}})),ei=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;function t(e){if(typeof e==`string`){let t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return n(i(a(e),e.length*8))}function n(e){let t=[],n=e.length*32,r=`0123456789abcdef`;for(let i=0;i<n;i+=8){let n=e[i>>5]>>>i%32&255,a=parseInt(r.charAt(n>>>4&15)+r.charAt(n&15),16);t.push(a)}return t}function r(e){return(e+64>>>9<<4)+14+1}function i(e,t){e[t>>5]|=128<<t%32,e[r(t)-1]=t;let n=1732584193,i=-271733879,a=-1732584194,s=271733878;for(let t=0;t<e.length;t+=16){let r=n,c=i,p=a,m=s;n=l(n,i,a,s,e[t],7,-680876936),s=l(s,n,i,a,e[t+1],12,-389564586),a=l(a,s,n,i,e[t+2],17,606105819),i=l(i,a,s,n,e[t+3],22,-1044525330),n=l(n,i,a,s,e[t+4],7,-176418897),s=l(s,n,i,a,e[t+5],12,1200080426),a=l(a,s,n,i,e[t+6],17,-1473231341),i=l(i,a,s,n,e[t+7],22,-45705983),n=l(n,i,a,s,e[t+8],7,1770035416),s=l(s,n,i,a,e[t+9],12,-1958414417),a=l(a,s,n,i,e[t+10],17,-42063),i=l(i,a,s,n,e[t+11],22,-1990404162),n=l(n,i,a,s,e[t+12],7,1804603682),s=l(s,n,i,a,e[t+13],12,-40341101),a=l(a,s,n,i,e[t+14],17,-1502002290),i=l(i,a,s,n,e[t+15],22,1236535329),n=u(n,i,a,s,e[t+1],5,-165796510),s=u(s,n,i,a,e[t+6],9,-1069501632),a=u(a,s,n,i,e[t+11],14,643717713),i=u(i,a,s,n,e[t],20,-373897302),n=u(n,i,a,s,e[t+5],5,-701558691),s=u(s,n,i,a,e[t+10],9,38016083),a=u(a,s,n,i,e[t+15],14,-660478335),i=u(i,a,s,n,e[t+4],20,-405537848),n=u(n,i,a,s,e[t+9],5,568446438),s=u(s,n,i,a,e[t+14],9,-1019803690),a=u(a,s,n,i,e[t+3],14,-187363961),i=u(i,a,s,n,e[t+8],20,1163531501),n=u(n,i,a,s,e[t+13],5,-1444681467),s=u(s,n,i,a,e[t+2],9,-51403784),a=u(a,s,n,i,e[t+7],14,1735328473),i=u(i,a,s,n,e[t+12],20,-1926607734),n=d(n,i,a,s,e[t+5],4,-378558),s=d(s,n,i,a,e[t+8],11,-2022574463),a=d(a,s,n,i,e[t+11],16,1839030562),i=d(i,a,s,n,e[t+14],23,-35309556),n=d(n,i,a,s,e[t+1],4,-1530992060),s=d(s,n,i,a,e[t+4],11,1272893353),a=d(a,s,n,i,e[t+7],16,-155497632),i=d(i,a,s,n,e[t+10],23,-1094730640),n=d(n,i,a,s,e[t+13],4,681279174),s=d(s,n,i,a,e[t],11,-358537222),a=d(a,s,n,i,e[t+3],16,-722521979),i=d(i,a,s,n,e[t+6],23,76029189),n=d(n,i,a,s,e[t+9],4,-640364487),s=d(s,n,i,a,e[t+12],11,-421815835),a=d(a,s,n,i,e[t+15],16,530742520),i=d(i,a,s,n,e[t+2],23,-995338651),n=f(n,i,a,s,e[t],6,-198630844),s=f(s,n,i,a,e[t+7],10,1126891415),a=f(a,s,n,i,e[t+14],15,-1416354905),i=f(i,a,s,n,e[t+5],21,-57434055),n=f(n,i,a,s,e[t+12],6,1700485571),s=f(s,n,i,a,e[t+3],10,-1894986606),a=f(a,s,n,i,e[t+10],15,-1051523),i=f(i,a,s,n,e[t+1],21,-2054922799),n=f(n,i,a,s,e[t+8],6,1873313359),s=f(s,n,i,a,e[t+15],10,-30611744),a=f(a,s,n,i,e[t+6],15,-1560198380),i=f(i,a,s,n,e[t+13],21,1309151649),n=f(n,i,a,s,e[t+4],6,-145523070),s=f(s,n,i,a,e[t+11],10,-1120210379),a=f(a,s,n,i,e[t+2],15,718787259),i=f(i,a,s,n,e[t+9],21,-343485551),n=o(n,r),i=o(i,c),a=o(a,p),s=o(s,m)}return[n,i,a,s]}function a(e){if(e.length===0)return[];let t=e.length*8,n=new Uint32Array(r(t));for(let r=0;r<t;r+=8)n[r>>5]|=(e[r/8]&255)<<r%32;return n}function o(e,t){let n=(e&65535)+(t&65535);return(e>>16)+(t>>16)+(n>>16)<<16|n&65535}function s(e,t){return e<<t|e>>>32-t}function c(e,t,n,r,i,a){return o(s(o(o(t,e),o(r,a)),i),n)}function l(e,t,n,r,i,a,o){return c(t&n|~t&r,e,t,i,a,o)}function u(e,t,n,r,i,a,o){return c(t&r|n&~r,e,t,i,a,o)}function d(e,t,n,r,i,a,o){return c(t^n^r,e,t,i,a,o)}function f(e,t,n,r,i,a,o){return c(n^(t|~r),e,t,i,a,o)}e.default=t})),ti=r((e=>
9{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=r($r()),n=r(ei());function r(e){return e&&e.__esModule?e:{default:e}}e.default=(0,t.default)(`v3`,48,n.default)})),ni=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)}})),ri=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=i(ni()),n=i(qr()),r=Xr();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,i,a){if(t.default.randomUUID&&!i&&!e)return t.default.randomUUID();e||={};let o=e.random||(e.rng||n.default)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,i){a||=0;for(let e=0;e<16;++e)i[a+e]=o[e];return i}return(0,r.unsafeStringify)(o)}e.default=a})),ii=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;function t(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function n(e,t){return e<<t|e>>>32-t}function r(e){let r=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e==`string`){let t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let a=e.length/4+2,o=Math.ceil(a/16),s=Array(o);for(let t=0;t<o;++t){let n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[t*64+r*4]<<24|e[t*64+r*4+1]<<16|e[t*64+r*4+2]<<8|e[t*64+r*4+3];s[t]=n}s[o-1][14]=(e.length-1)*8/2**32,s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=(e.length-1)*8&4294967295;for(let e=0;e<o;++e){let a=new Uint32Array(80);for(let t=0;t<16;++t)a[t]=s[e][t];for(let e=16;e<80;++e)a[e]=n(a[e-3]^a[e-8]^a[e-14]^a[e-16],1);let o=i[0],c=i[1],l=i[2],u=i[3],d=i[4];for(let e=0;e<80;++e){let i=Math.floor(e/20),s=n(o,5)+t(i,c,l,u)+d+r[i]+a[e]>>>0;d=u,u=l,l=n(c,30)>>>0,c=o,o=s}i[0]=i[0]+o>>>0,i[1]=i[1]+c>>>0,i[2]=i[2]+l>>>0,i[3]=i[3]+u>>>0,i[4]=i[4]+d>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,i[0]&255,i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,i[1]&255,i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,i[2]&255,i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,i[3]&255,i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,i[4]&255]}e.default=r})),ai=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=r($r()),n=r(ii());function r(e){return e&&e.__esModule?e:{default:e}}e.default=(0,t.default)(`v5`,80,n.default)})),oi=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=`00000000-0000-0000-0000-000000000000`})),si=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=n(Yr());function n(e){return e&&e.__esModule?e:{default:e}}function r(e){if(!(0,t.default)(e))throw TypeError(`Invalid UUID`);return parseInt(e.slice(14,15),16)}e.default=r})),ci=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return o.default}});var t=u(Zr()),n=u(ti()),r=u(ri()),i=u(ai()),a=u(oi()),o=u(si()),s=u(Yr()),c=u(Xr()),l=u(Qr());function u(e){return e&&e.__esModule?e:{default:e}}})),li=r(((e,t)=>{t.exports=typeof ArrayBuffer<`u`&&typeof DataView<`u`})),ui=r(((e,t)=>{var n=li(),r=o(),a=i(),s=_(),c=v(),l=F(),u=Te(),d=E(),f=G(),p=q(),m=Ie(),h=b(),g=En(),y=jt(),x=L(),S=I(),C=ae(),w=C.enforce,T=C.get,D=a.Int8Array,O=D&&D.prototype,k=a.Uint8ClampedArray,A=k&&k.prototype,j=D&&g(D),M=O&&g(O),N=Object.prototype,P=a.TypeError,R=x(`toStringTag`),z=S(`TYPED_ARRAY_TAG`),B=`TypedArrayConstructor`,V=n&&!!y&&u(a.opera)!==`Opera`,H=!1,U,W,ee,K={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},te={BigInt64Array:8,BigUint64Array:8},ne=function(e){if(!c(e))return!1;var t=u(e);return t===`DataView`||l(K,t)||l(te,t)},re=function(e){var t=g(e);
vendor: 11,432 bytes, line 9
9if(c(t)){var n=T(t);return n&&l(n,B)?n[B]:re(t)}},ie=function(e){if(!c(e))return!1;var t=u(e);return l(K,t)||l(te,t)},oe=function(e){if(ie(e))return e;throw new P(`Target is not a typed array`)},se=function(e){if(s(e)&&(!y||h(j,e)))return e;throw new P(d(e)+` is not a typed array constructor`)},ce=function(e,t,n,i){if(r){if(n)for(var o in K){var s=a[o];if(s&&l(s.prototype,e))try{delete s.prototype[e]}catch{try{s.prototype[e]=t}catch{}}}(!M[e]||n)&&p(M,e,n?t:V&&O[e]||t,i)}},le=function(e,t,n){var i,o;if(r){if(y){if(n){for(i in K)if(o=a[i],o&&l(o,e))try{delete o[e]}catch{}}if(!j[e]||n)try{return p(j,e,n?t:V&&j[e]||t)}catch{}else return}for(i in K)o=a[i],o&&(!o[e]||n)&&p(o,e,t)}};for(U in K)W=a[U],ee=W&&W.prototype,ee?w(ee)[B]=W:V=!1;for(U in te)W=a[U],ee=W&&W.prototype,ee&&(w(ee)[B]=W);if((!V||!s(j)||j===Function.prototype)&&(j=function(){throw new P(`Incorrect invocation`)},V))for(U in K)a[U]&&y(a[U],j);if((!V||!M||M===N)&&(M=j.prototype,V))for(U in K)a[U]&&y(a[U].prototype,M);if(V&&g(A)!==M&&y(A,M),r&&!l(M,R))for(U in H=!0,m(M,R,{configurable:!0,get:function(){return c(this)?this[z]:void 0}}),K)a[U]&&f(a[U],z,U);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:V,TYPED_ARRAY_TAG:H&&z,aTypedArray:oe,aTypedArrayConstructor:se,exportTypedArrayMethod:ce,exportTypedArrayStaticMethod:le,getTypedArrayConstructor:re,isView:ne,isTypedArray:ie,TypedArray:j,TypedArrayPrototype:M}})),di=r(((e,t)=>{var n=i(),r=a(),o=$t(),s=ui().NATIVE_ARRAY_BUFFER_VIEWS,c=n.ArrayBuffer,l=n.Int8Array;t.exports=!s||!r(function(){l(1)})||!r(function(){new l(-1)})||!o(function(e){new l,new l(null),new l(1.5),new l(e)},!0)||r(function(){return new l(new c(2),1,void 0).length!==1})})),fi=r(((e,t)=>{var n=ce(),r=ue(),i=RangeError;t.exports=function(e){if(e===void 0)return 0;var t=n(e),a=r(t);if(t!==a)throw new i(`Wrong length or index`);return a}})),pi=r(((e,t)=>{t.exports=Math.sign||function(e){var t=+e;return t===0||t!==t?t:t<0?-1:1}})),mi=r(((e,t)=>{var n=4503599627370496;t.exports=function(e){return e+n-n}})),hi=r(((e,t)=>{var n=pi(),r=mi(),i=Math.abs,a=2220446049250313e-31;t.exports=function(e,t,o,s){var c=+e,l=i(c),u=n(c);if(l<s)return u*r(l/s/t)*s*t;var d=(1+t/a)*l,f=d-(d-l);return f>o||f!==f?u*(1/0):u*f}})),gi=r(((e,t)=>{var n=hi(),r=1.1920928955078125e-7,i=34028234663852886e22,a=11754943508222875e-54;t.exports=Math.fround||function(e){return n(e,r,i,a)}})),_i=r(((e,t)=>{var n=Array,r=Math.abs,i=Math.pow,a=Math.floor,o=Math.log,s=Math.LN2;t.exports={pack:function(e,t,c){var l=n(c),u=c*8-t-1,d=(1<<u)-1,f=d>>1,p=t===23?i(2,-24)-i(2,-77):0,m=+(e<0||e===0&&1/e<0),h=0,g,_,v;for(e=r(e),e!==e||e===1/0?(_=e===e?0:1,g=d):(g=a(o(e)/s),v=i(2,-g),e*v<1&&(g--,v*=2),g+f>=1?e+=p/v:e+=p*i(2,1-f),e*v>=2&&(g++,v/=2),g+f>=d?(_=0,g=d):g+f>=1?(_=(e*v-1)*i(2,t),g+=f):(_=e*i(2,f-1)*i(2,t),g=0));t>=8;)l[h++]=_&255,_/=256,t-=8;for(g=g<<t|_,u+=t;u>0;)l[h++]=g&255,g/=256,u-=8;return l[h-1]|=m*128,l},unpack:function(e,t){var n=e.length,r=n*8-t-1,a=(1<<r)-1,o=a>>1,s=r-7,c=n-1,l=e[c--],u=l&127,d;for(l>>=7;s>0;)u=u*256+e[c--],s-=8;for(d=u&(1<<-s)-1,u>>=-s,s+=t;s>0;)d=d*256+e[c--],s-=8;if(u===0)u=1-o;else if(u===a)return d?NaN:l?-1/0:1/0;else d+=i(2,t),u-=o;return(l?-1:1)*d*i(2,u-t)}}})),vi=r(((e,t)=>{var n=P(),r=le(),i=de();t.exports=function(e){for(var t=n(this),a=i(t),o=arguments.length,s=r(o>1?arguments[1]:void 0,a),c=o>2?arguments[2]:void 0,l=c===void 0?a:r(c,a);l>s;)t[s++]=e;return t}})),yi=r(((e,t)=>{var n=i(),r=d(),s=o(),c=li(),l=K(),u=G(),f=Ie(),p=Lr(),m=a(),h=X(),g=ce(),_=ue(),v=fi(),y=gi(),b=_i(),x=En(),S=jt(),C=vi(),w=Se(),T=Kn(),E=_e(),D=ye(),O=ae(),k=l.PROPER,A=l.CONFIGURABLE,j=`ArrayBuffer`,M=`DataView`,N=`prototype`,P=`Wrong length`,F=`Wrong index`,I=O.getterFor(j),L=O.getterFor(M),R=O.set,z=n[j],B=z,V=B&&B[N],H=n[M],U=H&&H[N],W=Object.prototype,ee=n.Array,te=n.RangeError,ne=r(C),re=r([].reverse),ie=b.pack,oe=b.unpack,q=function(e){return[e&255]},se=function(e){return[e&255,e>>8&255]},le=function(e){return[e&255,e>>8&255,e>>16&255,e>>24&255]},de=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},fe=function(e){return ie(y(e),23,4)},pe=function(e){return ie(e,52,8)},me=function(e,t,n){f(e[N],t,{configurable:!0,get:function(){return n(this)[t]}})},J=function(e,t,n,r){var i=L(e),a=v(n),o=!!r;if(a+t>i.byteLength)throw new te(F);var s=i.bytes,c=a+i.byteOffset,l=w(s,c,c+t);return o?l:re(l)},he=function(e,t,n,r,i,a){var o=L(e),s=v(n),c=r(+i),l=!!a;if(s+t>o.byteLength)throw new te(F);for(var u=o.bytes,d=s+o.byteOffset,f=0;f<t;f++)u[d+f]=c[l?f:t-f-1]};if(!c)B=function(e){h(this,V);var t=v(e);R(this,{type:j,bytes:ne(ee(t),0),byteLength:t}),s||(this.byteLength=t,this.detached=!1)},V=B[N],H=function(e,t,n){h(this,U),h(e,V);var r=I(e),i=r.byteLength,a=g(t);if(a<0||a>i)throw new te(`Wrong offset`);if(n=n===void 0?i-a:_(n),a+n>i)throw new te(P);R(this,{type:M,buffer:e,byteLength:n,byteOffset:a,bytes:r.bytes}),s||(this.buffer=e,this.byteLength=n,this.byteOffset=a)},U=H[N],s&&(me(B,`byteLength`,I),me(H,`buffer`,L),me(H,`byteLength`,L),me(H,`byteOffset`,L)),p(U,{getInt8:function(e){return J(this,1,e)[0]<<24>>24},getUint8:function(e){return J(this,1,e)[0]},getInt16:function(e){var t=J(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=J(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return de(J(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return de(J(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return oe(J(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return oe(J(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){he(this,1,e,q,t)},setUint8:function(e,t){he(this,1,e,q,t)},setInt16:function(e,t){he(this,2,e,se,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){he(this,2,e,se,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){he(this,4,e,le,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){he(this,4,e,le,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){he(this,4,e,fe,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){he(this,8,e,pe,t,arguments.length>2&&arguments[2])}});else{var ge=k&&z.name!==j;!m(function(){z(1)})||!m(function(){new z(-1)})||m(function(){return new z,new z(1.5),new z(NaN),z.length!==1||ge&&!A})?(B=function(e){return h(this,V),T(new z(v(e)),this,B)},B[N]=V,V.constructor=B,E(B,z)):ge&&A&&u(z,`name`,j),S&&x(U)!==W&&S(U,W);var ve=new H(new B(2)),Y=r(U.setInt8);ve.setInt8(0,2147483648),ve.setInt8(1,2147483649),(ve.getInt8(0)||!ve.getInt8(1))&&p(U,{setInt8:function(e,t){Y(this,e,t<<24>>24)},setUint8:function(e,t){Y(this,e,t<<24>>24)}},{unsafe:!0})}D(B,j),D(H,M),t.exports={ArrayBuffer:B,DataView:H}})),bi=r(((e,t)=>{var n=ce(),r=RangeError;t.exports=function(e){var t=n(e);if(t<0)throw new r(`The argument can't be less than 0`);return t}})),xi=r(((e,t)=>{var n=bi(),r=RangeError;t.exports=function(e,t){var i=n(e);if(i%t)throw new r(`Wrong offset`);return i}})),Si=r(((e,t)=>{var n=Math.round;t.exports=function(e){var t=n(e);return t<0?0:t>255?255:t&255}})),Ci=r(((e,t)=>{var n=Te();t.exports=function(e){var t=n(e);return t===`BigInt64Array`||t===`BigUint64Array`}})),wi=r(((e,t)=>{var n=R(),r=TypeError;t.exports=function(e){var t=n(e,`number`);if(typeof t==`number`)throw new r(`Can't convert number to bigint`);return BigInt(t)}})),Ti=r(((e,t)=>{var n=He(),r=c(),i=De(),a=P(),o=de(),s=Xt(),l=Yt(),u=Jt(),d=Ci(),f=ui().aTypedArrayConstructor,p=wi();t.exports=function(e){var t=i(this),c=a(e),m=arguments.length,h=m>1?arguments[1]:void 0,g=h!==void 0,_=l(c),v,y,b,x,S,C,w,T;if(_&&!u(_))for(w=s(c,_),T=w.next,c=[];!(C=r(T,w)).done;)c.push(C.value);for(g&&m>2&&(h=n(h,arguments[2])),y=o(c),b=new(f(t))(y),x=d(b),v=0;y>v;v++)S=g?h(c[v],v):c[v],b[v]=x?p(S):+S;return b}})),Ei=r(((e,t)=>{var n=de();t.exports=function(e,t,r){for(var i=0,a=arguments.length>2?r:n(t),o=new e(a);a>i;)o[i]=t[i++];return o}})),Di=r(((e,t)=>{var n=Y(),r=i(),a=c(),s=o(),l=di(),d=ui(),f=yi(),p=X(),m=u(),h=G(),g=wr(),_=ue(),y=fi(),x=xi(),S=Si(),C=z(),w=F(),E=Te(),D=v(),O=T(),k=je(),A=b(),j=jt(),M=J().f,N=Ti(),P=Ke().forEach,I=Mt(),L=Ie(),R=ee(),B=H(),V=Ei(),U=ae(),W=Kn(),K=U.get,te=U.set,ne=U.enforce,re=R.f,ie=B.f,oe=r.RangeError,q=f.ArrayBuffer,se=q.prototype,ce=f.DataView,le=d.NATIVE_ARRAY_BUFFER_VIEWS,de=d.TYPED_ARRAY_TAG,fe=d.TypedArray,pe=d.TypedArrayPrototype,me=d.isTypedArray,he=`BYTES_PER_ELEMENT`,ge=`Wrong length`,_e=function(e,t){L(e,t,{configurable:!0,get:function(){return K(this)[t]}})},ve=function(e){var t;return A(se,e)||(t=E(e))===`ArrayBuffer`||t===`SharedArrayBuffer`},ye=function(e,t){return me(e)&&!O(t)&&t in e&&g(+t)&&t>=0},be=function(e,t){return t=C(t),ye(e,t)?m(2,e[t]):ie(e,t)},xe=function(e,t,n){return t=C(t),ye(e,t)&&D(n)&&w(n,`value`)&&!w(n,`get`)&&!w(n,`set`)&&!n.configurable&&(!w(n,`writable`)||n.writable)&&(!w(n,`enumerable`)||n.enumerable)?(e[t]=n.value,e):re(e,t,n)};s?(le||(B.f=be,R.f=xe,_e(pe,`buffer`),_e(pe,`byteOffset`),_e(pe,`byteLength`),_e(pe,`length`)),n({target:`Object`,stat:!0,forced:!le},{getOwnPropertyDescriptor:be,defineProperty:xe}),t.exports=function(e,t,i){var o=e.match(/\d+/)[0]/8,s=e+(i?`Clamped`:``)+`Array`,c=`get`+e,u=`set`+e,d=r[s],f=d,m=f&&f.prototype,g={},v=function(e,t){var n=K(e);return n.view[c](t*o+n.byteOffset,!0)},b=function(e,t,n){var r=K(e);r.view[u](t*o+r.byteOffset,i?S(n):n,!0)},C=function(e,t){re(e,t,{get:function(){return v(this,t)},set:function(e){return b(this,t,e)},enumerable:!0})};le?l&&(f=t(function(e,t,n,r){return p(e,m),W(function(){return D(t)?ve(t)?r===void 0?n===void 0?new d(t):new d(t,x(n,o)):new d(t,x(n,o),r):me(t)?V(f,t):a(N,f,t):new d(y(t))}(),e,f)}),j&&j(f,fe),P(M(d),function(e){e in f||h(f,e,d[e])}),f.prototype=m):(f=t(function(e,t,n,r){p(e,m);var i=0,s=0,c,l,u;if(!D(t))u=y(t),l=u*o,c=new q(l);else if(ve(t)){c=t,s=x(n,o);var d=t.byteLength;if(r===void 0){if(d%o||(l=d-s,l<0))throw new oe(ge)}else if(l=_(r)*o,l+s>d)throw new oe(ge);u=l/o}else if(me(t))return V(f,t);else return a(N,f,t);for(te(e,{buffer:c,byteOffset:s,byteLength:l,length:u,view:new ce(c)});i<u;)C(e,i++)}),j&&j(f,fe),m=f.prototype=k(pe)),m.constructor!==f&&h(m,`constructor`,f),ne(m).TypedArrayConstructor=f,de&&h(m,de,s);var w=f!==d;g[s]=f,n({global:!0,constructor:!0,forced:w,sham:!le},g),he in f||h(f,he,o),he in m||h(m,he,o),I(s)}):t.exports=function(){}})),Oi=r((()=>{Di()(`Uint8`,function(e){return function(t,n,r){return e(this,t,n,r)}})})),ki=r((()=>{var e=ui(),t=de(),n=ce(),r=e.aTypedArray,i=e.exportTypedArrayMethod;i(`at`,function(e){var i=r(this),a=t(i),o=n(e),s=o>=0?o:a+o;return s<0||s>=a?void 0:i[s]})})),Ai=r(((e,t)=>{var n=E(),r=TypeError;t.exports=function(e,t){if(!delete e[t])throw new r(`Cannot delete property `+n(t)+` of `+n(e))}})),ji=r(((e,t)=>{var n=P(),r=le(),i=de(),a=Ai(),o=Math.min;t.exports=[].copyWithin||function(e,t){var s=n(this),c=i(s),l=r(e,c),u=r(t,c),d=arguments.length>2?arguments[2]:void 0,f=o((d===void 0?c:r(d,c))-u,c-l),p=1;for(u<l&&l<u+f&&(p=-1,u+=f-1,l+=f-1);f-->0;)u in s?s[l]=s[u]:a(s,l),l+=p,u+=p;return s}})),Mi=r((()=>{var e=d(),t=ui(),n=e(ji()),r=t.aTypedArray,i=t.exportTypedArrayMethod;i(`copyWithin`,function(e,t){return n(r(this),e,t,arguments.length>2?arguments[2]:void 0)})})),Ni=r((()=>{var e=ui(),t=Ke().every,n=e.aTypedArray,r=e.exportTypedArrayMethod;r(`every`,function(e){return t(n(this),e,arguments.length>1?arguments[1]:void 0)})})),Pi=r((()=>{var e=ui(),t=vi(),n=wi(),r=Te(),i=c(),o=d(),s=a(),l=e.aTypedArray,u=e.exp
9ortTypedArrayMethod,f=o(``.slice);u(`fill`,function(e){var a=arguments.length;l(this);var o=f(r(this),0,3)===`Big`?n(e):+e;return i(t,this,o,a>1?arguments[1]:void 0,a>2?arguments[2]:void 0)},s(function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),e!==1}))})),Fi=r(((e,t)=>{var n=Ei(),r=ui().getTypedArrayConstructor;t.exports=function(e,t){return n(r(e),t)}})),Ii=r((()=>{var e=ui(),t=Ke().filter,n=Fi(),r=e.aTypedArray,i=e.exportTypedArrayMethod;i(`filter`,function(e){var i=t(r(this),e,arguments.length>1?arguments[1]:void 0);return n(this,i)})})),Li=r((()=>{var e=ui(),t=Ke().find,n=e.aTypedArray,r=e.exportTypedArrayMethod;r(`find`,function(e){return t(n(this),e,arguments.length>1?arguments[1]:void 0)})})),Ri=r((()=>{var e=ui(),t=Ke().findIndex,n=e.aTypedArray,r=e.exportTypedArrayMethod;r(`findIndex`,function(e){return t(n(this),e,arguments.length>1?arguments[1]:void 0)})})),zi=r((()=>{var e=ui(),t=Ke().forEach,n=e.aTypedArray,r=e.exportTypedArrayMethod;r(`forEach`,function(e){t(n(this),e,arguments.length>1?arguments[1]:void 0)})})),Bi=r((()=>{var e=ui(),t=fe().includes,n=e.aTypedArray,r=e.exportTypedArrayMethod;r(`includes`,function(e){return t(n(this),e,arguments.length>1?arguments[1]:void 0)})})),Vi=r((()=>{var e=ui(),t=fe().indexOf,n=e.aTypedArray,r=e.exportTypedArrayMethod;r(`indexOf`,function(e){return t(n(this),e,arguments.length>1?arguments[1]:void 0)})})),Hi=r((()=>{var e=i(),t=a(),n=d(),r=ui(),o=Wn(),s=L()(`iterator`),c=e.Uint8Array,l=n(o.values),u=n(o.keys),f=n(o.entries),p=r.aTypedArray,m=r.exportTypedArrayMethod,h=c&&c.prototype,g=!t(function(){h[s].call([1])}),_=!!h&&h.values&&h[s]===h.values&&h.values.name===`values`,v=function(){return l(p(this))};m(`entries`,function(){return f(p(this))},g),m(`keys`,function(){return u(p(this))},g),m(`values`,v,g||!_,{name:`values`}),m(s,v,g||!_,{name:`values`})})),Ui=r((()=>{var e=ui(),t=d(),n=e.aTypedArray,r=e.exportTypedArrayMethod,i=t([].join);r(`join`,function(e){return i(n(this),e)})})),Wi=r(((e,t)=>{var n=xe(),r=g(),i=ce(),a=de(),o=Ct(),s=Math.min,c=[].lastIndexOf,l=!!c&&1/[1].lastIndexOf(1,-0)<0,u=o(`lastIndexOf`);t.exports=l||!u?function(e){if(l)return n(c,this,arguments)||0;var t=r(this),o=a(t);if(o===0)return-1;var u=o-1;for(arguments.length>1&&(u=s(u,i(arguments[1]))),u<0&&(u=o+u);u>=0;u--)if(u in t&&t[u]===e)return u||0;return-1}:c})),Gi=r((()=>{var e=ui(),t=xe(),n=Wi(),r=e.aTypedArray,i=e.exportTypedArrayMethod;i(`lastIndexOf`,function(e){var i=arguments.length;return t(n,r(this),i>1?[e,arguments[1]]:[e])})})),Ki=r((()=>{var e=ui(),t=Ke().map,n=e.aTypedArray,r=e.getTypedArrayConstructor,i=e.exportTypedArrayMethod;i(`map`,function(e){return t(n(this),e,arguments.length>1?arguments[1]:void 0,function(e,t){return new(r(e))(t)})})})),qi=r(((e,t)=>{var n=D(),r=P(),i=p(),a=de(),o=TypeError,s=`Reduce of empty array with no initial value`,c=function(e){return function(t,c,l,u){var d=r(t),f=i(d),p=a(d);if(n(c),p===0&&l<2)throw new o(s);var m=e?p-1:0,h=e?-1:1;if(l<2)for(;;){if(m in f){u=f[m],m+=h;break}if(m+=h,e?m<0:p<=m)throw new o(s)}for(;e?m>=0:p>m;m+=h)m in f&&(u=c(u,f[m],m,d));return u}};t.exports={left:c(!1),right:c(!0)}})),Ji=r((()=>{var e=ui(),t=qi().left,n=e.aTypedArray,r=e.exportTypedArrayMethod;r(`reduce`,function(e){var r=arguments.length;return t(n(this),e,r,r>1?arguments[1]:void 0)})})),Yi=r((()=>{var e=ui(),t=qi().right,n=e.aTypedArray,r=e.exportTypedArrayMethod;r(`reduceRight`,function(e){var r=arguments.length;return t(n(this),e,r,r>1?arguments[1]:void 0)})})),Xi=r((()=>{var e=ui(),t=e.aTypedArray,n=e.exportTypedArrayMethod,r=Math.floor;n(`reverse`,function(){for(var e=this,n=t(e).length,i=r(n/2),a=0,o;a<i;)o=e[a],e[a++]=e[--n],e[n]=o;return e})})),Zi=r((()=>{var e=i(),t=c(),n=ui(),r=de(),o=xi(),s=P(),l=a(),u=e.RangeError,d=e.Int8Array,f=d&&d.prototype,p=f&&f.set,m=n.aTypedArray,h=n.exportTypedArrayMethod,g=!l(function(){var e=new Uint8ClampedArray(2);return t(p,e,{length:1,0:3},1),e[1]!==3}),_=g&&n.NATIVE_ARRAY_BUFFER_VIEWS&&l(function(){var e=new d(2);return e.set(1),e.set(`2`,1),e[0]!==0||e[1]!==2});h(`set`,function(e){m(this);var n=o(arguments.length>
91?arguments[1]:void 0,1),i=s(e);if(g)return t(p,this,i,n);var a=this.length,c=r(i),l=0;if(c+n>a)throw new u(`Wrong length`);for(;l<c;)this[n+l]=i[l++]},!g||_)})),Qi=r((()=>{var e=ui(),t=a(),n=Se(),r=e.aTypedArray,i=e.getTypedArrayConstructor,o=e.exportTypedArrayMethod;o(`slice`,function(e,t){for(var a=n(r(this),e,t),o=i(this),s=0,c=a.length,l=new o(c);c>s;)l[s]=a[s++];return l},t(function(){new Int8Array(1).slice()}))})),$i=r((()=>{var e=ui(),t=Ke().some,n=e.aTypedArray,r=e.exportTypedArrayMethod;r(`some`,function(e){return t(n(this),e,arguments.length>1?arguments[1]:void 0)})})),ea=r(((e,t)=>{var n=Se(),r=Math.floor,i=function(e,t){var a=e.length;if(a<8)for(var o=1,s,c;o<a;){for(c=o,s=e[o];c&&t(e[c-1],s)>0;)e[c]=e[--c];c!==o++&&(e[c]=s)}else for(var l=r(a/2),u=i(n(e,0,l),t),d=i(n(e,l),t),f=u.length,p=d.length,m=0,h=0;m<f||h<p;)e[m+h]=m<f&&h<p?t(u[m],d[h])<=0?u[m++]:d[h++]:m<f?u[m++]:d[h++];return e};t.exports=i})),ta=r(((e,t)=>{var n=x().match(/firefox\/(\d+)/i);t.exports=!!n&&+n[1]})),na=r(((e,t)=>{var n=x();t.exports=/MSIE|Trident/.test(n)})),ra=r(((e,t)=>{var n=x().match(/AppleWebKit\/(\d+)\./);t.exports=!!n&&+n[1]})),ia=r((()=>{var e=i(),t=Ve(),n=a(),r=D(),o=ea(),s=ui(),c=ta(),l=na(),u=S(),d=ra(),f=s.aTypedArray,p=s.exportTypedArrayMethod,m=e.Uint16Array,h=m&&t(m.prototype.sort),g=!!h&&!(n(function(){h(new m(2),null)})&&n(function(){h(new m(2),{})})),_=!!h&&!n(function(){if(u)return u<74;if(c)return c<67;if(l)return!0;if(d)return d<602;var e=new m(516),t=Array(516),n,r;for(n=0;n<516;n++)r=n%4,e[n]=515-n,t[n]=n-2*r+3;for(h(e,function(e,t){return(e/4|0)-(t/4|0)}),n=0;n<516;n++)if(e[n]!==t[n])return!0}),v=function(e){return function(t,n){return e===void 0?n===n?t===t?t===0&&n===0?1/t>0&&1/n<0?1:-1:t>n:1:-1:+e(t,n)||0}};p(`sort`,function(e){return e!==void 0&&r(e),_?h(this,e):o(f(this),v(e))},!_||g)})),aa=r((()=>{var e=ui(),t=ue(),n=le(),r=e.aTypedArray,i=e.getTypedArrayConstructor,a=e.exportTypedArrayMethod;a(`subarray`,function(e,a){var o=r(this),s=o.length,c=n(e,s);return new(i(o))(o.buffer,o.byteOffset+c*o.BYTES_PER_ELEMENT,t((a===void 0?s:n(a,s))-c))})})),oa=r((()=>{var e=i(),t=xe(),n=ui(),r=a(),o=Se(),s=e.Int8Array,c=n.aTypedArray,l=n.exportTypedArrayMethod,u=[].toLocaleString,d=!!s&&r(function(){u.call(new s(1))});l(`toLocaleString`,function(){return t(u,d?o(c(this)):c(this),o(arguments))},r(function(){return[1,2].toLocaleString()!==new s([1,2]).toLocaleString()})||!r(function(){s.prototype.toLocaleString.call([1,2])}))})),sa=r((()=>
9{var e=ui().exportTypedArrayMethod,t=a(),n=i(),r=d(),o=n.Uint8Array,s=o&&o.prototype||{},c=[].toString,l=r([].join);t(function(){c.call({})})&&(c=function(){return l(this)});var u=s.toString!==c;e(`toString`,c,u)})),ca=r((()=>{var e=c(),t=d(),n=rr(),r=W(),i=m(),o=h(),s=Nt(),l=ir(),u=ue(),f=Pe(),p=O(),g=or(),_=Qn(),v=a(),y=_.UNSUPPORTED_Y,b=4294967295,x=Math.min,S=t([].push),C=t(``.slice),w=!v(function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n=`ab`.split(e);return n.length!==2||n[0]!==`a`||n[1]!==`b`}),T=`abbc`.split(/(b)*/)[1]===`c`||`test`.split(/(?:)/,-1).length!==4||`ab`.split(/(?:ab)*/).length!==2||`.`.split(/(.?)(.?)/).length!==4||`.`.split(/()()/).length>1||``.split(/.?/).length;n(`split`,function(t,n,a){var c=`0`.split(void 0,0).length?function(t,r){return t===void 0&&r===0?[]:e(n,this,t,r)}:n;return[function(n,r){var a=o(this),s=i(n)?void 0:p(n,t);return s?e(s,n,a,r):e(c,f(a),n,r)},function(e,t){var i=r(this),o=f(e);if(!T){var d=a(c,i,o,t,c!==n);if(d.done)return d.value}var p=s(i,RegExp),m=i.unicode,h=(i.ignoreCase?`i`:``)+(i.multiline?`m`:``)+(i.unicode?`u`:``)+(y?`g`:`y`),_=new p(y?`^(?:`+i.source+`)`:i,h),v=t===void 0?b:t>>>0;if(v===0)return[];if(o.length===0)return g(_,o)===null?[o]:[];for(var w=0,E=0,D=[];E<o.length;){_.lastIndex=y?0:E;var O=g(_,y?C(o,E):o),k;if(O===null||(k=x(u(_.lastIndex+(y?E:0)),o.length))===w)E=l(o,E,m);else{if(S(D,C(o,w,E)),D.length===v)return D;for(var A=1;A<=O.length-1;A++)if(S(D,O[A]),D.length===v)return D;E=w=k}}return S(D,C(o,w)),D}]},T||!w,y)})),la=r(((e,t)=>{function n(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),ua=r(((e,t)=>{function n(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(t.exports=n=function(){return!!e},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),da=r(((e,t)=>{var n=ua(),r=ct();function i(e,t,i){if(n())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,t);var o=new(e.bind.apply(e,a));return i&&r(o,i.prototype),o}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),fa=r(((e,t)=>{var n=ft(),r=ct(),i=la(),a=da();function o(e){var s=typeof Map==`function`?new Map:void 0;return t.exports=o=function(e){if(e===null||!i(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(s!==void 0){if(s.has(e))return s.get(e);s.set(e,t)}function t(){return a(e,arguments,n(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r(t,e)},t.exports.__esModule=!0,t.exports.default=t.exports,o(e)}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports})),pa=r(((e,t)=>{(function(){var n={function:!0,object:!0},r=n[typeof window]&&window||this,i=n[typeof e]&&e,a=n[typeof t]&&t&&!t.nodeType&&t,o=i&&a&&typeof global==`object`&&global;o&&(o.global===o||o.window===o||o.self===o)&&(r=o);var s=2**53-1,c=/\bOpera/,l=Object.prototype,u=l.hasOwnProperty,d=l.toString;function f(e){return e=String(e),e.charAt(0).toUpperCase()+e.slice(1)}function p(e,t,n){var r={"10.0":`10`,"6.4":`10 Technical Preview`,"6.3":`8.1`,"6.2":`8`,"6.1":`Server 2008 R2 / 7`,"6.0":`Server 2008 / Vista`,"5.2":`Server 2003 / XP 64-bit`,"5.1":`XP`,"5.01":`2000 SP1`,"5.0":`2000`,"4.0":`NT`,"4.90":`ME`};return t&&n&&/^Win/i.test(e)&&!/^Windows Phone /i.test(e)&&(r=r[/[\d.]+$/.exec(e)])&&(e=`Windows `+r),e=String(e),t&&n&&(e=e.replace(RegExp(t,`i`),n)),e=h(e.replace(/ ce$/i,` CE`).replace(/\bhpw/i,`web`).replace(/\bMacintosh\b/,`Mac OS`).replace(/_PowerPC\b/i,` OS`).replace(/\b(OS X) [^ \d]+/i,`$1`).replace(/\bMac (OS X)\b/,`$1`).replace(/\/(\d)/,` $1`).replace(/_/g,`.`).replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,``).replace(/\bx86\.64\b/gi,`x86_64`).replace(/\b(Windows Phone) OS\b/,`$1`).replace(/\b(Chrome OS \w+) [\d.]+\b/,`$1`).split(` on `)[0]),e}function m(e,t){var n=-1,r=e?e.length:0;if(typeof r==`number`&&r>-1&&r<=s)for(;++n<r;)t(e[n],n,e);else g(e,t)}function h(e){return e=x(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:f(e)}function g(e,t){for(var n in e)u.call(e,n)&&t(e[n],n,e)}function _(e){return e==null?f(e):d.call(e).slice(8,-1)}function v(e,t){var n=e==null?`number`:typeof e[t];return!/^(?:boolean|number|string|undefined)$/.test(n)&&(n!=`object`||!!e[t])}function y(e){return String(e).replace(/([ -])(?!$)/g,`$1?`)}function b(e,t){var n=null;return m(e,function(r,i){n=t(n,r,i,e)}),n}function x(e){return String(e).replace(/^ +| +$/g,``)}function S(e){var t=r,n=e&&typeof e==`object`&&_(e)!=`String`;n&&(t=e,e=null);var i=t.navigator||{},a=i.userAgent||``;e||=a;var o=n?!!i.likeChrome:/\bChrome\b/.test(e)&&!/internal|\n/i.test(d.toString()),s=`Object`,l=n?s:`ScriptBridgingProxyObject`,u=n?s:`Environment`,f=n&&t.java?`JavaPackage`:_(t.java),m=n?s:`RuntimeObject`,C=/\bJava/.test(f)&&t.java,w=C&&_(t.environment)==u,T=C?`a`:`α`,E=C?`b`:`β`,D=t.document||{},O=t.operamini||t.opera,k=c.test(k=n&&O?O[`[[Class]]`]:_(O))?k:O=null,A,j=e,M=[],N=null,P=e==a,F=P&&O&&typeof O.version==`function`&&O.version(),I,L=H([{label:`EdgeHTML`,pattern:`Edge`},`Trident`,{label:`WebKit`,pattern:`AppleWebKit`},`iCab`,`Presto`,`NetFront`,`Tasman`,`KHTML`,`Gecko`]),R=W([`Adobe AIR`,`Arora`,`Avant Browser`,`Breach`,`Camino`,`Electron`,`Epiphany`,`Fennec`,`Flock`,`Galeon`,`GreenBrowser`,`iCab`,`Iceweasel`,`K-Meleon`,`Konqueror`,`Lun
9ascape`,`Maxthon`,{label:`Microsoft Edge`,pattern:`(?:Edge|Edg|EdgA|EdgiOS)`},`Midori`,`Nook Browser`,`PaleMoon`,`PhantomJS`,`Raven`,`Rekonq`,`RockMelt`,{label:`Samsung Internet`,pattern:`SamsungBrowser`},`SeaMonkey`,{label:`Silk`,pattern:`(?:Cloud9|Silk-Accelerated)`},`Sleipnir`,`SlimBrowser`,{label:`SRWare Iron`,pattern:`Iron`},`Sunrise`,`Swiftfox`,`Vivaldi`,`Waterfox`,`WebPositive`,{label:`Yandex Browser`,pattern:`YaBrowser`},{label:`UC Browser`,pattern:`UCBrowser`},`Opera Mini`,{label:`Opera Mini`,pattern:`OPiOS`},`Opera`,{label:`Opera`,pattern:`OPR`},`Chromium`,`Chrome`,{label:`Chrome`,pattern:`(?:HeadlessChrome)`},{label:`Chrome Mobile`,pattern:`(?:CriOS|CrMo)`},{label:`Firefox`,pattern:`(?:Firefox|Minefield)`},{label:`Firefox for iOS`,pattern:`FxiOS`},{label:`IE`,pattern:`IEMobile`},{label:`IE`,pattern:`MSIE`},`Safari`]),z=G([{label:`BlackBerry`,pattern:`BB10`},`BlackBerry`,{label:`Galaxy S`,pattern:`GT-I9000`},{label:`Galaxy S2`,pattern:`GT-I9100`},{label:`Galaxy S3`,pattern:`GT-I9300`},{label:`Galaxy S4`,pattern:`GT-I9500`},{label:`Galaxy S5`,pattern:`SM-G900`},{label:`Galaxy S6`,pattern:`SM-G920`},{label:`Galaxy S6 Edge`,pattern:`SM-G925`},{label:`Galaxy S7`,pattern:`SM-G930`},{label:`Galaxy S7 Edge`,pattern:`SM-G935`},`Google TV`,`Lumia`,`iPad`,`iPod`,`iPhone`,`Kindle`,{label:`Kindle Fire`,pattern:`(?:Cloud9|Silk-Accelerated)`},`Nexus`,`Nook`,`PlayBook`,`PlayStation Vita`,`PlayStation`,`TouchPad`,`Transformer`,{label:`Wii U`,pattern:`WiiU`},`Wii`,`Xbox One`,{label:`Xbox 360`,pattern:`Xbox`},`Xoom`]),B=U({Apple:{iPad:1,iPhone:1,iPod:1},Alcatel:{},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},Huawei:{},Lenovo:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Oppo:{},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1},Xiaomi:{Mi:1,Redmi:1}}),V=ee([`Windows Phone`,`KaiOS`,`Android`,`CentOS`,{label:`Chrome OS`,pattern:`CrOS`},`Debian`,{label:`DragonFly BSD`,pattern:`DragonFly`},`Fedora`,`FreeBSD`,`Gentoo`,`Haiku`,`Kubuntu`,`Linux Mint`,`OpenBSD`,`Red Hat`,`SuSE`,`Ubuntu`,`Xubuntu`,`Cygwin`,`Symbian OS`,`hpwOS`,`webOS `,`webOS`,`Tablet OS`,`Tizen`,`Linux`,`Mac OS X`,`Macintosh`,`Mac`,`Windows 98;`,`Windows `]);function H(t){return b(t,function(t,n){return t||RegExp(`\\b`+(n.pattern||y(n))+`\\b`,`i`).exec(e)&&(n.label||n)})}function U(t){return b(t,function(t,n,r){return t||(n[z]||n[/^[a-z]+(?: +[a-z]+\b)*/i.exec(z)]||RegExp(`\\b`+y(r)+`(?:\\b|\\w*\\d)`,`i`).exec(e))&&r})}function W(t){return b(t,function(t,n){return t||RegExp(`\\b`+(n.pattern||y(n))+`\\b`,`i`).exec(e)&&(n.label||n)})}function ee(t){return b(t,function(t,n){var r=n.pattern||y(n);return!t&&(t=RegExp(`\\b`+r+`(?:/[\\d.]+|[ \\w.]*)`,`i`).exec(e))&&(t=p(t,r,n.label||n)),t})}function G(t){return b(t,function(t,n){var r=n.pattern||y(n);return!t&&(t=RegExp(`\\b`+r+` *\\d+[.\\w_]*`,`i`).exec(e)||RegExp(`\\b`+r+` *\\w+-[\\w]*`,`i`).exec(e)||RegExp(`\\b`+r+`(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)`,`i`).exec(e))&&((t=String(n.label&&!RegExp(r,`i`).test(n.label)?n.label:t).split(`/`))[1]&&!/[\d.]+/.test(t[0])&&(t[0]+=` `+t[1]),n=n.label||n,t=h(t[0].replace(RegExp(r,`i`),n).replace(RegExp(`; *(?:`+n+`[_-])?`,`i`),` `).replace(RegExp(`(`+n+`)[-_.]?(\\w)`,`i`),`$1 $2`))),t})}function K(t){return b(t,function(t,n){return t||(RegExp(n+`(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)`,`i`).exec(e)||0)[1]||null})}function te(){return this.description||``}if(L&&=[L],/\bAndroid\b/.test(V)&&!z&&(A=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(e))&&(z=x(A[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,``)||null),B&&!z?z=G([B]):B&&z&&(z=z.replace(RegExp(`^(`+y(B)+`)[-_.\\s]`,`i`),B+` `).replace(RegExp(`^(`+y(B)+`)[-_.]?(\\w)`,`i`),B+` $2`)),(A=/\bGoogle TV\b/.exec(z))&&(z=A[0]),/\bSimulator\b/i.test(e)&&(z=(z?z+` `:``)+`Simulator`),R==`Opera Mini`&&/\bOPiOS\b/.test(e)&&M.push(`running in Turbo/Uncompressed mode`),R==`IE`&&/\blike iPhone OS\b/.test(e)?(A=S(e.replace(/like iPhone OS/,``)),B=A.manufacturer,z=A.product):/^iP/.test(z)?(R||=`Safari`,V=`iOS`+((A=/ OS ([\d_]+)/i.exec(e))?` `+A[1].replace(/_/g,`.`):``)):R==`Konqueror`&&/^Linux\b/i.test(V)?V=`Kubuntu`:B&&B!=`Google`&&(/Chrome/.test(R)&&!/\bMobile Safari\b/i.test(e)||/\bVita\b/.test(z))||/\bAndroid\b/.test(V)&&/^Chrome/.test(R)&&/\bVersion\//i.test(e)?(R=`Android Browser`,V=/\bAndroid\b/.test(V)?V:`Android`):R==`Silk`?(/\bMobi/i.test(e)||(V=`Android`,M.unshift(`desktop mode`)),/Accelerated *= *true/i.test(e)&&M.unshift(`accelerated`)):R==`UC Browser`&&/\bUCWEB\b/.test(e)?M.push(`speed mode`):R==`PaleMoon`&&(A=/\bFirefox\/([\d.]+)\b/.exec(e))?M.push(`identifying as Firefox `+A[1]):R==`Firefox`&&(A=/\b(Mobile|Tablet|TV)\b/i.exec(e))?(V||=`Firefox OS`,z||=A[1]):!R||(A=!/\bMinefield\b/i.test(e)&&/\b(?:Firefox|Safari)\b/.exec(R))?(R&&!z&&/[\/,]|^[^(]+?\)/.test(e.slice(e.indexOf(A+`/`)+8))&&(R=null),(A=z||B||V)&&(z||B||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(V))&&(R=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(V)?V:A)+` Browser`)):R==`Electron`&&(A=(/\bChrome\/([\d.]+)\b/.exec(e)||0)[1])&&M.push(`Chromium `+A),F||=K([`(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)`,`Version`,y(R),`(?:Firefox|Minefield|NetFront)`]),(A=L==`iCab`&&parseFloat(F)>
vendor: 4,777 bytes, line 9
93&&`WebKit`||/\bOpera\b/.test(R)&&(/\bOPR\b/.test(e)?`Blink`:`Presto`)||/\b(?:Midori|Nook|Safari)\b/i.test(e)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&`WebKit`||!L&&/\bMSIE\b/i.test(e)&&(V==`Mac OS`?`Tasman`:`Trident`)||L==`WebKit`&&/\bPlayStation\b(?! Vita\b)/i.test(R)&&`NetFront`)&&(L=[A]),R==`IE`&&(A=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(e)||0)[1])?(R+=` Mobile`,V=`Windows Phone `+(/\+$/.test(A)?A:A+`.x`),M.unshift(`desktop mode`)):/\bWPDesktop\b/i.test(e)?(R=`IE Mobile`,V=`Windows Phone 8.x`,M.unshift(`desktop mode`),F||=(/\brv:([\d.]+)/.exec(e)||0)[1]):R!=`IE`&&L==`Trident`&&(A=/\brv:([\d.]+)/.exec(e))&&(R&&M.push(`identifying as `+R+(F?` `+F:``)),R=`IE`,F=A[1]),P){if(v(t,`global`)){if(C&&(A=C.lang.System,j=A.getProperty(`os.arch`),V||=A.getProperty(`os.name`)+` `+A.getProperty(`os.version`)),w){try{F=t.require(`ringo/engine`).version.join(`.`),R=`RingoJS`}catch{(A=t.system)&&A.global.system==t.system&&(R=`Narwhal`,V||=A[0].os||null)}R||=`Rhino`}else typeof t.process==`object`&&!t.process.browser&&(A=t.process)&&(typeof A.versions==`object`&&(typeof A.versions.electron==`string`?(M.push(`Node `+A.versions.node),R=`Electron`,F=A.versions.electron):typeof A.versions.nw==`string`&&(M.push(`Chromium `+F,`Node `+A.versions.node),R=`NW.js`,F=A.versions.nw)),R||(R=`Node.js`,j=A.arch,V=A.platform,F=/[\d.]+/.exec(A.version),F=F?F[0]:null))}else _(A=t.runtime)==l?(R=`Adobe AIR`,V=A.flash.system.Capabilities.os):_(A=t.phantom)==m?(R=`PhantomJS`,F=(A=A.version||null)&&A.major+`.`+A.minor+`.`+A.patch):typeof D.documentMode==`number`&&(A=/\bTrident\/(\d+)/i.exec(e))?(F=[F,D.documentMode],(A=+A[1]+4)!=F[1]&&(M.push(`IE `+F[1]+` mode`),L&&(L[1]=``),F[1]=A),F=R==`IE`?String(F[1].toFixed(1)):F[0]):typeof D.documentMode==`number`&&/^(?:Chrome|Firefox)\b/.test(R)&&(M.push(`masking as `+R+` `+F),R=`IE`,F=`11.0`,L=[`Trident`],V=`Windows`);V&&=h(V)}if(F&&(A=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(F)||/(?:alpha|beta)(?: ?\d)?/i.exec(e+`;`+(P&&i.appMinorVersion))||/\bMinefield\b/i.test(e)&&`a`)&&(N=/b/i.test(A)?`beta`:`alpha`,F=F.replace(RegExp(A+`\\+?$`),``)+(N==`beta`?E:T)+(/\d+\+?/.exec(A)||``)),R==`Fennec`||R==`Firefox`&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(V))R=`Firefox Mobile`;else if(R==`Maxthon`&&F)F=F.replace(/\.[\d.]+/,`.x`);else if(/\bXbox\b/i.test(z))z==`Xbox 360`&&(V=null),z==`Xbox 360`&&/\bIEMobile\b/.test(e)&&M.unshift(`mobile mode`);else if((/^(?:Chrome|IE|Opera)$/.test(R)||R&&!z&&!/Browser|Mobi/.test(R))&&(V==`Windows CE`||/Mobi/i.test(e)))R+=` Mobile`;else if(R==`IE`&&P)try{t.external===null&&M.unshift(`platform preview`)}catch{M.unshift(`embedded`)}else(/\bBlackBerry\b/.test(z)||/\bBB10\b/.test(e))&&(A=(RegExp(z.replace(/ +/g,` *`)+`/([.\\d]+)`,`i`).exec(e)||0)[1]||F)?(A=[A,/BB10/.test(e)],V=(A[1]?(z=null,B=`BlackBerry`):`Device Software`)+` `+A[0],F=null):this!=g&&z!=`Wii`&&(P&&O||/Opera/.test(R)&&/\b(?:MSIE|Firefox)\b/i.test(e)||R==`Firefox`&&/\bOS X (?:\d+\.){2,}/.test(V)||R==`IE`&&(V&&!/^Win/.test(V)&&F>5.5||/\bWindows XP\b/.test(V)&&F>8||F==8&&!/\bTrident\b/.test(e)))&&!c.test(A=S.call(g,e.replace(c,``)+`;`))&&A.name&&(A=`ing as `+A.name+((A=A.version)?` `+A:``),c.test(R)?(/\bIE\b/.test(A)&&V==`Mac OS`&&(V=null),A=`identify`+A):(A=`mask`+A,R=k?h(k.replace(/([a-z])([A-Z])/g,`$1 $2`)):`Opera`,/\bIE\b/.test(A)&&(V=null),P||(F=null)),L=[`Presto`],M.push(A));(A=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(e)||0)[1])&&(A=[parseFloat(A.replace(/\.(\d)$/,`.0$1`)),A],R==`Safari`&&A[1].slice(-1)==`+`?(R=`WebKit Nightly`,N=`alpha`,F=A[1].slice(0,-1)):(F==A[1]||F==(A[2]=(/\bSafari\/([\d.]+\+?)/i.exec(e)||0)[1]))&&(F=null),A[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(e)||0)[1],A[0]==537.36&&A[2]==537.36&&parseFloat(A[1])>=28&&L==`WebKit`&&(L=[`Blink`]),!P||!o&&!A[1]?(L&&(L[1]=`like Safari`),A=(A=A[0],A<400?1:A<500?2:A<526?3:A<533?4:A<534?`4+`:A<535?5:A<537?6:A<538?7:A<601?8:A<602?9:A<604?10:A<606?11:A<608?12:`12`)):(L&&(L[1]=`like Chrome`),A=A[1]||(A=A[0],A<530?1:A<532?2:A<532.05?3:A<533?4:A<534.03?5:A<534.07?6:A<534.1?7:A<534.13?8:A<534.16?9:A<534.24?10:A<534.3?11:A<535.01?12:A<535.02?`13+`:A<535.07?15:A<535.11?16:A<535.19?17:A<536.05?18:A<536.1?19:A<537.01?20:A<537.11?`21+`:A<537.13?23:A<537.18?24:A<537.24?25:A<537.36?26:L==`Blink`?`28`:`27`)),L&&(L[1]+=` `+(A+=typeof A==`number`?`.x`:/[.+]/.test(A)?``:`+`)),R==`Safari`&&(!F||parseInt(F)>45)?F=A:R==`Chrome`&&/\bHeadlessChrome/i.test(e)&&M.unshift(`headless`)),R==`Opera`&&(A=/\bzbov|zvav$/.exec(V))?(R+=` `,M.unshift(`desktop mode`),A==`zvav`?(R+=`Mini`,F=null):R+=`Mobile`,V=V.replace(RegExp(` *`+A+`$`),``)):R==`Safari`&&/\bChrome\b/.exec(L&&L[1])?(M.unshift(`desktop mode`),R=`Chrome Mobile`,F=null,/\bOS X\b/.test(V)?(B=`Apple`,V=`iOS 4.3+`):V=null):/\bSRWare Iron\b/.test(R)&&!F&&(F=K(`Chrome`)),F&&F.indexOf(A=/[\d.]+$/.exec(V))==0&&e.indexOf(`/`+A+`-`)>
9-1&&(V=x(V.replace(A,``))),V&&V.indexOf(R)!=-1&&!RegExp(R+` OS`).test(V)&&(V=V.replace(RegExp(` *`+y(R)+` *`),``)),L&&!/\b(?:Avant|Nook)\b/.test(R)&&(/Browser|Lunascape|Maxthon/.test(R)||R!=`Safari`&&/^iOS/.test(V)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(R)&&L[1])&&(A=L[L.length-1])&&M.push(A),M.length&&(M=[`(`+M.join(`; `)+`)`]),B&&z&&z.indexOf(B)<0&&M.push(`on `+B),z&&M.push((/^on /.test(M[M.length-1])?``:`on `)+z),V&&=(A=/ ([\d.+]+)$/.exec(V),I=A&&V.charAt(V.length-A[0].length-1)==`/`,{architecture:32,family:A&&!I?V.replace(A[0],``):V,version:A?A[1]:null,toString:function(){var e=this.version;return this.family+(e&&!I?` `+e:``)+(this.architecture==64?` 64-bit`:``)}}),(A=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(j))&&!/\bi686\b/i.test(j)?(V&&(V.architecture=64,V.family=V.family.replace(RegExp(` *`+A),``)),R&&(/\bWOW64\b/i.test(e)||P&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(e))&&M.unshift(`32-bit`)):V&&/^OS X/.test(V.family)&&R==`Chrome`&&parseFloat(F)>=39&&(V.architecture=64),e||=null;var ne={};return ne.description=e,ne.layout=L&&L[0],ne.manufacturer=B,ne.name=R,ne.prerelease=N,ne.product=z,ne.ua=e,ne.version=R&&F,ne.os=V||{architecture:null,family:null,version:null,toString:function(){return`null`}},ne.parse=S,ne.toString=te,ne.version&&M.unshift(F),ne.name&&M.unshift(R),V&&R&&!(V==String(V).split(` `)[0]&&(V==R.split(` `)[0]||z))&&M.push(z?`(`+V+`)`:`on `+V),M.length&&(ne.description=M.join(` `)),ne}var C=S();typeof define==`function`&&typeof define.amd==`object`&&define.amd?(r.platform=C,define(function(){return C})):i&&a?g(C,function(e,t){i[t]=e}):r.platform=C}).call(e)})),ma=r((()=>{var e=c(),t=rr(),n=W(),r=m(),i=ue(),a=Pe(),o=h(),s=O(),l=ir(),u=or();t(`match`,function(t,c,d){return[function(n){var i=o(this),c=r(n)?void 0:s(n,t);return c?e(c,n,i):new RegExp(n)[t](a(i))},function(e){var t=n(this),r=a(e),o=d(c,t,r);if(o.done)return o.value;if(!t.global)return u(t,r);var s=t.unicode;t.lastIndex=0;for(var f=[],p=0,m;(m=u(t,r))!==null;){var h=a(m[0]);f[p]=h,h===``&&(t.lastIndex=l(r,i(t.lastIndex),s)),p++}return p===0?null:f}]})})),ha=r(((e,t)=>{t.exports=Object.is||function(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}})),ga=r((()=>{var e=c(),t=rr(),n=W(),r=m(),i=h(),a=ha(),o=Pe(),s=O(),l=or();t(`search`,function(t,c,u){return[function(n){var a=i(this),c=r(n)?void 0:s(n,t);return c?e(c,n,a):new RegExp(n)[t](o(a))},function(e){var t=n(this),r=o(e),i=u(c,t,r);if(i.done)return i.value;var s=t.lastIndex;a(s,0)||(t.lastIndex=0);var d=l(t,r);return a(t.lastIndex,s)||(t.lastIndex=s),d===null?-1:d.index}]})})),_a=r(((e,t)=>{var n=o(),r=Ue(),i=TypeError,a=Object.getOwnPropertyDescriptor;t.exports=n&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(r(e)&&!a(e,`length`).writable)throw new i(`Cannot set read only .length`);return e.length=t}:function(e,t){return e.length=t}})),va=r((()=>{var e=Y(),t=P(),n=le(),r=ce(),i=de(),a=_a(),o=yn(),s=Ge(),c=it(),l=Ai(),u=tt()(`splice`),d=Math.max,f=Math.min;e({target:`Array`,proto:!0,forced:!u},{splice:function(e,u){var p=t(this),m=i(p),h=n(e,m),g=arguments.length,_,v,y,b,x,S;for(g===0?_=v=0:g===1?(_=0,v=m-h):(_=g-2,v=f(d(r(u),0),m-h)),o(m+_-v),y=s(p,v),b=0;b<v;b++)x=h+b,x in p&&c(y,b,p[x]);if(y.length=v,_<v){for(b=h;b<m-v;b++)x=b+v,S=b+_,x in p?p[S]=p[x]:l(p,S);for(b=m;b>m-v+_;b--)l(p,b-1)}else if(_>v)for(b=m-v;b>h;b--)x=b+v-1,S=b+_-1,x in p?p[S]=p[x]:l(p,S);for(b=0;b<_;b++)p[b+h]=arguments[b+2];return a(p,m-v+_),y}})})),ya=r((e=>{var t=t===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:t;Object.defineProperty(e,"__esModule",{value:!0}),be(),Me();var n=ot(),r=st(),i=Ar(),a=lt(),o=dt(),s=ft(),c=gt(),l=_t(),u=ht(),d=vn();bn(),bt(),Ur(),Q(),vt(),Qe();var f=ut(),p=Or();Cn(),jn();var m=Mn();Wn(),Gr(),Gn(),et(),_r(),cn();var h=Kr(),g=ci();nr(),sr(),Xn(),Oi(),ki(),Mi(),Ni(),Pi(),Ii(),Li(),Ri(),zi(),Bi(),Vi(),Hi(),Ui(),Gi(),Ki(),Ji(),Yi(),Xi(),Zi(),Qi(),$i(),ia(),aa(),oa(),sa(),ca();var _=fa();Ne(),nt(),rt(),Tt(),at();var v=Vr(),y=jr();Br();var b=pa();ma(),ga(),va();function x(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}
9function S(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var C=x(n),w=x(r),T=x(i),E=x(a),D=x(o),O=x(s),k=x(c),A=x(l),j=x(u),M=x(d),N=x(f),P=S(m),F=S(h),I=x(_),L=S(b);function R(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if((typeof Reflect>`u`?`undefined`:N.default(Reflect))===`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function z(e,t){if((typeof Reflect>`u`?`undefined`:N.default(Reflect))===`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}var B=P.getLogger(`twilsock`);function V(e,t){return[`${new Date().toISOString()} Twilsock ${e}:`].concat(Array.from(t))}var H=new(function(){function e(t){A.default(this,e),j.default(this,`prefix`,``),this.prefix=t!=null&&t.length>0?` `+t+`:`:``}return k.default(e,[{key:`setLevel`,value:function(e){B.setLevel(e)}},{key:`trace`,value:function(){if(B.getLevel()==B.levels.TRACE){var e=[...arguments];B.debug.apply(null,V(`T`,e))}}},{key:`debug`,value:function(){var e=[...arguments];B.debug.apply(null,V(`D`,e))}}
9,{key:`info`,value:function(){var e=[...arguments];B.info.apply(null,V(`I`,e))}},{key:`warn`,value:function(){var e=[...arguments];B.warn.apply(null,V(`W`,e))}},{key:`error`,value:function(){var e=[...arguments];B.error.apply(null,V(`E`,e))}}],[{key:`setLevel`,value:function(e){B.setLevel(e)}},{key:`trace`,value:function(){if(B.getLevel()==B.levels.TRACE){var e=[...arguments];B.debug.apply(null,V(`T`,e))}}},{key:`debug`,value:function(){var e=[...arguments];B.debug.apply(null,V(`D`,e))}},{key:`info`,value:function(){var e=[...arguments];B.info.apply(null,V(`I`,e))}},{key:`warn`,value:function(){var e=[...arguments];B.warn.apply(null,V(`W`,e))}},{key:`error`,value:function(){var e=[...arguments];B.error.apply(null,V(`E`,e))}}]),e}())(``),U=`0.14.0`,W=function(){function e(t,n,r){A.default(this,e),j.default(this,`confirmedCapabilities`,new Set),this.activeGrant=n,this._token=t;var i=`wss://tsock.${r.region||`us1`}.twilio.com/v3/wsconnect`,a=r.twilsock||r.Twilsock||{};this.url=a.uri||i,this._continuationToken=r.continuationToken?r.continuationToken:null,this.logLevel=r.logLevel?r.logLevel:`error`,this.retryPolicy=r.retryPolicy?r.retryPolicy:{min:1e3,max:12e4,randomness:.2},this.clientMetadata=r.clientMetadata?r.clientMetadata:{},this.clientMetadata.ver=U,this.initRegistrations=r.initRegistrations?r.initRegistrations:null,this.tweaks=r.tweaks?r.tweaks:null}return k.default(e,[{key:`token`,get:function(){return this._token}},{key:`continuationToken`,get:function(){return this._continuationToken}},{key:`updateToken`,value:function(e){this._token=e}},{key:`updateContinuationToken`,value:function(e){this._continuationToken=e}}]),e}(),ee=k.default(function e(t){A.default(this,e),this.id=t||`TM${g.v4()}`});function G(e){var t=K();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function K(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var te=function(e){E.default(n,e);var t=G(n);function n(e,r,i,a,o){var s;return A.default(this,n),s=t.call(this),j.default(w.default(s),`method`,`init`),s.token=e,s.continuation_token=r,s.metadata=i,s.registrations=a,s.tweaks=o,s.capabilities=[`client_update`,`offline_storage`,`telemetry.v1`],s}return k.default(n)}(ee);function ne(e){var t=re();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function re(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var ie=function(e){E.default(n,e);var t=ne(n);function n(e,r,i,a,o,s,c){var l;return A.default(this,n),l=t.call(this,e),l.continuationToken=r,l.continuationTokenStatus=a,l.offlineStorage=o,l.initRegistrations=s,l.debugInfo=c,l.confirmedCapabilities=i,l}return k.default(n)}(ee);function ae(e){var t=oe();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function oe(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var q=function(e){E.default(n,e);var t=ae(n);function n(e){var r;return A.default(this,n),r=t.call(this),j.default(w.default(r),`method`,`update`),r.token=e,r}return k.default(n)}(ee);function se(e){var t=ce();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function ce(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var le=function(e){E.default(n,e);var t=se(n);
9function n(e,r,i){var a;return A.default(this,n),a=t.call(this),j.default(w.default(a),`method`,`message`),a.active_grant=e,a.payload_type=r,a.http_request=i,a}return k.default(n)}(ee);function ue(e){var t=de();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function de(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var fe=function(e){E.default(n,e);var t=ue(n);function n(e){var r;return A.default(this,n),r=t.call(this,e),j.default(w.default(r),`method`,`reply`),j.default(w.default(r),`payload_type`,`application/json`),j.default(w.default(r),`status`,{code:200,status:`OK`}),r}return k.default(n)}(ee);function pe(e){var t=me();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function me(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var J=function(e){E.default(n,e);var t=pe(n);function n(){var e;return A.default(this,n),e=t.call(this),j.default(w.default(e),`method`,`close`),e}return k.default(n)}(ee);function he(e){var t=ge();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function ge(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var _e=k.default(function e(t,n,r,i,a,o){A.default(this,e),this.start=t,this.end=n,this.title=r,this.details=i,this.id=a,this.type=o}),ve=function(e){E.default(n,e);var t=he(n);function n(e){var r;return A.default(this,n),r=t.call(this),j.default(w.default(r),`method`,`telemetry.v1`),r.events=e,r}return k.default(n)}(ee);function Y(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(Number(`0x`+t))}).length}function ye(e){var t=encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(Number(`0x`+t))}),n=new Uint8Array(t.length);return Array.prototype.forEach.call(t,function(e,t){n[t]=e.charCodeAt(0)}),n}function xe(e){var t=Array.prototype.map.call(e,function(e){return String.fromCharCode(e)}).join(``).replace(/(.)/g,function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n=`0`+n),`%`+n});return decodeURIComponent(t)}function Se(e){return JSON.parse(xe(e))}function Ce(e){for(var t=``,n=0;n<e.length;++n){var r=String.fromCharCode(e[n]);if(t+=r,r===`\r`){n+=2;break}}var i=t.split(` `);return{size:n,protocol:i[0],version:i[1],headerSize:Number(i[2])}}var we=function(){function e(){A.default(this,e)}return k.default(e,null,[{key:`parse`,value:function(e){var t=2,n=new Uint8Array(e),r=Ce(n);if(r.protocol!==`TWILSOCK`||r.version!==`V3.0`)return H.error(`unsupported protocol: ${r.protocol} ver ${r.version}`),null;var i;try{i=Se(n.subarray(r.size,r.size+r.headerSize))}catch(t){return H.error(`failed to parse message header`,t,e),null}H.debug(`message received:`,i.method);var a;if(i.payload_size>0){var o=t+r.size+r.headerSize,s=i.payload_size;if(!i.hasOwnProperty(`payload_type`)||i.payload_type.indexOf(`application/json`)===0)try{a=Se(n.subarray(o,o+s))}catch(t){return H.error(`failed to parse message body`,t,e),null}else i.payload_type.indexOf(`text/plain`)===0&&(a=xe(n.subarray(o,o+s)))}return{method:i.method,header:i,payload:a}}},{key:`createPacket`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``;e.payload_size=Y(t);var n=JSON.stringify(e),r=`TWILSOCK V3.0 `+Y(n);return H.debug(`send request:`,r+n+t),ye(r+`\r 10`+n+`\r 11`+t).buffer}}]),e}();function Te(e){var t=Ee();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function Ee(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var De=function(e){E.default(n,e);var t=Te(n);function n(e){return A.default(this,n),t.call(this,e)}return k.default(n)}(I.default(Error));function Oe(e){var t=ke();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}
11function ke(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Ae=function(e){E.default(n,e);var t=Oe(n);function n(e,r){var i;return A.default(this,n),i=t.call(this,e),i.reply=r,i}return k.default(n)}(De);function je(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 Pe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?je(Object(n),!0).forEach(function(t){j.default(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):je(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fe(e){var t=Ie();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function Ie(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Le=function(e){E.default(n,e);var t=Fe(n);function n(e){var r;return A.default(this,n),r=t.call(this),j.default(w.default(r),`newBackoff`,null),j.default(w.default(r),`usedBackoff`,null),j.default(w.default(r),`retrier`,null),r.options=e?Pe({},e):{},r}return k.default(n,[{key:`inProgress`,get:function(){return!!this.retrier}},{key:`start`,value:function(){if(this.inProgress)throw Error(`Already waiting for next attempt, call finishAttempt(success : boolean) to finish it`);this.createRetrier()}},{key:`stop`,value:function(){this.cleanRetrier(),this.newBackoff=null,this.usedBackoff=null}},{key:`modifyBackoff`,value:function(e){this.newBackoff=e}},{key:`attemptFailed`,value:function(){if(!this.inProgress)throw Error(`No attempt is in progress`);if(this.newBackoff){if(!this.usedBackoff||this.usedBackoff<this.newBackoff)this.createRetrier();else{var e;(e=this.retrier)==null||e.failed(Error())}}else{var t;(t=this.retrier)==null||t.failed(Error())}}},{key:`cancel`,value:function(){var e;(e=this.retrier)==null||e.cancel()}},{key:`cleanRetrier`,value:function(){var e,t;(e=this.retrier)==null||e.removeAllListeners(),(t=this.retrier)==null||t.cancel(),this.retrier=null}},{key:`getRetryPolicy`,value:function(){var e=Pe({},this.options);return this.newBackoff&&(e.min=this.newBackoff,e.max=this.options.max&&this.options.max>this.newBackoff?this.options.max:this.newBackoff),e.maxAttemptsCount=this.options.maxAttemptsCount?this.options.maxAttemptsCount+1:void 0,e}},{key:`createRetrier`,value:function(){var e=this;this.cleanRetrier();var t=this.getRetryPolicy();this.retrier=new v.Retrier(t),this.retrier.once(`attempt`,function(){var t,n;(t=e.retrier)==null||t.on(`attempt`,function(){return e.emit(`attempt`)}),(n=e.retrier)==null||n.failed(Error(`Skipping first attempt`))}),this.retrier.on(`failed`,function(t){return e.emit(`failed`,t)}),this.usedBackoff=this.newBackoff,this.newBackoff=null,this.retrier.start()}}]),n}(y.ReplayEventEmitter);function Re(e){var t=ze();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function ze(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Be=3e3;function Ve(e){setTimeout(e,0)}var He=function(e){E.default(n,e);var t=Re(n);function n(e,r,i){var a;A.default(this,n),a=t.call(this),j.default(w.default(a),`disconnectingTimer`,null),j.default(w.default(a),`disconnectedPromiseResolve`,null),j.default(w.default(a),`terminalStates`,[`disconnected`,`rejected`]),j.default(w.default(a),`tokenExpiredSasCode`,20104),j.default(w.default(a),`terminationReason`,`Connection is not initialized`),a.websocket=e,a.websocket.on(`connected`,function(){return a.fsm.socketConnected()}),a.websocket.on(`disconnected`,function(){return a.fsm.socketClosed()}),a.websocket.on(`message`,function(e){return a.onIncomingMessage(e)}),a.websocket.on(`socketError`,function(e){a.emit(`connectionError`,{terminal:!1,message:`Socket error: ${e.message}`,httpStatusCode:null,errorCode:null}),a.emit(`stateChanged`,`retrying`)}),a.transport=r,a.config=i,a.retrier=new Le(i.retryPolicy),a.retrier.on(`attempt`,function(){return a.retry()}),a.retrier.on(`failed`,function(e){H.warn(`Retrying failed: ${e.message}`),a.disconnect()}),typeof window<`u`&&window.addEventListener!==void 0&&(window.addEventListener(`online`,function(){H.debug(`Browser reported connectivity state: online`),a.resetBackoff(),a.fsm.systemOnline()}),window.addEventListener(`offline`,function(){H.debug(`Browser reported connectivity state: offline`),a.websocket.close(),a.fsm.socketClosed()}));var o=F.factory({init:`disconnected`,transitions:[{name:`userConnect`,from:[`disconnected`,`rejected`],to:`connecting`},{name:`userConnect`,from:[`connecting`,`connected`]},{name:`userDisconnect`,from:[`connecting`,`initialising`,`connected`,`updating`,`retrying`,`rejected`,`waitSocketClosed`,`waitOffloadSocketClosed`],to:`disconnecting`},{name:`userRetry`,from:[`retrying`],to:`connecting`},{name:`socketConnected`,from:[`connecting`],to:`initialising`},{name:`socketClosed`,from:[`connecting`,`initialising`,`connected`,`updating`,`error`,`waitOffloadSocketClosed`],to:`retrying`},{name:`socketClosed`,from:[`disconnecting`],to:`disconnected`},{name:`socketClosed`,from:[`waitSocketClosed`],to:`disconnected`},{name:`socketClosed`,from:[`rejected`],to:`rejected`},{name:`initSuccess`,from:[`initialising`],to:`connected`},{name:`initError`,from:[`initialising`],to:`error`},{name:`tokenRejected`,from:[`initialising`,`updating`],to:`rejected`},{name:`protocolError`,from:[`initialising`,`connected`,`updating`],to:`error`},{name:`receiveClose`,from:[`initialising`,`connected`,`updating`],to:`waitSocketClosed`},{name:`receiveOffload`,from:[`initialising`,`connected`,`updating`],to:`waitOffloadSocketClosed`},{name:`unsupportedProtocol`,from:[`initialising`,`connected`,`updating`],to:`unsupported`},{name:`receiveFatalClose`,from:[`initialising`,`connected`,`updating`],to:`unsupported`},{name:`userUpdateToken`,from:[`disconnected`,`rejected`,`connecting`,`retrying`],to:`connecting`},{name:`userUpdateToken`,from:[`connected`],to:`updating`},{name:`updateSuccess`,from:[`updating`],to:`connected`},{name:`updateError`,from:[`updating`],to:`error`},{name:`userSend`,from:[`connected`],to:`connected`},{name:`systemOnline`,from:[`retrying`],to:`connecting`}],methods:{onConnecting:function(){a.setupSocket(),a.emit(`connecting`)},onEnterInitialising:function(){a.sendInit()},onLeaveInitialising:function(){a.cancelInit()},onEnterUpdating:function(){a.sendUpdate()},onLeaveUpdating:function(){a.cancelUpdate()},onEnterRetrying:function(){a.initRetry(),a.emit(`connecting`)},onEnterConnected:function(){a.resetBackoff(),a.onConnected()},onUserUpdateToken:function(){a.resetBackoff()},onTokenRejected:function(){a.resetBackoff(),a.closeSocket(!0),a.finalizeSocket()},onUserDisconnect:function(){a.closeSocket(!0)},onEnterDisconnecting:function(){a.startDisconnectTimer()},onLeaveDisconnecting:function(){a.cancelDisconnectTimer()},onEnterWaitSocketClosed:function(){a.startDisconnectTimer()},onLeaveWaitSocketClosed:function(){a.cancelDisconnectTimer()},onEnterWaitOffloadSocketClosed:function(){a.startDisconnectTimer()},onLeaveWaitOffloadSocketClosed:function(){a.cancelDisconnectTimer()},onDisconnected:function(){a.resetBackoff(),a.finalizeSocket()},onReceiveClose:function(){a.onCloseReceived()},onReceiveOffload:function(e,t){H.debug(`onreceiveoffload: `,t),a.modifyBackoff(t.body),a.onCloseReceived()},onUnsupported:function(){a.closeSocket(!0),a.finalizeSocket()},onError:function(e,t){a.closeSocket(t),a.finalizeSocket()},onEnterState:function(e){e.from!==`none`&&a.changeState(e)},onInvalidTransition:function(e,t,n){H.warn(`FSM: unexpected transition`,t,n)}}});return a.fsm=new o,a}return k.default(n,[{key:`changeState`,value:function(e){H.debug(`FSM: ${e.transition}: ${e.from} --> ${e.to}`),this.lastEmittedState!==this.state&&(this.lastEmittedState=this.state,this.emit
11(`stateChanged`,this.state))}},{key:`resetBackoff`,value:function(){H.trace(`resetBackoff`),this.retrier.stop()}},{key:`modifyBackoff`,value:function(e){H.trace(`modifyBackoff`,e);var t=e?e.backoff_policy:null;t&&typeof t.reconnect_min_ms==`number`&&this.retrier.modifyBackoff(t.reconnect_min_ms)}},{key:`startDisconnectTimer`,value:function(){var e=this;H.trace(`startDisconnectTimer`),this.disconnectingTimer&&=(clearTimeout(this.disconnectingTimer),null),this.disconnectingTimer=setTimeout(function(){H.debug(`disconnecting is timed out`),e.closeSocket(!0)},Be)}},{key:`cancelDisconnectTimer`,value:function(){H.trace(`cancelDisconnectTimer`),this.disconnectingTimer&&=(clearTimeout(this.disconnectingTimer),null)}},{key:`isConnected`,get:function(){return this.state===`connected`&&this.websocket.isConnected}},{key:`state`,get:function(){switch(this.fsm.state){case`connecting`:case`initialising`:case`retrying`:case`error`:return`connecting`;case`updating`:case`connected`:return`connected`;case`rejected`:return`denied`;case`disconnecting`:case`waitSocketClosed`:case`waitOffloadSocketClosed`:return`disconnecting`;default:return`disconnected`}}},{key:`initRetry`,value:function(){H.debug(`initRetry`),this.retrier.inProgress?this.retrier.attemptFailed():this.retrier.start()}},{key:`retry`,value:function(){this.fsm.state==`connecting`?H.trace(`can retry as already connecting`):(H.trace(`retry`),this.websocket.close(),this.fsm.userRetry())}},{key:`onConnected`,value:function(){this.emit(`connected`)}},{key:`finalizeSocket`,value:function(){H.trace(`finalizeSocket`),this.websocket.close(),this.emit(`disconnected`),this.disconnectedPromiseResolve&&=(this.disconnectedPromiseResolve(),null)}},{key:`setupSocket`,value:function(){H.trace(`setupSocket:`,this.config.token),this.emit(`beforeConnect`),this.websocket.connect()}},{key:`onIncomingMessage`,value:function(e){var t=we.parse(e);if(t){var n=t.method,r=t.header,i=t.payload;if(n!==`reply`&&this.confirmReceiving(r),n===`notification`)this.emit(`message`,r.message_type,i);else if(r.method===`reply`)this.transport.processReply({id:r.id,status:r.status,header:r,body:i});else if(r.method===`client_update`)r.client_update_type===`token_about_to_expire`&&this.emit(`tokenAboutToExpire`);else if(r.method===`close`){if(r.status.code===308)H.debug(`Connection has been offloaded`),this.fsm.receiveOffload({status:r.status.status,body:i});else if(r.status.code===406){var a=`Server closed connection because can't parse protocol: ${JSON.stringify(r.status)}`;this.emitReplyConnectionError(a,r,!0),H.error(a),this.fsm.receiveFatalClose()}else r.status.code===417?(H.error(`Server closed connection because can't parse client reply: ${JSON.stringify(r.status)}`),this.fsm.receiveFatalClose(r.status.status)):r.status.code===410?(H.warn(`Server closed connection: ${JSON.stringify(r.status)}`),this.fsm.receiveClose(r.status.status),this.emit(`tokenExpired`)):r.status.code===401?(H.error(`Server closed connection: ${JSON.stringify(r.status)}`),this.fsm.receiveClose(r.status.status)):(H.warn(`unexpected message: `,r.status),this.fsm.receiveOffload({status:r.status.status,body:null}))}}}},{key:`sendInit`,value:function(){var e=C.default(M.default.mark(function e(){var t,n;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return H.trace(`sendInit`),e.prev=1,this.emit(`beforeSendInit`),e.next=5,this.transport.sendInit();case 5:t=e.sent,this.config.updateContinuationToken(t.continuationToken),this.config.confirmedCapabilities=t.confirmedCapabilities,this.fsm.initSuccess(t),this.emit(`initialized`,t),this.emit(`tokenUpdated`),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(1),e.t0 instanceof Ae?(n=!1,H.warn(`Init rejected by server: ${JSON.stringify(e.t0.reply.status)}`),this.emit(`sendInitFailed`),e.t0.reply.status.code===401||e.t0.reply.status.code===403?(n=!0,this.fsm.tokenRejected(e.t0.reply.status),e.t0.reply.status.errorCode===this.tokenExpiredSasCode&&this.emit(`tokenExpired`)):e.t0.reply.status.code===429?(this.modifyBackoff(e.t0.reply.body),this.fsm.initError(!0)):e.t0.reply.status.code===500?this.fsm.initError(!1):this.fsm.initError(!0),this.emitReplyConnectionError(e.t0.message,e.t0.reply,n)):(this.terminationReason=e.t0.message,this.emit
11(`connectionError`,{terminal:!0,message:`Unknown error during connection initialisation: ${e.t0.message} 12${JSON.stringify(e.t0,null,2)}`,httpStatusCode:null,errorCode:null}),this.fsm.initError(!0)),this.emit(`tokenUpdated`,e.t0);case 17:case`end`:return e.stop()}},e,this,[[1,13]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`sendUpdate`,value:function(){var e=C.default(M.default.mark(function e(){var t,n,r;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return H.trace(`sendUpdate`),t=new q(this.config.token),e.prev=2,e.next=5,this.transport.sendWithReply(t);case 5:n=e.sent,this.fsm.updateSuccess(n.body),this.emit(`tokenUpdated`),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(2),e.t0 instanceof Ae?(r=!1,H.warn(`Token update rejected by server: ${JSON.stringify(e.t0.reply.status)}`),e.t0.reply.status.code===401||e.t0.reply.status.code===403?(r=!0,this.fsm.tokenRejected(e.t0.reply.status),e.t0.reply.status.errorCode===this.tokenExpiredSasCode&&this.emit(`tokenExpired`)):(e.t0.reply.status.code===429&&this.modifyBackoff(e.t0.reply.body),this.fsm.updateError(e.t0.reply.status)),this.emitReplyConnectionError(e.t0.message,e.t0.reply,r)):(this.emit(`error`,!1,e.t0.message,null,null),this.fsm.updateError(e.t0)),this.emit(`tokenUpdated`,e.t0);case 14:case`end`:return e.stop()}},e,this,[[2,10]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`emitReplyConnectionError`,value:function(e,t,n){var r=t.status&&t.status.description?t.status.description:e,i=t.status.code,a=t.status&&t.status.errorCode?t.status.errorCode:null;n&&(this.terminationReason=r),this.emit(`connectionError`,{terminal:n,message:`Connection error: ${r}`,httpStatusCode:i,errorCode:a})}},{key:`cancelInit`,value:function(){H.trace(`cancelInit`)}},{key:`cancelUpdate`,value:function(){H.trace(`cancelUpdate`)}},{key:`confirmReceiving`,value:function(e){H.trace(`confirmReceiving`);try{this.transport.send(new fe(e.id))}catch(e){H.debug(`failed to confirm packet receiving`,e)}}},{key:`closeSocket`,value:function(e){var t=this;H.trace(`closeSocket (graceful: ${e})`),e&&this.transport.isConnected&&this.transport.sendClose(),this.websocket.close(),Ve(function(){return t.fsm.socketClosed()})}},{key:`connect`,value:function(){H.trace(`connect`),this.fsm.userConnect()}},{key:`disconnect`,value:function(){var e=this;return H.trace(`disconnect`),this.fsm.is(`disconnected`)?Promise.resolve():new Promise(function(t){e.disconnectedPromiseResolve=t,e.fsm.userDisconnect()})}},{key:`updateToken`,value:function(e){var t=this;return H.trace(`updateToken:`,e),new Promise(function(e,n){t.once(`tokenUpdated`,function(t){t?n(t):e()}),t.fsm.userUpdateToken()})}},{key:`isTerminalState`,get:function(){return this.terminalStates.indexOf(this.fsm.state)!==-1}},{key:`getTerminationReason`,get:function(){return this.terminationReason}},{key:`onCloseReceived`,value:function(){this.websocket.close()}}]),n}(y.ReplayEventEmitter),Ue=function(){function e(){A.default(this,e)}return k.default(e,null,[{key:`getMetadata`,value:function(e){var t=e&&e.clientMetadata?e.clientMetadata:{},n=[`ver`,`env`,`envv`,`os`,`osv`,`osa`,`type`,`sdk`,`sdkv`,`dev`,`devv`,`devt`,`app`,`appv`],r={env:L.name??`unknown`,envv:L.version??`unknown`,os:L.os?.family??`unknown`,osv:L.os?.version??`unknown`,osa:L.os?.architecture??`unknown`,sdk:`js-default`},i={};return n.filter(function(e){return e in t||e in r}).forEach(function(e){return i[e]=e in t?t[e]:r[e]}),i}}]),e}(),We=3e4;function Ge(e){return e>=200&&e<300}function Ke(e){switch(N.default(e)){case`undefined`:return``;case`object`:return JSON.stringify(e);default:return e}}var qe=function(){function e(t,n){var r=this;A.default(this,e),this.config=n,this.activeRequests=new Map,this.channel=t,this.channel.on(`reply`,function(e){return r.processReply(e)}),this.channel.on(`disconnected`,function(){r.activeRequests.forEach(function(e){clearTimeout(e.timeout),e.reject(new De(`disconnected`))}),r.activeRequests.clear()})}return k.default(e,[{key:`isConnected`,get:function(){return this.channel.isConnected}},{key:`processReply`,value:function(e){var t=this.activeRequests.get(e.id);t&&(clearTimeout(t.timeout),this.activeRequests.delete(e.id),Ge(e.status.code)?t.resolve(e):(t.reject(new Ae(`Transport failure: `+e.status.status,e)),H.trace(`message rejected`)))}},{key:`storeRequest`,value:function(e,t,n){var r={resolve:t,reject:n,timeout:setTimeout(function(){H.trace(`request`,e,`is timed out`),n(new De(`Twilsock: request timeout: `+e))},We)};this.activeRequests.set(e,r)}}
12,{key:`shutdown`,value:function(){this.activeRequests.forEach(function(e){clearTimeout(e.timeout),e.reject(new De(`Twilsock: request cancelled by user`))}),this.activeRequests.clear()}},{key:`sendInit`,value:function(){var e=C.default(M.default.mark(function e(){var t,n,r;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return H.trace(`sendInit`),t=Ue.getMetadata(this.config),n=new te(this.config.token,this.config.continuationToken,t,this.config.initRegistrations,this.config.tweaks),e.next=5,this.sendWithReply(n);case 5:return r=e.sent,e.abrupt(`return`,new ie(r.id,r.header.continuation_token,new Set(r.header.capabilities),r.header.continuation_token_status,r.header.offline_storage,r.header.init_registrations,r.header.debug_info));case 7:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`sendClose`,value:function(){var e=new J;this.send(e)}},{key:`sendWithReply`,value:function(e,t){var n=this;return new Promise(function(r,i){var a=n.send(e,t);n.storeRequest(a,r,i)})}},{key:`send`,value:function(e,t){e.id=e.id||`TM${g.v4()}`;var n=we.createPacket(e,Ke(t));try{return this.channel.send(n),e.id}catch(t){throw H.debug(`failed to send `,e,t),H.trace(t.stack),t}}}]),e}();function Je(e){var t=Ye();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function Ye(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Xe=function(e){E.default(r,e);var n=Je(r);function r(e){var i;return A.default(this,r),i=n.call(this),j.default(w.default(i),`socket`,null),i.url=e,i.url=e,i.WebSocket=t.WebSocket||t.MozWebSocket||{},i}return k.default(r,[{key:`isConnected`,get:function(){return!!this.socket&&this.socket.readyState===1}},{key:`connect`,value:function(){var e=this;H.trace(`connecting to socket`);var t;try{t=new this.WebSocket(this.url)}catch(e){H.debug(`Socket error: ${this.url}`),this.emit(`socketError`,e);return}t.binaryType=`arraybuffer`,t.onopen=function(){H.debug(`socket opened ${e.url}`),e.emit(`connected`)},t.onclose=function(t){H.debug(`socket closed`,t),e.emit(`disconnected`,t)},t.onerror=function(t){H.debug(`Socket error:`,t),e.emit(`socketError`,t)},t.onmessage=function(t){e.emit(`message`,t.data)},this.socket=t}},{key:`send`,value:function(e){return this.socket&&this.socket.send(e)}},{key:`close`,value:function(){if(H.trace(`closing socket`),this.socket){this.socket.onopen=null,this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null;try{this.socket.close()}finally{}}}}]),r}(y.ReplayEventEmitter);function Ze(e){var t=$e();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function $e(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var tt=function(e){E.default(n,e);var t=Ze(n);function n(e){var r;return A.default(this,n),r=t.call(this),r.transport=e,r.registrations=new Map,r.registrationsInProgress=new Map,r}return k.default(n,[{key:`putNotificationContext`,value:function(){var e=C.default(M.default.mark(function e(t,n){var r;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={method:`put_notification_ctx`,notification_ctx_id:t},e.next=3,this.transport.sendWithReply(r,n);case 3:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`deleteNotificationContext`,value:function(){var e=C.default(M.default.mark(function e(t){var n;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n={method:`delete_notification_ctx`,notification_ctx_id:t},e.next=3,this.transport.sendWithReply(n);case 3:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`updateRegistration`,value:function(){var e=C.default(M.default.mark(function e(t,n){var r,i;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return H.debug(`update registration for context`,t),r=this.registrationsInProgress.get(t),r||(r=new Set,this.registrationsInProgress.set(t,r)),i=g.v4(),r.add(i),e.prev=5,e.next=8,this.putNotificationContext(t,n);
12case 8:H.debug(`registration attempt succeeded for context`,n),r.delete(i),r.size===0&&(this.registrationsInProgress.delete(t),this.emit(`registered`,t)),e.next=19;break;case 13:e.prev=13,e.t0=e.catch(5),H.warn(`registration attempt failed for context`,n),H.debug(e.t0),r.delete(i),r.size===0&&(this.registrationsInProgress.delete(t),this.emit(`registrationFailed`,t,e.t0));case 19:case`end`:return e.stop()}},e,this,[[5,13]])}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`updateRegistrations`,value:function(){var e=C.default(M.default.mark(function e(){var t=this,n;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return H.trace(`refreshing ${this.registrations.size} registrations`),n=[],this.registrations.forEach(function(e,r){n.push(t.updateRegistration(r,e))}),e.next=5,Promise.all(n);case 5:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`setNotificationsContext`,value:function(){var e=C.default(M.default.mark(function e(t,n){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!t||!n)){e.next=2;break}throw new De(`Invalid arguments provided`);case 2:return this.registrations.set(t,n),e.next=5,this.updateRegistration(t,n);case 5:return e.abrupt(`return`,e.sent);case 6:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`removeNotificationsContext`,value:function(){var e=C.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.registrations.has(t)){e.next=2;break}return e.abrupt(`return`);case 2:return e.next=4,this.deleteNotificationContext(t);case 4:this.transport.isConnected&&this.registrations.delete(t);case 5:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()}]),n}(y.ReplayEventEmitter);function it(e){var t=ct();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function ct(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var pt=function(e){E.default(n,e);var t=it(n);function n(e,r,i){var a;return A.default(this,n),a=t.call(this,r),a.status=e,a.description=r,a.body=i,a}return k.default(n)}(De);function mt(e){var t=yt();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function yt(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var xt=function(e){E.default(n,e);var t=mt(n);function n(e){return A.default(this,n),t.call(this,e)}return k.default(n)}(De),St=2e4;function Ct(e){return e>=200&&e<300}function wt(e){return e&&e.header&&e.header.http_status}function Et(e){var t=e.match(/^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)(\/[^?#]*)(\?[^#]*|)(#.*|)$/);if(t){var n={protocol:t[1],host:t[2],hostname:t[3],port:t[4],pathname:t[5],search:t[6],hash:t[7],params:{}};return n.search.length>0&&(n.params=n.search.substring(1).split(`&`).map(function(e){return e.split(`=`)}).reduce(function(e,t){return e.hasOwnProperty(t[0])?Array.isArray(e[t[0]])?e[t[0]].push(t[1]):e[t[0]]=[e[t[0]],t[1]]:e[t[0]]=t[1],e},{})),n}throw new De(`Incorrect URI: `+e)}function Dt(e,t){var n=Et(t),r={method:e,host:n.host,path:n.pathname};return n.params&&(r.params=n.params),r}function Ot(e,t,n,r,i){return{to:Dt(e,t),headers:n,body:r,grant:i}}var kt=function(){function e(t,n,r){A.default(this,e),this.config=r,this.transport=t,this.pendingMessages=[],this.twilsock=n}return k.default(e,[{key:`saveMessage`,value:function(e){var t=this;return new Promise(function(n,r){var i={message:e,resolve:n,reject:r,alreadyRejected:!1,timeout:setTimeout(function(){H.debug(`request is timed out`),r(new De(`request '${e.to.method}' to '${e.to.host}' timed out`)),i.alreadyRejected=!0},St)};t.pendingMessages.push(i)})}},{key:`sendPendingMessages`,value:function(){for(var e=this,t=function(){var t=e.pendingMessages[0];if(!t.alreadyRejected)try{var n=t.message;e.actualSend(n).then(function(e){return t.resolve(e)}).catch(function(e){return t.reject(e)}),clearTimeout(t.timeout)}catch(e){return H.debug(`Failed to send pending message`,e),`break`}e.pendingMessages.splice(0,1)};this.pendingMessages.length>0&&t()!==`break`;);}},{key:`rejectPendingMessages`,value:function(){var e=this;
12this.pendingMessages.forEach(function(t){t.reject(new xt(`Unable to connect: `+e.twilsock.getTerminationReason)),t.alreadyRejected=!0,clearTimeout(t.timeout)}),this.pendingMessages.splice(0,this.pendingMessages.length)}},{key:`actualSend`,value:function(){var e=C.default(M.default.mark(function e(t){var n,r,i,a,o,s,c;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.to,r=t.headers,i=t.body,a=t.grant??this.config.activeGrant,o={host:n.host,path:n.path,method:n.method,params:n.params,headers:r},s=new le(a,r[`Content-Type`]||`application/json`,o),H.trace(`Sending upstream message`,s),e.next=9,this.transport.sendWithReply(s,i);case 9:if(c=e.sent,H.trace(`Received upstream message response`,c),!(wt(c)&&!Ct(c.header.http_status.code))){e.next=13;break}throw new pt(c.header.http_status.code,c.header.http_status.status,c.body);case 13:return e.abrupt(`return`,{status:c.header.http_status,headers:c.header.http_headers,body:c.body});case 14:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`send`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(this.twilsock.isTerminalState)return Promise.reject(new xt(`Unable to connect: `+this.twilsock.getTerminationReason));var a=Ot(e,t,n,r,i);return this.twilsock.isConnected?this.actualSend(a):this.saveMessage(a)}}]),e}(),At=function(){function e(){var t=this;A.default(this,e),this._promise=new Promise(function(e,n){t._resolve=e,t._reject=n})}return k.default(e,[{key:`promise`,get:function(){return this._promise}},{key:`update`,value:function(e){this._resolve(e)}},{key:`set`,value:function(e){this._resolve(e)}},{key:`fail`,value:function(e){this._reject(e)}}]),e}(),jt=function(){function e(t){A.default(this,e),this.id=t}return k.default(e,null,[{key:`create`,value:function(t){if(t instanceof Object&&`storage_id`in t)return new e(t.storage_id);throw new De(`Field "storage_id" is missing`)}}]),e}(),Mt=function(){function e(){return A.default(this,e),j.default(this,`initializedFlag`,`twilio_twilsock_token_storage`),j.default(this,`tokenStoragePrefix`,`twilio_continuation_token_`),e._instance||=(this.initialize(),this),e._instance}return k.default(e,[{key:`sessionStorage`,value:function(){try{return t.sessionStorage}catch{return null}}},{key:`window`,value:function(){try{return t.window}catch{return null}}},{key:`storeToken`,value:function(e,t){this.canStore()&&this.sessionStorage.setItem(this.getKeyName(t),e)}},{key:`getStoredToken`,value:function(e){return this.canStore()?this.sessionStorage.getItem(this.getKeyName(e)):null}},{key:`initialize`,value:function(){var e=this;if(this.canStore()){this.sessionStorage.getItem(this.initializedFlag)&&this.clear(),this.sessionStorage.setItem(this.initializedFlag,`true`);var t=this.sessionStorage.removeItem;this.window.addEventListener(`unload`,function(){t(e.initializedFlag)})}}},{key:`clear`,value:function(){if(this.canStore()){for(var e=[],t=0;t<this.sessionStorage.length;t++){var n=this.sessionStorage.key(t);n&&n.indexOf(this.tokenStoragePrefix)===0&&e.push(n)}var r=this.sessionStorage.removeItem;e.forEach(function(e){return r(e)}),r(this.initializedFlag)}}},{key:`getKeyName`,value:function(e){return`${this.tokenStoragePrefix}${e}`}},{key:`canStore`,value:function(){return!!(this.sessionStorage&&this.sessionStorage.length&&this.window)}}]),e}();j.default(Mt,`_instance`,null);var X=new Mt,Nt=function(){function e(t,n,r,i,a,o){A.default(this,e),this.title=t,this.details=n,this.start=r,this.type=a,this.id=o,this.end=i}return k.default(e,[{key:`toTelemetryEvent`,value:function(){var e=new Date,t=this.start,n=this.end?this.end:e;if(n<t){var r=n;n=t,t=r}return new _e(t.getTime()-e.getTime(),n.getTime()-e.getTime(),this.title,this.details,this.id,this.type)}}]),e}();e.TelemetryPoint=void 0,(function(e){e[e.Start=0]=`Start`,e[e.End=1]=`End`})(e.TelemetryPoint||={}),e.EventSendingLimitation=void 0,(function(e){e[e.MinEventsPortion=0]=`MinEventsPortion`,e[e.AnyEvents=1]=`AnyEvents`,e[e.AnyEventsIncludingUnfinished=2]=`AnyEventsIncludingUnfinished`})(e.EventSendingLimitation||={});var Pt=function(){function t(e,n){A.default(this,t),j.default(this,`minEventsPortionToSend`,50),j.default(this,`maxEventsPortionToSend`,100),j.default(this,`pendingEvents`,new Map),j.default(this,`readyEvents`,[]),j.default(this,`hasInitializationFinished`,!1),j.default(this,`_canSendTelemetry`,!1),this.config=e,this.packetInterface=n}
12return k.default(t,[{key:`isTelemetryEnabled`,get:function(){return this.config.confirmedCapabilities.has(`telemetry.v1`)}},{key:`canSendTelemetry`,get:function(){return this._canSendTelemetry&&this.isTelemetryEnabled},set:function(t){H.debug(`TelemetryTracker.canSendTelemetry: ${t} TelemetryTracker.isTelemetryEnabled: ${this.isTelemetryEnabled}`),this._canSendTelemetry&&!t&&(this.pendingEvents.clear(),this.readyEvents=[]),this._canSendTelemetry=t,t&&this.sendTelemetry(e.EventSendingLimitation.AnyEvents),t&&!this.hasInitializationFinished&&(this.hasInitializationFinished=!0)}},{key:`addTelemetryEvent`,value:function(e){!this.canSendTelemetry&&this.hasInitializationFinished||this.readyEvents.push(e)}},{key:`addPartialEvent`,value:function(t,n,r){H.debug(`Adding ${r===e.TelemetryPoint.Start?`starting`:`ending`} timepoint for '${n}' event`);var i=this.pendingEvents.has(n);if(r===e.TelemetryPoint.Start)i&&H.debug(`Overwriting starting point for '${n}' event`),this.pendingEvents.set(n,t);else{if(!i){H.info(`Could not find started event for '${n}' event`);return}this.addTelemetryEvent(this.merge(this.pendingEvents.get(n),t)),this.pendingEvents.delete(n)}}},{key:`getTelemetryToSend`,value:function(t){return!this.canSendTelemetry||this.readyEvents.length==0||t==e.EventSendingLimitation.MinEventsPortion&&this.readyEvents.length<this.minEventsPortionToSend?[]:this.getTelemetryPortion(t==e.EventSendingLimitation.AnyEventsIncludingUnfinished)}},{key:`getTelemetryPortion`,value:function(e){var t=this,n=Math.min(this.readyEvents.length,this.maxEventsPortionToSend),r=this.readyEvents.splice(0,n);return e&&r.length<this.maxEventsPortionToSend&&this.pendingEvents.forEach(function(e,n){if(!(r.length>=t.maxEventsPortionToSend)){var i=t.pendingEvents.get(n);t.pendingEvents.delete(n),r.push(new Nt(`[UNFINISHED] ${i.title}`,i.details,i.start,null,i.type,i.id))}}),r}},{key:`merge`,value:function(e,t){return new Nt(t.title?t.title:e.title,t.details?t.details:e.details,e.start,t.end,t.type?t.type:e.type,t.id?t.id:e.id)}},{key:`sendTelemetryIfMinimalPortionCollected`,value:function(){this.sendTelemetry(e.EventSendingLimitation.MinEventsPortion)}},{key:`sendTelemetry`,value:function(e){var t=this.getTelemetryToSend(e);if(t.length!==0)try{this.packetInterface.send(new ve(t.map(function(e){return e.toTelemetryEvent()})))}catch(e){H.debug(`Error while sending ${t.length} telemetry events due to ${e}; they will be resubmitted`),this.readyEvents=this.readyEvents.concat(t)}}}]),t}();function Ft(e){var t=It();return function(){var n=O.default(e),r;if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D.default(this,r)}}function It(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Lt=k.default(function e(){A.default(this,e)});j.default(Lt,`TWILSOCK_CONNECT`,`twilsock.sdk.connect`),j.default(Lt,`TWILSOCK_INIT`,`twilsock.sdk.init`),e.TwilsockClient=function(t){E.default(r,t);var n=Ft(r);function r(t,i,a){var o;A.default(this,r),o=n.call(this),j.default(w.default(o),`version`,U),j.default(w.default(o),`offlineStorageDeferred`,new At),a.continuationToken=a.continuationToken?a.continuationToken:X.getStoredToken(i);var s=o.config=new W(t,i,a);H.setLevel(s.logLevel);var c=new Xe(s.url),l=new qe(c,s);return o.channel=new He(c,l,s),o.registrations=new tt(l),o.upstream=new kt(l,o.channel,s),o.telemetryTracker=new Pt(s,l),o.channel.on(`initialized`,function(){return o.telemetryTracker.canSendTelemetry=!0}),c.on(`disconnected`,function(){return o.telemetryTracker.canSendTelemetry=!1}),o.registrations.on(`registered`,function(e){return o.emit(`registered`,e)}),o.channel.on(`message`,function(e,t){return setTimeout(function(){return o.emit(`message`,e,t)},0)}),o.channel.on(`stateChanged`,function(e){return setTimeout(function(){return o.emit(`stateChanged`,e)},0)}),o.channel.on(`connectionError`,function(e){return setTimeout(function(){return o.emit(`connectionError`,e)},0)}),o.channel.on(`tokenAboutToExpire`,function(){return setTimeout(function(){return o.emit(`tokenAboutToExpire`)},0)}),o.channel.on(`tokenExpired`,function(){return setTimeout(function(){return o.emit(`tokenExpired`)},0)}),o.channel.on(`connected`,function(){return o.registrations.updateRegistrations()}),o.channel.on(`connected`,function(){return o.upstream.sendPendingMessages()}),o.channel.on(`connected`,function(){return setTimeout(function(){return o.emit(`connected`)},0)}),o.channel.on(`beforeConnect`,function(){return o.telemetryTracker.addPartialEvent(new Nt(`Establish WebSocket connection`,``,new Date),Lt.TWILSOCK_CONNECT,e.TelemetryPoint.Start)}),o.channel.on(`connected`,function(){return o.telemetryTracker.addPartialEvent(new Nt(`Establish WebSocket connection`,``,new Date,new Date),Lt.TWILSOCK_CONNECT,e.TelemetryPoint.End)}),o.channel.on(`beforeSendInit`,function(){return o.telemetryTracker.addPartialEvent(new Nt(`Send Twilsock init`,``,new Date),Lt.TWILSOCK_INIT,e.TelemetryPoint.Start)}),o.channel.on(`initialized`,function(){return o.telemetryTracker.addPartialEvent(new Nt(`Send Twilsock init`,`Succeeded`,new Date,new Date),Lt.TWILSOCK_INIT,e.TelemetryPoint.End)}),o.channel.on(`sendInitFailed`,function(){return o.telemetryTracker.addPartialEvent(new Nt(`Send Twilsock init`,`Failed`,new Date,new Date),Lt.TWILSOCK_INIT,e.TelemetryPoint.End)}),o.channel.on(`initialized`,function(e){o.handleStorageId(i,e),X.storeToken(e.continuationToken,i),setTimeout(function(){return o.emit(`initialized`,e)},0)}),o.channel.on(`disconnected`,function(){return setTimeout(function(){return o.emit(`disconnected`)},0)}),o.channel.on(`disconnected`,function(){return o.upstream.rejectPendingMessages()}),o.channel.on(`disconnected`,function(){return o.offlineStorageDeferred.fail(new De(`Client disconnected`))}),o.offlineStorageDeferred.promise.catch(function(){}),o}return k.default(r,[{key:`emit`,value:function(e){var t,n=[...arguments].slice(1);return H.debug(`Emitting ${e.toString()}(${n.map(function(e){return JSON.stringify(e)}).join(`, `)})`),(t=T.default(O.default(r.prototype),`emit`,this)).call.apply(t,[this,e].concat(n))}},{key:`handleStorageId`,value:function(e,t){if(!t.offlineStorage)this.offlineStorageDeferred.fail(new De(`No offline storage id`));else if(t.offlineStorage.hasOwnProperty(e))try{this.offlineStorageDeferred.set(jt.create(t.offlineStorage[e])),H.debug(`Offline storage for '${e}' product: ${JSON.stringify(t.offlineStorage[e])}.`)}catch(n){this.offlineStorageDeferred.fail(new De(`Failed to parse offline storage for ${e} ${JSON.stringify(t.offlineStorage[e])}. ${n}.`))}else this.offlineStorageDeferred.fail(new De(`No offline storage id for '${e}' product: ${JSON.stringify(t.offlineStorage)}`))}},{key:`storageId`,value:function(){return this.offlineStorageDeferred.promise}}
12,{key:`isConnected`,get:function(){return this.channel.isConnected}},{key:`state`,get:function(){return this.channel.state}},{key:`updateToken`,value:function(){var e=C.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(H.trace(`updating token '${t}'`),this.config.token!==t){e.next=3;break}return e.abrupt(`return`);case 3:return this.config.updateToken(t),e.next=6,this.channel.updateToken(t);case 6:return e.abrupt(`return`,e.sent);case 7:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`setNotificationsContext`,value:function(){var e=C.default(M.default.mark(function e(t,n){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.registrations.setNotificationsContext(t,n);case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`removeNotificationsContext`,value:function(){var e=C.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.registrations.removeNotificationsContext(t);case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`connect`,value:function(){return this.channel.connect()}},{key:`disconnect`,value:function(){var t=C.default(M.default.mark(function t(){return M.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.telemetryTracker.sendTelemetry(e.EventSendingLimitation.AnyEventsIncludingUnfinished),t.next=3,this.channel.disconnect();case 3:return t.abrupt(`return`,t.sent);case 4:case`end`:return t.stop()}},t,this)}));function n(){return t.apply(this,arguments)}return n}()},{key:`get`,value:function(){var t=C.default(M.default.mark(function t(n,r,i){return M.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.telemetryTracker.sendTelemetry(e.EventSendingLimitation.AnyEvents),t.next=3,this.upstream.send(`GET`,n,r,void 0,i);case 3:return t.abrupt(`return`,t.sent);case 4:case`end`:return t.stop()}},t,this)}));function n(e,n,r){return t.apply(this,arguments)}return n}()},{key:`post`,value:function(){var t=C.default(M.default.mark(function t(n,r,i,a){return M.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.telemetryTracker.sendTelemetry(e.EventSendingLimitation.AnyEvents),t.next=3,this.upstream.send(`POST`,n,r,i,a);case 3:return t.abrupt(`return`,t.sent);case 4:case`end`:return t.stop()}},t,this)}));function n(e,n,r,i){return t.apply(this,arguments)}return n}()},{key:`put`,value:function(){var t=C.default(M.default.mark(function t(n,r,i,a){return M.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.telemetryTracker.sendTelemetry(e.EventSendingLimitation.AnyEvents),t.next=3,this.upstream.send(`PUT`,n,r,i,a);case 3:return t.abrupt(`return`,t.sent);case 4:case`end`:return t.stop()}},t,this)}));function n(e,n,r,i){return t.apply(this,arguments)}return n}()},{key:`delete`,value:function(){var t=C.default(M.default.mark(function t(n,r,i,a){return M.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.telemetryTracker.sendTelemetry(e.EventSendingLimitation.AnyEvents),t.next=3,this.upstream.send(`DELETE`,n,r,i,a);case 3:return t.abrupt(`return`,t.sent);case 4:case`end`:return t.stop()}},t,this)}));function n(e,n,r,i){return t.apply(this,arguments)}return n}()},{key:`addTelemetryEvent`,value:function(e){this.telemetryTracker.addTelemetryEvent(e),this.telemetryTracker.sendTelemetryIfMinimalPortionCollected()}},{key:`addPartialTelemetryEvent`,value:function(t,n,r){this.telemetryTracker.addPartialEvent(t,n,r),r===e.TelemetryPoint.End&&this.telemetryTracker.sendTelemetryIfMinimalPortionCollected()}}]),r}(y.ReplayEventEmitter),e.TwilsockClient=R([p.validateConstructorTypes(p.nonEmptyString,p.nonEmptyString,[p.pureObject,`undefined`,p.literal(null)]),z(`design:paramtypes`,[String,String,Object])],e.TwilsockClient),e.InitRegistration=function(){function e(t){A.default(this,e),this.product=t,this.type=`ers`,this.notification_protocol_version=0,this.message_types=[]}return k.default(e,[{key:`populateInitRegistrations`,value:function(e){var t=new Set(this.message_types);for(var n in e)t.add(e[n]);this.message_types=Array.from(t)}}]),e}(),e.TelemetryEventDescription=Nt,e.TelemetryTracker=Pt,e.TransportUnavailableError=xt,e.Twilsock=e.TwilsockClient,e.TwilsockError=De})),ba=r(((e,t)=>{var n=o(),r=d(),i=c(),s=a(),u=Oe(),f=he(),m=l(),h=P(),g=p(),_=Object.assign,v=Object.defineProperty,y=r([].concat);t.exports=!_||s(function(){if(n&&_({b:1},_(v({},`a`,{enumerable:!0,get:function(){v(this,`b`,{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var e={},t={},r=Symbol(`assign detection`),i=`abcdefghijklmnopqrst`;return e[r]=7,i.split(``).forEach(function(e){t[e]=e}),_({},e)[r]!==7||u(_({},t)).join(``)!==i})?function(e,t){for(var r=h(e),a=arguments.length,o=1,s=f.f,c=m.f;a>o;)for(var l=g(arguments[o++]),d=s?y(u(l),s(l)):u(l),p=d.length,_=0,v;p>_;)v=d[_++],(!n||i(c,l,v))&&(r[v]=l[v]);return r}:_})),xa=r((()=>{var e=Y(),t=ba();e({target:`Object`,stat:!0,arity:2,forced:Object.assign!==t},{assign:t})})),Sa=r((e=>
12{Object.defineProperty(e,"__esModule",{value:!0}),be(),Me();var t=ot(),n=_t(),r=gt(),i=lt(),a=dt(),o=ft(),s=vn();Wn(),Br(),bt(),jn(),Gn(),bn(),Tt(),cn();var c=ut(),l=ya(),u=st(),d=ht();Ur(),Cn(),xa();var f=Vr(),p=mr(),m=Sr();Gr(),nt();var h=Mn(),g=ci(),_=Or();function v(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}function y(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var b=v(t),x=v(n),S=v(r),C=v(i),w=v(a),T=v(o),E=v(s),D=v(c),O=v(u),k=v(d),A=v(p),j=v(m),M=y(h),N=y(g);function P(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if((typeof Reflect>`u`?`undefined`:D.default(Reflect))===`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function F(e,t){if((typeof Reflect>`u`?`undefined`:D.default(Reflect))===`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}var I;function L(){}L.prototype=Object.create(null);function R(){R.init.call(this)}R.EventEmitter=R,R.usingDomains=!1,R.prototype.domain=void 0,R.prototype._events=void 0,R.prototype._maxListeners=void 0,R.defaultMaxListeners=10,R.init=function(){this.domain=null,R.usingDomains&&I.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new L,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},R.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||isNaN(e))throw TypeError(`"n" argument must be a positive number`);return this._maxListeners=e,this};function z(e){return e._maxListeners===void 0?R.defaultMaxListeners:e._maxListeners}R.prototype.getMaxListeners=function(){return z(this)};function B(e,t,n){if(t)e.call(n);else for(var r=e.length,i=re(e,r),a=0;a<r;++a)i[a].call(n)}function V(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,a=re(e,i),o=0;o<i;++o)a[o].call(n,r)}function H(e,t,n,r,i){if(t)e.call(n,r,i);else for(var a=e.length,o=re(e,a),s=0;s<a;++s)o[s].call(n,r,i)}function U(e,t,n,r,i,a){if(t)e.call(n,r,i,a);else for(var o=e.length,s=re(e,o),c=0;c<o;++c)s[c].call(n,r,i,a)}function W(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,a=re(e,i),o=0;o<i;++o)a[o].apply(n,r)}R.prototype.emit=function(e){var t,n,r,i,a,o,s,c=e===`error`;if(o=this._events,o)c&&=o.error==null;else if(!c)return!1;if(s=this.domain,c){if(t=arguments[1],s)t||=Error(`Uncaught, unspecified "error" event`),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit(`error`,t);else if(t instanceof Error)throw t;else{var l=Error(`Uncaught, unspecified "error" event. (`+t+`)`);throw l.context=t,l}return!1}if(n=o[e],!n)return!1;var u=typeof n==`function`;switch(r=arguments.length,r){case 1:B(n,u,this);break;case 2:V(n,u,this,arguments[1]);break;case 3:H(n,u,this,arguments[1],arguments[2]);break;case 4:U(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=Array(r-1),a=1;a<r;a++)i[a-1]=arguments[a];W(n,u,this,i)}return!0};function ee(e,t,n,r){var i,a,o;if(typeof n!=`function`)throw TypeError(`"listener" argument must be a function`);if(a=e._events,a?(a.newListener&&(e.emit(`newListener`,t,n.listener?n.listener:n),a=e._events),o=a[t]):(a=e._events=new L,e._eventsCount=0),!o)o=a[t]=n,++e._eventsCount;else if(typeof o==`function`?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=z(e),i&&i>0&&o.length>i)){o.warned=!0;var s=Error(`Possible EventEmitter memory leak detected. `+o.length+` `+t+` listeners added. Use emitter.setMaxListeners() to increase limit`);s.name=`MaxListenersExceededWarning`,s.emitter=e,s.type=t,s.count=o.length,G(s)}return e}function G(e){typeof console.warn==`function`?console.warn(e):console.log(e)}R.prototype.addListener=function(e,t){return ee(this,e,t,!1)},R.prototype.on=R.prototype.addListener,R.prototype.prependListener=function(e,t){return ee(this,e,t,!0)};function K(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}R.prototype.once=function(e,t){if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);return this.on(e,K(this,e,t)),this},R.prototype.prependOnceListener=function(e,t){if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);return this.prependListener(e,K(this,e,t)),this},R.prototype.removeListener=function(e,t){var n,r,i,a,o;if(typeof t!=`function`)throw TypeError(`"listener" argument must be a function`);if(r=this._events,!r||(n=r[e],!n))return this;if(n===t||n.listener&&n.listener===t)--this._eventsCount===0?this._events=new L:(delete r[e],r.removeListener&&this.emit
12(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length;a-->0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount===0)return this._events=new L,this;delete r[e]}else ne(n,i);r.removeListener&&this.emit(`removeListener`,e,o||t)}return this},R.prototype.off=function(e,t){return this.removeListener(e,t)},R.prototype.removeAllListeners=function(e){var t,n=this._events;if(!n)return this;if(!n.removeListener)return arguments.length===0?(this._events=new L,this._eventsCount=0):n[e]&&(--this._eventsCount===0?this._events=new L:delete n[e]),this;if(arguments.length===0){for(var r=Object.keys(n),i=0,a;i<r.length;++i)a=r[i],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=new L,this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t)do this.removeListener(e,t[t.length-1]);while(t[0]);return this},R.prototype.listeners=function(e){var t,n,r=this._events;return r?(t=r[e],n=t?typeof t==`function`?[t.listener||t]:ie(t):[]):n=[],n},R.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):te.call(e,t)},R.prototype.listenerCount=te;function te(e){var t=this._events;if(t){var n=t[e];if(typeof n==`function`)return 1;if(n)return n.length}return 0}R.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function ne(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}function re(e,t){for(var n=Array(t);t--;)n[t]=e[t];return n}function ie(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}var ae=M.getLogger(`twilio-notificatiions`);function oe(e,t){return[`${new Date().toISOString()} Twilio.Notifications ${e}:`].concat(Array.from(t))}var q=new(function(){function e(){x.default(this,e)}return S.default(e,[{key:`setLevel`,value:function(e){ae.setLevel(e)}},{key:`trace`,value:function(){if(ae.getLevel()==ae.levels.TRACE){var e=[...arguments];ae.debug.apply(null,oe(`T`,e))}}},{key:`debug`,value:function(){var e=[...arguments];ae.debug.apply(null,oe(`D`,e))}}
12,{key:`info`,value:function(){var e=[...arguments];ae.info.apply(null,oe(`I`,e))}},{key:`warn`,value:function(){var e=[...arguments];ae.warn.apply(null,oe(`W`,e))}},{key:`error`,value:function(){var e=[...arguments];ae.error.apply(null,oe(`E`,e))}}]),e}());function se(e){var t=ce();return function(){var n=T.default(e),r;if(t){var i=T.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return w.default(this,r)}}function ce(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var le=S.default(function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;x.default(this,e),this.token=t,this.notificationId=n,this.messageTypes=r});function ue(e,t){return[].concat(j.default(j.default(e).filter(function(e){return!t.has(e)})),j.default(j.default(t).filter(function(t){return!e.has(t)})))}function de(e,t){var n=new Set;return e.notificationId!==t.notificationId&&n.add(`notificationId`),e.token!==t.token&&n.add(`token`),ue(e.messageTypes,t.messageTypes).length>0&&n.add(`messageType`),[n.size>0,n]}var fe=function(e){C.default(n,e);var t=se(n);function n(e){var r;return x.default(this,n),r=t.call(this),k.default(O.default(r),`desiredState`,new le),k.default(O.default(r),`currentState`,new le),k.default(O.default(r),`_hasActiveAttempt`,!1),r.channelType=e,r}return S.default(n,[{key:`setNotificationId`,value:function(e){this.desiredState.notificationId=e}},{key:`isActive`,value:function(){return this.desiredState.notificationId!==``}},{key:`subscribe`,value:function(e){if(this.desiredState.messageTypes.has(e)){q.debug(`message type '${e}' for channel ${this.channelType} is already registered`);return}this.desiredState.messageTypes.add(e)}},{key:`unsubscribe`,value:function(e){this.desiredState.messageTypes.has(e)&&this.desiredState.messageTypes.delete(e)}},{key:`updateToken`,value:function(e){this.desiredState.token=e}},{key:`commitChanges`,value:function(){var e=b.default(E.default.mark(function e(){var t,n,r,i,a,o;return E.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._hasActiveAttempt){e.next=3;break}throw q.error(`One registration attempt is already in progress`),Error(`One registration attempt is already in progress`);case 3:if(t=de(this.desiredState,this.currentState),n=A.default(t,2),r=n[0],i=n[1],r){e.next=6;break}return e.abrupt(`return`);case 6:if(this.currentState.notificationId||i.delete(`notificationId`),q.trace(`Persisting ${this.channelType} registration`,i,this.desiredState),e.prev=8,this._hasActiveAttempt=!0,a=new le,a.token=this.desiredState.token,a.notificationId=this.desiredState.notificationId,a.messageTypes=new Set(this.desiredState.messageTypes),!(a.messageTypes.size>0)){e.next=24;break}return e.next=17,this.updateRegistration(a,i);case 17:o=e.sent,this.currentState.token=o.token,this.currentState.notificationId=o.notificationId,this.currentState.messageTypes=new Set(o.messageTypes),this.emit(`stateChanged`,this.channelType,`registered`,this.currentState),e.next=30;break;case 24:return e.next=26,this.removeRegistration();case 26:this.currentState.token=a.token,this.currentState.notificationId=a.notificationId,this.currentState.messageTypes.clear(),this.emit(`stateChanged`,this.channelType,`unregistered`,this.currentState);case 30:e.next=35;break;case 32:throw e.prev=32,e.t0=e.catch(8),e.t0;case 35:return e.prev=35,this._hasActiveAttempt=!1,e.finish(35);case 38:case`end`:return e.stop()}},e,this,[[8,32,35,38]])}));function t(){return e.apply(this,arguments)}return t}()}]),n}(R);function pe(e){var t=me();return function(){var n=T.default(e),r;if(t){var i=T.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return w.default(this,r)}}function me(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var J={min:2e3,max:12e4,randomness:.2},he=function(e){C.default(n,e);var t=pe(n);function n(e,r,i,a){var o;return x.default(this,n),o=t.call(this,e),k.default(O.default(o),`registrationId`,null),o.context=r,o.twilsock=i,o.registrarUrl=a,o}return S.default(n,[{key:`updateRegistration`,value:function(){var e=b.default(E.default.mark(function e(t,n){var r=this,i,a,o,s,c;return E.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.has(`notificationId`)){e.next=3;break}return e.next=3,this.removeRegistration();case 3:if(!(!t.notificationId||!t.notificationId.length)){e.next=6;break}throw q.error(`No push notification ID for registration`),Error(`No push notification ID for registration`);case 6:return q.trace(`Registering`,this.channelType,t),i={endpoint_platform:this.context.platform,channel_type:this.channelType,version:this.context.protocolVersion.toString(),message_types:Array.from(t.messageTypes),data:{registration_id:t.notificationId}},a=this.context.productId,o=`${this.registrarUrl}?productId=${a}`,s={"Content-Type":`application/json`},q.trace(`Creating registration for channel ${this.channelType}`),e.prev=12,e.next=15,new f.AsyncRetrier(J).run(function(){return r.twilsock.post(o,s,i,a)});case 15:c=e.sent,this.registrationId=c.body.id,q.debug(`Registration created: `,c),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),q.error(`Registration failed: `,e.t0),e.t0;case 24:return e.abrupt(`return`,t);case 25:case`end`:return e.stop()}},e,this,[[12,20]])}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`removeRegistration`,value:function(){var e=b.default(E.default.mark(function e(){var t=this,n,r,i;return E.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.registrationId){e.next=2;break}return e.abrupt(`return`);case 2:return n=this.context.productId,r=`${this.registrarUrl}/${this.registrationId}?productId=${n}`,i={"Content-Type":`application/json`},q.trace(`Removing registration for ${this.channelType}`),e.prev=6,e.next=9,new f.AsyncRetrier(Object.assign(J,{maxAttemptsCount:3})).run(function(){return t.twilsock.delete(r,i,{},n)});case 9:this.registrationId=null,this.currentState.notificationId=``,q.debug(`Registration removed for ${this.channelType}`),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(6),q.error(`Failed to remove registration `,this.channelType,e.t0),e.t0;case 18:case`end`:return e.stop()}},e,this,[[6,14]])}
12));function t(){return e.apply(this,arguments)}return t}()},{key:`sendDeviceRemoveRequest`,value:function(){var e=b.default(E.default.mark(function e(t){var n=this,r,i,a,o;return E.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==``){e.next=2;break}throw Error(`Empty registration ID`);case 2:return r=this.context.productId,i=`${this.registrarUrl}?productId=${r}`,a={"Content-Type":`application/json`},o={binding_type:this.channelType,address:t},e.prev=6,q.trace(`Removing old registrations for ${this.channelType}`),e.next=10,new f.AsyncRetrier(Object.assign(J,{maxAttemptsCount:3})).run(function(){return n.twilsock.delete(i,a,o,r)});case 10:this.registrationId=null,this.currentState.notificationId=``,q.debug(`Registration removed for ${this.channelType}`),e.next=19;break;case 15:throw e.prev=15,e.t0=e.catch(6),q.error(`Failed to remove registration `,this.channelType,e.t0),e.t0;case 19:case`end`:return e.stop()}},e,this,[[6,15]])}));function t(t){return e.apply(this,arguments)}return t}()}]),n}(fe);function ge(e){var t=_e();return function(){var n=T.default(e),r;if(t){var i=T.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return w.default(this,r)}}function _e(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var ve=function(e){C.default(n,e);var t=ge(n);function n(e,r,i){var a;return x.default(this,n),a=t.call(this,`twilsock`),k.default(O.default(a),`contextId`,N.v4()),a.productId=e,a.platform=r,a.twilsock=i,a}return S.default(n,[{key:`updateRegistration`,value:function(){var e=b.default(E.default.mark(function e(t,n){var r,i;return E.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n.has(`messageType`)){e.next=2;break}return e.abrupt(`return`,t);case 2:return r=Array.from(t.messageTypes),i={product_id:this.productId,notification_protocol_version:4,endpoint_platform:this.platform,message_types:r},e.prev=4,e.next=7,this.twilsock.setNotificationsContext(this.contextId,i);case 7:e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(4),q.error(`Failed to update twilsock notification context: ${e.t0}`),e.t0;case 13:return e.abrupt(`return`,t);case 14:case`end`:return e.stop()}},e,this,[[4,9]])}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`removeRegistration`,value:function(){var e=b.default(E.default.mark(function e(){return E.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.twilsock.removeNotificationsContext(this.contextId);case 3:e.next=9;break;case 5:throw e.prev=5,e.t0=e.catch(0),q.error(`Failed to remove twilsock notification context: ${e.t0}`),e.t0;case 9:case`end`:return e.stop()}},e,this,[[0,5]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`sendDeviceRemoveRequest`,value:function(){var e=b.default(E.default.mark(function e(t){return E.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case`end`:return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()}]),n}(fe);function Y(e){var t=ye();return function(){var n=T.default(e),r;if(t){var i=T.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return w.default(this,r)}}function ye(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var xe,Se=_.literal(`apn`,`fcm`,`twilsock`);e.Notifications=xe=function(e){C.default(n,e);var t=Y(n);function n(e){var r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.default(this,n),r=t.call(this),i.logLevel=i.logLevel??`error`,q.setLevel(i.logLevel);var a=i.productId??`notifications`,o=!i.twilsockClient,s=i.twilsockClient=i.twilsockClient??new l.TwilsockClient(e,a,i),c=i.notifications??{},u=`https://ers.${c.region??i.region??`us1`}.twilio.com/v1/registrations`,d=c.ersUrl||u;r.connectors=new Map;var f=xe._detectPlatform();return r.connectors.set(`apn`,new he(`apn`,{protocolVersion:4,productId:a,platform:f},s,d)),r.connectors.set(`fcm`,new he(`fcm`,{protocolVersion:3,productId:a,platform:f},s,d)),r.connectors.set(`twilsock`,new ve(a,f,s)),s.on(`stateChanged`,function(e){return r.emit(`transportState`,e)}),r._connector(`twilsock`).on(`stateChanged`,function(e,t,n){return r.emit(`stateChanged`,e,t,n)}),r._connector(`apn`).on(`stateChanged`,function(e,t,n){return r.emit(`stateChanged`,e,t,n)}),r._connector(`fcm`).on(`stateChanged`,function(e,t,n){return r.emit(`stateChanged`,e,t,n)}),s.on(`message`,function(e,t){return r._routeMessage(e,t)}),r.updateToken(e),o&&(s.connect(),r.twilsock=s),r}return S.default(n,[{key:`shutdown`,value:function(){var e=b.default(E.default.mark(function e(){return E.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connectors.clear(),!this.twilsock){e.next=4;break}return e.next=4,this.twilsock.disconnect();case 4:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`setPushRegistrationId`,value:function(e,t){q.debug(`Set ${e} push registration id '${t}'`),this._connector(e).setNotificationId(t)}},{key:`subscribe`,value:function(e,t){q.debug(`Add ${e} subscriptions for message type ${t}`),this._connector(e).subscribe(t)}},{key:`unsubscribe`,value:function(e,t){q.debug(`Remove ${e} subscriptions for message type ${t}`),this._connector(e).unsubscribe(t)}}
12,{key:`updateToken`,value:function(e){this.connectors.forEach(function(t){return t.updateToken(e)})}},{key:`commitChanges`,value:function(){var e=b.default(E.default.mark(function e(){var t;return E.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],this.connectors.forEach(function(e){e.isActive()&&t.push(e.commitChanges())}),e.next=4,Promise.all(t);case 4:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`removeRegistrations`,value:function(){var e=b.default(E.default.mark(function e(t,n){return E.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._connector(t).sendDeviceRemoveRequest(n);case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`handlePushNotification`,value:function(e){return{messageType:e.twi_message_type,payload:e.payload}}},{key:`_routeMessage`,value:function(e,t){q.debug(`Notification message arrived: `,e,t),this.emit(`message`,e,t)}},{key:`_connector`,value:function(e){var t=this.connectors.get(e);if(!t)throw Error(`Unknown channel type: ${e}`);return t}}],[{key:`_detectPlatform`,value:function(){var e=``;return typeof navigator<`u`?(e=`unknown`,navigator.product!==void 0&&(e=navigator.product),navigator.userAgent!==void 0&&(e=navigator.userAgent)):e=`web`,e.substring(0,128)}}]),n}(R),P([_.validateTypes(Se,_.nonEmptyString),F(`design:type`,Function),F(`design:paramtypes`,[String,String]),F(`design:returntype`,void 0)],e.Notifications.prototype,`setPushRegistrationId`,null),P([_.validateTypes(Se,_.nonEmptyString),F(`design:type`,Function),F(`design:paramtypes`,[String,String]),F(`design:returntype`,void 0)],e.Notifications.prototype,`subscribe`,null),P([_.validateTypes(Se,_.nonEmptyString),F(`design:type`,Function),F(`design:paramtypes`,[String,String]),F(`design:returntype`,void 0)],e.Notifications.prototype,`unsubscribe`,null),P([_.validateTypes(_.nonEmptyString),F(`design:type`,Function),F(`design:paramtypes`,[String]),F(`design:returntype`,void 0)],e.Notifications.prototype,`updateToken`,null),P([_.validateTypesAsync(Se,_.nonEmptyString),F(`design:type`,Function),F(`design:paramtypes`,[String,String]),F(`design:returntype`,Promise)],e.Notifications.prototype,`removeRegistrations`,null),e.Notifications=xe=P([_.validateConstructorTypes(_.nonEmptyString,[_.pureObject,`undefined`,_.literal(null)]),F(`design:paramtypes`,[String,Object])],e.Notifications)})),Ca=r((()=>{var e=Y(),t=d(),n=D(),r=P(),i=de(),o=Ai(),s=Pe(),c=a(),l=ea(),u=Ct(),f=ta(),p=na(),m=S(),h=ra(),g=[],_=t(g.sort),v=t(g.push),y=c(function(){g.sort(void 0)}),b=c(function(){g.sort(null)}),x=u(`sort`),C=!c(function(){if(m)return m<70;if(!(f&&f>3)){if(p)return!0;if(h)return h<603;var e=``,t,n,r,i;for(t=65;t<76;
12t++){switch(n=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(i=0;i<47;i++)g.push({k:n+i,v:r})}for(g.sort(function(e,t){return t.v-e.v}),i=0;i<g.length;i++)n=g[i].k.charAt(0),e.charAt(e.length-1)!==n&&(e+=n);return e!==`DGBEFHACIJK`}}),w=y||!b||!x||!C,T=function(e){return function(t,n){return n===void 0?-1:t===void 0?1:e===void 0?s(t)>s(n)?1:-1:+e(t,n)||0}};e({target:`Array`,proto:!0,forced:w},{sort:function(e){e!==void 0&&n(e);var t=r(this);if(C)return e===void 0?_(t):_(t,e);var a=[],s=i(t),c,u;for(u=0;u<s;u++)u in t&&v(a,t[u]);for(l(a,T(e)),c=i(a),u=0;u<c;)t[u]=a[u++];for(;u<s;)o(t,u++);return t}})})),wa=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),Ne(),et(),nt(),rt(),Tt(),at(),be(),Me();var t=ot(),n=_t(),r=gt(),i=st(),a=lt(),o=dt(),s=ft(),c=ht();vt(),bt(),cn();var l=vn(),u=ut(),d=Or(),f=ya();Q();var p=fa();cr(),bn(),Qe(),Cr(),Cn(),jn();var m=Mn();hr(),gr(),_r(),vr();var h=mr();Wn(),Br(),Gn(),xa(),nr(),ma();var g=Vr();sr();var _=ci(),v=Ar();Xn();var y=jr(),b=Sr();Ca();var x=pa();function S(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}function C(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var w=S(t),T=S(n),E=S(r),D=S(i),O=S(a),k=S(o),A=S(s),j=S(c),M=S(l),N=S(u),P=S(p),F=C(m),I=S(h),L=C(_),R=S(v),z=S(b),B=C(x);function V(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if((typeof Reflect>`u`?`undefined`:N.default(Reflect))===`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function H(e,t){if((typeof Reflect>`u`?`undefined`:N.default(Reflect))===`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}var U=function(){function e(t){T.default(this,e),this.base=t,this.args=[],this.paths=[]}return E.default(e,[{key:`pathSegment`,value:function(e){return this.paths.push(encodeURIComponent(e)),this}},{key:`queryParam`,value:function(e,t){return t!==void 0&&this.args.push(encodeURIComponent(e)+`=`+encodeURIComponent(t)),this}},{key:`build`,value:function(){var e=this.base;return this.paths.length&&(e+=`/`+this.paths.join(`/`)),this.args.length&&(e+=`?`+this.args.join(`&`)),e}}]),e}();function W(e){var t=ee();return function(){var n=A.default(e),r;if(t){var i=A.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return k.default(this,r)}}function ee(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var G=function(e){O.default(n,e);var t=W(n);function n(e){var r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return T.default(this,n),r=t.call(this),r.name=r.constructor.name,r.message=`${e} (status: ${i}, code: ${a})`,r.status=i,r.code=a,r}return E.default(n)}(P.default(Error)),K=function(e){O.default(n,e);var t=W(n);function n(e){var r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0;return T.default(this,n),r=t.call(this,e,i,a),r.body=o,r}return E.default(n)}(G);function te(e){return JSON.parse(JSON.stringify(e))}function ne(e){if(!(e===void 0||ie(e)))throw new G(`Invalid pageSize parameter. Expected a positive integer, was '${e}'.`,400,20007)}function re(e){return!isNaN(parseInt(e))&&isFinite(e)}function ie(e){return re(e)&&e>0}var ae=F.getLogger(`twilio-sync`);function oe(e,t){return[`${new Date().toISOString()} Sync ${e}:`].concat(Array.from(t))}var q={setLevel:function(e){ae.setLevel(e)},trace:function(){if(ae.getLevel()==ae.levels.TRACE){var e=[...arguments];ae.debug.apply(null,oe(`T`,e))}},debug:function(){var e=[...arguments];ae.debug.apply(null,oe(`D`,e))},info:function(){var e=[...arguments];ae.info.apply(null,oe(`I`,e))},warn:function(){var e=[...arguments];ae.warn.apply(null,oe(`W`,e))},error:function(){var e=[...arguments];ae.error.apply(null,oe(`E`,e))}},se=`/v4/Subscriptions`,ce=`/v3/Maps`,le=`/v3/Lists`,ue=`/v3/Documents`,de=`/v3/Stream
12s`,fe=`/v3/Insights`;function pe(e,t,n){return e&&e[t]!==void 0?e[t]:n}var me=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T.default(this,e);var n=`https://cds.${t.region||`us1`}.twilio.com`,r=t.cdsUri||n;this.settings={subscriptionsUri:r+se,documentsUri:r+ue,listsUri:r+le,mapsUri:r+ce,streamsUri:r+de,insightsUri:r+fe,sessionStorageEnabled:pe(t.Sync,`enableSessionStorage`,!0),productId:t.productId}}return E.default(e,[{key:`subscriptionsUri`,get:function(){return this.settings.subscriptionsUri}},{key:`documentsUri`,get:function(){return this.settings.documentsUri}},{key:`listsUri`,get:function(){return this.settings.listsUri}},{key:`mapsUri`,get:function(){return this.settings.mapsUri}},{key:`streamsUri`,get:function(){return this.settings.streamsUri}},{key:`insightsUri`,get:function(){return this.settings.insightsUri}},{key:`backoffConfig`,get:function(){return this.settings.backoffConfig||{}}},{key:`sessionStorageEnabled`,get:function(){return this.settings.sessionStorageEnabled}},{key:`productId`,get:function(){return this.settings.productId}}]),e}();function J(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=he(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 13In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function he(e,t){if(e){if(typeof e==`string`)return ge(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ge(e,t)}}function ge(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var _e=function(){function e(t){T.default(this,e),this.localObject=t,this.pendingCorrelationId=null,this.pendingAction=null,this.established=!1,this.retryCount=0}return E.default(e,[{key:`sid`,get:function(){return this.localObject.sid}},{key:`type`,get:function(){return this.localObject.type}},{key:`lastEventId`,get:function(){return this.localObject.lastEventId}}
13,{key:`indexName`,get:function(){return this.localObject.indexName}},{key:`queryString`,get:function(){return this.localObject.queryString}},{key:`isEstablished`,get:function(){return this.established}},{key:`update`,value:function(e,t){this.localObject._update(e,t)}},{key:`updatePending`,value:function(e,t){this.pendingAction=e,this.pendingCorrelationId=t}},{key:`reset`,value:function(){this.updatePending(null,null),this.retryCount=0,this.established=!1,this.setSubscriptionState(`none`)}},{key:`markAsFailed`,value:function(e){this.rejectedWithError=e.error,this.updatePending(null,null),this.localObject.reportFailure(new G(`Failed to subscribe on service events: ${e.error.message}`,e.error.status,e.error.code))}},{key:`complete`,value:function(e){this.updatePending(null,null),this.established=!0,this.localObject._advanceLastEventId(e)}},{key:`setSubscriptionState`,value:function(e){this.localObject._setSubscriptionState(e)}}]),e}(),ve=function(){function e(t){var n=this;T.default(this,e),j.default(this,`isConnected`,!1),j.default(this,`maxBatchSize`,100),j.default(this,`subscriptionTtlTimer`,null),j.default(this,`pendingPokeReason`,null),this.services=t,this.subscriptions=new Map,this.persisted=new Map,this.latestPokeResponseArrivalTimestampByCorrelationId=new Map;var r={randomisationFactor:.2,initialDelay:100,maxDelay:12e4};this.backoff=g.Backoff.exponential(Object.assign(r,this.services.config.backoffConfig)),this.backoff.on(`ready`,function(){var e=n.getSubscriptionUpdateBatch(),t=e.action,r=e.subscriptions;t?n.applyNewSubscriptionUpdateBatch(t,r):(n.backoff.reset(),q.debug(`All subscriptions resolved.`))})}return E.default(e,[{key:`getSubscriptionUpdateBatch`,value:function(){function e(e,t,n,r){var i=[],a=J(e),o;try{for(a.s();!(o=a.n()).done;){var s=I.default(o.value,2),c=s[0],l=s[1];if(!t.get(c)&&n!==l.pendingAction&&!l.rejectedWithError&&(i.push(l),r&&i.length>=r))break}}catch(e){a.e(e)}finally{a.f()}return i}var t=e(this.subscriptions,this.persisted,`establish`,this.maxBatchSize);if(t.length>0)return{action:`establish`,subscriptions:t};var n=e(this.persisted,this.subscriptions,`cancel`,this.maxBatchSize);return n.length>0?{action:`cancel`,subscriptions:n}:{action:null,subscriptions:null}}},{key:`persist`,value:function(){this.backoff.backoff()}},{key:`applyNewSubscriptionUpdateBatch`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r=this,i,a,o,s,c,l,u,d,p,m,h,g,_,v,y,b;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isConnected){e.next=4;break}return q.debug(`Twilsock connection (required for subscription) not ready; waitingâ¦`),this.backoff.reset(),e.abrupt(`return`);case 4:n=this.processLocalActions(t,n),i=new Date().getTime(),a=J(n);try{for(a.s();!(o=a.n()).done;)s=o.value,this.recordActionAttemptOn(s,t,i)}catch(e){a.e(e)}finally{a.f()}return c=this.pendingPokeReason,this.pendingPokeReason=null,e.prev=10,e.next=13,this.request(t,i,c,n);case 13:l=e.sent,u=l.body.max_batch_size,!isNaN(parseInt(u))&&isFinite(u)&&u>0&&(this.maxBatchSize=u),this.subscriptionTtlTimer||(d=l.body.ttl_in_s,p=!isNaN(parseFloat(d))&&isFinite(d),m=p&&d>0,m&&(this.subscriptionTtlTimer=setTimeout(function(){return r.onSubscriptionTtlElapsed()},d*1e3))),t===`establish`&&(h=l.body.estimated_delivery_in_ms,g=!isNaN(parseFloat(h))&&isFinite(h),_=g&&h>0,_?setTimeout(function(){return r.verifyPokeDelivery(i,h,n)},h):q.error(`Invalid timeout: ${h}`),n.filter(function(e){return e.pendingCorrelationId===i}).forEach(function(e){return e.setSubscriptionState(`response_in_flight`)})),this.backoff.reset(),e.next=26;break;case 21:e.prev=21,e.t0=e.catch(10),v=J(n);try{for(v.s();!(y=v.n()).done;)b=y.value,this.recordActionFailureOn(b,t)}catch(e){v.e(e)}finally{v.f()}e.t0 instanceof f.TransportUnavailableError?(q.debug(`Twilsock connection (required for subscription) not ready (c:${i}); waitingâ¦`),this.backoff.reset()):(q.debug(`Failed an attempt to ${t} subscriptions (c:${i}); retrying`,e.t0),this.persist());case 26:case`end`:return e.stop()}},e,this,[[10,21]])}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`verifyPokeDelivery`,value:function(e,t,n){var r=this,i=this.latestPokeResponseArrivalTimestampByCorrelationId.get(e),a=i?new Date().getTime()-i:t;if(a>=t)n.filter(function(t){return t.pendingCorrelationId===e}
13).forEach(function(e){e.updatePending(null,null),e.retryCount++,r.persisted.delete(e.sid)}),this.persist(),this.latestPokeResponseArrivalTimestampByCorrelationId.delete(e);else{var o=t-a;setTimeout(function(){return r.verifyPokeDelivery(e,t,n)},o)}}},{key:`processLocalActions`,value:function(e,t){return e===`cancel`?t.filter(function(e){return!e.rejectedWithError}):t}},{key:`recordActionAttemptOn`,value:function(e,t,n){if(e.setSubscriptionState(`request_in_flight`),t===`establish`)this.persisted.set(e.sid,e),e.updatePending(t,n);else{var r=this.persisted.get(e.sid);r&&r.updatePending(t,n)}}},{key:`recordActionFailureOn`,value:function(e,t){e.setSubscriptionState(`none`),e.updatePending(null,null),t===`establish`&&this.persisted.delete(e.sid)}},{key:`request`,value:function(e,t,n,r){var i=r.map(function(t){return{object_sid:t.sid,object_type:t.type,last_event_id:e===`establish`?t.lastEventId:void 0,index_name:e===`establish`?t.indexName:void 0,query_string:e===`establish`?t.queryString:void 0}}),a=r.filter(function(e){return e.retryCount>0}).length;q.debug(`Attempting '${e}' request (c:${t}):`,i);var o={event_protocol_version:4,action:e,correlation_id:t,retried_requests:a,ttl_in_s:-1,requests:i};return n===`ttl`&&(o.reason=n),this.services.network.post(this.services.config.subscriptionsUri,o)}},{key:`add`,value:function(e,t){q.debug(`Establishing intent to subscribe to ${e}`);var n=this.subscriptions.get(e);n&&t&&n.lastEventId===t.lastEventId||(this.persisted.delete(e),this.subscriptions.set(e,new _e(t)),this.persist())}},{key:`remove`,value:function(e){q.debug(`Establishing intent to unsubscribe from ${e}`),this.subscriptions.delete(e)&&this.persist()}},{key:`acceptMessage`,value:function(e,t){q.trace(`Subscriptions received`,e);var n=e.event_type,r=e.events===void 0?[e.event]:e.events,i=e.correlation_id;i&&this.latestPokeResponseArrivalTimestampByCorrelationId.set(i,new Date().getTime());var a=J(r),o;try{for(a.s();!(o=a.n()).done;){var s=o.value,c=void 0;switch(e.event_type){case`subscription_established`:this.applySubscriptionEstablishedMessage(s,i);break;case`subscription_canceled`:this.applySubscriptionCancelledMessage(s,i);break;case`subscription_failed`:this.applySubscriptionFailedMessage(s,i);break;case(c=n.match(/^(?:map|list|document|stream|live_query)_/)||{}).input:var l=void 0;switch(c[0]){case`map_`:l=s.map_sid;break;case`list_`:l=s.list_sid;break;case`document_`:l=s.document_sid;break;case`stream_`:l=s.stream_sid;break;case`live_query_`:l=s.query_id,t=!1,e.strictly_ordered===!0&&(t=!0);break;default:l=void 0}this.applyEventToSubscribedEntity(l,s,n,t);break;default:q.debug(`Dropping unknown message type ${n}`)}}}catch(e){a.e(e)}finally{a.f()}}},{key:`applySubscriptionEstablishedMessage`,value:function(e,t){var n=e.object_sid,r=this.persisted.get(e.object_sid);r&&r.pendingCorrelationId===t?e.replay_status===`interrupted`?(q.debug(`Event Replay for subscription to ${n} (c:${t}) interrupted; continuing eagerly.`),r.updatePending(null,null),this.persisted.delete(r.sid),this.backoff.reset()):e.replay_status===`completed`&&(q.debug(`Event Replay for subscription to ${n} (c:${t}) completed. Subscription is ready.`),r.complete(e.last_event_id),this.persisted.set(e.object_sid,r),r.setSubscriptionState(`established`),this.backoff.reset()):q.debug(`Late message for ${e.object_sid} (c:${t}) dropped.`),this.persist()}},{key:`applySubscriptionCancelledMessage`,value:function(e,t){var n=this.persisted.get(e.object_sid);n&&n.pendingCorrelationId===t?(n.updatePending(null,null),n.setSubscriptionState(`none`),this.persisted.delete(e.object_sid)):q.debug(`Late message for ${e.object_sid} (c:${t}) dropped.`),this.persist()}},{key:`applySubscriptionFailedMessage`,value:function(e,t){var n=e.object_sid,r=this.subscriptions.get(n),i=this.persisted.get(n);r&&i?i.pendingCorrelationId===t&&(q.error(`Failed to subscribe on ${i.sid}`,e.error),i.markAsFailed(e),i.setSubscriptionState(`none`)):!r&&i&&(this.persisted.delete(n),i.setSubscriptionState(`none`)),this.persist()}},{key:`applyEventToSubscribedEntity`,value:function(e,t,n,r){var i=this;if(e){r||=function(){var t=i.persisted.get(e);return t&&t.isEstablished}();var a=this.subscriptions.get(e);a?(t.type=n,a.update(t,r)):q.debug(`Message dropped for SID '${e}', for which there is no subscription.`)}}},{key:`onConnectionStateChanged`,value:function(e){this.isConnected=e,e&&this.poke(`reconnect`)}},{key:`onSubscriptionTtlElapsed`,value:function(){this.isConnected&&this.poke(`ttl`)}},{key:`poke`,value:function(e){q.debug(`Triggering event replay for all subscriptions, reason=${e}`),this.pendingPokeReason=e,this.subscriptionTtlTimer&&=(clearTimeout(this.subscriptionTtlTimer),null);var t=[],n=J(this.persisted.values()),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.reset(),i.rejectedWithError&&t.push(i)}}catch(e){n.e(e)}finally{n.f()}this.persisted.clear();for(var a=0,o=t;a<o.length;a++){var s=o[a];this.persisted.set(s.sid,s)}this.persist()}},{key:`shutdown`,value:function(){this.backoff.reset(),this.subscriptions.clear()}}]),e}(),Y=4e3,ye=6e4,xe=9e4,Se=.2;function Ce(e){if(e.body&&e.body.message)return e.body.message;switch(e.status){case 429:return`Throttled by server`;case 404:return`Not found from server`;default:return`Error from server`}}function we(e){return e.body?e.body.code:0}function Te(e){return e.status===409?new K(Ce(e),e.status,we(e),e.body):e.status?new G(Ce(e),e.status,we(e)):e instanceof f.TransportUnavailableError?e:new G(e.message,0,0)}var Ee=function(){function e(t,n,r){T.default(this,e),this.clientInfo=t,this.config=n,this.transport=r}return E.default(e,[{key:`createHeaders`,value:function(){return{"Content-Type":`application/json`,"Twilio-Sync-Client-Info":JSON.stringify(this.clientInfo),"Twilio-Request-Id":`RQ`+L.v4().replace(/-/g,``)}}},{key:`backoffConfig`,value:function(){return Object.assign({min:Y,max:ye,maxAttemptsTime:xe,randomness:Se},this.config.backoffConfig)}},{key:`executeWithRetry`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return new Promise(function(r,i){var a=[502,503,504];n&&a.push(429);var o=new g.Retrier(t.backoffConfig());o.on(`attempt`,function(){e().then(function(e){return o.succeeded(e)}).catch(function(e){if(a.includes(e.status)){var t=parseInt(e.headers?e.headers[`Retry-After`]:null);o.failed(Te(e),isNaN(t)?null:t*1e3)}else e.message===`Twilsock disconnected`?o.failed(Te(e)):(o.removeAllListeners(),o.cancel(),i(Te(e)))})}),o.on(`succeeded`,function(e){r(e)}),o.on(`cancelled`,function(e){return i(Te(e))}),o.on(`failed`,function(e){return i(Te(e))}),o.start()})}},{key:`get`,value:function(e){var t=this,n=this.createHeaders();return q.debug(`GET`,e,`ID:`,n[`Twilio-Request-Id`]),this.executeWithRetry(function(){return t.transport.get(e,n,t.config.productId)},!0)}},{key:`post`,value:function(e,t,n){var r=this,i=arguments.length>3&&arguments[3]!==void 0&&arguments[3],a=this.createHeaders();return n!=null&&(a[`If-Match`]=n),q.debug(`POST`,e,`ID:`,a[`Twil
13io-Request-Id`]),this.executeWithRetry(function(){return r.transport.post(e,a,t,r.config.productId)},i)}},{key:`put`,value:function(e,t,n){var r=this,i=this.createHeaders();return n!=null&&(i[`If-Match`]=n),q.debug(`PUT`,e,`ID:`,i[`Twilio-Request-Id`]),this.executeWithRetry(function(){return r.transport.put(e,i,t,r.config.productId)},!1)}},{key:`delete`,value:function(e){var t=this,n=this.createHeaders();return q.debug(`DELETE`,e,`ID:`,n[`Twilio-Request-Id`]),this.executeWithRetry(function(){return t.transport.delete(e,n,t.config.productId)},!1)}}]),e}(),De=function(){function e(t,n){T.default(this,e),this.config=t,this.storageId=null;try{this.storage=n||sessionStorage}catch{}}return E.default(e,[{key:`storageKey`,value:function(e,t){return`${this.storageId}::${e}::${t}`}},{key:`isReady`,get:function(){return this.config.sessionStorageEnabled&&!!this.storageId}},{key:`updateStorageId`,value:function(e){this.storageId=e}},{key:`store`,value:function(e,t,n){return this.isReady?this._store(this.storageKey(e,t),n):null}},{key:`read`,value:function(e,t){return this.isReady?this._read(this.storageKey(e,t)):null}},{key:`remove`,value:function(e,t,n){if(!this.isReady)return null;try{this.storage.removeItem(this.storageKey(e,t)),n&&this.storage.removeItem(this.storageKey(e,n))}catch{}}},{key:`update`,value:function(e,t,n,r){if(!this.isReady)return null;this._apply(this.storageKey(e,t),r),n&&this._apply(this.storageKey(e,n),r)}},{key:`_store`,value:function(e,t){try{this.storage.setItem(e,JSON.stringify(t))}catch{}}},{key:`_read`,value:function(e){try{var t=this.storage.getItem(e);if(t)return JSON.parse(t)}catch{}return null}},{key:`_apply`,value:function(e,t){var n=this._read(e);if(!n)return!1;this._store(e,Object.assign(n,t))}}]),e}();function Oe(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=ke(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 14In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function ke(e,t){if(e){if(typeof e==`string`)return Ae(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ae(e,t)}}function Ae(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var je=function(){function e(t,n){T.default(this,e),this.services=t,this.removalHandler=n,this.subscriptionState=`none`,this._attachedListeners=new Map}return E.default(e,[{key:`_advanceLastEventId`,value:function(e,t){}},{key:`reportFailure`,value:function(e){e.status===404?this.onRemoved(!1):this.broadcastEventToListeners(`failure`,e)}},{key:`_subscribe`,value:function(){this.services.router._subscribe(this.sid,this)}},{key:`_unsubscribe`,value:function(){this.services.router._unsubscribe(this.sid)}},{key:`_setSubscriptionState`,value:function(e){this.subscriptionState=e,this.broadcastEventToListeners(`_subscriptionStateChanged`,e)}},{key:`close`,value:function(){this._unsubscribe(),this.removalHandler!=null&&this.removalHandler(this.type,this.sid,this.uniqueName)}},{key:`attach`,value:function(e){var t=e.listenerUuid;this._attachedListeners.get(t)||(this._attachedListeners.size||this._subscribe(),this._attachedListeners.set(t,e))}},{key:`detach`,value:function(e){this._attachedListeners.delete(e),this._attachedListeners.size||this.close()}},{key:`broadcastEventToListeners`,value:function(e){var t=[...arguments].slice(1),n=Oe(this._attachedListeners.values()),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.emit.apply(i,[e].concat(t))}}catch(e){n.e(e)}finally{n.f()}}}]),e}(),Pe=function(){function e(t){T.default(this,e),j.default(this,`queuedRequests`,[]),j.default(this,`isRequestInFlight`,!1),this.inputMergingFunction=t}return E.default(e,[{key:`add`,value:function(e,t){var n=this,r=new Promise(function(r,i){return n.queuedRequests.push({input:e,requestFunction:t,resolve:r,reject:i})});return this.wakeupQueue(),r}},{key:`squashAndAdd`,value:function(e,t){var n=this.queuedRequests;this.queuedRequests=[];var r;n.length>0?(r=n.map(function(e){return e.input}).reduce(this.inputMergingFunction),r=this.inputMergingFunction(r,e)):r=e;var i=this.add(r,t);
14return n.forEach(function(e){return i.then(e.resolve,e.reject)}),i}},{key:`isEmpty`,value:function(){return this.queuedRequests.length===0&&!this.isRequestInFlight}},{key:`wakeupQueue`,value:function(){var e=this;if(!(this.queuedRequests.length===0||this.isRequestInFlight)){var t=this.queuedRequests.shift();this.isRequestInFlight=!0,t.requestFunction(t.input).then(t.resolve,t.reject).then(function(t){e.isRequestInFlight=!1,e.wakeupQueue()})}}}]),e}(),Fe=function(){function e(t){T.default(this,e),j.default(this,`queueByNamespaceKey`,new Map),this.inputReducer=t}return E.default(e,[{key:`add`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.invokeQueueMethod(t,function(e){return e.add(n,r)}));case 1:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`squashAndAdd`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.invokeQueueMethod(t,function(e){return e.squashAndAdd(n,r)}));case 1:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`invokeQueueMethod`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r,i;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.queueByNamespaceKey.has(t)||this.queueByNamespaceKey.set(t,new Pe(this.inputReducer)),r=this.queueByNamespaceKey.get(t),i=n(r),this.queueByNamespaceKey.get(t).isEmpty()&&this.queueByNamespaceKey.delete(t),e.abrupt(`return`,i);case 5:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()}]),e}();function Ie(e){var t=Le();return function(){var n=A.default(e),r;if(t){var i=A.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return k.default(this,r)}}function Le(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Re=function(e){O.default(n,e);var t=Ie(n);function n(){var e;return T.default(this,n),e=t.call(this),e.closed=!1,e.uuid=_.v4(),e}return E.default(n,[{key:`listenerUuid`,get:function(){return this.uuid}},{key:`close`,value:function(){this.removeAllListeners(),this.closed=!0}},{key:`ensureNotClosed`,value:function(){if(this.closed)throw Error(`Invalid operation on closed object`)}}]),n}(y.ReplayEventEmitter);function ze(e){var t=Be();return function(){var n=A.default(e),r;if(t){var i=A.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return k.default(this,r)}}function Be(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Ve=function(e){O.default(n,e);var t=ze(n);function n(e,r,i){var a;return T.default(this,n),a=t.call(this,e,i),j.default(D.default(a),`isDeleted`,!1),a.updateMergingQueue=new Pe(function(e,t){return typeof t.ttl==`number`?{ttl:t.ttl}:e}),a.descriptor=r,a.descriptor.data=a.descriptor.data||{},a.descriptor.date_updated=new Date(a.descriptor.date_updated),a}return E.default(n,[{key:`uri`,get:function(){return this.descriptor.url}},{key:`revision`,get:function(){return this.descriptor.revision}},{key:`lastEventId`,get:function(){return this.descriptor.last_event_id}}
14,{key:`dateExpires`,get:function(){return this.descriptor.date_expires}},{key:`type`,get:function(){return`document`}},{key:`indexName`,get:function(){}},{key:`queryString`,get:function(){}},{key:`sid`,get:function(){return this.descriptor.sid}},{key:`data`,get:function(){return this.descriptor.data}},{key:`dateUpdated`,get:function(){return this.descriptor.date_updated}},{key:`uniqueName`,get:function(){return this.descriptor.unique_name||null}},{key:`_update`,value:function(e){switch(e.date_created=new Date(e.date_created),e.type){case`document_updated`:if(e.id<=this.lastEventId){q.trace(`Document update skipped, current:`,this.lastEventId,`, remote:`,e.id);break}var t=this.descriptor.data===void 0?null:te(this.descriptor.data);this.descriptor.last_event_id=e.id,this.descriptor.revision=e.document_revision,this.descriptor.date_updated=e.date_created,this.descriptor.data=e.document_data,this.broadcastEventToListeners(`updated`,{data:e.document_data,isLocal:!1,previousData:t}),this.services.storage.update(this.type,this.sid,this.uniqueName,{last_event_id:e.id,revision:e.document_revision,date_updated:e.date_created,data:e.document_data});break;case`document_removed`:this.onRemoved(!1)}}},{key:`set`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r=this,i;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=n||{},e.abrupt(`return`,this.updateMergingQueue.squashAndAdd(i,function(e){return r._setUnconditionally(t,e.ttl)}));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`mutate`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r=this,i;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=n||{},e.abrupt(`return`,this.updateMergingQueue.add(i,function(e){return r._setWithIfMatch(t,e.ttl)}));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`update`,value:function(){var e=w.default(M.default.mark(function e(t,n){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.mutate(function(e){return Object.assign(e,t)},n));case 1:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`setTtl`,value:function(){var e=w.default(M.default.mark(function e(t){var n;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._postUpdateToServer({ttl:t});case 2:n=e.sent,this.descriptor.date_expires=n.date_expires;case 4:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_setUnconditionally`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._postUpdateToServer({data:t,revision:void 0,ttl:n});case 2:return r=e.sent,this._handleSuccessfulUpdateResult(r),e.abrupt(`return`,this.descriptor.data);case 5:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`_setWithIfMatch`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r,i,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t(te(this.descriptor.data)),!r){e.next=22;break}return i=this.revision,e.prev=3,e.next=6,this._postUpdateToServer({data:r,revision:i,ttl:n});case 6:return a=e.sent,this._handleSuccessfulUpdateResult(a),e.abrupt(`return`,this.descriptor.data);case 11:if(e.prev=11,e.t0=e.catch(3),e.t0.status!==412){e.next=19;break}return e.next=16,this._softSync();case 16:return e.abrupt(`return`,this._setWithIfMatch(t));case 19:throw e.t0;case 20:e.next=23;break;case 22:return e.abrupt(`return`,this.descriptor.data);case 23:case`end`:return e.stop()}},e,this,[[3,11]])}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`_handleSuccessfulUpdateResult`,value:function(e){if(!(e.last_event_id<=this.descriptor.last_event_id)){var t=this.descriptor.data===void 0?null:te(this.descriptor.data);this.descriptor.revision=e.revision,this.descriptor.data=e.data,this.descriptor.last_event_id=e.last_event_id,this.descriptor.date_expires=e.date_expires,this.descriptor.date_updated=new Date(e.date_updated),this.services.storage.update(this.t
14ype,this.sid,this.uniqueName,{last_event_id:e.last_event_id,revision:e.revision,date_updated:e.date_updated,data:e.data}),this.broadcastEventToListeners(`updated`,{data:this.descriptor.data,isLocal:!0,previousData:t})}}},{key:`_postUpdateToServer`,value:function(){var e=w.default(M.default.mark(function e(t){var n,r,i;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isDeleted){e.next=17;break}return n={data:t.data},t.ttl!==void 0&&(n.ttl=t.ttl),r=t.revision,e.prev=4,e.next=7,this.services.network.post(this.uri,n,r);case 7:return i=e.sent,e.abrupt(`return`,{revision:i.body.revision,data:t.data,last_event_id:i.body.last_event_id,date_updated:i.body.date_updated,date_expires:i.body.date_expires});case 11:throw e.prev=11,e.t0=e.catch(4),e.t0.status===404&&this.onRemoved(!1),e.t0;case 15:e.next=18;break;case 17:return e.abrupt(`return`,Promise.reject(new G(`The Document has been removed`,404,54100)));case 18:case`end`:return e.stop()}},e,this,[[4,11]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_softSync`,value:function(){var e=w.default(M.default.mark(function e(){var t=this;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.services.network.get(this.uri).then(function(e){var n={type:`document_updated`,id:e.body.last_event_id,document_revision:e.body.revision,document_data:e.body.data,date_created:e.body.date_updated};return t._update(n),t}).catch(function(e){e.status===404?t.onRemoved(!1):q.error(`Can't get updates for ${t.sid}:`,e)}));case 1:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`onRemoved`,value:function(e){if(!this.isDeleted){var t=this.descriptor.data===void 0?null:te(this.descriptor.data);this.isDeleted=!0,this._unsubscribe(),this.removalHandler(this.type,this.sid,this.uniqueName),this.broadcastEventToListeners(`removed`,{isLocal:e,previousData:t})}}},{key:`removeDocument`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isDeleted){e.next=6;break}return e.next=3,this.services.network.delete(this.uri);case 3:this.onRemoved(!0),e.next=7;break;case 6:return e.abrupt(`return`,Promise.reject(new G(`The Document has been removed`,404,54100)));case 7:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()}],[{key:`type`,get:function(){return`document`}}]),n}(je),He=function(e){O.default(n,e);var t=ze(n);function n(e){var r;return T.default(this,n),r=t.call(this),r.syncDocumentImpl=e,r.syncDocumentImpl.attach(D.default(r)),r}return E.default(n,[{key:`uri`,get:function(){return this.syncDocumentImpl.uri}},{key:`revision`,get:function(){return this.syncDocumentImpl.revision}},{key:`lastEventId`,get:function(){return this.syncDocumentImpl.lastEventId}}
14,{key:`dateExpires`,get:function(){return this.syncDocumentImpl.dateExpires}},{key:`type`,get:function(){return Ve.type}},{key:`sid`,get:function(){return this.syncDocumentImpl.sid}},{key:`data`,get:function(){return this.syncDocumentImpl.data}},{key:`dateUpdated`,get:function(){return this.syncDocumentImpl.dateUpdated}},{key:`uniqueName`,get:function(){return this.syncDocumentImpl.uniqueName}},{key:`set`,value:function(){var e=w.default(M.default.mark(function e(t,n){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncDocumentImpl.set(t,n));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`mutate`,value:function(){var e=w.default(M.default.mark(function e(t,n){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncDocumentImpl.mutate(t,n));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`update`,value:function(){var e=w.default(M.default.mark(function e(t,n){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncDocumentImpl.update(t,n));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`setTtl`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncDocumentImpl.setTtl(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`removeDocument`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncDocumentImpl.removeDocument());case 2:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`close`,value:function(){R.default(A.default(n.prototype),`close`,this).call(this),this.syncDocumentImpl.detach(this.listenerUuid)}}],[{key:`type`,get:function(){return Ve.type}}]),n}(Re);j.default(He,`removed`,`removed`),j.default(He,`updated`,`updated`),V([d.validateTypesAsync(d.pureObject,[`undefined`,d.objectSchema(`document metadata`,{ttl:[d.nonNegativeInteger,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Object,Object]),H(`design:returntype`,Promise)],He.prototype,`set`,null),V([d.validateTypesAsync(`function`,[`undefined`,d.objectSchema(`document metadata`,{ttl:[d.nonNegativeInteger,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Function,Object]),H(`design:returntype`,Promise)],He.prototype,`mutate`,null),V([d.validateTypesAsync(d.pureObject,[`undefined`,d.objectSchema(`document metadata`,{ttl:[d.nonNegativeInteger,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Object,Object]),H(`design:returntype`,Promise)],He.prototype,`update`,null),V([d.validateTypesAsync(d.nonNegativeInteger),H(`design:type`,Function),H(`design:paramtypes`,[Number]),H(`design:returntype`,Promise)],He.prototype,`setTtl`,null);var Ue=function(){function e(t){T.default(this,e),this.descriptor=t}return E.default(e,[{key:`url`,get:function(){return this.descriptor.url}},{key:`revision`,get:function(){return this.descriptor.revision}},{key:`lastEventId`,get:function(){return this.descriptor.lastEventId}},{key:`dateUpdated`,get:function(){return this.descriptor.dateUpdated}}
14,{key:`dateExpires`,get:function(){return this.descriptor.dateExpires}},{key:`index`,get:function(){return this.descriptor.index}},{key:`data`,get:function(){return this.descriptor.data}},{key:`cacheKey`,get:function(){return this.index}},{key:`update`,value:function(e,t,n,r){return this.descriptor.lastEventId=e,this.descriptor.revision=t,this.descriptor.data=n,this.descriptor.dateUpdated=r,this}},{key:`updateDateExpires`,value:function(e){this.descriptor.dateExpires=e}}]),e}(),We=function(){function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;T.default(this,e),this.items=t,this.source=n,this.prevPageItemId=r,this.nextPageItemId=i}return E.default(e,[{key:`nextPage`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasNextPage){e.next=2;break}throw Error(`No next page`);case 2:return e.abrupt(`return`,this.source({nextPageItemId:this.nextPageItemId}));case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`prevPage`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasPrevPage){e.next=2;break}throw Error(`No previous page`);case 2:return e.abrupt(`return`,this.source({prevPageItemId:this.prevPageItemId}));case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`hasNextPage`,get:function(){return this.nextPageItemId!==null}},{key:`hasPrevPage`,get:function(){return this.prevPageItemId!==null}}]),e}();function Ge(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Ke(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 15In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function Ke(e,t){if(e){if(typeof e==`string`)return qe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qe(e,t)}}function qe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Je=function(){function e(t,n){T.default(this,e),this.balanceFactor=0,this.key=t,this.value=n,this.parent=null,this.left=null,this.right=null}return E.default(e,[{key:`isRoot`,get:function(){return this.parent===null}},{key:`isLeaf`,get:function(){return this.left===null&&this.right===null}},{key:`isLeftChild`,get:function(){return this.parent.left===this}},{key:`update`,value:function(e){this.value=e}},{key:`replace`,value:function(e,t){e&&(this.left===t?this.left=t:this.right===t&&(this.right=t))}}]),e}(),Ye=function(e){function t(e,n){T.default(this,t),this.isLessThan=e||function(e,t){return e<t},this.isEqual=n||function(e,t){return e===t},this.root=null,this.count=null}return E.default(t,[{key:`size`,get:function(){return this.count}},{key:`clear`,value:function(){this.root=null,this.count=0}},{key:`set`,value:function(e,t){var n=this.getNode(e);n?n.update(t):this.insert(e,t)}},{key:`insert`,value:function(e,t){var n=new Je(e,t);if(this.count++,!this.root){this.root=n;return}for(var r=this.root;;)if(this.isLessThan(e,r.key)){if(r.left)r=r.left;else{r.left=n;break}}else if(r.right)r=r.right;else{r.right=n;break}for(n.parent=r,r=n;r.parent;){var i=r.parent,a=i.balanceFactor;if(r.isLeftChild?i.balanceFactor++:i.balanceFactor--,Math.abs(i.balanceFactor)<Math.abs(a))break;if(i.balanceFactor<-1||i.balanceFactor>1){this.rebalance(i);break}r=i}}},{key:`get`,value:function(e){for(var t=this.root;t;){if(this.isEqual(e,t.key))return t.value;t=this.isLessThan(e,t.key)?t.left:t.right}return null}},{key:`delete`,value:function(e){var t=this.getNode(e);if(!t||t.key!==e)return null;var n=t.parent,r=t.left,i=t.right;if(!!r!=!!i){var a=r||i;!n&&!a?this.root=null:n&&!a?this.root=a:(n.replace(t,null),this.rebalance(n))}else{for(var o=t.left;o.right;)o=o.right;if(t.left===o)t.isRoot?(this.root=o,o.parent=null):(t.isLeftChild?t.parent.left=o:t.parent.right=o,o.parent=t.parent),o.right=t.right,o.right.parent=o,o.balanceFactor=t.balanceFactor,t={parent:o,isLeftChild:!0};else{var s=o.parent,c=o.left;
15s.right=c,c&&(c.parent=s),t.isRoot?(this.root=o,o.parent=null):(t.isLeftChild?t.parent.left=o:t.parent.right=o,o.parent=t.parent),o.right=t.right,o.right.parent=o,o.left=t.left,o.left.parent=o,o.balanceFactor=t.balanceFactor,t={parent:s,isLeftChild:!1}}}for(this.count--;t.parent;){var l=t.parent,u=l.balanceFactor;if(t.isLeftChild?--l.balanceFactor:l.balanceFactor+=1,Math.abs(l.balanceFactor)>Math.abs(u)){if(l.balanceFactor<-1||l.balanceFactor>1){if(this.rebalance(l),l.parent.balanceFactor===0)t=l.parent;else break}else break}else t=l}return null}},{key:`getNode`,value:function(e){for(var t=this.root;t;){if(this.isEqual(e,t.key))return t;t=this.isLessThan(e,t.key)?t.left:t.right}return null}},{key:`rebalance`,value:function(e){e.balanceFactor<0?(e.right.balanceFactor>0&&this.rotateRight(e.right),this.rotateLeft(e)):e.balanceFactor>0&&(e.left.balanceFactor<0&&this.rotateLeft(e.left),this.rotateRight(e))}},{key:`rotateLeft`,value:function(e){var t=e.right;e.right=t.left,t.left!==null&&(t.left.parent=e),t.parent=e.parent,t.parent===null?this.root=t:e.isLeftChild?t.parent.left=t:t.parent.right=t,t.left=e,e.parent=t,e.balanceFactor=e.balanceFactor+1-Math.min(t.balanceFactor,0),t.balanceFactor=t.balanceFactor+1-Math.max(e.balanceFactor,0)}},{key:`rotateRight`,value:function(e){var t=e.left;e.left=t.right,t.right!==null&&(t.right.parent=e),t.parent=e.parent,t.parent===null?this.root=t:e.isLeftChild?t.parent.left=t:t.parent.right=t,t.right=e,e.parent=t,e.balanceFactor=e.balanceFactor-1-Math.min(t.balanceFactor,0),t.balanceFactor=t.balanceFactor-1-Math.max(e.balanceFactor,0)}},{key:e,value:M.default.mark(function e(){var t,n,r;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=Ge(this.getIterator()),e.prev=1,t.s();case 3:if((n=t.n()).done){e.next=9;break}return r=n.value,e.next=7,r;case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),t.e(e.t0);case 14:return e.prev=14,t.f(),e.finish(14);case 17:case`end`:return e.stop()}},e,this,[[1,11,14,17]])})},{key:`getIterator`,value:M.default.mark(function e(){var t,n,r,i=arguments;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=i.length>0&&i[0]!==void 0?i[0]:null,n=this.root;case 2:if(!n){e.next=8;break}if(!(this.isEqual(t,n.key)||t===null&&!n.left)){e.next=5;break}return e.abrupt(`break`,8);case 5:n=this.isLessThan(t,n.key)||t===null?n.left:n.right,e.next=2;break;case 8:if(n){e.next=10;break}return e.abrupt(`return`,null);case 10:r=!0;case 11:if(!r){e.next=29;break}return e.next=14,[n.key,n.value];case 14:if(r=!1,!n.right){e.next=21;break}for(n=n.right;n.left;)n=n.left;r=!0,e.next=27;break;case 21:if(!n.parent){e.next=26;break}r=n.parent.left===n,n=n.parent,e.next=27;break;case 26:return e.abrupt(`break`,37);case 27:e.next=35;break;case 29:if(!n.parent){e.next=34;break}r=n.parent.left===n,n=n.parent,e.next=35;break;case 34:return e.abrupt(`break`,37);case 35:e.next=11;break;case 37:return e.abrupt(`return`,null);case 38:case`end`:return e.stop()}},e,this)})},{key:`getReverseIterator`,value:M.default.mark(function e(){var t,n,r,i=arguments;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=i.length>0&&i[0]!==void 0?i[0]:null,n=this.root;case 2:if(!n){e.next=8;break}if(!(this.isEqual(t,n.key)||t===null&&!n.right)){e.next=5;break}return e.abrupt(`break`,8);case 5:n=!this.isLessThan(t,n.key)||t===null?n.right:n.left,e.next=2;break;case 8:if(n){e.next=10;break}return e.abrupt(`return`,null);case 10:r=!0;case 11:if(!r){e.next=29;break}return e.next=14,[n.key,n.value];case 14:if(r=!1,!n.left){e.next=21;break}for(n=n.left;n.right;)n=n.right;r=!0,e.next=27;break;case 21:if(!n.parent){e.next=26;break}r=n.parent.right===n,n=n.parent,e.next=27;break;case 26:return e.abrupt(`break`,37);case 27:e.next=35;break;case 29:if(!n.parent){e.next=34;break}r=n.parent.right===n,n=n.parent,e.next=35;break;case 34:return e.abrupt(`break`,37);case 35:e.next=11;break;case 37:return e.abrupt(`return`,null);case 38:case`end`:return e.stop()}},e,this)})}]),t}(Symbol.iterator);function Xe(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];
15if(!n){if(Array.isArray(e)||(n=Ze(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 16In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function Ze(e,t){if(e){if(typeof e==`string`)return $e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $e(e,t)}}function $e(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var tt=function(){function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0&&arguments[2],i=arguments.length>3&&arguments[3]!==void 0&&arguments[3];T.default(this,e),this._data=t,this.lastEventId=n||0,this.isLeftBound=r,this.isRightBound=i}return E.default(e,[{key:`isValid`,get:function(){return!0}},{key:`value`,get:function(){return this._data}}]),e}(),it=function(){function e(t){T.default(this,e),this.lastEventId=t,this.isLeftBound=!1,this.isRightBound=!1}return E.default(e,[{key:`isValid`,get:function(){return!1}},{key:`value`,get:function(){return null}}]),e}(),ct=function(){function e(){T.default(this,e),j.default(this,`items`,new Ye),j.default(this,`beginKey`,null),j.default(this,`endKey`,null),this.items.clear()}return E.default(e,[{key:`size`,get:function(){return this.items.size}},{key:`collectionBegin`,get:function(){return this.beginKey}},{key:`collectionEnd`,get:function(){return this.endKey}},{key:`has`,value:function(e){return this.items.get(e)?.isValid??!1}},{key:`exists`,value:function(e){return!!this.items.get(e)}},{key:`getValue`,value:function(e){return this.items.get(e)?.value??null}},{key:`get`,value:function(e){return this.items.get(e)}},{key:`getNextItem`,value:function(e,t,n){return e===null?this.getFirstItem(t):n?this.getValue(e):this.getAdjacentItem(e,t)}},{key:`getFirstItem`,value:function(e){var t=e===`asc`?this.beginKey:this.endKey;if(this.exists(t)){var n=this.items.get(t);return n.isValid?n.value:this.getAdjacentItem(t,e)}return null}},{key:`getAdjacentItem`,value:function(e,t){var n=Xe(t===`asc`?this.items.getIterator(e):this.items.getReverseIterator(e)),r;try{for(n.s();!(r=n.n()).done;){var i=I.default(r.value,2);i[0];var a=i[1];if(t===`asc`?a.isRightBound:a.isLeftBound)break;if(a.isValid)return a.value}}catch(e){n.e(e)}finally{n.f()}return null}},{key:`store`,value:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=this.items.get(e);if(a&&a.lastEventId>n)return a.value;if(this.items.set(e,new tt(t,n,a?a.isLeftBound&&r:r,a?a.isRightBound&&i:i)),this.beginKey!==null&&e<this.beginKey){var o=this.items.get(this.beginKey);o&&(o.isLeftBound=!1),this.beginKey=e}if(this.endKey!==null&&this.endKey<e){var s=this.items.get(this.endKey);s&&(s.isRightBound=!1),this.endKey=e}return t}},{key:`populate`,value:function(e,t,n){var r=this;if(e.length){var i=z.default(e);if(i.sort(function(e,t){return e.cacheKey===t.cacheKey?0:e.cacheKey>t.cacheKey?1:-1}),i.forEach(function(e,t){r.store(e.cacheKey,e,e.lastEventId,t===0,t===i.length-1)}),t){var a=i[0].cacheKey;(!this.beginKey||a<this.beginKey)&&(this.beginKey=a)}if(n){var o=i[i.length-1].cacheKey;(!this.endKey||this.endKey<o)&&(this.endKey=o)}}}},{key:`delete`,value:function(e,t){var n=this.items.get(e);(n===null||t===null||n.lastEventId<t)&&this.items.set(e,new it(t))}}
16,{key:`isKnown`,value:function(e,t){var n=this.items.get(e);return n&&n.lastEventId>=t}},{key:`getIterator`,value:M.default.mark(function e(t){var n,r,i,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t===null&&this.beginKey!==null&&(t=this.beginKey),t!==null){e.next=3;break}return e.abrupt(`return`);case 3:n=Xe(this.items.getIterator(t)),e.prev=4,n.s();case 6:if((r=n.n()).done){e.next=16;break}if(i=I.default(r.value,2),a=i[1],a.isValid){e.next=10;break}return e.abrupt(`continue`,14);case 10:return e.next=12,a;case 12:if(!a.isRightBound){e.next=14;break}return e.abrupt(`break`,16);case 14:e.next=6;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(4),n.e(e.t0);case 21:return e.prev=21,n.f(),e.finish(21);case 24:case`end`:return e.stop()}},e,this,[[4,18,21,24]])})},{key:`getReverseIterator`,value:M.default.mark(function e(t){var n,r,i,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t===null&&this.endKey!==null&&(t=this.endKey),t!==null){e.next=3;break}return e.abrupt(`return`);case 3:n=Xe(this.items.getReverseIterator(t)),e.prev=4,n.s();case 6:if((r=n.n()).done){e.next=16;break}if(i=I.default(r.value,2),a=i[1],a.isValid){e.next=10;break}return e.abrupt(`continue`,14);case 10:return e.next=12,a;case 12:if(!a.isLeftBound){e.next=14;break}return e.abrupt(`break`,16);case 14:e.next=6;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(4),n.e(e.t0);case 21:return e.prev=21,n.f(),e.finish(21);case 24:case`end`:return e.stop()}},e,this,[[4,18,21,24]])})},{key:`forEach`,value:function(e){if(this.items){var t=Xe(this.items),n;try{for(t.s();!(n=t.n()).done;){var r=I.default(n.value,2),i=r[0],a=r[1];a.isValid&&e(i,a.value)}}catch(e){t.e(e)}finally{t.f()}}}}]),e}(),pt=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},mt={exports:{}};(function(e,t){(function(){var n,r=`Expected a function`,i=`__lodash_hash_undefined__`,a=`__lodash_placeholder__`,o=1,s=2,c=8,l=16,u=32,d=64,f=128,p=256,m=512,h=1/0,g=9007199254740991,_=17976931348623157e292,v=NaN,y=4294967295,b=y-1,x=y>>>1,S=[[`ary`,f],[`bind`,o],[`bindKey`,s],[`curry`,c],[`curryRight`,l],[`flip`,m],[`partial`,u],[`partialRight`,d],[`rearg`,p]],C=`[object Arguments]`,w=`[object Array]`,T=`[object AsyncFunction]`,E=`[object Boolean]`,D=`[object Date]`,O=`[object DOMException]`,k=`[object Error]`,A=`[object Function]`,j=`[object GeneratorFunction]`,M=`[object Map]`,P=`[object Number]`,F=`[object Null]`,I=`[object Object]`,L=`[object Promise]`,R=`[object Proxy]`,z=`[object RegExp]`,B=`[object Set]`,V=`[object String]`,H=`[object Symbol]`,U=`[object Undefined]`,W=`[object WeakMap]`,ee=`[object WeakSet]`,G=`[object ArrayBuffer]`,K=`[object DataView]`,te=`[object Float32Array]`,ne=`[object Float64Array]`,re=`[object Int8Array]`,ie=`[object Int16Array]`,ae=`[object Int32Array]`,oe=`[object Uint8Array]`,q=`[object Uint8ClampedArray]`,se=`[object Uint16Array]`,ce=`[object Uint32Array]`,le=/\b__p \+= '';/g,ue=/\b(__p \+=) '' \+/g,de=/(__e\(.*?\)|\b__t\)) \+\n'';/g,fe=/&(?:amp|lt|gt|quot|#39);/g,pe=/[&<>"']/g,me=RegExp(fe.source),J=RegExp(pe.source),he=/<%-([\s\S]+?)%>/g,ge=/<%([\s\S]+?)%>/g,_e=/<%=([\s\S]+?)%>/g,ve=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,ye=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,be=/[\\^$.*+?()[\]{}|]/g,xe=RegExp(be.source),Se=/^\s+/,Ce=/\s/,we=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Te=/\{\n\/\* \[wrapped with (.+)\] \*/,Ee=/,? & /,De=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Oe=/[()=,{}\[\]\/\s]/,ke=/\\(\\)?/g,Ae=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,je=/\w*$/,Me=/^[-+]0x[0-9a-f]+$/i,Ne=/^0b[01]+$/i,Pe=/^\[object .+?Constructor\]$/,Fe=/^0o[0-7]+$/i,Ie=/^(?:0|[1-9]\d*)$/,Le=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u01
vendor: 5,738 bytes, line 16
167f]/g,Re=/($^)/,ze=/['\n\r\u2028\u2029\\]/g,Be=`\\ud800-\\udfff`,Ve=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,He=`\\u2700-\\u27bf`,Ue=`a-z\\xdf-\\xf6\\xf8-\\xff`,We=`\\xac\\xb1\\xd7\\xf7`,Ge=`\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf`,Ke=`\\u2000-\\u206f`,qe=` \\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`,Je=`A-Z\\xc0-\\xd6\\xd8-\\xde`,Ye=`\\ufe0e\\ufe0f`,Xe=We+Ge+Ke+qe,Ze=`['â]`,Qe=`[`+Be+`]`,$e=`[`+Xe+`]`,et=`[`+Ve+`]`,tt=`\\d+`,nt=`[`+He+`]`,rt=`[`+Ue+`]`,it=`[^`+Be+Xe+tt+He+Ue+Je+`]`,at=`\\ud83c[\\udffb-\\udfff]`,ot=`(?:`+et+`|`+at+`)`,st=`[^`+Be+`]`,ct=`(?:\\ud83c[\\udde6-\\uddff]){2}`,lt=`[\\ud800-\\udbff][\\udc00-\\udfff]`,ut=`[`+Je+`]`,dt=`\\u200d`,ft=`(?:`+rt+`|`+it+`)`,mt=`(?:`+ut+`|`+it+`)`,ht=`(?:`+Ze+`(?:d|ll|m|re|s|t|ve))?`,gt=`(?:`+Ze+`(?:D|LL|M|RE|S|T|VE))?`,_t=ot+`?`,vt=`[`+Ye+`]?`,yt=`(?:`+dt+`(?:`+[st,ct,lt].join(`|`)+`)`+vt+_t+`)*`,bt=`\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])`,xt=`\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])`,St=vt+_t+yt,Ct=`(?:`+[nt,ct,lt].join(`|`)+`)`+St,wt=`(?:`+[st+et+`?`,et,ct,lt,Qe].join(`|`)+`)`,Tt=RegExp(Ze,`g`),Et=RegExp(et,`g`),Dt=RegExp(at+`(?=`+at+`)|`+wt+St,`g`),Ot=RegExp([ut+`?`+rt+`+`+ht+`(?=`+[$e,ut,`$`].join(`|`)+`)`,mt+`+`+gt+`(?=`+[$e,ut+ft,`$`].join(`|`)+`)`,ut+`?`+ft+`+`+ht,ut+`+`+gt,xt,bt,tt,Ct].join(`|`),`g`),kt=RegExp(`[`+dt+Be+Ve+Ye+`]`),At=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,jt=`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`.split(`.`),Mt=-1,X={};X[te]=X[ne]=X[re]=X[ie]=X[ae]=X[oe]=X[q]=X[se]=X[ce]=!0,X[C]=X[w]=X[G]=X[E]=X[K]=X[D]=X[k]=X[A]=X[M]=X[P]=X[I]=X[z]=X[B]=X[V]=X[W]=!1;var Nt={};Nt[C]=Nt[w]=Nt[G]=Nt[K]=Nt[E]=Nt[D]=Nt[te]=Nt[ne]=Nt[re]=Nt[ie]=Nt[ae]=Nt[M]=Nt[P]=Nt[I]=Nt[z]=Nt[B]=Nt[V]=Nt[H]=Nt[oe]=Nt[q]=Nt[se]=Nt[ce]=!0,Nt[k]=Nt[A]=Nt[W]=!1;var Pt={Ã:`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`,Å¿:`s`},Ft={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},It={"&":`&`,"<":`<`,">":`>`,""":`"`,"'":`'`},Lt={"\\":`\\`,"'":`'`,"\n":`n`,"\r":`r`,"\u2028":`u2028`,"\u2029":`u2029`},Rt=parseFloat,zt=parseInt,Bt=N.default(pt)==`object`&&pt&&pt.Object===Object&&pt,Vt=(typeof self>`u`?`undefined`:N.default(self))==`object`&&self&&self.Object===Object&&self,Z=Bt||Vt||Function(`return this`)(),Ht=t&&!t.nodeType&&t,Ut=Ht&&e&&!e.nodeType&&e,Wt=Ut&&Ut.exports===Ht,Gt=Wt&&Bt.process,Kt=function(){try{return Ut&&Ut.require&&Ut.require(`util`).types||Gt&&Gt.binding&&Gt.binding(`util`)}catch{}}(),qt=Kt&&Kt.isArrayBuffer,Jt=Kt&&Kt.isDate,Yt=Kt&&Kt.isMap,Xt=Kt&&Kt.isRegExp,Zt=Kt&&Kt.isSet,Qt=Kt&&Kt.isTypedArray;function $t(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function en(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}function tn(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}function nn(e,t){for(var n=e==null?0:e.length;n--&&t(e[n],n,e)!==!1;);return e}function rn(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function an(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function on(e,t){return!!(e!=null&&e.length)&&vn(e,t,0)>-1}function sn(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function cn(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function ln(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function un(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function dn(e,t,n,r){var i=e==null?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function fn(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var pn=Sn(`length`);function mn(e){return e.split(``)}function hn(e){return e.match(De)||[]}function gn(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function _n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}
vendor: 5,076 bytes, line 16
16function vn(e,t,n){return t===t?Jn(e,t,n):_n(e,bn,n)}function yn(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function bn(e){return e!==e}function xn(e,t){var n=e==null?0:e.length;return n?En(e,t)/n:v}function Sn(e){return function(t){return t==null?n:t[e]}}function Cn(e){return function(t){return e==null?n:e[t]}}function wn(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}function Tn(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function En(e,t){for(var r,i=-1,a=e.length;++i<a;){var o=t(e[i]);o!==n&&(r=r===n?o:r+o)}return r}function Dn(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function On(e,t){return cn(t,function(t){return[t,e[t]]})}function kn(e){return e&&e.slice(0,Qn(e)+1).replace(Se,``)}function An(e){return function(t){return e(t)}}function jn(e,t){return cn(t,function(t){return e[t]})}function Mn(e,t){return e.has(t)}function Nn(e,t){for(var n=-1,r=e.length;++n<r&&vn(t,e[n],0)>-1;);return n}function Pn(e,t){for(var n=e.length;n--&&vn(t,e[n],0)>-1;);return n}function Fn(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var In=Cn(Pt),Ln=Cn(Ft);function Rn(e){return`\\`+Lt[e]}function zn(e,t){return e==null?n:e[t]}function Bn(e){return kt.test(e)}function Vn(e){return At.test(e)}function Hn(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function Un(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Wn(e,t){return function(n){return e(t(n))}}function Gn(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];(s===t||s===a)&&(e[n]=a,o[i++]=n)}return o}function Kn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function qn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Jn(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function Yn(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}function Xn(e){return Bn(e)?er(e):pn(e)}function Zn(e){return Bn(e)?tr(e):mn(e)}function Qn(e){for(var t=e.length;t--&&Ce.test(e.charAt(t)););return t}var $n=Cn(It);function er(e){for(var t=Dt.lastIndex=0;Dt.test(e);)++t;return t}function tr(e){return e.match(Dt)||[]}function nr(e){return e.match(Ot)||[]}var rr=function e(t){t=t==null?Z:rr.defaults(Z.Object(),t,rr.pick(Z,jt));var Ce=t.Array,De=t.Date,Be=t.Error,Ve=t.Function,He=t.Math,Ue=t.Object,We=t.RegExp,Ge=t.String,Ke=t.TypeError,qe=Ce.prototype,Je=Ve.prototype,Ye=Ue.prototype,Xe=t[`__core-js_shared__`],Ze=Je.toString,Qe=Ye.hasOwnProperty,$e=0,et=function(){var e=/[^.]+$/.exec(Xe&&Xe.keys&&Xe.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),tt=Ye.toString,nt=Ze.call(Ue),rt=Z._,it=We(`^`+Ze.call(Qe).replace(be,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),at=Wt?t.Buffer:n,ot=t.Symbol,st=t.Uint8Array,ct=at?at.allocUnsafe:n,lt=Wn(Ue.getPrototypeOf,Ue),ut=Ue.create,dt=Ye.propertyIsEnumerable,ft=qe.splice,pt=ot?ot.isConcatSpreadable:n,mt=ot?ot.iterator:n,ht=ot?ot.toStringTag:n,gt=function(){try{var e=Ao(Ue,`defineProperty`);return e({},``,{}),e}catch{}}(),_t=t.clearTimeout!==Z.clearTimeout&&t.clearTimeout,vt=De&&De.now!==Z.Date.now&&De.now,yt=t.setTimeout!==Z.setTimeout&&t.setTimeout,bt=He.ceil,xt=He.floor,St=Ue.getOwnPropertySymbols,Ct=at?at.isBuffer:n,wt=t.isFinite,Dt=qe.join,Ot=Wn(Ue.keys,Ue),kt=He.max,At=He.min,Pt=De.now,Ft=t.parseInt,It=He.random,Lt=qe.reverse,Bt=Ao(t,`DataView`),Vt=Ao(t,`Map`),Ht=Ao(t,`Promise`),Ut=Ao(t,`Set`),Gt=Ao(t,`WeakMap`),Kt=Ao(Ue,`create`),pn=Gt&&new Gt,mn={},Cn=hs(Bt),Jn=hs(Vt),er=hs(Ht),tr=hs(Ut),ir=hs(Gt),ar=ot?ot.prototype:n,or=ar?ar.valueOf:n,sr=ar?ar.toString:n;function Q(e){if(cu(e)&&!Gl(e)&&!(e instanceof dr)){if(e instanceof ur)return e;if(Qe.call(e,`__wrapped__`))return _s(e)}return new ur(e)}var cr=function(){function e(){}return function(t){if(!su(t))return{};if(ut)return ut(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function lr(){}function ur(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}Q.templateSettings={escape:he,evaluate:ge,interpolate:_e,variable:``,imports:{_:Q}},Q.prototype=lr.prototype,Q.prototype.constructor=Q,ur.prototype=cr(lr.prototype),ur.prototype.constructor=ur;function dr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=y,this.__views__=[]}function fr(){var e=new dr(this.__wrapped__);return e.__actions__=Va(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Va(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Va(this.__views__),e}function pr(){if(this.__filtered__){var e=new dr(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function mr(){var e=this.__wrapped__.value(),t=this.__dir__,n=Gl(e),r=t<0,i=n?e.length:0,a=Fo(0,i,this.__views__),o=a.start,s=a.end,c=s-o,l=r?s:o-1,u=this.__iteratees__,d=u.length,f=0,p=At(c,this.__takeCount__);if(!n||!r&&i==c&&p==c)return Sa(e,this.__actions__);var m=[];outer:for(;c--&&f<p;){l+=t;
vendor: 55,344 bytes, lines 16-35
16for(var h=-1,g=e[l];++h<d;){var _=u[h],v=_.iteratee,y=_.type,b=v(g);if(y==2)g=b;else if(!b){if(y==1)continue outer;break outer}}m[f++]=g}return m}dr.prototype=cr(lr.prototype),dr.prototype.constructor=dr;function hr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function gr(){this.__data__=Kt?Kt(null):{},this.size=0}function _r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}function vr(e){var t=this.__data__;if(Kt){var r=t[e];return r===i?n:r}return Qe.call(t,e)?t[e]:n}function yr(e){var t=this.__data__;return Kt?t[e]!==n:Qe.call(t,e)}function br(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=Kt&&t===n?i:t,this}hr.prototype.clear=gr,hr.prototype.delete=_r,hr.prototype.get=vr,hr.prototype.has=yr,hr.prototype.set=br;function xr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Sr(){this.__data__=[],this.size=0}function Cr(e){var t=this.__data__,n=Jr(t,e);return n<0?!1:(n==t.length-1?t.pop():ft.call(t,n,1),--this.size,!0)}function wr(e){var t=this.__data__,r=Jr(t,e);return r<0?n:t[r][1]}function Tr(e){return Jr(this.__data__,e)>-1}function Er(e,t){var n=this.__data__,r=Jr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}xr.prototype.clear=Sr,xr.prototype.delete=Cr,xr.prototype.get=wr,xr.prototype.has=Tr,xr.prototype.set=Er;function Dr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Or(){this.size=0,this.__data__={hash:new hr,map:new(Vt||xr),string:new hr}}function kr(e){var t=Oo(this,e).delete(e);return this.size-=+!!t,t}function Ar(e){return Oo(this,e).get(e)}function jr(e){return Oo(this,e).has(e)}function Mr(e,t){var n=Oo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}Dr.prototype.clear=Or,Dr.prototype.delete=kr,Dr.prototype.get=Ar,Dr.prototype.has=jr,Dr.prototype.set=Mr;function Nr(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Dr;++t<n;)this.add(e[t])}function Pr(e){return this.__data__.set(e,i),this}function Fr(e){return this.__data__.has(e)}Nr.prototype.add=Nr.prototype.push=Pr,Nr.prototype.has=Fr;function Ir(e){var t=this.__data__=new xr(e);this.size=t.size}function Lr(){this.__data__=new xr,this.size=0}function Rr(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function zr(e){return this.__data__.get(e)}function Br(e){return this.__data__.has(e)}function Vr(e,t){var n=this.__data__;if(n instanceof xr){var r=n.__data__;if(!Vt||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Dr(r)}return n.set(e,t),this.size=n.size,this}Ir.prototype.clear=Lr,Ir.prototype.delete=Rr,Ir.prototype.get=zr,Ir.prototype.has=Br,Ir.prototype.set=Vr;function Hr(e,t){var n=Gl(e),r=!n&&Wl(e),i=!n&&!r&&Xl(e),a=!n&&!r&&!i&&Cu(e),o=n||r||i||a,s=o?Dn(e.length,Ge):[],c=s.length;for(var l in e)(t||Qe.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||Uo(l,c)))&&s.push(l);return s}function Ur(e){var t=e.length;return t?e[ta(0,t-1)]:n}function Wr(e,t){return fs(Va(e),ei(t,0,e.length))}function Gr(e){return fs(Va(e))}function Kr(e,t,r){(r!==n&&!Vl(e[t],r)||r===n&&!(t in e))&&Qr(e,t,r)}function qr(e,t,r){var i=e[t];(!(Qe.call(e,t)&&Vl(i,r))||r===n&&!(t in e))&&Qr(e,t,r)}function Jr(e,t){for(var n=e.length;n--;)if(Vl(e[n][0],t))return n;return-1}function Yr(e,t,n,r){return oi(e,function(e,i,a){t(r,e,n(e),a)}),r}function Xr(e,t){return e&&Ha(t,ad(t),e)}function Zr(e,t){return e&&Ha(t,od(t),e)}function Qr(e,t,n){t==`__proto__`&>?gt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function $r(e,t){for(var r=-1,i=t.length,a=Ce(i),o=e==null;++r<i;)a[r]=o?n:$u(e,t[r]);return a}function ei(e,t,r){return e===e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function ti(e,t,r,i,a,o){var s,c=t&1,l=t&2,u=t&4;if(r&&(s=a?r(e,i,a,o):r(e)),s!==n)return s;if(!su(e))return e;var d=Gl(e);if(d){if(s=Ro(e),!c)return Va(e,s)}else{var f=Po(e),p=f==A||f==j;if(Xl(e))return ja(e,c);if(f==I||f==C||p&&!a){if(s=l||p?{}:zo(e),!c)return l?Wa(e,Zr(s,e)):Ua(e,Xr(s,e))}else{if(!Nt[f])return a?e:{};s=Bo(e,f,c)}}o||=new Ir;var m=o.get(e);if(m)return m;o.set(e,s),bu(e)?e.forEach(function(n){s.add(ti(n,t,r,n,e,o))}):lu(e)&&e.forEach(function(n,i){s.set(i,ti(n,t,r,i,e,o))});var h=d?n:(u?l?wo:Co:l?od:ad)(e);return tn(h||e,function(n,i){h&&(i=n,n=e[i]),qr(s,i,ti(n,t,r,i,e,o))}),s}function ni(e){var t=ad(e);return function(n){return ri(n,e,t)}}function ri(e,t,r){var i=r.length;if(e==null)return!i;for(e=Ue(e);i--;){var a=r[i],o=t[a],s=e[a];if(s===n&&!(a in e)||!o(s))return!1}return!0}function ii(e,t,i){if(typeof e!=`function`)throw new Ke(r);return cs(function(){e.apply(n,i)},t)}function ai(e,t,n,r){var i=-1,a=on,o=!0,s=e.length,c=[],l=t.length;if(!s)return c;n&&(t=cn(t,An(n))),r?(a=sn,o=!1):t.length>=200&&(a=Mn,o=!1,t=new Nr(t));outer:for(;++i<s;){var u=e[i],d=n==null?u:n(u);if(u=r||u!==0?u:0,o&&d===d){for(var f=l;f--;)if(t[f]===d)continue outer;c.push(u)}else a(t,d,r)||c.push(u)}return c}var oi=qa(hi),si=qa(gi,!0);function ci(e,t){var n=!0;return oi(e,function(e,r,i){return n=!!t(e,r,i),n}),n}function li(e,t,r){for(var i=-1,a=e.length;++i<a;){var o=e[i],s=t(o);if(s!=null&&(c===n?s===s&&!Su(s):r(s,c)))var c=s,l=o}return l}function ui(e,t,r,i){var a=e.length;for(r=ju(r),r<0&&(r=-r>a?0:a+r),i=i===n||i>a?a:ju(i),i<0&&(i+=a),i=r>i?0:Mu(i);r<i;)e[r++]=t;return e}function di(e,t){var n=[];return oi(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function fi(e,t,n,r,i){var a=-1,o=e.length;for(n||=Ho,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?fi(s,t-1,n,r,i):ln(i,s):r||(i[i.length]=s)}return i}var pi=Ja(),mi=Ja(!0);function hi(e,t){return e&&pi(e,t,ad)}function gi(e,t){return e&&mi(e,t,ad)}function _i(e,t){return an(t,function(t){return iu(e[t])})}function vi(e,t){t=Da(t,e);for(var r=0,i=t.length;e!=null&&r<i;)e=e[ms(t[r++])];return r&&r==i?e:n}function yi(e,t,n){var r=t(e);return Gl(e)?r:ln(r,n(e))}function bi(e){return e==null?e===n?U:F:ht&&ht in Ue(e)?jo(e):ns(e)}function xi(e,t){return e>t}function Si(e,t){return e!=null&&Qe.call(e,t)}function Ci(e,t){return e!=null&&t in Ue(e)}function wi(e,t,n){return e>=At(t,n)&&e<kt(t,n)}function Ti(e,t,r){for(var i=r?sn:on,a=e[0].length,o=e.length,s=o,c=Ce(o),l=1/0,u=[];s--;){var d=e[s];s&&t&&(d=cn(d,An(t))),l=At(d.length,l),c[s]=!r&&(t||a>=120&&d.length>=120)?new Nr(s&&d):n}d=e[0];var f=-1,p=c[0];outer:for(;++f<a&&u.length<l;){var m=d[f],h=t?t(m):m;if(m=r||m!==0?m:0,!(p?Mn(p,h):i(u,h,r))){for(s=o;--s;){var g=c[s];if(!(g?Mn(g,h):i(e[s],h,r)))continue outer}p&&p.push(h),u.push(m)}}return u}function Ei(e,t,n,r){return hi(e,function(e,i,a){t(r,n(e),i,a)}),r}function Di(e,t,r){t=Da(t,e),e=is(e,t);var i=e==null?e:e[ms(Hs(t))];return i==null?n:$t(i,e,r)}function Oi(e){return cu(e)&&bi(e)==C}function ki(e){return cu(e)&&bi(e)==G}function Ai(e){return cu(e)&&bi(e)==D}function ji(e,t,n,r,i){return e===t?!0:e==null||t==null||!cu(e)&&!cu(t)?e!==e&&t!==t:Mi(e,t,n,r,ji,i)}function Mi(e,t,n,r,i,a){var o=Gl(e),s=Gl(t),c=o?w:Po(e),l=s?w:Po(t);c=c==C?I:c,l=l==C?I:l;var u=c==I,d=l==I,f=c==l;if(f&&Xl(e)){if(!Xl(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new Ir,o||Cu(e)?yo(e,t,n,r,i,a):bo(e,t,c,n,r,i,a);if(!(n&1)){var p=u&&Qe.call(e,`__wrapped__`),m=d&&Qe.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new Ir,i(h,g,n,r,a)}}return f?(a||=new Ir,xo(e,t,n,r,i,a)):!1}function Ni(e){return cu(e)&&Po(e)==M}function Pi(e,t,r,i){var a=r.length,o=a,s=!i;if(e==null)return!o;for(e=Ue(e);a--;){var c=r[a];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++a<o;){c=r[a];var l=c[0],u=e[l],d=c[1];if(s&&c[2]){if(u===n&&!(l in e))return!1}else{var f=new Ir;if(i)var p=i(u,d,l,e,t,f);if(!(p===n?ji(d,u,3,i,f):p))return!1}}return!0}function Fi(e){return!su(e)||Jo(e)?!1:(iu(e)?it:Pe).test(hs(e))}function Ii(e){return cu(e)&&bi(e)==z}function Li(e){return cu(e)&&Po(e)==B}function Ri(e){return cu(e)&&ou(e.length)&&!!X[bi(e)]}function zi(e){return typeof e==`function`?e:e==null?mf:N.default(e)==`object`?Gl(e)?Gi(e[0],e[1]):Wi(e):Df(e)}function Bi(e){if(!Xo(e))return Ot(e);var t=[];for(var n in Ue(e))Qe.call(e,n)&&n!=`constructor`&&t.push(n);return t}function Vi(e){if(!su(e))return ts(e);var t=Xo(e),n=[];for(var r in e)r==`constructor`&&(t||!Qe.call(e,r))||n.push(r);return n}function Hi(e,t){return e<t}function Ui(e,t){var n=-1,r=ql(e)?Ce(e.length):[];return oi(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function Wi(e){var t=ko(e);return t.length==1&&t[0][2]?Qo(t[0][0],t[0][1]):function(n){return n===e||Pi(n,e,t)}}function Gi(e,t){return Go(e)&&Zo(t)?Qo(ms(e),t):function(r){var i=$u(r,e);return i===n&&i===t?td(r,e):ji(t,i,3)}}function Ki(e,t,r,i,a){e!==t&&pi(t,function(o,s){if(a||=new Ir,su(o))qi(e,t,s,r,Ki,i,a);else{var c=i?i(os(e,s),o,s+``,e,t,a):n;c===n&&(c=o),Kr(e,s,c)}},od)}function qi(e,t,r,i,a,o,s){var c=os(e,r),l=os(t,r),u=s.get(l);if(u){Kr(e,r,u);return}var d=o?o(c,l,r+``,e,t,s):n,f=d===n;if(f){var p=Gl(l),m=!p&&Xl(l),h=!p&&!m&&Cu(l);d=l,p||m||h?Gl(c)?d=c:Jl(c)?d=Va(c):m?(f=!1,d=ja(l,!0)):h?(f=!1,d=Ia(l,!0)):d=[]:_u(l)||Wl(l)?(d=c,Wl(c)?d=Pu(c):(!su(c)||iu(c))&&(d=zo(l))):f=!1}f&&(s.set(l,d),a(d,l,i,o,s),s.delete(l)),Kr(e,r,d)}function Ji(e,t){var r=e.length;if(r)return t+=t<0?r:0,Uo(t,r)?e[t]:n}function Yi(e,t,n){t=t.length?cn(t,function(e){return Gl(e)?function(t){return vi(t,e.length===1?e[0]:e)}:e}):[mf];var r=-1;return t=cn(t,An($())),Tn(Ui(e,function(e,n,i){return{criteria:cn(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return Ra(e,t,n)})}function Xi(e,t){return Zi(e,t,function(t,n){return td(e,n)})}function Zi(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=vi(e,o);n(s,o)&&sa(a,Da(o,e),s)}return a}function Qi(e){return function(t){return vi(t,e)}}function $i(e,t,n,r){var i=r?yn:vn,a=-1,o=t.length,s=e;for(e===t&&(t=Va(t)),n&&(s=cn(e,An(n)));++a<o;)for(var c=0,l=t[a],u=n?n(l):l;(c=i(s,u,c,r))>-1;)s!==e&&ft.call(s,c,1),ft.call(e,c,1);return e}function ea(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;Uo(i)?ft.call(e,i,1):ya(e,i)}}return e}function ta(e,t){return e+xt(It()*(t-e+1))}function na(e,t,n,r){for(var i=-1,a=kt(bt((t-e)/(n||1)),0),o=Ce(a);a--;)o[r?a:++i]=e,e+=n;return o}function ra(e,t){var n=``;if(!e||t<1||t>g)return n;do t%2&&(n+=e),t=xt(t/2),t&&(e+=e);while(t);return n}function ia(e,t){return ls(rs(e,t,mf),e+``)}function aa(e){return Ur(wd(e))}function oa(e,t){var n=wd(e);return fs(n,ei(t,0,n.length))}function sa(e,t,r,i){if(!su(e))return e;t=Da(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=ms(t[a]),u=r;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):n,u===n&&(u=su(d)?d:Uo(t[a+1])?[]:{})}qr(c,l,u),c=c[l]}return e}var ca=pn?function(e,t){return pn.set(e,t),e}:mf,la=gt?function(e,t){return gt(e,`toString`,{configurable:!0,enumerable:!1,value:uf(t),writable:!0})}:mf;function ua(e){return fs(wd(e))}function da(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Ce(i);++r<i;)a[r]=e[r+t];return a}function fa(e,t){var n;return oi(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}function pa(e,t,n){var r=0,i=e==null?r:e.length;if(typeof t==`number`&&t===t&&i<=x){for(;r<i;){var a=r+i>>>1,o=e[a];o!==null&&!Su(o)&&(n?o<=t:o<t)?r=a+1:i=a}return i}return ma(e,t,mf,n)}function ma(e,t,r,i){var a=0,o=e==null?0:e.length;if(o===0)return 0;t=r(t);for(var s=t!==t,c=t===null,l=Su(t),u=t===n;a<o;){var d=xt((a+o)/2),f=r(e[d]),p=f!==n,m=f===null,h=f===f,g=Su(f);if(s)var _=i||h;else _=u?h&&(i||p):c?h&&p&&(i||!m):l?h&&p&&!m&&(i||!g):m||g?!1:i?f<=t:f<t;_?a=d+1:o=d}return At(o,b)}function ha(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n],s=t?t(o):o;if(!n||!Vl(s,c)){var c=s;a[i++]=o===0?0:o}}return a}function ga(e){return typeof e==`number`?e:Su(e)?v:+e}function _a(e){if(typeof e==`string`)return e;if(Gl(e))return cn(e,_a)+``;if(Su(e))return sr?sr.call(e):``;var t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function va(e,t,n){var r=-1,i=on,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=sn;else if(a>=200){var l=t?null:po(e);if(l)return Kn(l);o=!1,i=Mn,c=new Nr}else c=t?[]:s;outer:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue outer;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}function ya(e,t){return t=Da(t,e),e=is(e,t),e==null||delete e[ms(Hs(t))]}function ba(e,t,n,r){return sa(e,t,n(vi(e,t)),r)}function xa(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?da(e,r?0:a,r?a+1:i):da(e,r?a+1:0,r?i:a)}function Sa(e,t){var n=e;return n instanceof dr&&(n=n.value()),un(t,function(e,t){return t.func.apply(t.thisArg,ln([e],t.args))},n)}function Ca(e,t,n){var r=e.length;if(r<2)return r?va(e[0]):[];for(var i=-1,a=Ce(r);++i<r;)for(var o=e[i],s=-1;++s<r;)s!=i&&(a[i]=ai(a[i]||o,e[s],t,n));return va(fi(a,1),t,n)}function wa(e,t,r){for(var i=-1,a=e.length,o=t.length,s={};++i<a;){var c=i<o?t[i]:n;r(s,e[i],c)}return s}function Ta(e){return Jl(e)?e:[]}function Ea(e){return typeof e==`function`?e:mf}function Da(e,t){return Gl(e)?e:Go(e,t)?[e]:ps(Iu(e))}var Oa=ia;function ka(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:da(e,t,r)}var Aa=_t||function(e){return Z.clearTimeout(e)};function ja(e,t){if(t)return e.slice();var n=e.length,r=ct?ct(n):new e.constructor(n);return e.copy(r),r}function Ma(e){var t=new e.constructor(e.byteLength);return new st(t).set(new st(e)),t}function Na(e,t){var n=t?Ma(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Pa(e){var t=new e.constructor(e.source,je.exec(e));return t.lastIndex=e.lastIndex,t}function Fa(e){return or?Ue(or.call(e)):{}}function Ia(e,t){var n=t?Ma(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function La(e,t){if(e!==t){var r=e!==n,i=e===null,a=e===e,o=Su(e),s=t!==n,c=t===null,l=t===t,u=Su(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e<t||u&&r&&a&&!i&&!o||c&&r&&a||!s&&a||!l)return-1}return 0}function Ra(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=La(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function za(e,t,n,r){for(var i=-1,a=e.length,o=n.length,s=-1,c=t.length,l=kt(a-o,0),u=Ce(c+l),d=!r;++s<c;)u[s]=t[s];for(;++i<o;)(d||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[s++]=e[i++];return u}function Ba(e,t,n,r){for(var i=-1,a=e.length,o=-1,s=n.length,c=-1,l=t.length,u=kt(a-s,0),d=Ce(u+l),f=!r;++i<u;)d[i]=e[i];for(var p=i;++c<l;)d[p+c]=t[c];for(;++o<s;)(f||i<a)&&(d[p+n[o]]=e[i++]);return d}function Va(e,t){var n=-1,r=e.length;for(t||=Ce(r);++n<r;)t[n]=e[n];return t}function Ha(e,t,r,i){var a=!r;r||={};for(var o=-1,s=t.length;++o<s;){var c=t[o],l=i?i(r[c],e[c],c,r,e):n;l===n&&(l=e[c]),a?Qr(r,c,l):qr(r,c,l)}return r}function Ua(e,t){return Ha(e,Mo(e),t)}function Wa(e,t){return Ha(e,No(e),t)}function Ga(e,t){return function(n,r){var i=Gl(n)?en:Yr,a=t?t():{};return i(n,e,$(r,2),a)}}function Ka(e){return ia(function(t,r){var i=-1,a=r.length,o=a>1?r[a-1]:n,s=a>2?r[2]:n;for(o=e.length>3&&typeof o==`function`?(a--,o):n,s&&Wo(r[0],r[1],s)&&(o=a<3?n:o,a=1),t=Ue(t);++i<a;){var c=r[i];c&&e(t,c,i,o)}return t})}function qa(e,t){return function(n,r){if(n==null)return n;if(!ql(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Ue(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}function Ja(e){return function(t,n,r){for(var i=-1,a=Ue(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}function Ya(e,t,n){var r=t&o,i=Qa(e);function a(){return(this&&this!==Z&&this instanceof a?i:e).apply(r?n:this,arguments)}return a}function Xa(e){return function(t){t=Iu(t);var r=Bn(t)?Zn(t):n,i=r?r[0]:t.charAt(0),a=r?ka(r,1).join(``):t.slice(1);return i[e]()+a}}function Za(e){return function(t){return un(af(jd(t).replace(Tt,``)),e,``)}}function Qa(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=cr(e.prototype),r=e.apply(n,t);return su(r)?r:n}}function $a(e,t,r){var i=Qa(e);function a(){for(var o=arguments.length,s=Ce(o),c=o,l=Do(a);c--;)s[c]=arguments[c];var u=o<3&&s[0]!==l&&s[o-1]!==l?[]:Gn(s,l);return o-=u.length,o<r?uo(e,t,no,a.placeholder,n,s,u,n,n,r-o):$t(this&&this!==Z&&this instanceof a?i:e,this,s)}return a}function eo(e){return function(t,r,i){var a=Ue(t);if(!ql(t)){var o=$(r,3);t=ad(t),r=function(e){return o(a[e],e,a)}}var s=e(t,r,i);return s>-1?a[o?t[s]:s]:n}}function to(e){return So(function(t){var i=t.length,a=i,o=ur.prototype.thru;for(e&&t.reverse();a--;){var s=t[a];if(typeof s!=`function`)throw new Ke(r);if(o&&!l&&Eo(s)==`wrapper`)var l=new ur([],!0)}for(a=l?a:i;++a<i;){s=t[a];var d=Eo(s),m=d==`wrapper`?To(s):n;l=m&&qo(m[0])&&m[1]==(f|c|u|p)&&!m[4].length&&m[9]==1?l[Eo(m[0])].apply(l,m[3]):s.length==1&&qo(s)?l[d]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&e.length==1&&Gl(n))return l.plant(n).value();for(var r=0,a=i?t[r].apply(this,e):n;++r<i;)a=t[r].call(this,a);return a}})}function no(e,t,r,i,a,u,d,p,h,g){var _=t&f,v=t&o,y=t&s,b=t&(c|l),x=t&m,S=y?n:Qa(e);function C(){for(var n=arguments.length,o=Ce(n),s=n;s--;)o[s]=arguments[s];if(b)var c=Do(C),l=Fn(o,c);if(i&&(o=za(o,i,a,b)),u&&(o=Ba(o,u,d,b)),n-=l,b&&n<g){var f=Gn(o,c);return uo(e,t,no,C.placeholder,r,o,f,p,h,g-n)}var m=v?r:this,w=y?m[e]:e;return n=o.length,p?o=as(o,p):x&&n>1&&o.reverse(),_&&h<n&&(o.length=h),this&&this!==Z&&this instanceof C&&(w=S||Qa(w)),w.apply(m,o)}return C}function ro(e,t){return function(n,r){return Ei(n,e,t(r),{})}}function io(e,t){return function(r,i){var a;if(r===n&&i===n)return t;if(r!==n&&(a=r),i!==n){if(a===n)return i;typeof r==`string`||typeof i==`string`?(r=_a(r),i=_a(i)):(r=ga(r),i=ga(i)),a=e(r,i)}return a}}function ao(e){return So(function(t){return t=cn(t,An($())),ia(function(n){var r=this;return e(t,function(e){return $t(e,r,n)})})})}function oo(e,t){t=t===n?` `:_a(t);var r=t.length;if(r<2)return r?ra(t,e):t;var i=ra(t,bt(e/Xn(t)));return Bn(t)?ka(Zn(i),0,e).join(``):i.slice(0,e)}function so(e,t,n,r){var i=t&o,a=Qa(e);function s(){for(var t=-1,o=arguments.length,c=-1,l=r.length,u=Ce(l+o),d=this&&this!==Z&&this instanceof s?a:e;++c<l;)u[c]=r[c];for(;o--;)u[c++]=arguments[++t];return $t(d,i?n:this,u)}return s}function co(e){return function(t,r,i){return i&&typeof i!=`number`&&Wo(t,r,i)&&(r=i=n),t=Au(t),r===n?(r=t,t=0):r=Au(r),i=i===n?t<r?1:-1:Au(i),na(t,r,i,e)}}function lo(e){return function(t,n){return(typeof t!=`string`||typeof n!=`string`)&&(t=Nu(t),n=Nu(n)),e(t,n)}}function uo(e,t,r,i,a,l,f,p,m,h){var g=t&c,_=g?f:n,v=g?n:f,y=g?l:n,b=g?n:l;t|=g?u:d,t&=~(g?d:u),t&4||(t&=~(o|s));var x=[e,t,a,y,_,b,v,p,m,h],S=r.apply(n,x);return qo(e)&&ss(S,x),S.placeholder=i,us(S,e,t)}function fo(e){var t=He[e];return function(e,n){if(e=Nu(e),n=n==null?0:At(ju(n),292),n&&wt(e)){var r=(Iu(e)+`e`).split(`e`);return r=(Iu(t(r[0]+`e`+(+r[1]+n)))+`e`).split(`e`),+(r[0]+`e`+(+r[1]-n))}return t(e)}}var po=Ut&&1/Kn(new Ut([,-0]))[1]==h?function(e){return new Ut(e)}:Sf;function mo(e){return function(t){var n=Po(t);return n==M?Un(t):n==B?qn(t):On(t,e(t))}}function ho(e,t,i,a,f,p,m,h){var g=t&s;if(!g&&typeof e!=`function`)throw new Ke(r);var _=a?a.length:0;if(_||(t&=~(u|d),a=f=n),m=m===n?m:kt(ju(m),0),h=h===n?h:ju(h),_-=f?f.length:0,t&d){var v=a,y=f;a=f=n}var b=g?n:To(e),x=[e,t,i,a,f,v,y,p,m,h];if(b&&es(x,b),e=x[0],t=x[1],i=x[2],a=x[3],f=x[4],h=x[9]=x[9]===n?g?0:e.length:kt(x[9]-_,0),!h&&t&(c|l)&&(t&=~(c|l)),!t||t==o)var S=Ya(e,t,i);else S=t==c||t==l?$a(e,t,h):(t==u||t==(o|u))&&!f.length?so(e,t,i,a):no.apply(n,x);return us((b?ca:ss)(S,x),e,t)}function go(e,t,r,i){return e===n||Vl(e,Ye[r])&&!Qe.call(i,r)?t:e}function _o(e,t,r,i,a,o){return su(e)&&su(t)&&(o.set(t,e),Ki(e,t,n,_o,o),o.delete(t)),e}function vo(e){return _u(e)?n:e}function yo(e,t,r,i,a,o){var s=r&1,c=e.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var f=-1,p=!0,m=r&2?new Nr:n;for(o.set(e,t),o.set(t,e);++f<c;){var h=e[f],g=t[f];if(i)var _=s?i(g,h,f,t,e,o):i(h,g,f,e,t,o);if(_!==n){if(_)continue;p=!1;break}if(m){if(!fn(t,function(e,t){if(!Mn(m,t)&&(h===e||a(h,e,r,i,o)))return m.push(t)})){p=!1;break}}else if(!(h===g||a(h,g,r,i,o))){p=!1;break}}return o.delete(e),o.delete(t),p}function bo(e,t,n,r,i,a,o){switch(n){case K:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case G:return!(e.byteLength!=t.byteLength||!a(new st(e),new st(t)));case E:case D:case P:return Vl(+e,+t);case k:return e.name==t.name&&e.message==t.message;case z:case V:return e==t+``;case M:var s=Un;case B:var c=r&1;if(s||=Kn,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var u=yo(s(e),s(t),r,i,a,o);return o.delete(e),u;case H:if(or)return or.call(e)==or.call(t)}return!1}function xo(e,t,r,i,a,o){var s=r&1,c=Co(e),l=c.length;if(l!=Co(t).length&&!s)return!1;for(var u=l;u--;){var d=c[u];if(!(s?d in t:Qe.call(t,d)))return!1}var f=o.get(e),p=o.get(t);if(f&&p)return f==t&&p==e;var m=!0;o.set(e,t),o.set(t,e);for(var h=s;++u<l;){d=c[u];var g=e[d],_=t[d];if(i)var v=s?i(_,g,d,t,e,o):i(g,_,d,e,t,o);if(!(v===n?g===_||a(g,_,r,i,o):v)){m=!1;break}h||=d==`constructor`}if(m&&!h){var y=e.constructor,b=t.constructor;y!=b&&`constructor`in e&&`constructor`in t&&!(typeof y==`function`&&y instanceof y&&typeof b==`function`&&b instanceof b)&&(m=!1)}return o.delete(e),o.delete(t),m}function So(e){return ls(rs(e,n,js),e+``)}function Co(e){return yi(e,ad,Mo)}function wo(e){return yi(e,od,No)}var To=pn?function(e){return pn.get(e)}:Sf;function Eo(e){for(var t=e.name+``,n=mn[t],r=Qe.call(mn,t)?n.length:0;r--;){var i=n[r],a=i.func;if(a==null||a==e)return i.name}return t}function Do(e){return(Qe.call(Q,`placeholder`)?Q:e).placeholder}function $(){var e=Q.iteratee||hf;return e=e===hf?zi:e,arguments.length?e(arguments[0],arguments[1]):e}function Oo(e,t){var n=e.__data__;return Ko(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function ko(e){for(var t=ad(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Zo(i)]}return t}function Ao(e,t){var r=zn(e,t);return Fi(r)?r:n}function jo(e){var t=Qe.call(e,ht),r=e[ht];try{e[ht]=n;var i=!0}catch{}var a=tt.call(e);return i&&(t?e[ht]=r:delete e[ht]),a}var Mo=St?function(e){return e==null?[]:(e=Ue(e),an(St(e),function(t){return dt.call(e,t)}))}:jf,No=St?function(e){for(var t=[];e;)ln(t,Mo(e)),e=lt(e);return t}:jf,Po=bi;(Bt&&Po(new Bt(new ArrayBuffer(1)))!=K||Vt&&Po(new Vt)!=M||Ht&&Po(Ht.resolve())!=L||Ut&&Po(new Ut)!=B||Gt&&Po(new Gt)!=W)&&(Po=function(e){var t=bi(e),r=t==I?e.constructor:n,i=r?hs(r):``;if(i)switch(i){case Cn:return K;case Jn:return M;case er:return L;case tr:return B;case ir:return W}return t});function Fo(e,t,n){for(var r=-1,i=n.length;++r<i;){var a=n[r],o=a.size;switch(a.type){case`drop`:e+=o;break;case`dropRight`:t-=o;break;case`take`:t=At(t,e+o);break;case`takeRight`:e=kt(e,t-o)}}return{start:e,end:t}}function Io(e){var t=e.match(Te);return t?t[1].split(Ee):[]}function Lo(e,t,n){t=Da(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=ms(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&ou(i)&&Uo(o,i)&&(Gl(e)||Wl(e)))}function Ro(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&Qe.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function zo(e){return typeof e.constructor==`function`&&!Xo(e)?cr(lt(e)):{}}function Bo(e,t,n){var r=e.constructor;switch(t){case G:return Ma(e);case E:case D:return new r(+e);case K:return Na(e,n);case te:case ne:case re:case ie:case ae:case oe:case q:case se:case ce:return Ia(e,n);case M:return new r;case P:case V:return new r(e);case z:return Pa(e);case B:return new r;case H:return Fa(e)}}function Vo(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?`& `:``)+t[r],t=t.join(n>2?`, `:` `),e.replace(we,`{ 17/* [wrapped with `+t+`] */ 18`)}function Ho(e){return Gl(e)||Wl(e)||!!(pt&&e&&e[pt])}function Uo(e,t){var n=N.default(e);return t??=g,!!t&&(n==`number`||n!=`symbol`&&Ie.test(e))&&e>-1&&e%1==0&&e<t}function Wo(e,t,n){if(!su(n))return!1;var r=N.default(t);return(r==`number`?ql(n)&&Uo(t,n.length):r==`string`&&t in n)?Vl(n[t],e):!1}function Go(e,t){if(Gl(e))return!1;var n=N.default(e);return n==`number`||n==`symbol`||n==`boolean`||e==null||Su(e)?!0:Y.test(e)||!ve.test(e)||t!=null&&e in Ue(t)}function Ko(e){var t=N.default(e);return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function qo(e){var t=Eo(e),n=Q[t];if(typeof n!=`function`||!(t in dr.prototype))return!1;if(e===n)return!0;var r=To(n);return!!r&&e===r[0]}function Jo(e){return!!et&&et in e}var Yo=Xe?iu:Mf;function Xo(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Ye)}function Zo(e){return e===e&&!su(e)}function Qo(e,t){return function(r){return r!=null&&r[e]===t&&(t!==n||e in Ue(r))}}function $o(e){var t=Cl(e,function(e){return n.size===500&&n.clear(),e}),n=t.cache;return t}function es(e,t){var n=e[1],r=t[1],i=n|r,l=i<(o|s|f),u=r==f&&n==c||r==f&&n==p&&e[7].length<=t[8]||r==(f|p)&&t[7].length<=t[8]&&n==c;if(!(l||u))return e;r&o&&(e[2]=t[2],i|=n&o?0:4);var d=t[3];if(d){var m=e[3];e[3]=m?za(m,d,t[4]):d,e[4]=m?Gn(e[3],a):t[4]}return d=t[5],d&&(m=e[5],e[5]=m?Ba(m,d,t[6]):d,e[6]=m?Gn(e[5],a):t[6]),d=t[7],d&&(e[7]=d),r&f&&(e[8]=e[8]==null?t[8]:At(e[8],t[8])),e[9]??=t[9],e[0]=t[0],e[1]=i,e}function ts(e){var t=[];if(e!=null)for(var n in Ue(e))t.push(n);return t}function ns(e){return tt.call(e)}function rs(e,t,r){return t=kt(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=kt(n.length-t,0),o=Ce(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=Ce(t+1);++i<t;)s[i]=n[i];return s[t]=r(o),$t(e,this,s)}}function is(e,t){return t.length<2?e:vi(e,da(t,0,-1))}function as(e,t){for(var r=e.length,i=At(t.length,r),a=Va(e);i--;){var o=t[i];e[i]=Uo(o,r)?a[o]:n}return e}function os(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}var ss=ds(ca),cs=yt||function(e,t){return Z.setTimeout(e,t)},ls=ds(la);function us(e,t,n){var r=t+``;return ls(e,Vo(r,gs(Io(r),n)))}function ds(e){var t=0,r=0;return function(){var i=Pt(),a=16-(i-r);if(r=i,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function fs(e,t){var r=-1,i=e.length,a=i-1;for(t=t===n?i:t;++r<t;){var o=ta(r,a),s=e[o];e[o]=e[r],e[r]=s}return e.length=t,e}var ps=$o(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(ye,function(e,n,r,i){t.push(r?i.replace(ke,`$1`):n||e)}),t});function ms(e){if(typeof e==`string`||Su(e))return e;var t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function hs(e){if(e!=null){try{return Ze.call(e)}catch{}try{return e+``}catch{}}return``}function gs(e,t){return tn(S,function(n){var r=`_.`+n[0];t&n[1]&&!on(e,r)&&e.push(r)}),e.sort()}function _s(e){if(e instanceof dr)return e.clone();var t=new ur(e.__wrapped__,e.__chain__);return t.__actions__=Va(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function vs(e,t,r){t=(r?Wo(e,t,r):t===n)?1:kt(ju(t),0);var i=e==null?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=Ce(bt(i/t));a<i;)s[o++]=da(e,a,a+=t);return s}function ys(e){for(var t=-1,n=e==null?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i}function bs(){var e=arguments.length;if(!e)return[];for(var t=Ce(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return ln(Gl(n)?Va(n):[n],fi(t,1))}var xs=ia(function(e,t){return Jl(e)?ai(e,fi(t,1,Jl,!0)):[]}),Ss=ia(function(e,t){var r=Hs(t);return Jl(r)&&(r=n),Jl(e)?ai(e,fi(t,1,Jl,!0),$(r,2)):[]}),Cs=ia(function(e,t){var r=Hs(t);return Jl(r)&&(r=n),Jl(e)?ai(e,fi(t,1,Jl,!0),n,r):[]});function ws(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===n?1:ju(t),da(e,t<0?0:t,i)):[]}function Ts(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===n?1:ju(t),t=i-t,da(e,0,t<0?0:t)):[]}function Es(e,t){return e&&e.length?xa(e,$(t,3),!0,!0):[]}function Ds(e,t){return e&&e.length?xa(e,$(t,3),!0):[]}function Os(e,t,n,r){var i=e==null?0:e.length;return i?(n&&typeof n!=`number`&&Wo(e,t,n)&&(n=0,r=i),ui(e,t,n,r)):[]}function ks(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:ju(n);return i<0&&(i=kt(r+i,0)),_n(e,$(t,3),i)}function As(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var a=i-1;return r!==n&&(a=ju(r),a=r<0?kt(i+a,0):At(a,i-1)),_n(e,$(t,3),a,!0)}function js(e){return e!=null&&e.length?fi(e,1):[]}function Ms(e){return e!=null&&e.length?fi(e,h):[]}function Ns(e,t){return e!=null&&e.length?(t=t===n?1:ju(t),fi(e,t)):[]}function Ps(e){for(var t=-1,n=e==null?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r}function Fs(e){return e&&e.length?e[0]:n}function Is(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:ju(n);return i<0&&(i=kt(r+i,0)),vn(e,t,i)}function Ls(e){return e!=null&&e.length?da(e,0,-1):[]}var Rs=ia(function(e){var t=cn(e,Ta);return t.length&&t[0]===e[0]?Ti(t):[]}),zs=ia(function(e){var t=Hs(e),r=cn(e,Ta);return t===Hs(r)?t=n:r.pop(),r.length&&r[0]===e[0]?Ti(r,$(t,2)):[]}),Bs=ia(function(e){var t=Hs(e),r=cn(e,Ta);return t=typeof t==`function`?t:n,t&&r.pop(),r.length&&r[0]===e[0]?Ti(r,n,t):[]});function Vs(e,t){return e==null?``:Dt.call(e,t)}function Hs(e){var t=e==null?0:e.length;return t?e[t-1]:n}function Us(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var a=i;return r!==n&&(a=ju(r),a=a<0?kt(i+a,0):At(a,i-1)),t===t?Yn(e,t,a):_n(e,bn,a,!0)}function Ws(e,t){return e&&e.length?Ji(e,ju(t)):n}var Gs=ia(Ks);function Ks(e,t){return e&&e.length&&t&&t.length?$i(e,t):e}function qs(e,t,n){return e&&e.length&&t&&t.length?$i(e,t,$(n,2)):e}function Js(e,t,r){return e&&e.length&&t&&t.length?$i(e,t,n,r):e}var Ys=So(function(e,t){var n=e==null?0:e.length,r=$r(e,t);return ea(e,cn(t,function(e){return Uo(e,n)?+e:e}).sort(La)),r});function Xs(e,t){var n=[];if(!(e&&e.length))return n;var r=-1,i=[],a=e.length;for(t=$(t,3);++r<a;){var o=e[r];t(o,r,e)&&(n.push(o),i.push(r))}return ea(e,i),n}function Zs(e){return e==null?e:Lt.call(e)}function Qs(e,t,r){var i=e==null?0:e.length;return i?(r&&typeof r!=`number`&&Wo(e,t,r)?(t=0,r=i):(t=t==null?0:ju(t),r=r===n?i:ju(r)),da(e,t,r)):[]}function $s(e,t){return pa(e,t)}function ec(e,t,n){return ma(e,t,$(n,2))}function tc(e,t){var n=e==null?0:e.length;if(n){var r=pa(e,t);if(r<n&&Vl(e[r],t))return r}return-1}function nc(e,t){return pa(e,t,!0)}function rc(e,t,n){return ma(e,t,$(n,2),!0)}function ic(e,t){if(e!=null&&e.length){var n=pa(e,t,!0)-1;if(Vl(e[n],t))return n}return-1}function ac(e){return e&&e.length?ha(e):[]}function oc(e,t){return e&&e.length?ha(e,$(t,2)):[]}function sc(e){var t=e==null?0:e.length;return t?da(e,1,t):[]}function cc(e,t,r){return e&&e.length?(t=r||t===n?1:ju(t),da(e,0,t<0?0:t)):[]}function lc(e,t,r){var i=e==null?0:e.length;return i?(t=r||t===n?1:ju(t),t=i-t,da(e,t<0?0:t,i)):[]}function uc(e,t){return e&&e.length?xa(e,$(t,3),!1,!0):[]}function dc(e,t){return e&&e.length?xa(e,$(t,3)):[]}var fc=ia(function(e){return va(fi(e,1,Jl,!0))}),pc=ia(function(e){var t=Hs(e);return Jl(t)&&(t=n),va(fi(e,1,Jl,!0),$(t,2))}),mc=ia(function(e){var t=Hs(e);return t=typeof t==`function`?t:n,va(fi(e,1,Jl,!0),n,t)});function hc(e){return e&&e.length?va(e):[]}function gc(e,t){return e&&e.length?va(e,$(t,2)):[]}function _c(e,t){return t=typeof t==`function`?t:n,e&&e.length?va(e,n,t):[]}function vc(e){if(!(e&&e.length))return[];var t=0;return e=an(e,function(e){if(Jl(e))return t=kt(e.length,t),!0}),Dn(t,function(t){return cn(e,Sn(t))})}function yc(e,t){if(!(e&&e.length))return[];var r=vc(e);return t==null?r:cn(r,function(e){return $t(t,n,e)})}var bc=ia(function(e,t){return Jl(e)?ai(e,t):[]}),xc=ia(function(e){return Ca(an(e,Jl))}),Sc=ia(function(e){var t=Hs(e);return Jl(t)&&(t=n),Ca(an(e,Jl),$(t,2))}),Cc=ia(function(e){var t=Hs(e);return t=typeof t==`function`?t:n,Ca(an(e,Jl),n,t)}),wc=ia(vc);function Tc(e,t){return wa(e||[],t||[],qr)}function Ec(e,t){return wa(e||[],t||[],sa)}var Dc=ia(function(e){var t=e.length,r=t>1?e[t-1]:n;return r=typeof r==`function`?(e.pop(),r):n,yc(e,r)});function Oc(e){var t=Q(e);return t.__chain__=!0,t}function kc(e,t){return t(e),e}function Ac(e,t){return t(e)}var jc=So(function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,a=function(t){return $r(t,e)};return t>1||this.__actions__.length||!(i instanceof dr)||!Uo(r)?this.thru(a):(i=i.slice(r,+r+ +!!t),i.__actions__.push({func:Ac,args:[a],thisArg:n}),new ur(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(n),e}))});function Mc(){return Oc(this)}function Nc(){return new ur(this.value(),this.__chain__)}function Pc(){this.__values__===n&&(this.__values__=ku(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}}function Fc(){return this}function Ic(e){for(var t,r=this;r instanceof lr;){var i=_s(r);i.__index__=0,i.__values__=n,t?a.__wrapped__=i:t=i;var a=i;r=r.__wrapped__}return a.__wrapped__=e,t}function Lc(){var e=this.__wrapped__;if(e instanceof dr){var t=e;return this.__actions__.length&&(t=new dr(this)),t=t.reverse(),t.__actions__.push({func:Ac,args:[Zs],thisArg:n}),new ur(t,this.__chain__)}return this.thru(Zs)}function Rc(){return Sa(this.__wrapped__,this.__actions__)}var zc=Ga(function(e,t,n){Qe.call(e,n)?++e[n]:Qr(e,n,1)});function Bc(e,t,r){var i=Gl(e)?rn:ci;return r&&Wo(e,t,r)&&(t=n),i(e,$(t,3))}function Vc(e,t){return(Gl(e)?an:di)(e,$(t,3))}var Hc=eo(ks),Uc=eo(As);function Wc(e,t){return fi($c(e,t),1)}function Gc(e,t){return fi($c(e,t),h)}function Kc(e,t,r){return r=r===n?1:ju(r),fi($c(e,t),r)}function qc(e,t){return(Gl(e)?tn:oi)(e,$(t,3))}function Jc(e,t){return(Gl(e)?nn:si)(e,$(t,3))}var Yc=Ga(function(e,t,n){Qe.call(e,n)?e[n].push(t):Qr(e,n,[t])});function Xc(e,t,n,r){e=ql(e)?e:wd(e),n=n&&!r?ju(n):0;var i=e.length;return n<0&&(n=kt(i+n,0)),xu(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&vn(e,t,n)>-1}var Zc=ia(function(e,t,n){var r=-1,i=typeof t==`function`,a=ql(e)?Ce(e.length):[];return oi(e,function(e){a[++r]=i?$t(t,e,n):Di(e,t,n)}),a}),Qc=Ga(function(e,t,n){Qr(e,n,t)});function $c(e,t){return(Gl(e)?cn:Ui)(e,$(t,3))}function el(e,t,r,i){return e==null?[]:(Gl(t)||(t=t==null?[]:[t]),r=i?n:r,Gl(r)||(r=r==null?[]:[r]),Yi(e,t,r))}var tl=Ga(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]});function nl(e,t,n){var r=Gl(e)?un:wn,i=arguments.length<3;return r(e,$(t,4),n,i,oi)}function rl(e,t,n){var r=Gl(e)?dn:wn,i=arguments.length<3;return r(e,$(t,4),n,i,si)}function il(e,t){return(Gl(e)?an:di)(e,wl($(t,3)))}function al(e){return(Gl(e)?Ur:aa)(e)}function ol(e,t,r){return t=(r?Wo(e,t,r):t===n)?1:ju(t),(Gl(e)?Wr:oa)(e,t)}function sl(e){return(Gl(e)?Gr:ua)(e)}function cl(e){if(e==null)return 0;if(ql(e))return xu(e)?Xn(e):e.length;var t=Po(e);return t==M||t==B?e.size:Bi(e).length}function ll(e,t,r){var i=Gl(e)?fn:fa;return r&&Wo(e,t,r)&&(t=n),i(e,$(t,3))}var ul=ia(function(e,t){if(e==null)return[];var n=t.length;return n>1&&Wo(e,t[0],t[1])?t=[]:n>2&&Wo(t[0],t[1],t[2])&&(t=[t[0]]),Yi(e,fi(t,1),[])}),dl=vt||function(){return Z.Date.now()};function fl(e,t){if(typeof t!=`function`)throw new Ke(r);return e=ju(e),function(){if(--e<1)return t.apply(this,arguments)}}function pl(e,t,r){return t=r?n:t,t=e&&t==null?e.length:t,ho(e,f,n,n,n,n,t)}function ml(e,t){var i;if(typeof t!=`function`)throw new Ke(r);return e=ju(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var hl=ia(function(e,t,n){var r=o;if(n.length){var i=Gn(n,Do(hl));r|=u}return ho(e,r,t,n,i)}),gl=ia(function(e,t,n){var r=o|s;if(n.length){var i=Gn(n,Do(gl));r|=u}return ho(t,r,e,n,i)});function _l(e,t,r){t=r?n:t;var i=ho(e,c,n,n,n,n,n,t);return i.placeholder=_l.placeholder,i}function vl(e,t,r){t=r?n:t;var i=ho(e,l,n,n,n,n,n,t);return i.placeholder=vl.placeholder,i}function yl(e,t,i){var a,o,s,c,l,u,d=0,f=!1,p=!1,m=!0;if(typeof e!=`function`)throw new Ke(r);t=Nu(t)||0,su(i)&&(f=!!i.leading,p=`maxWait`in i,s=p?kt(Nu(i.maxWait)||0,t):s,m=`trailing`in i?!!i.trailing:m);function h(t){var r=a,i=o;return a=o=n,d=t,c=e.apply(i,r),c}function g(e){return d=e,l=cs(y,t),f?h(e):c}function _(e){var n=e-u,r=e-d,i=t-n;return p?At(i,s-r):i}function v(e){var r=e-u,i=e-d;return u===n||r>=t||r<0||p&&i>=s}function y(){var e=dl();if(v(e))return b(e);l=cs(y,_(e))}function b(e){return l=n,m&&a?h(e):(a=o=n,c)}function x(){l!==n&&Aa(l),d=0,a=u=o=l=n}function S(){return l===n?c:b(dl())}function C(){var e=dl(),r=v(e);if(a=arguments,o=this,u=e,r){if(l===n)return g(u);if(p)return Aa(l),l=cs(y,t),h(u)}return l===n&&(l=cs(y,t)),c}return C.cancel=x,C.flush=S,C}var bl=ia(function(e,t){return ii(e,1,t)}),xl=ia(function(e,t,n){return ii(e,Nu(t)||0,n)});function Sl(e){return ho(e,m)}function Cl(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw new Ke(r);var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Cl.Cache||Dr),n}Cl.Cache=Dr;function wl(e){if(typeof e!=`function`)throw new Ke(r);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Tl(e){return ml(2,e)}var El=Oa(function(e,t){t=t.length==1&&Gl(t[0])?cn(t[0],An($())):cn(fi(t,1),An($()));var n=t.length;return ia(function(r){for(var i=-1,a=At(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return $t(e,this,r)})}),Dl=ia(function(e,t){return ho(e,u,n,t,Gn(t,Do(Dl)))}),Ol=ia(function(e,t){return ho(e,d,n,t,Gn(t,Do(Ol)))}),kl=So(function(e,t){return ho(e,p,n,n,n,t)});function Al(e,t){if(typeof e!=`function`)throw new Ke(r);return t=t===n?t:ju(t),ia(e,t)}function jl(e,t){if(typeof e!=`function`)throw new Ke(r);return t=t==null?0:kt(ju(t),0),ia(function(n){var r=n[t],i=ka(n,0,t);return r&&ln(i,r),$t(e,this,i)})}function Ml(e,t,n){var i=!0,a=!0;if(typeof e!=`function`)throw new Ke(r);return su(n)&&(i=`leading`in n?!!n.leading:i,a=`trailing`in n?!!n.trailing:a),yl(e,t,{leading:i,maxWait:t,trailing:a})}function Nl(e){return pl(e,1)}function Pl(e,t){return Dl(Ea(t),e)}function Fl(){if(!arguments.length)return[];var e=arguments[0];return Gl(e)?e:[e]}function Il(e){return ti(e,4)}function Ll(e,t){return t=typeof t==`function`?t:n,ti(e,4,t)}function Rl(e){return ti(e,5)}function zl(e,t){return t=typeof t==`function`?t:n,ti(e,5,t)}function Bl(e,t){return t==null||ri(e,t,ad(t))}function Vl(e,t){return e===t||e!==e&&t!==t}var Hl=lo(xi),Ul=lo(function(e,t){return e>=t}),Wl=Oi(function(){return arguments}())?Oi:function(e){return cu(e)&&Qe.call(e,`callee`)&&!dt.call(e,`callee`)},Gl=Ce.isArray,Kl=qt?An(qt):ki;function ql(e){return e!=null&&ou(e.length)&&!iu(e)}function Jl(e){return cu(e)&&ql(e)}function Yl(e){return e===!0||e===!1||cu(e)&&bi(e)==E}var Xl=Ct||Mf,Zl=Jt?An(Jt):Ai;function Ql(e){return cu(e)&&e.nodeType===1&&!_u(e)}function $l(e){if(e==null)return!0;if(ql(e)&&(Gl(e)||typeof e==`string`||typeof e.splice==`function`||Xl(e)||Cu(e)||Wl(e)))return!e.length;var t=Po(e);if(t==M||t==B)return!e.size;if(Xo(e))return!Bi(e).length;for(var n in e)if(Qe.call(e,n))return!1;return!0}function eu(e,t){return ji(e,t)}function tu(e,t,r){r=typeof r==`function`?r:n;var i=r?r(e,t):n;return i===n?ji(e,t,n,r):!!i}function nu(e){if(!cu(e))return!1;var t=bi(e);return t==k||t==O||typeof e.message==`string`&&typeof e.name==`string`&&!_u(e)}function ru(e){return typeof e==`number`&&wt(e)}function iu(e){if(!su(e))return!1;var t=bi(e);return t==A||t==j||t==T||t==R}function au(e){return typeof e==`number`&&e==ju(e)}function ou(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=g}function su(e){var t=N.default(e);return e!=null&&(t==`object`||t==`function`)}function cu(e){return e!=null&&N.default(e)==`object`}var lu=Yt?An(Yt):Ni;function uu(e,t){return e===t||Pi(e,t,ko(t))}function du(e,t,r){return r=typeof r==`function`?r:n,Pi(e,t,ko(t),r)}function fu(e){return gu(e)&&e!=+e}function pu(e){if(Yo(e))throw new Be(`Unsupported core-js use. Try https://npms.io/search?q=ponyfill.`);return Fi(e)}function mu(e){return e===null}function hu(e){return e==null}function gu(e){return typeof e==`number`||cu(e)&&bi(e)==P}function _u(e){if(!cu(e)||bi(e)!=I)return!1;var t=lt(e);if(t===null)return!0;var n=Qe.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Ze.call(n)==nt}var vu=Xt?An(Xt):Ii;function yu(e){return au(e)&&e>=-g&&e<=g}var bu=Zt?An(Zt):Li;function xu(e){return typeof e==`string`||!Gl(e)&&cu(e)&&bi(e)==V}function Su(e){return N.default(e)==`symbol`||cu(e)&&bi(e)==H}var Cu=Qt?An(Qt):Ri;function wu(e){return e===n}function Tu(e){return cu(e)&&Po(e)==W}function Eu(e){return cu(e)&&bi(e)==ee}var Du=lo(Hi),Ou=lo(function(e,t){return e<=t});function ku(e){if(!e)return[];if(ql(e))return xu(e)?Zn(e):Va(e);if(mt&&e[mt])return Hn(e[mt]());var t=Po(e);return(t==M?Un:t==B?Kn:wd)(e)}function Au(e){return e?(e=Nu(e),e===h||e===-1/0?(e<0?-1:1)*_:e===e?e:0):e===0?e:0}function ju(e){var t=Au(e),n=t%1;return t===t?n?t-n:t:0}function Mu(e){return e?ei(ju(e),0,y):0}function Nu(e){if(typeof e==`number`)return e;if(Su(e))return v;if(su(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=su(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=kn(e);var n=Ne.test(e);return n||Fe.test(e)?zt(e.slice(2),n?2:8):Me.test(e)?v:+e}function Pu(e){return Ha(e,od(e))}function Fu(e){return e?ei(ju(e),-g,g):e===0?e:0}function Iu(e){return e==null?``:_a(e)}var Lu=Ka(function(e,t){if(Xo(t)||ql(t)){Ha(t,ad(t),e);return}for(var n in t)Qe.call(t,n)&&qr(e,n,t[n])}),Ru=Ka(function(e,t){Ha(t,od(t),e)}),zu=Ka(function(e,t,n,r){Ha(t,od(t),e,r)}),Bu=Ka(function(e,t,n,r){Ha(t,ad(t),e,r)}),Vu=So($r);function Hu(e,t){var n=cr(e);return t==null?n:Xr(n,t)}var Uu=ia(function(e,t){e=Ue(e);var r=-1,i=t.length,a=i>2?t[2]:n;for(a&&Wo(t[0],t[1],a)&&(i=1);++r<i;)for(var o=t[r],s=od(o),c=-1,l=s.length;++c<l;){var u=s[c],d=e[u];(d===n||Vl(d,Ye[u])&&!Qe.call(e,u))&&(e[u]=o[u])}return e}),Wu=ia(function(e){return e.push(n,_o),$t(ud,n,e)});function Gu(e,t){return gn(e,$(t,3),hi)}function Ku(e,t){return gn(e,$(t,3),gi)}function qu(e,t){return e==null?e:pi(e,$(t,3),od)}function Ju(e,t){return e==null?e:mi(e,$(t,3),od)}function Yu(e,t){return e&&hi(e,$(t,3))}function Xu(e,t){return e&&gi(e,$(t,3))}function Zu(e){return e==null?[]:_i(e,ad(e))}function Qu(e){return e==null?[]:_i(e,od(e))}function $u(e,t,r){var i=e==null?n:vi(e,t);return i===n?r:i}function ed(e,t){return e!=null&&Lo(e,t,Si)}function td(e,t){return e!=null&&Lo(e,t,Ci)}var nd=ro(function(e,t,n){t!=null&&typeof t.toString!=`function`&&(t=tt.call(t)),e[t]=n},uf(mf)),rd=ro(function(e,t,n){t!=null&&typeof t.toString!=`function`&&(t=tt.call(t)),Qe.call(e,t)?e[t].push(n):e[t]=[n]},$),id=ia(Di);function ad(e){return ql(e)?Hr(e):Bi(e)}function od(e){return ql(e)?Hr(e,!0):Vi(e)}function sd(e,t){var n={};return t=$(t,3),hi(e,function(e,r,i){Qr(n,t(e,r,i),e)}),n}function cd(e,t){var n={};return t=$(t,3),hi(e,function(e,r,i){Qr(n,r,t(e,r,i))}),n}var ld=Ka(function(e,t,n){Ki(e,t,n)}),ud=Ka(function(e,t,n,r){Ki(e,t,n,r)}),dd=So(function(e,t){var n={};if(e==null)return n;var r=!1;t=cn(t,function(t){return t=Da(t,e),r||=t.length>1,t}),Ha(e,wo(e),n),r&&(n=ti(n,7,vo));for(var i=t.length;i--;)ya(n,t[i]);return n});function fd(e,t){return md(e,wl($(t)))}var pd=So(function(e,t){return e==null?{}:Xi(e,t)});function md(e,t){if(e==null)return{};var n=cn(wo(e),function(e){return[e]});return t=$(t),Zi(e,n,function(e,n){return t(e,n[0])})}function hd(e,t,r){t=Da(t,e);var i=-1,a=t.length;for(a||(a=1,e=n);++i<a;){var o=e==null?n:e[ms(t[i])];o===n&&(i=a,o=r),e=iu(o)?o.call(e):o}return e}function gd(e,t,n){return e==null?e:sa(e,t,n)}function _d(e,t,r,i){return i=typeof i==`function`?i:n,e==null?e:sa(e,t,r,i)}var vd=mo(ad),yd=mo(od);function bd(e,t,n){var r=Gl(e),i=r||Xl(e)||Cu(e);if(t=$(t,4),n==null){var a=e&&e.constructor;n=i?r?new a:[]:su(e)&&iu(a)?cr(lt(e)):{}}return(i?tn:hi)(e,function(e,r,i){return t(n,e,r,i)}),n}function xd(e,t){return e==null||ya(e,t)}function Sd(e,t,n){return e==null?e:ba(e,t,Ea(n))}function Cd(e,t,r,i){return i=typeof i==`function`?i:n,e==null?e:ba(e,t,Ea(r),i)}function wd(e){return e==null?[]:jn(e,ad(e))}function Td(e){return e==null?[]:jn(e,od(e))}function Ed(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=Nu(r),r=r===r?r:0),t!==n&&(t=Nu(t),t=t===t?t:0),ei(Nu(e),t,r)}function Dd(e,t,r){return t=Au(t),r===n?(r=t,t=0):r=Au(r),e=Nu(e),wi(e,t,r)}function Od(e,t,r){if(r&&typeof r!=`boolean`&&Wo(e,t,r)&&(t=r=n),r===n&&(typeof t==`boolean`?(r=t,t=n):typeof e==`boolean`&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=Au(e),t===n?(t=e,e=0):t=Au(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var a=It();return At(e+a*(t-e+Rt(`1e-`+((a+``).length-1))),t)}return ta(e,t)}var kd=Za(function(e,t,n){return t=t.toLowerCase(),e+(n?Ad(t):t)});function Ad(e){return rf(Iu(e).toLowerCase())}function jd(e){return e=Iu(e),e&&e.replace(Le,In).replace(Et,``)}function Md(e,t,r){e=Iu(e),t=_a(t);var i=e.length;r=r===n?i:ei(ju(r),0,i);var a=r;return r-=t.length,r>=0&&e.slice(r,a)==t}function Nd(e){return e=Iu(e),e&&J.test(e)?e.replace(pe,Ln):e}function Pd(e){return e=Iu(e),e&&xe.test(e)?e.replace(be,`\\$&`):e}var Fd=Za(function(e,t,n){return e+(n?`-`:``)+t.toLowerCase()}),Id=Za(function(e,t,n){return e+(n?` `:``)+t.toLowerCase()}),Ld=Xa(`toLowerCase`);function Rd(e,t,n){e=Iu(e),t=ju(t);var r=t?Xn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return oo(xt(i),n)+e+oo(bt(i),n)}function zd(e,t,n){e=Iu(e),t=ju(t);var r=t?Xn(e):0;return t&&r<t?e+oo(t-r,n):e}function Bd(e,t,n){e=Iu(e),t=ju(t);var r=t?Xn(e):0;return t&&r<t?oo(t-r,n)+e:e}function Vd(e,t,n){return n||t==null?t=0:t&&=+t,Ft(Iu(e).replace(Se,``),t||0)}function Hd(e,t,r){return t=(r?Wo(e,t,r):t===n)?1:ju(t),ra(Iu(e),t)}function Ud(){var e=arguments,t=Iu(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var Wd=Za(function(e,t,n){return e+(n?`_`:``)+t.toLowerCase()});function Gd(e,t,r){return r&&typeof r!=`number`&&Wo(e,t,r)&&(t=r=n),r=r===n?y:r>>>0,r?(e=Iu(e),e&&(typeof t==`string`||t!=null&&!vu(t))&&(t=_a(t),!t&&Bn(e))?ka(Zn(e),0,r):e.split(t,r)):[]}var Kd=Za(function(e,t,n){return e+(n?` `:``)+rf(t)});function qd(e,t,n){return e=Iu(e),n=n==null?0:ei(ju(n),0,e.length),t=_a(t),e.slice(n,n+t.length)==t}function Jd(e,t,r){var i=Q.templateSettings;r&&Wo(e,t,r)&&(t=n),e=Iu(e),t=zu({},t,i,go);var a=zu({},t.imports,i.imports,go),o=ad(a),s=jn(a,o),c,l,u=0,d=t.interpolate||Re,f=`__p += '`,p=We((t.escape||Re).source+`|`+d.source+`|`+(d===_e?Ae:Re).source+`|`+(t.evaluate||Re).source+`|$`,`g`),m=`//# sourceURL=`+(Qe.call(t,`sourceURL`)?(t.sourceURL+``).replace(/\s/g,` `):`lodash.templateSources[`+ ++Mt+`]`)+` 19`;e.replace(p,function(t,n,r,i,a,o){return r||=i,f+=e.slice(u,o).replace(ze,Rn),n&&(c=!0,f+=`' + 20__e(`+n+`) + 21'`),a&&(l=!0,f+=`'; 22`+a+`; 23__p += '`),r&&(f+=`' + 24((__t = (`+r+`)) == null ? '' : __t) + 25'`),u=o+t.length,t}),f+=`'; 26`;var h=Qe.call(t,`variable`)&&t.variable;if(!h)f=`with (obj) { 27`+f+` 28} 29`;else if(Oe.test(h))throw new Be("Invalid `variable` option passed into `_.template`");f=(l?f.replace(le,``):f).replace(ue,`$1`).replace(de,`$1;`),f=`function(`+(h||`obj`)+`) { 30`+(h?``:`obj || (obj = {}); 31`)+`var __t, __p = ''`+(c?`, __e = _.escape`:``)+(l?`, __j = Array.prototype.join; 32function print() { __p += __j.call(arguments, '') } 33`:`; 34`)+f+`return __p 35}`;var g=of(function(){return Ve(o,m+`return `+f).apply(n,s)});if(g.source=f,nu(g))throw g;return g}function Yd(e){return Iu(e).toLowerCase()}function Xd(e){return Iu(e).toUpperCase()}function Zd(e,t,r){if(e=Iu(e),e&&(r||t===n))return kn(e);if(!e||!(t=_a(t)))return e;var i=Zn(e),a=Zn(t);return ka(i,Nn(i,a),Pn(i,a)+1).join(``)}function Qd(e,t,r){if(e=Iu(e),e&&(r||t===n))return e.slice(0,Qn(e)+1);if(!e||!(t=_a(t)))return e;var i=Zn(e);return ka(i,0,Pn(i,Zn(t))+1).join(``)}function $d(e,t,r){if(e=Iu(e),e&&(r||t===n))return e.replace(Se,``);if(!e||!(t=_a(t)))return e;var i=Zn(e);return ka(i,Nn(i,Zn(t))).join(``)}function ef(e,t){var r=30,i=`...`;if(su(t)){var a=`separator`in t?t.separator:a;r=`length`in t?ju(t.length):r,i=`omission`in t?_a(t.omission):i}e=Iu(e);var o=e.length;if(Bn(e)){var s=Zn(e);o=s.length}if(r>=o)return e;var c=r-Xn(i);if(c<1)return i;var l=s?ka(s,0,c).join(``):e.slice(0,c);if(a===n)return l+i;if(s&&(c+=l.length-c),vu(a)){if(e.slice(c).search(a)){var u,d=l;for(a.global||(a=We(a.source,Iu(je.exec(a))+`g`)),a.lastIndex=0;u=a.exec(d);)var f=u.index;l=l.slice(0,f===n?c:f)}}else if(e.indexOf(_a(a),c)!=c){var p=l.lastIndexOf(a);p>-1&&(l=l.slice(0,p))}return l+i}function tf(e){return e=Iu(e),e&&me.test(e)?e.replace(fe,$n):e}var nf=Za(function(e,t,n){return e+(n?` `:``)+t.toUpperCase()}),rf=Xa(`toUpperCase`);function af(e,t,r){return e=Iu(e),t=r?n:t,t===n?Vn(e)?nr(e):hn(e):e.match(t)||[]}var of=ia(function(e,t){try{return $t(e,n,t)}catch(e){return nu(e)?e:new Be(e)}}),sf=So(function(e,t){return tn(t,function(t){t=ms(t),Qr(e,t,hl(e[t],e))}),e});function cf(e){var t=e==null?0:e.length,n=$();return e=t?cn(e,function(e){if(typeof e[1]!=`function`)throw new Ke(r);return[n(e[0]),e[1]]}):[],ia(function(n){for(var r=-1;++r<t;){var i=e[r];if($t(i[0],this,n))return $t(i[1],this,n)}})}function lf(e){return ni(ti(e,1))}function uf(e){return function(){return e}}function df(e,t){return e==null||e!==e?t:e}var ff=to(),pf=to(!0);function mf(e){return e}function hf(e){return zi(typeof e==`function`?e:ti(e,1))}function gf(e){return Wi(ti(e,1))}function _f(e,t){return Gi(e,ti(t,1))}var vf=ia(function(e,t){return function(n){return Di(n,e,t)}}),yf=ia(function(e,t){return function(n){return Di(e,n,t)}});function bf(e,t,n){var r=ad(t),i=_i(t,r);n==null&&!(su(t)&&(i.length||!r.length))&&(n=t,t=e,e=this,i=_i(t,ad(t)));var a=!(su(n)&&`chain`in n)||!!n.chain,o=iu(e);return tn(i,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=Va(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,ln([this.value()],arguments))})}),e}function xf(){return Z._===this&&(Z._=rt),this}function Sf(){}function Cf(e){return e=ju(e),ia(function(t){return Ji(t,e)})}var wf=ao(cn),Tf=ao(rn),Ef=ao(fn);function Df(e){return Go(e)?Sn(ms(e)):Qi(e)}function Of(e){return function(t){return e==null?n:vi(e,t)}}var kf=co(),Af=co(!0);function jf(){return[]}function Mf(){return!1}function Nf(){return{}}function Pf(){return``}function Ff(){return!0}function If(e,t){if(e=ju(e),e<1||e>g)return[];var n=y,r=At(e,y);t=$(t),e-=y;for(var i=Dn(r,t);++n<e;)t(n);return i}function Lf(e){return Gl(e)?cn(e,ms):Su(e)?[e]:Va(ps(Iu(e)))}function Rf(e){var t=++$e;return Iu(e)+t}var zf=io(function(e,t){return e+t},0),Bf=fo(`ceil`),Vf=io(function(e,t){return e/t},1),Hf=fo(`floor`);function Uf(e){return e&&e.length?li(e,mf,xi):n}function Wf(e,t){return e&&e.length?li(e,$(t,2),xi):n}function Gf(e){return xn(e,mf)}function Kf(e,t){return xn(e,$(t,2))}function qf(e){return e&&e.length?li(e,mf,Hi):n}function Jf(e,t){return e&&e.length?li(e,$(t,2),Hi):n}var Yf=io(function(e,t){return e*t},1),Xf=fo(`round`),Zf=io(function(e,t){return e-t},0);function Qf(e){return e&&e.length?En(e,mf):0}function $f(e,t){return e&&e.length?En(e,$(t,2)):0}return Q.after=fl,Q.ary=pl,Q.assign=Lu,Q.assignIn=Ru,Q.assignInWith=zu,Q.assignWith=Bu,Q.at=Vu,Q.before=ml,Q.bind=hl,Q.bindAll=sf,Q.bindKey=gl,Q.castArray=Fl,Q.chain=Oc,Q.chunk=vs,Q.compact=ys,Q.concat=bs,Q.cond=cf,Q.conforms=lf,Q.constant=uf,Q.countBy=zc,Q.create=Hu,Q.curry=_l,Q.curryRight=vl,Q.debounce=yl,Q.defaults=Uu,Q.defaultsDeep=Wu,Q.defer=bl,Q.delay=xl,Q.difference=xs,Q.differenceBy=Ss,Q.differenceWith=Cs,Q.drop=ws,Q.dropRight=Ts,Q.dropRightWhile=Es,Q.dropWhile=Ds,Q.fill=Os,Q.filter=Vc,Q.flatMap=Wc,Q.flatMapDeep=Gc,Q.flatMapDepth=Kc,Q.flatten=js,Q.flattenDeep=Ms,Q.flattenDepth=Ns,Q.flip=Sl,Q.flow=ff,Q.flowRight=pf,Q.fromPairs=Ps,Q.functions=Zu,Q.functionsIn=Qu,Q.groupBy=Yc,Q.initial=Ls,Q.intersection=Rs,Q.intersectionBy=zs,Q.intersectionWith=Bs,Q.invert=nd,Q.invertBy=rd,Q.invokeMap=Zc,Q.iteratee=hf,Q.keyBy=Qc,Q.keys=ad,Q.keysIn=od,Q.map=$c,Q.mapKeys=sd,Q.mapValues=cd,Q.matches=gf,Q.matchesProperty=_f,Q.memoize=Cl,Q.merge=ld,Q.mergeWith=ud,Q.method=vf,Q.methodOf=yf,Q.mixin=bf,Q.negate=wl,Q.nthArg=Cf,Q.omit=dd,Q.omitBy=fd,Q.once=Tl,Q.orderBy=el,Q.over=wf,Q.overArgs=El,Q.overEvery=Tf,Q.overSome=Ef,Q.partial=Dl,Q.partialRight=Ol,Q.partition=tl,Q.pick=pd,Q.pickBy=md,Q.property=Df,Q.propertyOf=Of,Q.pull=Gs,Q.pullAll=Ks,Q.pullAllBy=qs,Q.pullAllWith=Js,Q.pullAt=Ys,Q.range=kf,Q.rangeRight=Af,Q.rearg=kl,Q.reject=il,Q.remove=Xs,Q.rest=Al,Q.reverse=Zs,Q.sampleSize=ol,Q.set=gd,Q.setWith=_d,Q.shuffle=sl,Q.slice=Qs,Q.sortBy=ul,Q.sortedUniq=ac,Q.sortedUniqBy=oc,Q.split=Gd,Q.spread=jl,Q.tail=sc,Q.take=cc,Q.takeRight=lc,Q.takeRightWhile=uc,Q.takeWhile=dc,Q.tap=kc,Q.throttle=Ml,Q.thru=Ac,Q.toArray=ku,Q.toPairs=vd,Q.toPairsIn=yd,Q.toPath=Lf,Q.toPlainObject=Pu,Q.transform=bd,Q.unary=Nl,Q.union=fc,Q.unionBy=pc,Q.unionWith=mc,Q.uniq=hc,Q.uniqBy=gc,Q.uniqWith=_c,Q.unset=xd,Q.unzip=vc,Q.unzipWith=yc,Q.update=Sd,Q.updateWith=Cd,Q.values=wd,Q.valuesIn=Td,Q.without=bc,Q.words=af,Q.wrap=Pl,Q.xor=xc,Q.xorBy=Sc,Q.xorWith=Cc,Q.zip=wc,Q.zipObject=Tc,Q.zipObjectDeep=Ec,Q.zipWith=Dc,Q.entries=vd,Q.entriesIn=yd,Q.extend=Ru,Q.extendWith=zu,bf(Q,Q),Q.add=zf,Q.attempt=of,Q.camelCase=kd,Q.capitalize=Ad,Q.ceil=Bf,Q.clamp=Ed,Q.clone=Il,Q.cloneDeep=Rl,Q.cloneDeepWith=zl,Q.cloneWith=Ll,Q.conformsTo=Bl,Q.deburr=jd,Q.defaultTo=df,Q.divide=Vf,Q.endsWith=Md,Q.eq=Vl,Q.escape=Nd,Q.escapeRegExp=Pd,Q.every=Bc,Q.find=Hc,Q.findIndex=ks,Q.findKey=Gu,Q.findLast=Uc,Q.findLastIndex=As,Q.findLastKey=Ku,Q.floor=Hf,Q.forEach=qc,Q.forEachRight=Jc,Q.forIn=qu,Q.forInRight=Ju,Q.forOwn=Yu,Q.forOwnRight=Xu,Q.get=$u,Q.gt=Hl,Q.gte=Ul,Q.has=ed,Q.hasIn=td,Q.head=Fs,Q.identity=mf,Q.includes=Xc,Q.indexOf=Is,Q.inRange=Dd,Q.invoke=id,Q.isArguments=Wl,Q.isArray=Gl,Q.isArrayBuffer=Kl,Q.isArrayLike=ql,Q.isArrayLikeObject=Jl,Q.isBoolean=Yl,Q.isBuffer=Xl,Q.isDate=Zl,Q.isElement=Ql,Q.isEmpty=$l,Q.isEqual=eu,Q.isEqualWith=tu,Q.isError=nu,Q.isFinite=ru,Q.isFunction=iu,Q.isInteger=au,Q.isLength=ou,Q.isMap=lu,Q.isMatch=uu,Q.isMatchWith=du,Q.isNaN=fu,Q.isNative=pu,Q.isNil=hu,Q.isNull=mu,Q.isNumber=gu,Q.isObject=su,Q.isObjectLike=cu,Q.isPlainObject=_u,Q.isRegExp=vu,Q.isSafeInteger=yu,Q.isSet=bu,Q.isString=xu,Q.isSymbol=Su,Q.isTypedArray=Cu,Q.isUndefined=wu,Q.isWeakMap=Tu,Q.isWeakSet=Eu,Q.join=Vs,Q.kebabCase=Fd,Q.last=Hs,Q.lastIndexOf=Us,Q.lowerCase=Id,Q.lowerFirst=Ld,Q.lt=Du,Q.lte=Ou,Q.max=Uf,Q.maxBy=Wf,Q.mean=Gf,Q.meanBy=Kf,Q.min=qf,Q.minBy=Jf,Q.stubArray=jf,Q.stubFalse=Mf,Q.stubObject=Nf,Q.stubString=Pf,Q.stubTrue=Ff,Q.multiply=Yf,Q.nth=Ws,Q.noConflict=xf,Q.noop=Sf,Q.now=dl,Q.pad=Rd,Q.padEnd=zd,Q.padStart=Bd,Q.parseInt=Vd,Q.random=Od,Q.reduce=nl,Q.reduceRight=rl,Q.repeat=Hd,Q.replace=Ud,Q.result=hd,Q.round=Xf,Q.runInContext=e,Q.sample=al,Q.size=cl,Q.snakeCase=Wd,Q.some=ll,Q.sortedIndex=$s,Q.sortedIndexBy=ec,Q.sortedIndexOf=tc,Q.sortedLastIndex=nc,Q.sortedLastIndexBy=rc,Q.sortedLastIndexOf=ic,Q.startCase=Kd,Q.startsWith=qd,Q.subtract=Zf,Q.sum=Qf,Q.sumBy=$f,Q.template=Jd,Q.times=If,Q.toFinite=Au,Q.toInteger=ju,Q.toLength=Mu,Q.toLower=Yd,Q.toNumber=Nu,Q.toSafeInteger=Fu,Q.toString=Iu,Q.toUpper=Xd,Q.trim=Zd,Q.trimEnd=Qd,Q.trimStart=$d,Q.truncate=ef,Q.unescape=tf,Q.uniqueId=Rf,Q.upperCase=nf,Q.upperFirst=rf,Q.each=qc,Q.eachRight=Jc,Q.first=Fs,bf(Q,function(){var e={};return hi(Q,function(t,n){Qe.call(Q.prototype,n)||(e[n]=t)}),e}(),{chain:!1}
35),Q.VERSION=`4.17.21`,tn([`bind`,`bindKey`,`curry`,`curryRight`,`partial`,`partialRight`],function(e){Q[e].placeholder=Q}),tn([`drop`,`take`],function(e,t){dr.prototype[e]=function(r){r=r===n?1:kt(ju(r),0);var i=this.__filtered__&&!t?new dr(this):this.clone();return i.__filtered__?i.__takeCount__=At(r,i.__takeCount__):i.__views__.push({size:At(r,y),type:e+(i.__dir__<0?`Right`:``)}),i},dr.prototype[e+`Right`]=function(t){return this.reverse()[e](t).reverse()}}),tn([`filter`,`map`,`takeWhile`],function(e,t){var n=t+1,r=n==1||n==3;dr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),tn([`head`,`last`],function(e,t){var n=`take`+(t?`Right`:``);dr.prototype[e]=function(){return this[n](1).value()[0]}}),tn([`initial`,`tail`],function(e,t){var n=`drop`+(t?``:`Right`);dr.prototype[e]=function(){return this.__filtered__?new dr(this):this[n](1)}}),dr.prototype.compact=function(){return this.filter(mf)},dr.prototype.find=function(e){return this.filter(e).head()},dr.prototype.findLast=function(e){return this.reverse().find(e)},dr.prototype.invokeMap=ia(function(e,t){return typeof e==`function`?new dr(this):this.map(function(n){return Di(n,e,t)})}),dr.prototype.reject=function(e){return this.filter(wl($(e)))},dr.prototype.slice=function(e,t){e=ju(e);var r=this;return r.__filtered__&&(e>0||t<0)?new dr(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(t=ju(t),r=t<0?r.dropRight(-t):r.take(t-e)),r)},dr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},dr.prototype.toArray=function(){return this.take(y)},hi(dr.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=Q[i?`take`+(t==`last`?`Right`:``):t],o=i||/^find/.test(t);a&&(Q.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof dr,l=s[0],u=c||Gl(t),d=function(e){var t=a.apply(Q,ln([e],s));return i&&f?t[0]:t};u&&r&&typeof l==`function`&&l.length!=1&&(c=u=!1);var f=this.__chain__,p=!!this.__actions__.length,m=o&&!f,h=c&&!p;if(!o&&u){t=h?t:new dr(this);var g=e.apply(t,s);return g.__actions__.push({func:Ac,args:[d],thisArg:n}),new ur(g,f)}return m&&h?e.apply(this,s):(g=this.thru(d),m?i?g.value()[0]:g.value():g)})}),tn([`pop`,`push`,`shift`,`sort`,`splice`,`unshift`],function(e){var t=qe[e],n=/^(?:push|sort|unshift)$/.test(e)?`tap`:`thru`,r=/^(?:pop|shift)$/.test(e);Q.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Gl(i)?i:[],e)}return this[n](function(n){return t.apply(Gl(n)?n:[],e)})}}),hi(dr.prototype,function(e,t){var n=Q[t];if(n){var r=n.name+``;Qe.call(mn,r)||(mn[r]=[]),mn[r].push({name:t,func:n})}}),mn[no(n,s).name]=[{name:`wrapper`,func:n}],dr.prototype.clone=fr,dr.prototype.reverse=pr,dr.prototype.value=mr,Q.prototype.at=jc,Q.prototype.chain=Mc,Q.prototype.commit=Nc,Q.prototype.next=Pc,Q.prototype.plant=Ic,Q.prototype.reverse=Lc,Q.prototype.toJSON=Q.prototype.valueOf=Q.prototype.value=Rc,Q.prototype.first=Q.prototype.head,mt&&(Q.prototype[mt]=Fc),Q}();Ut?((Ut.exports=rr)._=rr,Ht._=rr):Z._=rr}).call(pt)})(mt,mt.exports);function yt(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=xt(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 36In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function xt(e,t){if(e){if(typeof e==`string`)return St(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return St(e,t)}}function St(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ct(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 wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];
36t%2?Ct(Object(n),!0).forEach(function(t){j.default(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ct(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Et(e){var t=Dt();return function(){var n=A.default(e),r;if(t){var i=A.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return k.default(this,r)}}function Dt(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Ot=function(e){O.default(n,e);var t=Et(n);function n(e,r,i){var a;return T.default(this,n),a=t.call(this,e,i),a.updateMergingQueue=new Fe(function(e,t){return typeof t.ttl==`number`?{ttl:t.ttl}:e}),a.cache=new ct,a.descriptor=r,a.descriptor.date_updated=new Date(a.descriptor.date_updated),a}return E.default(n,[{key:`uri`,get:function(){return this.descriptor.url}},{key:`revision`,get:function(){return this.descriptor.revision}},{key:`lastEventId`,get:function(){return this.descriptor.last_event_id}},{key:`links`,get:function(){return this.descriptor.links}}
36,{key:`dateExpires`,get:function(){return this.descriptor.date_expires}},{key:`type`,get:function(){return`list`}},{key:`indexName`,get:function(){}},{key:`queryString`,get:function(){}},{key:`sid`,get:function(){return this.descriptor.sid}},{key:`uniqueName`,get:function(){return this.descriptor.unique_name||null}},{key:`dateUpdated`,get:function(){return this.descriptor.date_updated}},{key:`_addOrUpdateItemOnServer`,value:function(){var e=w.default(M.default.mark(function e(t,n,r,i){var a,o;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a={data:n},i!==void 0&&(a.ttl=i),e.next=4,this.services.network.post(t,a,r);case 4:return o=e.sent,o.body.data=n,o.body.date_updated=new Date(o.body.date_updated),e.abrupt(`return`,o.body);case 8:case`end`:return e.stop()}},e,this)}));function t(t,n,r,i){return e.apply(this,arguments)}return t}()},{key:`push`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r,i,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=(n||{}).ttl,e.next=3,this._addOrUpdateItemOnServer(this.links.items,t,void 0,r);case 3:return i=e.sent,a=Number(i.index),this._handleItemMutated(a,i.url,i.last_event_id,i.revision,t,i.date_updated,i.date_expires,!0,!1),e.abrupt(`return`,this.cache.getValue(a));case 7:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`set`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){var i=this,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=r||{},e.abrupt(`return`,this.updateMergingQueue.squashAndAdd(t,a,function(e){return i._updateItemUnconditionally(t,n,e.ttl)}));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`_updateItemUnconditionally`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){var i,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.get(t);case 2:return i=e.sent,e.next=5,this._addOrUpdateItemOnServer(i.url,n,void 0,r);case 5:return a=e.sent,this._handleItemMutated(t,a.url,a.last_event_id,a.revision,a.data,a.date_updated,a.date_expires,!1,!1),e.abrupt(`return`,this.cache.getValue(t));case 8:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`_updateItemWithIfMatch`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){var i,a,o,s;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.get(t);case 2:if(i=e.sent,a=n(te(i.data)),!a){e.next=25;break}return o=i.revision,e.prev=6,e.next=9,this._addOrUpdateItemOnServer(i.url,a,o,r);case 9:return s=e.sent,this._handleItemMutated(t,s.url,s.last_event_id,s.revision,s.data,s.date_updated,s.date_expires,!1,!1),e.abrupt(`return`,this.cache.getValue(t));case 14:if(e.prev=14,e.t0=e.catch(6),e.t0.status!==412){e.next=22;break}return e.next=19,this._getItemFromServer(t);case 19:return e.abrupt(`return`,this._updateItemWithIfMatch(t,n,r));case 22:throw e.t0;case 23:e.next=26;break;case 25:return e.abrupt(`return`,i);case 26:case`end`:return e.stop()}},e,this,[[6,14]])}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`mutate`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){var i=this,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=r||{},e.abrupt(`return`,this.updateMergingQueue.add(t,a,function(e){return i._updateItemWithIfMatch(t,n,e.ttl)}));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`update`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.mutate(t,function(e){return Object.assign(e,n)},r));case 1:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`remove`,value:function(){var e=w.default(M.default.mark(function e(t){var n,r,i;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.get(t);case 2:return n=e.sent,r=te(n.data),e.next=6,this.services.network.delete(n.url);case 6:i=e.sent,this._handleItemRemoved(t,i.body.last_event_id,r,new Date(i.body.date_updated),!1);case 8:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`get`,value:function(){var e=w.default(M.default.mark(function e(t){var n;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.cache.get(t),!n){e.next=3;break}return e.abrupt(`return`,n.value);case 3:return e.abrupt(`return`,this._getItemFromServer(t));case 4:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_getItemFromServer`,value:function(){var e=w.default(M.default.mark(function e(t){var n;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._queryItemsFromServer({index:t});
36case 2:if(n=e.sent,!(n.items.length<1)){e.next=7;break}throw new G(`No item with index ${t} found`,404,54151);case 7:return e.abrupt(`return`,n.items[0]);case 8:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`queryItems`,value:function(){var e=w.default(M.default.mark(function e(t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.index){e.next=5;break}if(n=this.cache.get(t.index),!n){e.next=4;break}return e.abrupt(`return`,this.makePaginator(n.isValid?[n.value]:[],t,!1,!1));case 4:return e.abrupt(`return`,this._querySingleItemFromServer(t.index));case 5:r=!!t.nextPageItemId||!!t.prevPageItemId,i=wt({},t),r&&(t.from=t.nextPageItemId??t.prevPageItemId??t.from),a=!!t.prevPageItemId,o=t.order===`desc`?a?this.cache.getIterator(t.prevPageItemId??t.from??null):this.cache.getReverseIterator(t.nextPageItemId??t.from??null):a?this.cache.getReverseIterator(t.prevPageItemId??t.from??null):this.cache.getIterator(t.nextPageItemId??t.from??null),s=[],c=r?t.limit+1:t.limit,l=yt(o),e.prev=13,l.s();case 15:if((u=l.n()).done){e.next=25;break}if(d=u.value,!(r&&d.value.index==t.from)){e.next=19;break}return e.abrupt(`continue`,23);case 19:if(s.push(d.value),!(s.length>=t.limit)){e.next=23;break}return a&&mt.exports.reverse(s),e.abrupt(`return`,this.makePaginator(s,t,this._prevPageAllowed(s,t.order),this._nextPageAllowed(s,t.order)));case 23:e.next=15;break;case 25:e.next=30;break;case 27:e.prev=27,e.t0=e.catch(13),l.e(e.t0);case 30:return e.prev=30,l.f(),e.finish(30);case 33:if(s.length>0&&(t.from=mt.exports.last(s).index),f=Math.max(c-s.length,10),a&&(t.order=t.order===`desc`?`asc`:`desc`),p=t.from!==(i.order===`desc`?a?this.cache.collectionEnd:this.cache.collectionBegin:a?this.cache.collectionBegin:this.cache.collectionEnd),!p){e.next=66;break}return e.next=40,this._queryItemsFromServer(wt(wt({},t),{},{limit:f}));case 40:m=e.sent,h=m.items,i.order===`desc`?(g=!m.hasNextPage,_=!m.hasPrevPage):(g=!m.hasPrevPage,_=!m.hasNextPage),this.cache.populate(h,g,_),v=yt(h),e.prev=45,v.s();case 47:if((y=v.n()).done){e.next=56;break}if(b=y.value,!((s.length>0||r)&&b.index==t.from)){e.next=51;break}return e.abrupt(`continue`,54);case 51:if(a?s.unshift(b):s.push(b),!(s.length>=t.limit)){e.next=54;break}return e.abrupt(`break`,56);case 54:e.next=47;break;case 56:e.next=61;break;case 58:e.prev=58,e.t1=e.catch(45),v.e(e.t1);case 61:return e.prev=61,v.f(),e.finish(61);case 64:e.next=67;break;case 66:a&&mt.exports.reverse(s);case 67:return e.abrupt(`return`,this.makePaginator(s,i,this._prevPageAllowed(s,i.order),this._nextPageAllowed(s,i.order)));case 68:case`end`:return e.stop()}},e,this,[[13,27,30,33],[45,58,61,64]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_prevPageAllowed`,value:function(e,t){return e.length>0&&mt.exports.head(e).index!==(t===`desc`?this.cache.collectionEnd:this.cache.collectionBegin)}},{key:`_nextPageAllowed`,value:function(e,t){return e.length>0&&mt.exports.last(e).index!==(t===`desc`?this.cache.collectionBegin:this.cache.collectionEnd)}},{key:`makePaginator`,value:function(e,t,n,r){var i=this;t.nextPageItemId=t.prevPageItemId=null;var a=n&&this._prevPageAllowed(e,t.order),o=r&&this._nextPageAllowed(e,t.order);return new We(e,function(e){return i.queryItems(wt(wt({},t),e))},a?mt.exports.head(e).index:null,o?mt.exports.last(e).index:null)}},{key:`_querySingleItemFromServer`,value:function(){var e=w.default(M.default.mark(function e(t){var n;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._queryItemsFromServer({index:t});case 2:return n=e.sent,n.items.length===0&&this.cache.exists(t)&&this.cache.delete(t,null),e.abrupt(`return`,n);case 5:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_queryItemsFromServer`,value:function(){var e=w.default(M.default.mark(function e(t){var n=this,r,i,a,o;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=new U(this.links.items).queryParam(`HideExpired`,!0).queryParam(`Index`,t.index).queryParam(`PageToken`,t.pageToken).queryParam(`From`,t.from).queryParam(`PageSize`,t.limit).queryParam(`Order`,t.order).build(),e.next=3,this.services.network.get(r);case 3:return i=e.sent,a=(i.body?.items??[]).map(function(e){e.date_updated=new Date(e.date_updated);var t=n.cache.get(e.index);if(t&&t.value)n._handleItemMutated(e.index,e.url,e.last_event_id,e.revision,e.data,e.date_updated,e.date_expires,!1,!0);
36else{var r=new Ue({index:e.index,url:e.url,lastEventId:e.last_event_id,revision:e.revision,data:e.data,dateUpdated:e.date_updated,dateExpires:e.date_expires});n.cache.store(e.index,r,e.last_event_id)}return n.cache.getValue(e.index)}),o=i.body.meta,e.abrupt(`return`,this.makePaginator(a,t,!!o.previous_token,!!o.next_token));case 7:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getItems`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t||={},ne(t.pageSize),t.limit=t.pageSize||t.limit||50,t.order=t.order||`asc`,e.abrupt(`return`,this.queryItems(t));case 5:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getContext`,value:function(){var e=w.default(M.default.mark(function e(){var t;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.context){e.next=5;break}return e.next=3,this.services.network.get(this.links.context);case 3:t=e.sent,this._updateContextIfRequired(t.body.data,t.body.last_event_id);case 5:return e.abrupt(`return`,this.context);case 6:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`setTtl`,value:function(){var e=w.default(M.default.mark(function e(t){var n,r;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n={ttl:t},e.next=4,this.services.network.post(this.uri,n);case 4:r=e.sent,this.descriptor.date_expires=r.body.date_expires,e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),e.t0.status===404&&this.onRemoved(!1),e.t0;case 12:case`end`:return e.stop()}},e,this,[[0,8]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`setItemTtl`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r,i,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.get(t);case 2:return r=e.sent,i={ttl:n},e.next=6,this.services.network.post(r.url,i);case 6:a=e.sent,r.updateDateExpires(a.body.date_expires);case 8:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`removeList`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.network.delete(this.uri);case 2:this.onRemoved(!0);case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`onRemoved`,value:function(e){this._unsubscribe(),this.removalHandler(this.type,this.sid,this.uniqueName),this.broadcastEventToListeners(`removed`,{isLocal:e})}},{key:`shouldIgnoreEvent`,value:function(e,t){return this.cache.isKnown(e,t)}},{key:`_update`,value:function(e,t){var n=Number(e.item_index);switch(e.date_created=new Date(e.date_created),e.type){case`list_item_added`:case`list_item_updated`:this._handleItemMutated(n,e.item_url,e.id,e.item_revision,e.item_data,e.date_created,e.date_expires,e.type===`list_item_added`,!0);break;case`list_item_removed`:this._handleItemRemoved(n,e.id,e.item_data,e.date_created,!0);break;case`list_context_updated`:this._handleContextUpdate(e.context_data,e.id,e.date_created);break;case`list_removed`:this.onRemoved(!1)}t&&this._advanceLastEventId(e.id,e.list_revision)}},{key:`_advanceLastEventId`,value:function(e,t){this.lastEventId<e&&(this.descriptor.last_event_id=e,t&&(this.descriptor.revision=t))}},{key:`_updateRootDateUpdated`,value:function(e){(!this.descriptor.date_updated||e.getTime()>this.descriptor.date_updated.getTime())&&(this.descriptor.date_updated=e,this.services.storage.update(this.type,this.sid,this.uniqueName,{date_updated:e}))}},{key:`_handleItemMutated`,value:function(e,t,n,r,i,a,o,s,c){if(this.shouldIgnoreEvent(e,n)){q.trace(`Item ${e} update skipped, current: ${this.lastEventId}, remote: ${n}`);return}this._updateRootDateUpdated(a);var l=this.cache.getValue(e);if(!l){var u=new Ue({index:e,url:t,lastEventId:n,revision:r,data:i,dateUpdated:a,dateExpires:o});this.cache.store(e,u,n),this.emitItemMutationEvent(u,c,s);return}var d=te(l.data);l.update(n,r,i,a),this.cache.store(e,l,n),o!==void 0&&l.updateDateExpires(o),this.emitItemMutationEvent(l,c,!1,d)}},{key:`emitItemMutationEvent`,value:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=n?`itemAdded`:`itemUpdated`,a={item:e,isLocal:!t};n||(a.previousItemData=r),this.broadcastEventToListeners(i,a)}},{key:`_handleItemRemoved`,value:function(e,t,n,r,i){this._updateRootDateUpdated(r),this.cache.delete(e,t),this.broadcastEventToListeners(`itemRemoved`,{index:e,isLocal:!i,previousItemData:n})}},{key:`_handleContextUpdate`,value:function(e,t,n){this._updateRootDateUpdated(n),this._updateContextIfRequired(e,t)&&this.broadcastEventToListeners(`contextUpdated`,{context:e,isLocal:!1})}},{key:`_updateContextIfRequired`,value:function(e,t){return!this.contextEventId||t>this.contextEventId?(this.context=e,this.contextEventId=t,!0):(q.trace(`Context update skipped, current:`,this.lastEventId,`, remote:`,t),
36!1)}}],[{key:`type`,get:function(){return`list`}}]),n}(je),kt=function(e){O.default(n,e);var t=Et(n);function n(e){var r;return T.default(this,n),r=t.call(this),r.syncListImpl=e,r.syncListImpl.attach(D.default(r)),r}return E.default(n,[{key:`uri`,get:function(){return this.syncListImpl.uri}},{key:`revision`,get:function(){return this.syncListImpl.revision}},{key:`lastEventId`,get:function(){return this.syncListImpl.lastEventId}},{key:`links`,get:function(){return this.syncListImpl.links}},{key:`dateExpires`,get:function(){return this.syncListImpl.dateExpires}},{key:`type`,get:function(){return Ot.type}},{key:`sid`,get:function(){return this.syncListImpl.sid}},{key:`uniqueName`,get:function(){return this.syncListImpl.uniqueName}},{key:`dateUpdated`,get:function(){return this.syncListImpl.dateUpdated}},{key:`push`,value:function(){var e=w.default(M.default.mark(function e(t,n){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.push(t,n));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`set`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.set(t,n,r));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`mutate`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.mutate(t,n,r));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`update`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.update(t,n,r));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`remove`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.remove(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`get`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.get(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getContext`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.getContext());case 2:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getItems`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.getItems(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`setTtl`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.setTtl(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`setItemTtl`,value:function(){var e=w.default(M.default.mark(function e(t,n){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.setItemTtl(t,n));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`removeList`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncListImpl.removeList());case 2:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`close`,value:function(){R.default(A.default(n.prototype),`close`,this).call(this),this.syncListImpl.detach(this.listenerUuid)}}],[{key:`type`,get:function(){return Ot.type}}]),n}(Re);j.default(kt,`itemAdded`,`itemAdded`),j.default(kt,`itemUpdated`,`itemUpdated`),j.default(kt,`itemRemoved`,`itemRemoved`),j.default(kt,`removed`,`removed`),V([d.validateTypesAsync(d.pureObject,[`undefined`,d.objectSchema(`
36item metadata`,{ttl:[d.nonNegativeInteger,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Object,Object]),H(`design:returntype`,Promise)],kt.prototype,`push`,null),V([d.validateTypesAsync(d.nonNegativeInteger,d.pureObject,[`undefined`,d.objectSchema(`item metadata`,{ttl:[d.nonNegativeInteger,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Number,Object,Object]),H(`design:returntype`,Promise)],kt.prototype,`set`,null),V([d.validateTypesAsync(d.nonNegativeInteger,`function`,[`undefined`,d.objectSchema(`item metadata`,{ttl:[d.nonNegativeInteger,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Number,Function,Object]),H(`design:returntype`,Promise)],kt.prototype,`mutate`,null),V([d.validateTypesAsync(d.nonNegativeInteger,d.pureObject,[`undefined`,d.objectSchema(`item metadata`,{ttl:[d.nonNegativeInteger,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Number,Object,Object]),H(`design:returntype`,Promise)],kt.prototype,`update`,null),V([d.validateTypesAsync(d.nonNegativeInteger),H(`design:type`,Function),H(`design:paramtypes`,[Number]),H(`design:returntype`,Promise)],kt.prototype,`remove`,null),V([d.validateTypesAsync(d.nonNegativeInteger),H(`design:type`,Function),H(`design:paramtypes`,[Number]),H(`design:returntype`,Promise)],kt.prototype,`get`,null),V([d.validateTypesAsync([`undefined`,d.objectSchema(`query options`,{from:[d.nonNegativeInteger,`undefined`],pageSize:[d.custom(function(e){return[ie(e),`a positive integer`]}),`undefined`],order:[d.custom(function(e){return[e===`asc`||e===`desc`,`either 'asc' or 'desc'`]}),`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Object]),H(`design:returntype`,Promise)],kt.prototype,`getItems`,null),V([d.validateTypesAsync(d.nonNegativeInteger),H(`design:type`,Function),H(`design:paramtypes`,[Number]),H(`design:returntype`,Promise)],kt.prototype,`setTtl`,null),V([d.validateTypesAsync(d.nonNegativeInteger,d.nonNegativeInteger),H(`design:type`,Function),H(`design:paramtypes`,[Number,Number]),H(`design:returntype`,Promise)],kt.prototype,`setItemTtl`,null);var At=function(){function e(t){T.default(this,e),this.descriptor=t}return E.default(e,[{key:`uri`,get:function(){return this.descriptor.url}},{key:`revision`,get:function(){return this.descriptor.revision}},{key:`lastEventId`,get:function(){return this.descriptor.last_event_id}}
36,{key:`dateExpires`,get:function(){return this.descriptor.date_expires}},{key:`key`,get:function(){return this.descriptor.key}},{key:`data`,get:function(){return this.descriptor.data}},{key:`dateUpdated`,get:function(){return this.descriptor.date_updated}},{key:`cacheKey`,get:function(){return this.key}},{key:`update`,value:function(e,t,n,r){return this.descriptor.last_event_id=e,this.descriptor.revision=t,this.descriptor.data=n,this.descriptor.date_updated=r,this}},{key:`updateDateExpires`,value:function(e){this.descriptor.date_expires=e}}]),e}();function jt(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Mt(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 37In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function Mt(e,t){if(e){if(typeof e==`string`)return X(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return X(e,t)}}function X(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Nt(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 Pt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Nt(Object(n),!0).forEach(function(t){j.default(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ft(e){var t=It();return function(){var n=A.default(e),r;if(t){var i=A.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return k.default(this,r)}}function It(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Lt=function(e){O.default(n,e);var t=Ft(n);function n(e,r,i){var a;return T.default(this,n),a=t.call(this,e,i),a.updateMergingQueue=new Fe(function(e,t){return typeof t.ttl==`number`?{ttl:t.ttl}:e}),a.cache=new ct,a.descriptor=r,a.descriptor.date_updated=new Date(a.descriptor.date_updated),r.items&&r.items.forEach(function(e){e.date_updated=new Date(e.date_updated),a.cache.store(e.key,new At(e),e.last_event_id)}),a}return E.default(n,[{key:`uri`,get:function(){return this.descriptor.url}},{key:`links`,get:function(){return this.descriptor.links}},{key:`revision`,get:function(){return this.descriptor.revision}},{key:`lastEventId`,get:function(){return this.descriptor.last_event_id}}
37,{key:`dateExpires`,get:function(){return this.descriptor.date_expires}},{key:`type`,get:function(){return`map`}},{key:`indexName`,get:function(){}},{key:`queryString`,get:function(){}},{key:`sid`,get:function(){return this.descriptor.sid}},{key:`uniqueName`,get:function(){return this.descriptor.unique_name||null}},{key:`dateUpdated`,get:function(){return this.descriptor.date_updated}},{key:`set`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){var i=this,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=r||{},e.abrupt(`return`,this.updateMergingQueue.squashAndAdd(t,a,function(e){return i._putItemUnconditionally(t,n,e.ttl)}));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`get`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t!=null){e.next=2;break}throw new G(`SyncMapItem key may not be empty`,400,54209);case 2:if(!this.cache.has(t)){e.next=6;break}return e.abrupt(`return`,this.cache.getValue(t));case 6:return e.abrupt(`return`,this._getItemFromServer(t));case 7:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_getItemFromServer`,value:function(){var e=w.default(M.default.mark(function e(t){var n;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._queryItemsFromServer({key:t});case 2:if(n=e.sent,!(n.items.length<1)){e.next=7;break}throw new G(`The specified Map Item does not exist`,404,54201);case 7:return e.abrupt(`return`,n.items[0]);case 8:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`mutate`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){var i=this,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=r||{},e.abrupt(`return`,this.updateMergingQueue.add(t,a,function(e){return i._putItemWithIfMatch(t,n,e.ttl)}));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`update`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.mutate(t,function(e){return Object.assign(e,n)},r));case 1:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`_putItemUnconditionally`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){var i,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._putItemToServer(t,n,void 0,r);case 2:return i=e.sent,a=i.item,this._handleItemMutated(a.key,a.url,a.last_event_id,a.revision,a.data,a.date_updated,a.date_expires,i.added,!1),e.abrupt(`return`,this.cache.getValue(a.key));case 6:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`_putItemWithIfMatch`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){var i,a,o,s,c;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.get(t).catch(function(e){if(e.status===404)return new At({key:t,data:{},last_event_id:-1,revision:`-1`,url:null,date_updated:null,date_expires:null});throw e});case 2:if(i=e.sent,a=n(te(i.data)),!a){e.next=26;break}return o=i.revision,e.prev=6,e.next=9,this._putItemToServer(t,a,o,r);case 9:return s=e.sent,c=s.item,this._handleItemMutated(c.key,c.url,c.last_event_id,c.revision,c.data,c.date_updated,c.date_expires,s.added,!1),e.abrupt(`return`,this.cache.getValue(c.key));case 15:if(e.prev=15,e.t0=e.catch(6),e.t0.status!==412){e.next=23;break}return e.next=20,this._getItemFromServer(t);case 20:return e.abrupt(`return`,this._putItemWithIfMatch(t,n,r));case 23:throw e.t0;case 24:e.next=27;break;case 26:return e.abrupt(`return`,i);case 27:case`end`:return e.stop()}},e,this,[[6,15]])}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`_putItemToServer`,value:function(){var e=w.default(M.default.mark(function e(t,n,r,i){var a,o,s,c,l;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=new U(this.links.items).pathSegment(t).build(),o={data:n},i!==void 0&&(o.ttl=i),e.prev=3,e.next=6,this.services.network.put(a,o,r);case 6:return s=e.sent,c=s.body,c.data=n,c.date_updated=new Date(c.date_updated),l=s.status.code===201,e.abrupt(`return`,{added:l,item:c});case 14:throw e.prev=14,e.t0=e.catch(3),e.t0.status===404&&this.onRemoved(!1),e.t0;case 18:case`end`:return e.stop()}},e,this,[[3,14]])}));function t(t,n,r,i){return e.apply(this,arguments)}return t}()},{key:`remove`,value:function(){var e=w.default(M.default.mark(function e(t){var n,r,i;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.get(t);case 2:return n=e.sent,r=te(n.data),e.next=6,this.services.network.delete(n.uri);case 6:i=e.sent,this._handleItemRemoved(t,i.body.last_event_id,r,new Date(i.body.date_updated),!1);case 8:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`queryItems`,value:function(){var e=w.default(M.default.mark(function e(t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.key){e.next=5;break}if(n=this.cache.get(t.key),!n){e.next=4;break}return e.abrupt(`return`,this.makePaginator(n.isValid?[n.value]:[],t,!1,!1));case 4:return e.abrupt(`return`,this._querySingleItemFromServer(t.key));case 5:r=!!t.nextPageItemId||!!t.prevPageItemId,i=Pt({},t),r&&(t.from=t.nextPageItemId??t.prevPageItemId??t.from),a=!!t.prevPageItemId,o=t.order===`desc`?a?this.cache.getIterator(t.prevPageItemId??t.from??null):this.cache.getReverseIterator(t.nextPageItemId??t.from??null):a?this.cache.getReverseIterator(t.prevPageItemId??t.from??null):this.cache.getIterator(t.nextPageItemId??t.from??null),s=[],c=r?t.limit+1:t.limit,l=jt(o),e.prev=13,l.s();case 15:if((u=l.n()).done){e.next=25;break}if(d=u.value,!(r&&d.value.key==t.from)){e.next=19;break}return e.abrupt(`continue`,23);case 19:if(s.push(d.value),!(s.length>=t.limit)){e.next=23;break}return a&&mt.exports.reverse(s),e.abrupt(`return`,this.makePaginator(s,t,this._prevPageAllowed(s,t.order),this._nextPageAllowed(s,t.order)));case 23:e.next=15;break;case 25:e.next=30;break;case 27:e.prev=27,e.t0=e.catch(13),l.e(e.t0);case 30:return e.prev=30,l.f(),e.finish(30);case 33:if(s.length>0&&(t.from=mt.exports.last(s).key),f=Math.max(c-s.length,10),a&&(t.order=t.order===`desc`?`asc`:`desc`),p=t.from!==(i.order===`desc`?a?this.cache.collectionEnd:this.cache.collectionBegin:a?this.cache.collectionBegin:this.cache.collectionEnd),!p){e.
37next=66;break}return e.next=40,this._queryItemsFromServer(Pt(Pt({},t),{},{limit:f}));case 40:m=e.sent,h=m.items,i.order===`desc`?(g=!m.hasNextPage,_=!m.hasPrevPage):(g=!m.hasPrevPage,_=!m.hasNextPage),this.cache.populate(h,g,_),v=jt(h),e.prev=45,v.s();case 47:if((y=v.n()).done){e.next=56;break}if(b=y.value,!((s.length>0||r)&&b.key==t.from)){e.next=51;break}return e.abrupt(`continue`,54);case 51:if(a?s.unshift(b):s.push(b),!(s.length>=t.limit)){e.next=54;break}return e.abrupt(`break`,56);case 54:e.next=47;break;case 56:e.next=61;break;case 58:e.prev=58,e.t1=e.catch(45),v.e(e.t1);case 61:return e.prev=61,v.f(),e.finish(61);case 64:e.next=67;break;case 66:a&&mt.exports.reverse(s);case 67:return e.abrupt(`return`,this.makePaginator(s,i,this._prevPageAllowed(s,i.order),this._nextPageAllowed(s,i.order)));case 68:case`end`:return e.stop()}},e,this,[[13,27,30,33],[45,58,61,64]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_prevPageAllowed`,value:function(e,t){return e.length>0&&mt.exports.head(e).key!==(t===`desc`?this.cache.collectionEnd:this.cache.collectionBegin)}},{key:`_nextPageAllowed`,value:function(e,t){return e.length>0&&mt.exports.last(e).key!==(t===`desc`?this.cache.collectionBegin:this.cache.collectionEnd)}},{key:`makePaginator`,value:function(e,t,n,r){var i=this;t.nextPageItemId=t.prevPageItemId=null;var a=n&&this._prevPageAllowed(e,t.order),o=r&&this._nextPageAllowed(e,t.order);return new We(e,function(e){return i.queryItems(Pt(Pt({},t),e))},a?mt.exports.head(e).key:null,o?mt.exports.last(e).key:null)}},{key:`_querySingleItemFromServer`,value:function(){var e=w.default(M.default.mark(function e(t){var n;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._queryItemsFromServer({key:t});case 2:return n=e.sent,n.items.length===0&&this.cache.exists(t)&&this.cache.delete(t,null),e.abrupt(`return`,n);case 5:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_queryItemsFromServer`,value:function(){var e=w.default(M.default.mark(function e(t){var n=this,r,i,a,o;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=new U(this.links.items).queryParam(`HideExpired`,!0).queryParam(`Key`,t.key).queryParam(`PageToken`,t.pageToken).queryParam(`From`,t.from).queryParam(`PageSize`,t.limit).queryParam(`Order`,t.order).build(),e.next=3,this.services.network.get(r);case 3:return i=e.sent,a=(i.body?.items??[]).map(function(e){e.date_updated=new Date(e.date_updated);var t=n.cache.get(e.key);if(t&&t.value)n._handleItemMutated(e.key,e.url,e.last_event_id,e.revision,e.data,e.date_updated,e.date_expires,!1,!0);else{var r=new At({key:e.key,url:e.url,last_event_id:e.last_event_id,revision:e.revision,data:e.data,date_updated:e.date_updated,date_expires:e.date_expires});n.cache.store(e.key,r,e.last_event_id)}return n.cache.getValue(e.key)}),o=i.body.meta,e.abrupt(`return`,this.makePaginator(a,t,!!o.previous_token,!!o.next_token));case 7:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getItems`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t||={},ne(t.pageSize),t.limit=t.pageSize||t.limit||50,t.order=t.order||`asc`,e.abrupt(`return`,this.queryItems(t));case 5:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`shouldIgnoreEvent`,value:function(e,t){return this.cache.isKnown(e,t)}},{key:`_update`,value:function(e,t){switch(e.date_created=new Date(e.date_created),e.type){case`map_item_added`:case`map_item_updated`:this._handleItemMutated(e.item_key,e.item_url,e.id,e.item_revision,e.item_data,e.date_created,e.date_expires,e.type===`map_item_added`,!0);break;case`map_item_removed`:this._handleItemRemoved(e.item_key,e.id,e.item_data,e.date_created,!0);break;case`map_removed`:this.onRemoved(!1)}t&&this._advanceLastEventId(e.id,e.map_revision)}},{key:`_advanceLastEventId`,value:function(e,t){this.lastEventId<e&&(this.descriptor.last_event_id=e,t&&(this.descriptor.revision=t))}},{key:`_updateRootDateUpdated`,value:function(e){(!this.descriptor.date_updated||e.getTime()>this.descriptor.date_updated.getTime())&&(this.descriptor.date_updated=e,this.services.storage.update(this.t
37ype,this.sid,this.uniqueName,{date_updated:e}))}},{key:`_handleItemMutated`,value:function(e,t,n,r,i,a,o,s,c){if(this.shouldIgnoreEvent(e,n)){q.trace(`SyncMapItem `,e,` update skipped, current:`,this.lastEventId,`, remote:`,n);return}this._updateRootDateUpdated(a);var l=this.cache.getValue(e);if(!l){var u=new At({key:e,url:t,last_event_id:n,revision:r,data:i,date_updated:a,date_expires:o});this.cache.store(e,u,n),this.emitItemMutationEvent(u,c,s);return}var d=te(l.data);l.update(n,r,i,a),this.cache.store(e,l,n),o!==void 0&&l.updateDateExpires(o),this.emitItemMutationEvent(l,c,!1,d)}},{key:`emitItemMutationEvent`,value:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=n?`itemAdded`:`itemUpdated`,a={item:e,isLocal:!t};n||(a.previousItemData=r),this.broadcastEventToListeners(i,a)}},{key:`_handleItemRemoved`,value:function(e,t,n,r,i){this._updateRootDateUpdated(r),this.cache.delete(e,t),this.broadcastEventToListeners(`itemRemoved`,{key:e,isLocal:!i,previousItemData:n})}},{key:`onRemoved`,value:function(e){this._unsubscribe(),this.removalHandler(this.type,this.sid,this.uniqueName),this.broadcastEventToListeners(`removed`,{isLocal:e})}},{key:`setTtl`,value:function(){var e=w.default(M.default.mark(function e(t){var n,r;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n={ttl:t},e.next=4,this.services.network.post(this.uri,n);case 4:r=e.sent,this.descriptor.date_expires=r.body.date_expires,e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),e.t0.status===404&&this.onRemoved(!1),e.t0;case 12:case`end`:return e.stop()}},e,this,[[0,8]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`setItemTtl`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r,i,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.get(t);case 2:return r=e.sent,i={ttl:n},e.next=6,this.services.network.post(r.uri,i);case 6:a=e.sent,r.updateDateExpires(a.body.date_expires);case 8:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`removeMap`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.network.delete(this.uri);case 2:this.onRemoved(!0);case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()}],[{key:`type`,get:function(){return`map`}}]),n}(je),Rt=function(e){O.default(n,e);var t=Ft(n);function n(e){var r;return T.default(this,n),r=t.call(this),r.syncMapImpl=e,r.syncMapImpl.attach(D.default(r)),r}return E.default(n,[{key:`uri`,get:function(){return this.syncMapImpl.uri}},{key:`links`,get:function(){return this.syncMapImpl.links}},{key:`revision`,get:function(){return this.syncMapImpl.revision}},{key:`lastEventId`,get:function(){return this.syncMapImpl.lastEventId}}
37,{key:`dateExpires`,get:function(){return this.syncMapImpl.dateExpires}},{key:`type`,get:function(){return Lt.type}},{key:`sid`,get:function(){return this.syncMapImpl.sid}},{key:`uniqueName`,get:function(){return this.syncMapImpl.uniqueName}},{key:`dateUpdated`,get:function(){return this.syncMapImpl.dateUpdated}},{key:`set`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncMapImpl.set(t,n,r));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`get`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncMapImpl.get(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`mutate`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncMapImpl.mutate(t,n,r));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`update`,value:function(){var e=w.default(M.default.mark(function e(t,n,r){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncMapImpl.update(t,n,r));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`remove`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncMapImpl.remove(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getItems`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncMapImpl.getItems(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`setTtl`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncMapImpl.setTtl(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`setItemTtl`,value:function(){var e=w.default(M.default.mark(function e(t,n){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncMapImpl.setItemTtl(t,n));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`removeMap`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.next=3,this.syncMapImpl.removeMap();case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`close`,value:function(){R.default(A.default(n.prototype),`close`,this).call(this),this.syncMapImpl.detach(this.listenerUuid)}}],[{key:`type`,get:function(){return Lt.type}}]),n}(Re);j.default(Rt,`itemAdded`,`itemAdded`),j.default(Rt,`itemUpdated`,`itemUpdated`),j.default(Rt,`itemRemoved`,`itemRemoved`),j.default(Rt,`removed`,`removed`),V([d.validateTypesAsync(`string`,d.pureObject,[`undefined`,d.objectSchema(`item metadata`,{ttl:[d.nonNegativeInteger,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[String,Object,Object]),H(`design:returntype`,Promise)],Rt.prototype,`set`,null),V([d.validateTypesAsync(`string`),H(`design:type`,Function),H(`design:paramtypes`,[String]),H(`design:returntype`,Promise)],Rt.prototype,`get`,null),V([d.validateTypesAsync(`string`,`function`,[`undefined`,d.objectSchema(`
37item metadata`,{ttl:[d.nonNegativeInteger,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[String,Function,Object]),H(`design:returntype`,Promise)],Rt.prototype,`mutate`,null),V([d.validateTypesAsync(`string`,d.pureObject,[`undefined`,d.objectSchema(`item metadata`,{ttl:[d.nonNegativeInteger,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[String,Object,Object]),H(`design:returntype`,Promise)],Rt.prototype,`update`,null),V([d.validateTypesAsync(`string`),H(`design:type`,Function),H(`design:paramtypes`,[String]),H(`design:returntype`,Promise)],Rt.prototype,`remove`,null),V([d.validateTypesAsync([`undefined`,d.objectSchema(`query options`,{from:[`string`,`undefined`],pageSize:[d.custom(function(e){return[ie(e),`a positive integer`]}),`undefined`],order:[d.custom(function(e){return[e===`asc`||e===`desc`,`either 'asc' or 'desc'`]}),`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Object]),H(`design:returntype`,Promise)],Rt.prototype,`getItems`,null),V([d.validateTypesAsync(d.nonNegativeInteger),H(`design:type`,Function),H(`design:paramtypes`,[Number]),H(`design:returntype`,Promise)],Rt.prototype,`setTtl`,null),V([d.validateTypesAsync(`string`,d.nonNegativeInteger),H(`design:type`,Function),H(`design:paramtypes`,[String,Number]),H(`design:returntype`,Promise)],Rt.prototype,`setItemTtl`,null);function zt(e){var t=Bt();return function(){var n=A.default(e),r;if(t){var i=A.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return k.default(this,r)}}function Bt(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Vt=function(e){O.default(n,e);var t=zt(n);function n(e,r,i){var a;return T.default(this,n),a=t.call(this,e,i),a.descriptor=r,a}return E.default(n,[{key:`uri`,get:function(){return this.descriptor.url}},{key:`links`,get:function(){return this.descriptor.links}}
37,{key:`dateExpires`,get:function(){return this.descriptor.date_expires}},{key:`type`,get:function(){return`stream`}},{key:`lastEventId`,get:function(){return null}},{key:`indexName`,get:function(){}},{key:`queryString`,get:function(){}},{key:`sid`,get:function(){return this.descriptor.sid}},{key:`uniqueName`,get:function(){return this.descriptor.unique_name||null}},{key:`publishMessage`,value:function(){var e=w.default(M.default.mark(function e(t){var n,r,i,a;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n={data:t},e.next=3,this.services.network.post(this.links.messages,n);case 3:return r=e.sent,i=r.body,a=this._handleMessagePublished(i.sid,t,!1),e.abrupt(`return`,a);case 7:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`setTtl`,value:function(){var e=w.default(M.default.mark(function e(t){var n,r;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n={ttl:t},e.next=4,this.services.network.post(this.uri,n);case 4:r=e.sent,this.descriptor.date_expires=r.body.date_expires,e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),e.t0.status===404&&this.onRemoved(!1),e.t0;case 12:case`end`:return e.stop()}},e,this,[[0,8]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`removeStream`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.network.delete(this.uri);case 2:this.onRemoved(!0);case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`_update`,value:function(e){switch(e.type){case`stream_message_published`:this._handleMessagePublished(e.message_sid,e.message_data,!0);break;case`stream_removed`:this.onRemoved(!1)}}},{key:`_handleMessagePublished`,value:function(e,t,n){var r={sid:e,data:t};return this.broadcastEventToListeners(`messagePublished`,{message:r,isLocal:!n}),r}},{key:`onRemoved`,value:function(e){this._unsubscribe(),this.removalHandler(this.type,this.sid,this.uniqueName),this.broadcastEventToListeners(`removed`,{isLocal:e})}}],[{key:`type`,get:function(){return`stream`}}]),n}(je);V([d.validateTypesAsync(d.pureObject),H(`design:type`,Function),H(`design:paramtypes`,[Object]),H(`design:returntype`,Promise)],Vt.prototype,`publishMessage`,null),V([d.validateTypesAsync(d.nonNegativeInteger),H(`design:type`,Function),H(`design:paramtypes`,[Number]),H(`design:returntype`,Promise)],Vt.prototype,`setTtl`,null);var Z=function(e){O.default(n,e);var t=zt(n);function n(e){var r;return T.default(this,n),r=t.call(this),r.syncStreamImpl=e,r.syncStreamImpl.attach(D.default(r)),r}return E.default(n,[{key:`uri`,get:function(){return this.syncStreamImpl.uri}},{key:`links`,get:function(){return this.syncStreamImpl.links}}
37,{key:`dateExpires`,get:function(){return this.syncStreamImpl.dateExpires}},{key:`type`,get:function(){return Vt.type}},{key:`lastEventId`,get:function(){return null}},{key:`sid`,get:function(){return this.syncStreamImpl.sid}},{key:`uniqueName`,get:function(){return this.syncStreamImpl.uniqueName}},{key:`publishMessage`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncStreamImpl.publishMessage(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`setTtl`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncStreamImpl.setTtl(t));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`removeStream`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.ensureNotClosed(),e.abrupt(`return`,this.syncStreamImpl.removeStream());case 2:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`close`,value:function(){R.default(A.default(n.prototype),`close`,this).call(this),this.syncStreamImpl.detach(this.listenerUuid)}}],[{key:`type`,get:function(){return Vt.type}}]),n}(Re);j.default(Z,`messagePublished`,`messagePublished`),j.default(Z,`removed`,`removed`),V([d.validateTypesAsync(d.pureObject),H(`design:type`,Function),H(`design:paramtypes`,[Object]),H(`design:returntype`,Promise)],Z.prototype,`publishMessage`,null),V([d.validateTypesAsync(d.nonNegativeInteger),H(`design:type`,Function),H(`design:paramtypes`,[Number]),H(`design:returntype`,Promise)],Z.prototype,`setTtl`,null);var Ht=E.default(function e(t){T.default(this,e),this.sdk=`js`,this.sdkVer=t,this.os=B.os.family,this.osVer=B.os.version,this.pl=B.name,this.plVer=B.version}),Ut=function(){function e(){T.default(this,e),this.names=new Map,this.entities=new Map}return E.default(e,[{key:`store`,value:function(e){return this.entities.get(e.sid)||(this.entities.set(e.sid,e),e.uniqueName&&this.names.set(e.type+`::`+e.uniqueName,e.sid),e)}},{key:`getResolved`,value:function(e,t){var n=this.names.get(t+`::`+e);return n?this.entities.get(n):null}},{key:`get`,value:function(e,t){return this.entities.get(e)||this.getResolved(e,t)||null}},{key:`remove`,value:function(e){var t=this.entities.get(e);t&&(this.entities.delete(e),t.uniqueName&&this.names.delete(t.type+`::`+t.uniqueName))}}]),e}();function Wt(e){var t=Gt();return function(){var n=A.default(e),r;if(t){var i=A.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return k.default(this,r)}}function Gt(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Kt=function(){function e(t,n,r){T.default(this,e),this.key=t,this.value=n,this.lastEventId=r}return E.default(e,[{key:`cacheKey`,get:function(){return this.key}}]),e}(),qt=function(e){O.default(n,e);var t=Wt(n);function n(e,r,i,a){var o;return T.default(this,n),o=t.call(this,r,i),o.descriptor=e,o.cache=new ct,a&&a.forEach(function(e){var t=new Kt(e.key,e.data,e.revision);o.cache.store(e.key,t,e.revision)}),o}return E.default(n,[{key:`sid`,get:function(){return this.descriptor.sid}},{key:`uniqueName`,get:function(){return null}},{key:`type`,get:function(){return n.type}},{key:`lastEventId`,get:function(){return this.descriptor.last_event_id}},{key:`indexName`,get:function(){return this.descriptor.indexName}},{key:`queryString`,get:function(){return this.descriptor.queryExpression}},{key:`queryUri`,get:function(){return this.descriptor.queryUri}},{key:`liveQueryDescriptor`,get:function(){return this.descriptor}},{key:`onRemoved`,value:function(){}},{key:`getItems`,value:function(){var e={};return this.cache.forEach(function(t,n){e[t]=n.value}),e}},{key:`_update`,value:function(e,t){switch(e.type){case`live_query_item_updated`:this.handleItemMutated(e.item_
37key,e.item_data,e.item_revision);break;case`live_query_item_removed`:this.handleItemRemoved(e.item_key,e.item_revision);break;case`live_query_updated`:this.handleBatchUpdate(e.items)}t&&this._advanceLastEventId(e.last_event_id)}},{key:`handleItemMutated`,value:function(e,t,n){if(this.shouldIgnoreEvent(e,n)){q.trace(`Item ${e} update skipped, revision: ${n}`);return}var r=new Kt(e,t,n);this.cache.store(e,r,n),this.broadcastEventToListeners(`itemUpdated`,r)}},{key:`handleItemRemoved`,value:function(e,t){if(this.shouldIgnoreEvent(e,t)){q.trace(`Item ${e} delete skipped, revision: ${t}`);return}this.cache.delete(e,t),this.broadcastEventToListeners(`itemRemoved`,{key:e})}},{key:`handleBatchUpdate`,value:function(e){var t=this,n={};for(var r in e?.forEach(function(e){n[e.key]={data:e.data,revision:e.revision}}),this.cache.forEach(function(e,r){var i=n[e];i==null?t.handleItemRemoved(e,null):t.handleItemMutated(e,i.data,i.revision),delete n[e]}),n)this.handleItemMutated(r,n[r].data,n[r].revision)}},{key:`shouldIgnoreEvent`,value:function(e,t){return e!=null&&t!=null&&this.cache.isKnown(e,t)}},{key:`_advanceLastEventId`,value:function(e,t){this.lastEventId<e&&(this.descriptor.last_event_id=e)}}],[{key:`type`,get:function(){return`live_query`}}]),n}(je);function Jt(e){return Yt.apply(this,arguments)}function Yt(){return Yt=w.default(M.default.mark(function e(t){var n,r,i,a,o,s;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.network,r=t.queryString,i=t.uri,a=t.type,r!=null){e.next=3;break}throw new G(`Invalid query`,400,54507);case 3:return o={query_string:r},a===Xt.type&&(o.type=a),e.next=7,n.post(i,o,void 0,!0);case 7:return s=e.sent,e.abrupt(`return`,s.body);case 9:case`end`:return e.stop()}},e)})),Yt.apply(this,arguments)}var Xt=function(e){O.default(n,e);var t=Wt(n);function n(e){var r;return T.default(this,n),r=t.call(this),r.liveQueryImpl=e,r.liveQueryImpl.attach(D.default(r)),r}return E.default(n,[{key:`type`,get:function(){return qt.type}},{key:`lastEventId`,get:function(){return this.liveQueryImpl.lastEventId}},{key:`sid`,get:function(){return this.liveQueryImpl.sid}},{key:`close`,value:function(){R.default(A.default(n.prototype),`close`,this).call(this),this.liveQueryImpl.detach(this.listenerUuid)}},{key:`getItems`,value:function(){return this.ensureNotClosed(),this.liveQueryImpl.getItems()}}],[{key:`type`,get:function(){return qt.type}}]),n}(Re);j.default(Xt,`itemUpdated`,`itemUpdated`),j.default(Xt,`itemRemoved`,`itemRemoved`);var Zt=function(e){O.default(n,e);var t=Wt(n);function n(e){var r;return T.default(this,n),r=t.call(this),j.default(D.default(r),`queryExpression`,null),j.default(D.default(r),`items`,{}),Object.assign(D.default(r),e),r.updateIndexName(e.indexName),r}return E.default(n,[{key:`type`,get:function(){return n.type}},{key:`search`,value:function(){var e=w.default(M.default.mark(function e(t){var n=this,r;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.items={},e.prev=1,e.next=4,Jt({network:this.network,uri:this.queryUri,queryString:t});case 4:r=e.sent,this.queryExpression=t,r.items&&r.items.forEach(function(e){n.items[e.key]=e.data}),this.emit(`searchResult`,this.getItems()),e.next=15;break;case 10:throw e.prev=10,e.t0=e.catch(1),q.error(`Error '${e.t0.message}' while executing query '${t}'`),this.queryExpression=null,e.t0;case 15:case`end`:return e.stop()}},e,this,[[1,10]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`subscribe`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.queryExpression!=null){e.next=2;break}return e.abrupt(`return`,Promise.reject(new G(`Invalid query`,400,54507)));case 2:return e.abrupt(`return`,this.liveQueryCreator(this.indexName,this.queryExpression));case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getItems`,value:function(){return this.items}},{key:`updateIndexName`,value:function(e){this.indexName=e,this.queryUri=this.generateQueryUri(this.indexName)}},{key:`generateQueryUri`,value:function(e){return new U(this.insightsUri).pathSegment(e).pathSegment(`Items`).build()}}],[{key:`type`,get:function(){return`instant_query`}}]),n}(y.ReplayEventEmitter);j.default(Zt,`searchResult`,`searchResult`),V([d.validateTypesAsync(`string`),H(`design:type`,Function),H(`design:paramtypes`,[String]),H(`design:returntype`,Promise)],Zt.prototype,`search`,null),V([d.validateTypes(d.nonEmptyString),H(`design:type`,Function),H(`design:paramtypes`,[String]),H(`design:returntype`,void 0)],Zt.prototype,`updateIndexName`,null);var Qt=`3.4.0`;function $t(e){var t=en();return function(){var n=A.default(e),r;if(t){var i=A.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return k.default(this,r)}}function en(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function tn(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 nn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];
37t%2?tn(Object(n),!0).forEach(function(t){j.default(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var rn=`data_sync`,an=Qt;function on(e){if(!e)return{mode:`create_new`};if(typeof e==`string`)return{id:e,mode:`open_or_create`};var t=e.mode||(e.id?`open_or_create`:`create_new`);return nn(nn({},e),{},{mode:t})}var sn=`com.twilio.rtd.cds.document`,ln=`com.twilio.rtd.cds.list`,un=`com.twilio.rtd.cds.map`,dn=`twilio.sync.event`,fn=function(e){O.default(n,e);var t=$t(n);function n(e){var r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(T.default(this,n),r=t.call(this),!e)throw Error(`Sync library needs a valid Twilio token to be passed`);i.hasOwnProperty(`logLevel`)?q.setLevel(i.logLevel):q.setLevel(`silent`);var a=i.productId=i.productId||rn;i.clientMetadata=i.clientMetadata||{},i.clientMetadata.hasOwnProperty(`type`)||(i.clientMetadata.type=`sync`),i.clientMetadata.hasOwnProperty(`sdk`)||(i.clientMetadata.sdk=`JS`,i.clientMetadata.sdkv=an);var o=!i.twilsockClient;if(!i.initRegistrations){var s=new f.InitRegistration(a);n.populateInitRegistrations(s),i.initRegistrations=[s]}var c=i.twilsockClient=i.twilsockClient??new f.Twilsock(e,a,i);c.on(`tokenAboutToExpire`,function(){return r.emit(`tokenAboutToExpire`)}),c.on(`tokenExpired`,function(){return r.emit(`tokenExpired`)}),c.on(`connectionError`,function(e){return r.emit(`connectionError`,e)}),c.on(`stateChanged`,function(e){r.emit(`connectionStateChanged`,e),r.services.subscriptions.onConnectionStateChanged(e===`connected`)}),c.on(`message`,function(e,t){return r._routeMessage(e,t)});var l=new me(i),u=new Ee(new Ht(an),l,c),d=new De(l);return r.services={config:l,twilsock:c,network:u,storage:d,router:D.default(r),subscriptions:null},r.services.subscriptions=new ve(r.services),r.entities=new Ut,o&&c.connect(),r}return E.default(n,[{key:`_routeMessage`,value:function(e,t){switch(q.trace(`Notification type:`,e,`content:`,t),e){case sn:case ln:case un:this.services.subscriptions.acceptMessage(t,!1);break;case dn:this.services.subscriptions.acceptMessage(t,!0)}}},{key:`_subscribe`,value:function(e,t){this.services.subscriptions.add(e,t)}},{key:`_unsubscribe`,value:function(e){this.services.subscriptions.remove(e)}},{key:`connectionState`,get:function(){return this.services.twilsock.state}},{key:`ensureReady`,value:function(){var e=w.default(M.default.mark(function e(){var t;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.services.config.sessionStorageEnabled){e.next=2;break}return e.abrupt(`return`);case 2:return e.prev=2,e.next=5,this.services.twilsock.storageId();case 5:t=e.sent,this.services.storage.updateStorageId(t.id),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),q.warn(`Failed to initialize storage`,e.t0);case 12:case`end`:return e.stop()}},e,this,[[2,9]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`storeRootInSessionCache`,value:function(e,t,n){if(!(!this.services.config.sessionStorageEnabled||!t)){var r=te(n);(e===kt.type||e===Rt.type)&&(r.last_event_id=null,delete r.items),this.services.storage.store(e,t,r)}}},{key:`readRootFromSessionCache`,value:function(e,t){return!this.services.config.sessionStorageEnabled||!t?null:this.services.storage.read(e,t)}},{key:`_get`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r,i,a,o=arguments;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=o.length>2&&o[2]!==void 0&&o[2],n){e.next=3;break}throw new G(`Cannot get entity without id`,404);case 3:return i=new U(t).pathSegment(n).queryParam(`Include`,r?`items`:void 0).build(),e.next=6,this.services.network.get(i);case 6:return a=e.sent,e.abrupt(`return`,a.body);case 8:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`_createDocument`,value:function(e,t,n){var r={unique_name:e,data:t||{}};return n!==void 0&&(r.ttl=n),this.services.network.post(this.services.config.documentsUri,r).then(function(e){return e.body.data=r.data,e.body})}},{key:`_getDocument`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.readRootFromSessionCache(He.type,t)||this._get(this.services.config.documentsUri,t));case 1:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_createList`,value:function(e,t,n,r){var i={unique_name:e,purpose:t,context:n};return r!==void 0&&(i.ttl=r),this.services.network.post(this.services.config.listsUri,i).then(function(e){return e.body})}},{key:`_getList`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.readRootFromSessionCache(kt.type,t)||this._get(this.services.config.listsUri,t));case 1:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_createMap`,value:function(e,t){var n={unique_name:e};return t!==void 0&&(n.ttl=t),this.services.network.post(this.services.config.mapsUri,n).then(function(e){return e.body})}},{key:`_getMap`,value:function(){var e=w.default(M.default.mark(function e(t){var n,r=arguments;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&r[1]!==void 0&&r[1],e.abrupt(`return`,this.readRootFromSessionCache(Rt.type,t)||this._get(this.services.config.mapsUri,t,n));case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_getStream`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.readRootFromSessionCache(Z.type,t)||this._get(this.services.config.streamsUri,t,!1));case 1:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_createStream`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r,i;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={unique_name:t},n!==void 0&&(r.ttl=n),e.next=4,this.services.network.post(this.services.config.streamsUri,r);case 4:return i=e.sent,e.abrupt(`return`,i.body);case 6:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`_getLiveQuery`,value:function(e){return this.readRootFromSessionCache(Xt.type,e)}},{key:`getCached`,value:function(e,t){return e&&this.entities.get(e,t)||null}},{key:`removeFromCacheAndSession`,value:function(e,t,n){this.entities.remove(t),this.services.config.sessionStorageEnabled&&this.services.storage.remove(e,t,n)}},{key:`document`,value:function(){var e=w.default(M.default.mark(function e(t){var n=this,r,i,a,o;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.ensureReady();case 2:if(r=on(t),r.mode!==`create_new`){e.next=9;break}return e.next=6,this._createDocument(r.id,r.data,r.ttl);case 6:i=e.sent,e.next=39;break;
37case 9:if(a=this.getCached(r.id,He.type),!a){e.next=14;break}return e.abrupt(`return`,new He(a));case 14:return e.prev=14,e.next=17,this._getDocument(r.id);case 17:i=e.sent,e.next=39;break;case 20:if(e.prev=20,e.t0=e.catch(14),e.t0.status===404&&r.mode!==`open_existing`){e.next=26;break}throw e.t0;case 26:return e.prev=26,e.next=29,this._createDocument(r.id,r.data,r.ttl);case 29:i=e.sent,e.next=39;break;case 32:if(e.prev=32,e.t1=e.catch(26),e.t1.status!==409){e.next=38;break}return e.abrupt(`return`,this.document(t));case 38:throw e.t1;case 39:return this.storeRootInSessionCache(He.type,r.id,i),o=new Ve(this.services,i,function(e,t,r){return n.removeFromCacheAndSession(e,t,r)}),o=this.entities.store(o),e.abrupt(`return`,new He(o));case 43:case`end`:return e.stop()}},e,this,[[14,20],[26,32]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`map`,value:function(){var e=w.default(M.default.mark(function e(t){var n=this,r,i,a,o;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.ensureReady();case 2:if(r=on(t),r.mode!==`create_new`){e.next=9;break}return e.next=6,this._createMap(r.id,r.ttl);case 6:i=e.sent,e.next=39;break;case 9:if(a=this.getCached(r.id,Rt.type),!a){e.next=14;break}return e.abrupt(`return`,new Rt(a));case 14:return e.prev=14,e.next=17,this._getMap(r.id,r.includeItems);case 17:i=e.sent,e.next=39;break;case 20:if(e.prev=20,e.t0=e.catch(14),e.t0.status===404&&r.mode!==`open_existing`){e.next=26;break}throw e.t0;case 26:return e.prev=26,e.next=29,this._createMap(r.id,r.ttl);case 29:i=e.sent,e.next=39;break;case 32:if(e.prev=32,e.t1=e.catch(26),e.t1.status!==409){e.next=38;break}return e.abrupt(`return`,this.map(t));case 38:throw e.t1;case 39:return this.storeRootInSessionCache(Rt.type,r.id,i),o=new Lt(this.services,i,function(e,t,r){return n.removeFromCacheAndSession(e,t,r)}),o=this.entities.store(o),e.abrupt(`return`,new Rt(o));case 43:case`end`:return e.stop()}},e,this,[[14,20],[26,32]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`list`,value:function(){var e=w.default(M.default.mark(function e(t){var n=this,r,i,a,o;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.ensureReady();case 2:if(r=on(t),r.mode!==`create_new`){e.next=9;break}return e.next=6,this._createList(r.id,r.purpose,r.context,r.ttl);case 6:i=e.sent,e.next=39;break;case 9:if(a=this.getCached(r.id,kt.type),!a){e.next=14;break}return e.abrupt(`return`,new kt(a));case 14:return e.prev=14,e.next=17,this._getList(r.id);case 17:i=e.sent,e.next=39;break;case 20:if(e.prev=20,e.t0=e.catch(14),e.t0.status===404&&r.mode!==`open_existing`){e.next=26;break}throw e.t0;case 26:return e.prev=26,e.next=29,this._createList(r.id,r.purpose,r.context,r.ttl);case 29:i=e.sent,e.next=39;break;case 32:if(e.prev=32,e.t1=e.catch(26),e.t1.status!==409){e.next=38;break}return e.abrupt(`return`,this.list(t));case 38:throw e.t1;case 39:return this.storeRootInSessionCache(kt.type,r.id,i),o=new Ot(this.services,i,function(e,t,r){return n.removeFromCacheAndSession(e,t,r)}),o=this.entities.store(o),e.abrupt(`return`,new kt(o));case 43:case`end`:return e.stop()}},e,this,[[14,20],[26,32]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`stream`,value:function(){var e=w.default(M.default.mark(function e(t){var n=this,r,i,a,o,s;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.ensureReady();case 2:if(r=on(t),r.mode!==`create_new`){e.next=9;break}return e.next=6,this._createStream(r.id,r.ttl);case 6:i=e.sent,e.next=39;break;case 9:if(a=this.getCached(r.id,Z.type),!a){e.next=14;break}return e.abrupt(`return`,new Z(a));case 14:return e.prev=14,e.next=17,this._getStream(r.id);case 17:i=e.sent,e.next=39;break;case 20:if(e.prev=20,e.t0=e.catch(14),e.t0.status===404&&r.mode!==`open_existing`){e.next=26;break}throw e.t0;case 26:return e.prev=26,e.next=29,this._createStream(r.id,r.ttl);case 29:i=e.sent,e.next=39;break;case 32:if(e.prev=32,e.t1=e.catch(26),e.t1.status!==409){e.next=38;break}return e.abrupt(`return`,this.stream(t));case 38:throw e.t1;case 39:return this.storeRootInSessionCache(Z.type,r.id,i),o=function(e,t,r){return n.removeFromCacheAndSession(e,t,r)},s=new Vt(this.services,i,o),s=this.entities.store(s),e.abrupt(`return`,new Z(s));case 44:case`end`:return e.stop()}},e,this,[[14,20],[26,32]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`shutdown`,value:function(){var e=w.default(M.default.mark(function e(){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.subscriptions.shutdown();case 2:return e.next=4,this.services.twilsock.disconnect();case 4:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`updateToken`,value:function(){var e=w.default(M.default.mark(function e(t){return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.services.twilsock.updateToken(t).cat
37ch(function(e){var t=e?.reply?.status;throw t?.code===401&&t?.status===`UNAUTHORIZED`?new G(`Updated token was rejected by server`,400,51130):e}));case 1:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`liveQuery`,value:function(){var e=w.default(M.default.mark(function e(t,n){var r=this,i,a,o,s,c;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.ensureReady();case 2:return i=new U(this.services.config.insightsUri).pathSegment(t).pathSegment(`Items`).build(),e.next=5,Jt({network:this.services.network,uri:i,queryString:n,type:Xt.type});case 5:return a=e.sent,o=this.getCached(a.query_id,Xt.type),o||=(s=this._getLiveQuery(a.query_id),s||={indexName:t,queryExpression:n,sid:a.query_id,queryUri:i,last_event_id:a.last_event_id},c=function(e,t,n){return r.removeFromCacheAndSession(e,t,n)},new qt(s,this.services,c,a.items)),this.storeRootInSessionCache(Xt.type,a.query_id,o.liveQueryDescriptor),o=this.entities.store(o),e.abrupt(`return`,new Xt(o));case 11:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`instantQuery`,value:function(){var e=w.default(M.default.mark(function e(t){var n=this,r;return M.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.ensureReady();case 2:return r=function(e,t){return n.liveQuery(e,t)},e.abrupt(`return`,new Zt({indexName:t,network:this.services.network,insightsUri:this.services.config.insightsUri,liveQueryCreator:r}));case 4:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()}],[{key:`populateInitRegistrations`,value:function(e){e.populateInitRegistrations([dn,sn,ln,un])}},{key:`version`,get:function(){return an}}]),n}(y.ReplayEventEmitter);j.default(fn,`connectionStateChanged`,`connectionStateChanged`),j.default(fn,`connectionError`,`connectionError`),j.default(fn,`tokenAboutToExpire`,`tokenAboutToExpire`),j.default(fn,`tokenExpired`,`tokenExpired`),V([d.validateTypesAsync([`undefined`,`string`,d.objectSchema(`open document options`,{id:[`string`,`undefined`],mode:[d.literal(`open_or_create`,`open_existing`,`create_new`),`undefined`],ttl:[d.nonNegativeInteger,`undefined`],data:[d.pureObject,`undefined`,d.literal(null)]})]),H(`design:type`,Function),H(`design:paramtypes`,[Object]),H(`design:returntype`,Promise)],fn.prototype,`document`,null),V([d.validateTypesAsync([`undefined`,`string`,d.objectSchema(`open map options`,{id:[`string`,`undefined`],mode:[d.literal(`open_or_create`,`open_existing`,`create_new`),`undefined`],ttl:[d.nonNegativeInteger,`undefined`],data:[d.pureObject,`undefined`,d.literal(null)],includeItems:[`boolean`,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Object]),H(`design:returntype`,Promise)],fn.prototype,`map`,null),V([d.validateTypesAsync([`undefined`,`string`,d.objectSchema(`open list options`,{id:[`string`,`undefined`],mode:[d.literal(`open_or_create`,`open_existing`,`create_new`),`undefined`],ttl:[d.nonNegativeInteger,`undefined`],data:[d.pureObject,`undefined`,d.literal(null)],purpose:[`string`,`undefined`],context:[d.pureObject,`undefined`],includeItems:[`boolean`,`undefined`]})]),H(`design:type`,Function),H(`design:paramtypes`,[Object]),H(`design:returntype`,Promise)],fn.prototype,`list`,null),V([d.validateTypesAsync([`undefined`,`string`,d.objectSchema(`open stream options`,{id:[`string`,`undefined`],mode:[d.literal(`open_or_create`,`open_existing`,`create_new`),`undefined`],ttl:[d.nonNegativeInteger,`undefined`],data:[d.pureObject,`undefined`,d.literal(null)]})]),H(`design:type`,Function),H(`design:paramtypes`,[Object]),H(`design:returntype`,Promise)],fn.prototype,`stream`,null),V([d.validateTypesAsync(d.nonEmptyString),H(`design:type`,Function),H(`design:paramtypes`,[String]),H(`design:returntype`,Promise)],fn.prototype,`updateToken`,null),V([d.validateTypesAsync(d.nonEmptyString,`string`),H(`design:type`,Function),H(`design:paramtypes`,[String,String]),H(`design:returntype`,Promise)],fn.prototype,`liveQuery`,null),V([d.validateTypesAsync(d.nonEmptyString),H(`design:type`,Function),H(`design:paramtypes`,[String]),H(`design:returntype`,Promise)],fn.prototype,`instantQuery`,null),e.Client=fn,e.InsightsItem=Kt,e.InstantQuery=Zt,e.LiveQuery=Xt,e.Paginator=We,e.SyncClient=fn,e.SyncDocument=He,e.SyncList=kt,e.SyncListItem=Ue,e.SyncMap=Rt,e.SyncMapItem=At,e.SyncStream=Z})),Ta=r(((e,t)=>{var n=v(),r=f(),i=L()(`match`);t.exports=function(e){var t;return n(e)&&((t=e[i])===void 0?r(e)===`RegExp`:!!t)}}
vendor: 6,000 bytes, line 37
37)),Ea=r(((e,t)=>{var n=Ta(),r=TypeError;t.exports=function(e){if(n(e))throw new r(`The method doesn't accept regular expressions`);return e}})),Da=r(((e,t)=>{var n=L()(`match`);t.exports=function(e){var t=/./;try{`/./`[e](t)}catch{try{return t[n]=!1,`/./`[e](t)}catch{}}return!1}})),Oa=r((()=>{var e=Y(),t=Ve(),n=H().f,r=ue(),i=Pe(),a=Ea(),o=h(),s=Da(),c=A(),l=t(``.slice),u=Math.min,d=s(`startsWith`);e({target:`String`,proto:!0,forced:!(!c&&!d&&function(){var e=n(String.prototype,`startsWith`);return e&&!e.writable}())&&!d},{startsWith:function(e){var t=i(o(this));a(e);var n=r(u(arguments.length>1?arguments[1]:void 0,t.length)),s=i(e);return l(t,n,n+s.length)===s}})})),ka=r(((e,t)=>{var n=a(),r=L(),i=o(),s=A(),c=r(`iterator`);t.exports=!n(function(){var e=new URL(`b?a=1&b=2&c=3`,`https://a`),t=e.searchParams,n=new URLSearchParams(`a=1&a=2&b=3`),r=``;return e.pathname=`c%20d`,t.forEach(function(e,n){t.delete(`b`),r+=n+e}),n.delete(`a`,2),n.delete(`b`,void 0),s&&(!e.toJSON||!n.has(`a`,1)||n.has(`a`,2)||!n.has(`a`,void 0)||n.has(`b`))||!t.size&&(s||!i)||!t.sort||e.href!==`https://a/c%20d?a=1&c=3`||t.get(`c`)!==`3`||String(new URLSearchParams(`?a=1`))!==`a=1`||!t[c]||new URL(`https://a@b`).username!==`a`||new URLSearchParams(new URLSearchParams(`a=b`)).get(`a`)!==`b`||new URL(`https://ÑеÑÑ`).host!==`xn--e1aybc`||new URL(`https://a#б`).hash!==`#%D0%B1`||r!==`a1c3`||new URL(`https://x`,void 0).host!==`x`})})),Aa=r(((e,t)=>{var n=d(),r=2147483647,i=36,a=1,o=26,s=38,c=700,l=72,u=128,f=`-`,p=/[^\0-\u007E]/,m=/[.\u3002\uFF0E\uFF61]/g,h=`Overflow: input needs wider integers to process`,g=i-a,_=RangeError,v=n(m.exec),y=Math.floor,b=String.fromCharCode,x=n(``.charCodeAt),S=n([].join),C=n([].push),w=n(``.replace),T=n(``.split),E=n(``.toLowerCase),D=function(e){for(var t=[],n=0,r=e.length;n<r;){var i=x(e,n++);if(i>=55296&&i<=56319&&n<r){var a=x(e,n++);(a&64512)==56320?C(t,((i&1023)<<10)+(a&1023)+65536):(C(t,i),n--)}else C(t,i)}return t},O=function(e){return e+22+75*(e<26)},k=function(e,t,n){var r=0;for(e=n?y(e/c):e>>1,e+=y(e/t);e>g*o>>1;)e=y(e/g),r+=i;return y(r+(g+1)*e/(e+s))},A=function(e){var t=[];e=D(e);var n=e.length,s=u,c=0,d=l,p,m;for(p=0;p<e.length;p++)m=e[p],m<128&&C(t,b(m));var g=t.length,v=g;for(g&&C(t,f);v<n;){var x=r;for(p=0;p<e.length;p++)m=e[p],m>=s&&m<x&&(x=m);var w=v+1;if(x-s>y((r-c)/w))throw new _(h);for(c+=(x-s)*w,s=x,p=0;p<e.length;p++){if(m=e[p],m<s&&++c>r)throw new _(h);if(m===s){for(var T=c,E=i;;){var A=E<=d?a:E>=d+o?o:E-d;if(T<A)break;var j=T-A,M=i-A;C(t,b(O(A+j%M))),T=y(j/M),E+=i}C(t,b(O(T))),d=k(c,w,v===g),c=0,v++}}c++,s++}return S(t,``)};t.exports=function(e){var t=[],n=T(w(E(e),m,`.`),`.`),r,i;for(r=0;r<n.length;r++)i=n[r],C(t,v(p,i)?`xn--`+A(i):i);return S(t,`.`)}})),ja=r((()=>{var e=Y(),t=d(),n=le(),r=RangeError,i=String.fromCharCode,a=String.fromCodePoint,o=t([].join);e({target:`String`,stat:!0,arity:1,forced:!!a&&a.length!==1},{fromCodePoint:function(e){for(var t=[],a=arguments.length,s=0,c;a>s;){if(c=+arguments[s++],n(c,1114111)!==c)throw new r(c+` is not a valid code point`);t[s]=c<65536?i(c):i(((c-=65536)>>10)+55296,c%1024+56320)}return o(t,``)}})})),Ma=r(((e,t)=>{Wn(),ja();var n=Y(),r=i(),a=Lt(),s=y(),l=c(),f=d(),p=o(),m=ka(),h=q(),g=Ie(),b=Lr(),x=ye(),S=On(),C=ae(),w=X(),T=_(),E=F(),D=He(),O=Te(),k=W(),A=v(),j=Pe(),M=je(),N=u(),P=Xt(),I=Yt(),R=An(),z=Pt(),B=L(),V=ea(),H=B(`iterator`),U=`URLSearchParams`,ee=U+`Iterator`,G=C.set,K=C.getterFor(U),te=C.getterFor(ee),ne=a(`fetch`),re=a(`Request`),ie=a(`Headers`),oe=re&&re.prototype,se=ie&&ie.prototype,ce=r.TypeError,le=r.encodeURIComponent,ue=String.fromCharCode,de=s(`String`,`fromCodePoint`),fe=parseInt,pe=f(``.charAt),me=f([].join),J=f([].push),he=f(``.replace),ge=f([].shift),_e=f([].splice),ve=f(``.split),be=f(``.slice),xe=f(/./.exec),Se=/\+/g,Ce=`�`,we=/^[0-9a-f]+$/i,Ee=function(e,t){var n=be(e,t,t+2);return xe(we,n)?fe(n,16):NaN},De=function(e){for(var t=0,n=128;n>0&&(e&n)!==0;n>>=1)t++;return t},Oe=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(e[0]&31)<<6|e[1]&63;break;case 3:t=(e[0]&15)<<12|(e[1]&63)<<6|e[2]&63;break;case 4:t=(e[0]&7)<<18|(e[1]&63)<<12|(e[2]&63)<<6|e[3]&63}return t>1114111?null:t},ke=function(e){e=he(e,Se,` `);for(var t=e.length,n=``,r=0;r<t;){var i=pe(e,r);if(i===`%`){if(pe(e,r+1)===`%`||r+3>t){n+=`%`,r++;continue}var a=Ee(e,r+1);if(a!==a){n+=i,r++;continue}r+=2;var o=De(a);if(o===0)i=ue(a);else{if(o===1||o>4){n+=Ce,r++;continue}for(var s=[a],c=1;c<o&&(r++,!(r+3>t||pe(e,r)!==`%`));){var l=Ee(e,r+1);if(l!==l){r+=3;break}if(l>191||l<128)break;J(s,l),r+=2,c++}if(s.length!==o){n+=Ce;continue}var u=Oe(s);u===null?n+=Ce:i=de(u)}}n+=i,r++}return n},Ae=/[!'()~]|%20/g,Me={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`},Ne=function(e){return Me[e]},Fe=function(e){return he(le(e),Ae,Ne)},Le=S(function(e,t){G(this,{type:ee,target:K(e).entries,index:0,kind:t})},U,function(){var e=te(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=null,R(void 0,!0);var r=t[n];switch(e.kind){case`keys`:return R(r.key,!1);case`values`:return R(r.value,!1)}return R([r.key,r.value],!1)},!0),Re=function(e){this.entries=[],this.url=null,e!==void 0&&(A(e)?this.parseObject(e):this.parseQuery(typeof e==`string`?pe(e,0)===`?`?be(e,1):e:j(e)))};Re.prototype={type:U,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t=this.entries,n=I(e),r,i,a,o,s,c,u;if(n)for(r=P(e,n),i=r.next;!(a=l(i,r)).done;){if(o=P(k(a.value)),s=o.next,(c=l(s,o)).done||(u=l(s,o)).done||!l(s,o).done)throw new ce(`Expected sequence with length 2`);J(t,{key:j(c.value),value:j(u.value)})}else for(var d in e)E(e,d)&&J(t,{key:d,value:j(e[d])})},parseQuery:function(e){if(e)for(var t=this.entries,n=ve(e,`&`),r=0,i,a;r<n.length;)i=n[r++],i.length&&(a=ve(i,`=`),J(t,{key:ke(ge(a)),value:ke(me(a,`=`))}))},serialize:function(){for(var e=this.entries,t=[],n=0,r;n<e.length;)r=e[n++],J(t,Fe(r.key)+`=`+Fe(r.value));return me(t,`&`)},update:function(){this.entries.length=0,this.parseQuery(this.url.query)}
vendor: 4,004 bytes, line 37
37,updateURL:function(){this.url&&this.url.update()}};var ze=function(){w(this,Be);var e=arguments.length>0?arguments[0]:void 0,t=G(this,new Re(e));p||(this.size=t.entries.length)},Be=ze.prototype;if(b(Be,{append:function(e,t){var n=K(this);z(arguments.length,2),J(n.entries,{key:j(e),value:j(t)}),p||this.length++,n.updateURL()},delete:function(e){for(var t=K(this),n=z(arguments.length,1),r=t.entries,i=j(e),a=n<2?void 0:arguments[1],o=a===void 0?a:j(a),s=0;s<r.length;){var c=r[s];if(c.key===i&&(o===void 0||c.value===o)){if(_e(r,s,1),o!==void 0)break}else s++}p||(this.size=r.length),t.updateURL()},get:function(e){var t=K(this).entries;z(arguments.length,1);for(var n=j(e),r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){var t=K(this).entries;z(arguments.length,1);for(var n=j(e),r=[],i=0;i<t.length;i++)t[i].key===n&&J(r,t[i].value);return r},has:function(e){for(var t=K(this).entries,n=z(arguments.length,1),r=j(e),i=n<2?void 0:arguments[1],a=i===void 0?i:j(i),o=0;o<t.length;){var s=t[o++];if(s.key===r&&(a===void 0||s.value===a))return!0}return!1},set:function(e,t){var n=K(this);z(arguments.length,1);for(var r=n.entries,i=!1,a=j(e),o=j(t),s=0,c;s<r.length;s++)c=r[s],c.key===a&&(i?_e(r,s--,1):(i=!0,c.value=o));i||J(r,{key:a,value:o}),p||(this.size=r.length),n.updateURL()},sort:function(){var e=K(this);V(e.entries,function(e,t){return e.key>t.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=K(this).entries,n=D(e,arguments.length>1?arguments[1]:void 0),r=0,i;r<t.length;)i=t[r++],n(i.value,i.key,this)},keys:function(){return new Le(this,`keys`)},values:function(){return new Le(this,`values`)},entries:function(){return new Le(this,`entries`)}},{enumerable:!0}),h(Be,H,Be.entries,{name:`entries`}),h(Be,`toString`,function(){return K(this).serialize()},{enumerable:!0}),p&&g(Be,`size`,{get:function(){return K(this).entries.length},configurable:!0,enumerable:!0}),x(ze,U),n({global:!0,constructor:!0,forced:!m},{URLSearchParams:ze}),!m&&T(ie)){var Ve=f(se.has),Ue=f(se.set),We=function(e){if(A(e)){var t=e.body,n;if(O(t)===U)return n=e.headers?new ie(e.headers):new ie,Ve(n,`content-type`)||Ue(n,`content-type`,`application/x-www-form-urlencoded;charset=UTF-8`),M(e,{body:N(0,j(t)),headers:N(0,n)})}return e};if(T(ne)&&n({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return ne(e,arguments.length>1?We(arguments[1]):{})}}),T(re)){var Ge=function(e){return w(this,oe),new re(e,arguments.length>1?We(arguments[1]):{})};oe.constructor=Ge,Ge.prototype=oe,n({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Ge})}}t.exports={URLSearchParams:ze,getState:K}})),Na=r((()=>{jn();var e=Y(),t=o(),n=ka(),r=i(),a=He(),s=d(),c=q(),l=Ie(),u=X(),f=F(),p=ba(),m=Sn(),h=Se(),g=wn().codeAt,_=Aa(),v=Pe(),y=ye(),b=Pt(),x=Ma(),S=ae(),C=S.set,w=S.getterFor(`URL`),T=x.URLSearchParams,E=x.getState,D=r.URL,O=r.TypeError,k=r.parseInt,A=Math.floor,j=Math.pow,M=s(``.charAt),N=s(/./.exec),P=s([].join),I=s(1 .toString),L=s([].pop),R=s([].push),z=s(``.replace),B=s([].shift),V=s(``.split),H=s(``.slice),U=s(``.toLowerCase),W=s([].unshift),ee=`Invalid authority`,G=`Invalid scheme`,K=`Invalid host`,te=`Invalid port`,ne=/[a-z]/i,re=/[\d+-.a-z]/i,ie=/\d/,oe=/^0x/i,se=/^[0-7]+$/,ce=/^\d+$/,le=/^[\da-f]+$/i,ue=/[\0\t\n\r #%/:<>?@[\\\]^|]/,de=/[\0\t\n\r #/:<>?@[\\\]^|]/,fe=/^[\u0000-\u0020]+/,pe=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,me=/[\t\n\r]/g,J,he=function(e){var t=V(e,`.`),n,r,i,a,o,s,c;if(t.length&&t[t.length-1]===``&&t.length--,n=t.length,n>4)return e;for(r=[],i=0;i<n;i++){if(a=t[i],a===``)return e;if(o=10,a.length>1&&M(a,0)===`0`&&(o=N(oe,a)?16:8,a=H(a,o===8?1:2)),a===``)s=0;else{if(!N(o===10?ce:o===8?se:le,a))return e;s=k(a,o)}R(r,s)}for(i=0;i<n;i++)if(s=r[i],i===n-1){if(s>=j(256,5-n))return null}else if(s>255)return null;for(c=L(r),i=0;i<r.length;i++)c+=r[i]*j(256,3-i);return c},ge=function(e){var t=[0,0,0,0,0,0,0,0],n=0,r=null,i=0,a,o,s,c,l,u,d,f=function(){return M(e,i)};if(f()===`:`){if(M(e,1)!==`:`)return;
vendor: 4,296 bytes, line 37
37i+=2,n++,r=n}for(;f();){if(n===8)return;if(f()===`:`){if(r!==null)return;i++,n++,r=n;continue}for(a=o=0;o<4&&N(le,f());)a=a*16+k(f(),16),i++,o++;if(f()===`.`){if(o===0||(i-=o,n>6))return;for(s=0;f();){if(c=null,s>0){if(f()===`.`&&s<4)i++;else return}if(!N(ie,f()))return;for(;N(ie,f());){if(l=k(f(),10),c===null)c=l;else if(c===0)return;else c=c*10+l;if(c>255)return;i++}t[n]=t[n]*256+c,s++,(s===2||s===4)&&n++}if(s!==4)return;break}if(f()===`:`){if(i++,!f())return}else if(f())return;t[n++]=a}if(r!==null)for(u=n-r,n=7;n!==0&&u>0;)d=t[n],t[n--]=t[r+u-1],t[r+--u]=d;else if(n!==8)return;return t},_e=function(e){for(var t=null,n=1,r=null,i=0,a=0;a<8;a++)e[a]===0?(r===null&&(r=a),++i):(i>n&&(t=r,n=i),r=null,i=0);return i>n?r:t},ve=function(e){var t,n,r,i;if(typeof e==`number`){for(t=[],n=0;n<4;n++)W(t,e%256),e=A(e/256);return P(t,`.`)}if(typeof e==`object`){for(t=``,r=_e(e),n=0;n<8;n++)i&&e[n]===0||(i&&=!1,r===n?(t+=n?`:`:`::`,i=!0):(t+=I(e[n],16),n<7&&(t+=`:`)));return`[`+t+`]`}return e},be={},xe=p({},be,{" ":1,'"':1,"<":1,">":1,"`":1}),Ce=p({},xe,{"#":1,"?":1,"{":1,"}":1}),we=p({},Ce,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Te=function(e,t){var n=g(e,0);return n>32&&n<127&&!f(t,e)?e:encodeURIComponent(e)},Ee={ftp:21,file:null,http:80,https:443,ws:80,wss:443},De=function(e,t){var n;return e.length===2&&N(ne,M(e,0))&&((n=M(e,1))===`:`||!t&&n===`|`)},Oe=function(e){var t;return e.length>1&&De(H(e,0,2))&&(e.length===2||(t=M(e,2))===`/`||t===`\\`||t===`?`||t===`#`)},ke=function(e){return e===`.`||U(e)===`%2e`},Ae=function(e){return e=U(e),e===`..`||e===`%2e.`||e===`.%2e`||e===`%2e%2e`},je={},Me={},Ne={},Fe={},Le={},Re={},ze={},Be={},Ve={},Ue={},We={},Ge={},Ke={},qe={},Je={},Ye={},Xe={},Ze={},Qe={},$e={},et={},tt=function(e,t,n){var r=v(e),i,a,o;if(t){if(a=this.parse(r),a)throw new O(a);this.searchParams=null}else{if(n!==void 0&&(i=new tt(n,!0)),a=this.parse(r,null,i),a)throw new O(a);o=E(new T),o.bindURL(this),this.searchParams=o}};tt.prototype={type:`URL`,parse:function(e,t,n){var r=this,i=t||je,a=0,o=``,s=!1,c=!1,l=!1,u,d,p,g;for(e=v(e),t||(r.scheme=``,r.username=``,r.password=``,r.host=null,r.port=null,r.path=[],r.query=null,r.fragment=null,r.cannotBeABaseURL=!1,e=z(e,fe,``),e=z(e,pe,`$1`)),e=z(e,me,``),u=m(e);a<=u.length;){switch(d=u[a],i){case je:if(d&&N(ne,d))o+=U(d),i=Me;else if(t)return G;else{i=Ne;continue}break;case Me:if(d&&(N(re,d)||d===`+`||d===`-`||d===`.`))o+=U(d);else if(d===`:`){if(t&&(r.isSpecial()!==f(Ee,o)||o===`file`&&(r.includesCredentials()||r.port!==null)||r.scheme===`file`&&!r.host))return;if(r.scheme=o,t){r.isSpecial()&&Ee[r.scheme]===r.port&&(r.port=null);return}o=``,r.scheme===`file`?i=qe:r.isSpecial()&&n&&n.scheme===r.scheme?i=Fe:r.isSpecial()?i=Be:u[a+1]===`/`?(i=Le,a++):(r.cannotBeABaseURL=!0,R(r.path,``),i=Qe)}else if(t)return G;else{o=``,i=Ne,a=0;continue}break;case Ne:if(!n||n.cannotBeABaseURL&&d!==`#`)return G;if(n.cannotBeABaseURL&&d===`#`){r.scheme=n.scheme,r.path=h(n.path),r.query=n.query,r.fragment=``,r.cannotBeABaseURL=!0,i=et;break}i=n.scheme===`file`?qe:Re;continue;case Fe:if(d===`/`&&u[a+1]===`/`)i=Ve,a++;else{i=Re;continue}break;case Le:if(d===`/`){i=Ue;break}i=Ze;continue;case Re:if(r.scheme=n.scheme,d===J)r.username=n.username,r.password=n.password,r.host=n.host,r.port=n.port,r.path=h(n.path),r.query=n.query;else if(d===`/`||d===`\\`&&r.isSpecial())i=ze;else if(d===`?`)r.username=n.username,r.password=n.password,r.host=n.host,r.port=n.port,r.path=h(n.path),r.query=``,i=$e;else if(d===`#`)r.username=n.username,r.password=n.password,r.host=n.host,r.port=n.port,r.path=h(n.path),r.query=n.query,r.fragment=``,i=et;else{r.username=n.username,r.password=n.password,r.host=n.host,r.port=n.port,r.path=h(n.path),r.path.length--,i=Ze;continue}break;case ze:if(r.isSpecial()&&(d===`/`||d===`\\`))i=Ve;else if(d===`/`)i=Ue;else{r.username=n.username,r.password=n.password,r.host=n.host,r.port=n.port,i=Ze;continue}break;case Be:if(i=Ve,d!==`/`||M(o,a+1)!==`/`)continue;a++;break;case Ve:if(d!==`/`&&d!==`\\`){i=Ue;continue}break;case Ue:if(d===`@`){s&&(o=`%40`+o),s=!0,p=m(o);for(var _=0;_<p.length;_++){var y=p[_];if(y===`:`&&!l){l=!0;continue}var b=Te(y,we);l?r.password+=b:r.username+=b}o=``}else if(d===J||d===`/`||d===`?`||d===`#`||d===`\\`&&r.isSpecial()){if(s&&o===``)return ee;
37a-=m(o).length+1,o=``,i=We}else o+=d;break;case We:case Ge:if(t&&r.scheme===`file`){i=Ye;continue}if(d===`:`&&!c){if(o===``)return K;if(g=r.parseHost(o),g)return g;if(o=``,i=Ke,t===Ge)return}else if(d===J||d===`/`||d===`?`||d===`#`||d===`\\`&&r.isSpecial()){if(r.isSpecial()&&o===``)return K;if(t&&o===``&&(r.includesCredentials()||r.port!==null))return;if(g=r.parseHost(o),g)return g;if(o=``,i=Xe,t)return;continue}else d===`[`?c=!0:d===`]`&&(c=!1),o+=d;break;case Ke:if(N(ie,d))o+=d;else if(d===J||d===`/`||d===`?`||d===`#`||d===`\\`&&r.isSpecial()||t){if(o!==``){var x=k(o,10);if(x>65535)return te;r.port=r.isSpecial()&&x===Ee[r.scheme]?null:x,o=``}if(t)return;i=Xe;continue}else return te;break;case qe:if(r.scheme=`file`,d===`/`||d===`\\`)i=Je;else if(n&&n.scheme===`file`)switch(d){case J:r.host=n.host,r.path=h(n.path),r.query=n.query;break;case`?`:r.host=n.host,r.path=h(n.path),r.query=``,i=$e;break;case`#`:r.host=n.host,r.path=h(n.path),r.query=n.query,r.fragment=``,i=et;break;default:Oe(P(h(u,a),``))||(r.host=n.host,r.path=h(n.path),r.shortenPath()),i=Ze;continue}else{i=Ze;continue}break;case Je:if(d===`/`||d===`\\`){i=Ye;break}n&&n.scheme===`file`&&!Oe(P(h(u,a),``))&&(De(n.path[0],!0)?R(r.path,n.path[0]):r.host=n.host),i=Ze;continue;case Ye:if(d===J||d===`/`||d===`\\`||d===`?`||d===`#`){if(!t&&De(o))i=Ze;else if(o===``){if(r.host=``,t)return;i=Xe}else{if(g=r.parseHost(o),g)return g;if(r.host===`localhost`&&(r.host=``),t)return;o=``,i=Xe}continue}o+=d;break;case Xe:if(r.isSpecial()){if(i=Ze,d!==`/`&&d!==`\\`)continue}else if(!t&&d===`?`)r.query=``,i=$e;else if(!t&&d===`#`)r.fragment=``,i=et;else if(d!==J&&(i=Ze,d!==`/`))continue;break;case Ze:if(d===J||d===`/`||d===`\\`&&r.isSpecial()||!t&&(d===`?`||d===`#`)){if(Ae(o)?(r.shortenPath(),d!==`/`&&!(d===`\\`&&r.isSpecial())&&R(r.path,``)):ke(o)?d!==`/`&&!(d===`\\`&&r.isSpecial())&&R(r.path,``):(r.scheme===`file`&&!r.path.length&&De(o
vendor: 4,924 bytes, line 37
37)&&(r.host&&=``,o=M(o,0)+`:`),R(r.path,o)),o=``,r.scheme===`file`&&(d===J||d===`?`||d===`#`))for(;r.path.length>1&&r.path[0]===``;)B(r.path);d===`?`?(r.query=``,i=$e):d===`#`&&(r.fragment=``,i=et)}else o+=Te(d,Ce);break;case Qe:d===`?`?(r.query=``,i=$e):d===`#`?(r.fragment=``,i=et):d!==J&&(r.path[0]+=Te(d,be));break;case $e:!t&&d===`#`?(r.fragment=``,i=et):d!==J&&(d===`'`&&r.isSpecial()?r.query+=`%27`:d===`#`?r.query+=`%23`:r.query+=Te(d,be));break;case et:d!==J&&(r.fragment+=Te(d,xe))}a++}},parseHost:function(e){var t,n,r;if(M(e,0)===`[`){if(M(e,e.length-1)!==`]`||(t=ge(H(e,1,-1)),!t))return K;this.host=t}else if(this.isSpecial()){if(e=_(e),N(ue,e)||(t=he(e),t===null))return K;this.host=t}else{if(N(de,e))return K;for(t=``,n=m(e),r=0;r<n.length;r++)t+=Te(n[r],be);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme===`file`},includesCredentials:function(){return this.username!==``||this.password!==``},isSpecial:function(){return f(Ee,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;t&&(this.scheme!==`file`||t!==1||!De(e[0],!0))&&e.length--},serialize:function(){var e=this,t=e.scheme,n=e.username,r=e.password,i=e.host,a=e.port,o=e.path,s=e.query,c=e.fragment,l=t+`:`;return i===null?t===`file`&&(l+=`//`):(l+=`//`,e.includesCredentials()&&(l+=n+(r?`:`+r:``)+`@`),l+=ve(i),a!==null&&(l+=`:`+a)),l+=e.cannotBeABaseURL?o[0]:o.length?`/`+P(o,`/`):``,s!==null&&(l+=`?`+s),c!==null&&(l+=`#`+c),l},setHref:function(e){var t=this.parse(e);if(t)throw new O(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if(e===`blob`)try{return new nt(e.path[0]).origin}catch{return`null`}return e===`file`||!this.isSpecial()?`null`:e+`://`+ve(this.host)+(t===null?``:`:`+t)},getProtocol:function(){return this.scheme+`:`},setProtocol:function(e){this.parse(v(e)+`:`,je)},getUsername:function(){return this.username},setUsername:function(e){var t=m(v(e));if(!this.cannotHaveUsernamePasswordPort()){this.username=``;for(var n=0;n<t.length;n++)this.username+=Te(t[n],we)}},getPassword:function(){return this.password},setPassword:function(e){var t=m(v(e));if(!this.cannotHaveUsernamePasswordPort()){this.password=``;for(var n=0;n<t.length;n++)this.password+=Te(t[n],we)}},getHost:function(){var e=this.host,t=this.port;return e===null?``:t===null?ve(e):ve(e)+`:`+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,We)},getHostname:function(){var e=this.host;return e===null?``:ve(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Ge)},getPort:function(){var e=this.port;return e===null?``:v(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(e=v(e),e===``?this.port=null:this.parse(e,Ke))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?`/`+P(e,`/`):``},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,Xe))},getSearch:function(){var e=this.query;return e?`?`+e:``},setSearch:function(e){e=v(e),e===``?this.query=null:(M(e,0)===`?`&&(e=H(e,1)),this.query=``,this.parse(e,$e)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?`#`+e:``},setHash:function(e){if(e=v(e),e===``){this.fragment=null;return}M(e,0)===`#`&&(e=H(e,1)),this.fragment=``,this.parse(e,et)},update:function(){this.query=this.searchParams.serialize()||null}};var nt=function(e){var n=u(this,rt),r=C(n,new tt(e,!1,b(arguments.length,1)>1?arguments[1]:void 0));t||(n.href=r.serialize(),n.origin=r.getOrigin(),n.protocol=r.getProtocol(),n.username=r.getUsername(),n.password=r.getPassword(),n.host=r.getHost(),n.hostname=r.getHostname(),n.port=r.getPort(),n.pathname=r.getPathname(),n.search=r.getSearch(),n.searchParams=r.getSearchParams(),n.hash=r.getHash())},rt=nt.prototype,it=function(e,t){return{get:function(){return w(this)[e]()},set:t&&function(e){return w(this)[t](e)},configurable:!0,enumerable:!0}};if(t&&(l(rt,`href`,it(`serialize`,`setHref`)),l(rt,`origin`,it(`getOrigin`)),l(rt,`protocol`,it(`getProtocol`,`setProtocol`)),l(rt,`username`,it(`getUsername`,`setUsername`)),l(rt,`password`,it(`getPassword`,`setPassword`)),l(rt,`host`,it(`getHost`,`setHost`)),l(rt,`hostname`,it(`getHostname`,`setHostname`)),l(rt,`port`,it(`getPort`,`setPort`)),l(rt,`pathname`,it(`getPathname`,`setPathname`)),l(rt,`search`,it(`getSearch`,`setSearch`)),l(rt,`searchParams`,it(`getSearchParams`)),l(rt,`hash`,it(`getHash`,`setHash`))),c(rt,`toJSON`,function(){return w(this).serialize()},{enumerable:!0}),c(rt,`toString`,function(){return w(this).serialize()},{enumerable:!0}),D){var at=D.createObjectURL,ot=D.revokeObjectURL;at&&c(nt,`createObjectURL`,a(at,D)),ot&&c(nt,`revokeObjectURL`,a(ot,D))}y(nt,`URL`),e({global:!0,constructor:!0,forced:!n,sham:!t},{URL:nt})})),Pa=r((()=>{Na()})),Fa=r((()=>{Ma()})),Ia=r((e=>{var t=t===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:t;
37Object.defineProperty(e,"__esModule",{value:!0}),be(),Me();var n=_t(),r=gt(),i=lt(),a=dt(),o=ft(),s=fa(),c=ht();bt(),cn(),Wn(),Br(),jn(),Gn();var l=ot(),u=vn();bn(),vt(),Tt();var d=ut();Cn();var f=Mn();Oa(),nt(),nr(),ca(),sr(),Q(),hr(),Qe(),xa(),Pa(),Fa();var p=Vr(),m=Or();function h(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}function g(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var _=h(n),v=h(r),y=h(i),b=h(a),x=h(o),S=h(s),C=h(c),w=h(l),T=h(u),E=h(d),D=g(f),O={exports:{}},k=typeof crypto<`u`&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<`u`&&typeof window.msCrypto.getRandomValues==`function`&&msCrypto.getRandomValues.bind(msCrypto);if(k){var A=new Uint8Array(16);O.exports=function(){return k(A),A}}else{var j=Array(16);O.exports=function(){for(var e=0,t;e<16;e++)e&3||(t=Math.random()*4294967296),j[e]=t>>>((e&3)<<3)&255;return j}}for(var M=[],N=0;N<256;++N)M[N]=(N+256).toString(16).substr(1);function P(e,t){var n=t||0,r=M;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],`-`,r[e[n++]],r[e[n++]],`-`,r[e[n++]],r[e[n++]],`-`,r[e[n++]],r[e[n++]],`-`,r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join(``)}var F=P,I=O.exports,L=F,R,z,B=0,V=0;function H(e,t,n){var r=t&&n||0,i=t||[];e||={};var a=e.node||R,o=e.clockseq===void 0?z:e.clockseq;if(a==null||o==null){var s=I();a??=R=[s[0]|1,s[1],s[2],s[3],s[4],s[5]],o??=z=(s[6]<<8|s[7])&16383}var c=e.msecs===void 0?new Date().getTime():e.msecs,l=e.nsecs===void 0?V+1:e.nsecs,u=c-B+(l-V)/1e4;if(u<0&&e.clockseq===void 0&&(o=o+1&16383),(u<0||c>B)&&e.nsecs===void 0&&(l=0),l>=1e4)throw Error(`uuid.v1(): Can't create more than 10M uuids/sec`);B=c,V=l,z=o,c+=0xb1d069b5400;var d=((c&268435455)*1e4+l)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var f=c/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=f&255,i[r++]=f>>>24&15|16,i[r++]=f>>>16&255,i[r++]=o>>>8|128,i[r++]=o&255;for(var p=0;p<6;++p)i[r+p]=a[p];return t||L(i)}var U=H,W=O.exports,ee=F;function G(e,t,n){var r=t&&n||0;typeof e==`string`&&(t=e===`binary`?Array(16):null,e=null),e||={};var i=e.random||(e.rng||W)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var a=0;a<16;++a)t[r+a]=i[a];return t||ee(i)}var K=G,te=U,ne=K,re=ne;re.v1=te,re.v4=ne;var ie=re;function ae(e){var t=oe();return function(){var n=x.default(e),r;if(t){var i=x.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return b.default(this,r)}}function oe(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var q=function(e){y.default(n,e);var t=ae(n);function n(e){var r;_.default(this,n);var i=ie.v4(),a;return r=t.call(this,function(t,r){return a=r,e(function(e){n.cancellationMap.delete(i),t(e)},function(e){n.cancellationMap.delete(i),r(e)},function(e){n.cancellationMap.set(i,e)})}),r.id=i,r.rejectPromise=a,r}return v.default(n,[{key:`cancel`,value:function(){return n.cancellationMap.get(this.id)?.(),this.rejectPromise&&(this.catch(function(){}),this.rejectPromise(Error(`Promise was cancelled`))),this}}]),n}(S.default(Promise));C.default(q,`cancellationMap`,new Map);function se(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if((typeof Reflect>`u`?`undefined`:E.default(Reflect))===`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function ce(e,t){if((typeof Reflect>`u`?`undefined`:E.default(Reflect))===`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function le(e,t){return[`${new Date().toISOString()} MCS Client ${e}:`].concat(Array.from(t))}var ue=function(){function e(t){_.default(this,e),C.default(this,`prefix`,``),this.prefix=t!=null&&t.length>0?t+` `:``}return v.default(e,[{key:`setLevel`,value:function(e){D.setLevel(e)}},{key:`trace`,value:function(){if(D.getLevel()==D.levels.TRACE){var e=[...arguments];D.debug.apply(null,le(this.prefix+`T`,e))}}},{key:`debug`,value:function(){var e=[...arguments];D.debug.apply(null,le(this.prefix+`D`,e))}}
37,{key:`info`,value:function(){var e=[...arguments];D.info.apply(null,le(this.prefix+`I`,e))}},{key:`warn`,value:function(){var e=[...arguments];D.warn.apply(null,le(this.prefix+`W`,e))}},{key:`error`,value:function(){var e=[...arguments];D.error.apply(null,le(this.prefix+`E`,e))}}],[{key:`scope`,value:function(t){return new e(t)}},{key:`setLevel`,value:function(e){D.setLevel(e)}},{key:`trace`,value:function(){if(D.getLevel()==D.levels.TRACE){var e=[...arguments];D.debug.apply(null,le(`T`,e))}}},{key:`debug`,value:function(){var e=[...arguments];D.debug.apply(null,le(`D`,e))}},{key:`info`,value:function(){var e=[...arguments];D.info.apply(null,le(`I`,e))}},{key:`warn`,value:function(){var e=[...arguments];D.warn.apply(null,le(`W`,e))}},{key:`error`,value:function(){var e=[...arguments];D.error.apply(null,le(`E`,e))}}]),e}(),de=1e3,fe=4e3,pe=3,me=!0,J=function(e){return`https://mcs.${e??`us1`}.twilio.com`},he=function(e){return e.startsWith(`http`)},ge=function(e,t){return`${he(e)?``:J(t)}${e}`},_e=function(){function e(t,n,r,i){_.default(this,e);var a=i.MCS??i??{};this.region=a.region??i.region??`us1`,this.mediaUrl=ge(n,this.region),this.mediaSetUrl=r?ge(r):`${this.mediaUrl}Set`,this.token=t,this.retryWhenThrottledOverride=a.retryWhenThrottledOverride??me,this.backoffConfigOverride=a.backoffConfigOverride??e.backoffConfigDefault}return v.default(e,[{key:`updateToken`,value:function(e){this.token=e}}],[{key:`backoffConfigDefault`,get:function(){return{min:de,max:fe,maxAttemptsCount:pe}}},{key:`retryWhenThrottledDefault`,get:function(){return me}}]),e}(),ve=function(){function e(t,n,r){_.default(this,e),this.config=t,this.network=n,this._update(r)}return v.default(e,[{key:`sid`,get:function(){return this.state.sid}},{key:`serviceSid`,get:function(){return this.state.serviceSid}},{key:`dateCreated`,get:function(){return this.state.dateCreated}},{key:`dateUpdated`,get:function(){return this.state.dateUpdated}},{key:`contentType`,get:function(){return this.state.contentType}},{key:`size`,get:function(){return this.state.size}},{key:`fileName`,get:function(){return this.state.filename}},{key:`filename`,get:function(){return this.state.filename}},{key:`category`,get:function(){return this.state.category}},{key:`getContentUrl`,value:function(){var e=this;return new q(function(){var t=w.default(T.default.mark(function t(n,r,i){var a,o;return T.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.network.get(`${e.config.mediaUrl}/${e.sid}`),i(function(){return a.cancel()}),t.prev=2,t.next=5,a;case 5:o=t.sent,e._update(o.body),n(e.state.contentDirectUrl),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(2),r(t.t0);case 13:case`end`:return t.stop()}},t,null,[[2,10]])}));return function(e,n,r){return t.apply(this,arguments)}}())}},{key:`_update`,value:function(e){this.state={sid:e.sid,serviceSid:e.service_sid,channelSid:e.channel_sid,messageSid:e.message_sid,dateCreated:e.date_created?new Date(e.date_created):null,dateUploadUpdated:e.date_upload_updated?new Date(e.date_upload_updated):null,dateUpdated:e.date_updated?new Date(e.date_updated):null,size:e.size,contentType:e.content_type,author:e.author,url:e.url,contentUrl:e.links.content,contentDirectUrl:e.links.content_direct_temporary??null,filename:e.filename??null,category:e.category??`media`,isMultipartUpstream:e.is_multipart_upstream??!1}}},{key:`_state`,value:function(){return{sid:this.state.sid,category:this.state.category,filename:this.state.filename??null,contentType:this.state.contentType,size:this.state.size}}}]),e}();function Y(e){var t=ye();return function(){var n=x.default(e),r;if(t){var i=x.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return b.default(this,r)}}function ye(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var xe=function(e){y.default(n,e);var t=Y(n);function n(e,r,i,a,o){var s;return _.default(this,n),s=t.call(this,e),s.code=r,s.body=i,s.status=a,s.headers=o,s}return v.default(n)}(S.default(Error)),Se=t.XMLHttpRequest||{};function Ce(e){return e?e.split(`\r 38`).map(function(e){return e.split(`: `)}).filter(function(e){return e.length===2&&e[1].length>0}).reduce(function(e,t){return e[t[0]]=t[1],e},{}):{}}function we(e){var t=e.getResponseHeader(`Content-Type`);if(!t||t.indexOf(`application/json`)!==0||e.responseText.length===0)return e.responseText;try{return JSON.parse(e.responseText)}catch{return e.responseText}}var Te=function(){function e(){_.default(this,e)}return v.default(e,[{key:`get`,value:function(t,n){return e.request(`GET`,t,n)}},{key:`post`,value:function(t,n,r){return e.request(`POST`,t,n,r)}}],[{key:`request`,value:function(e,t,n,r){return new q(function(i,a,o){var s=new Se,c=!1;for(var l in o(function(){s.abort(),c=!0}),s.open(e,t,!0),s.onreadystatechange=function(){if(!(s.readyState!==4||c)){var e=Ce(s.getAllResponseHeaders()),t=we(s);if(200<=s.status&&s.status<300)i({status:s.status,headers:e,body:t});else{var n=s.statusText??`NONE`,r;if(typeof t==`string`){if(t&&t.split(` 39`,2).length===1)r=t;else{var o=t.replace(/<.*?>/g,``).split(/\r\n/g).filter(function(e){return e.length}
39)[0]?.split(` `);r=o?.length>2?o?.slice(1).join(` `):``}}else r=JSON.stringify(t);a(new xe(`${s.status}: [${n}] ${r}`,s.status,t,n,e))}}},n)s.setRequestHeader(l,n[l]),l===`Content-Type`&&n[l]===`application/json`&&(r=JSON.stringify(r));s.send(r)})}}]),e}(),Ee=ue.scope(`Network`),De=function(){function e(t,n){_.default(this,e),this.config=t,this.transport=n}return v.default(e,[{key:`backoffConfig`,value:function(){return Object.assign(_e.backoffConfigDefault,this.config.backoffConfigOverride)}},{key:`retryWhenThrottled`,value:function(){return this.config.retryWhenThrottledOverride??_e.retryWhenThrottledDefault??!1}},{key:`executeWithRetry`,value:function(e,t){var n=this;return new q(function(){var r=w.default(T.default.mark(function r(i,a,o){var s,c;return T.default.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:s=new p.Retrier(n.backoffConfig()),c=[502,503,504],t&&c.push(429),o(function(){s.cancel(),s.removeAllListeners()}),s.on(`attempt`,w.default(T.default.mark(function t(){var n,r;return T.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,n=e(),o(function(){n.cancel(),s.cancel(),s.removeAllListeners()}),t.next=5,n;case 5:r=t.sent,s.succeeded(r),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),c.indexOf(t.t0.status)>-1||t.t0.message===`Twilsock disconnected`?s.failed(t.t0):(s.removeAllListeners(),s.cancel(),a(t.t0));case 12:case`end`:return t.stop()}},t,null,[[0,9]])}))),s.on(`succeeded`,function(e){i(e)}),s.on(`cancelled`,function(e){return a(e)}),s.on(`failed`,function(e){return a(e)}),s.start();case 9:case`end`:return r.stop()}},r)}));return function(e,t,n){return r.apply(this,arguments)}}())}},{key:`get`,value:function(e){var t=this;return new q(function(){var n=w.default(T.default.mark(function n(r,i,a){var o,s,c;return T.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return o={"X-Twilio-Token":t.config.token},s=t.executeWithRetry(function(){return t.transport.get(e,o)},t.retryWhenThrottled()),Ee.trace(`sending GET request to `,e,` headers `,o),a(function(){return s.cancel()}),n.prev=4,n.next=7,s;case 7:c=n.sent,Ee.trace(`response`,c),r(c),n.next=16;break;case 12:n.prev=12,n.t0=n.catch(4),Ee.debug(`get() error ${n.t0}`),i(n.t0);case 16:case`end`:return n.stop()}},n,null,[[4,12]])}));return function(e,t,r){return n.apply(this,arguments)}}())}},{key:`post`,value:function(e,n,r,i,a){var o=this,s={"X-Twilio-Token":this.config.token};(typeof FormData>`u`||!(r instanceof FormData))&&i&&Object.assign(s,{"Content-Type":i});var c=new URL(e);return n&&c.searchParams.append(`Category`,n),a&&c.searchParams.append(`Filename`,a),new q(function(){var n=w.default(T.default.mark(function n(i,a,l){var u,d;return T.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return u=o.transport.post(c.href,s,r),l(function(){return u.cancel()}),Ee.trace(`sending POST request to ${e} with headers ${s}`),n.prev=3,n.next=6,u;case 6:d=n.sent,n.next=17;break;case 9:if(n.prev=9,n.t0=n.catch(3),!(t.XMLHttpRequest===void 0&&r instanceof FormData)){n.next=14;break}return a(TypeError(`Posting FormData supported only with browser engine's FormData`)),n.abrupt(`return`);case 14:return Ee.debug(`post() error ${n.t0}`),a(n.t0),n.abrupt(`return`);case 17:Ee.trace(`response`,d),i(d);case 19:case`end`:return n.stop()}},n,null,[[3,9]])}));return function(e,t,r){return n.apply(this,arguments)}}())}}]),e}(),Oe=`0.7.0`,ke,Ae=ue.scope(``);e.default=(ke=function(){function e(t,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};_.default(this,e),this.options=i,this.options.logLevel=this.options.logLevel??`silent`,this.config=new _e(t,n,r,this.options),Ae.setLevel(this.options.logLevel),this.options.transport=this.options.transport??new Te,this.transport=this.options.transport,this.network=new De(this.config,this.transport)}return v.default(e,[{key:`updateToken`,value:function(e){Ae.info(`updateToken`),this.config.updateToken(e)}},{key:`get`,value:function(e){var t=this;return new q(function(){var n=w.default(T.default.mark(function n(r,i,a){var o,s;return T.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return o=t.network.get(`${t.config.mediaUrl}/${e}`),a(function(){return o.cancel()}),n.prev=2,n.next=5,o;case 5:s=n.sent,r(new ve(t.config,t.network,s.body)),n.next=12;break;case 9:n.prev=9,n.t0=n.catch(2),i(n.t0);case 12:case`end`:return n.stop()}},n,null,[[2,9]])}
39));return function(e,t,r){return n.apply(this,arguments)}}())}},{key:`post`,value:function(e,t,n,r){var i=this;return new q(function(){var a=w.default(T.default.mark(function a(o,s,c){var l,u;return T.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return l=i.network.post(i.config.mediaUrl,n??`media`,t,e,r),c(function(){return l.cancel()}),a.prev=2,a.next=5,l;case 5:u=a.sent,o(new ve(i.config,i.network,u.body)),a.next=12;break;case 9:a.prev=9,a.t0=a.catch(2),s(a.t0);case 12:case`end`:return a.stop()}},a,null,[[2,9]])}));return function(e,t,n){return a.apply(this,arguments)}}())}},{key:`postFormData`,value:function(e,t){var n=this;return new q(function(){var r=w.default(T.default.mark(function r(i,a,o){var s,c;return T.default.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return s=n.network.post(n.config.mediaUrl,t??`media`,e),o(function(){return s.cancel()}),r.prev=2,r.next=5,s;case 5:c=r.sent,i(new ve(n.config,n.network,c.body)),r.next=12;break;case 9:r.prev=9,r.t0=r.catch(2),a(r.t0);case 12:case`end`:return r.stop()}},r,null,[[2,9]])}));return function(e,t,n){return r.apply(this,arguments)}}())}},{key:`mediaSetGet`,value:function(e){var t=this;return new q(function(){var n=w.default(T.default.mark(function n(r,i,a){var o,s,c,l;return T.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return o={command:`get`,list:e.map(function(e){return{media_sid:e}})},s=t.network.post(`${t.config.mediaSetUrl}`,null,o,`application/json`),a(function(){return s.cancel()}),n.prev=3,n.next=6,s;case 6:c=n.sent,l=c.body.map(function(e){if(e.code!==200){i(`Failed to obtain detailed information about Media items (failed SID ${e.media_record.sid})`);return}return new ve(t.config,t.network,e.media_record)}),r(l),n.next=14;break;case 11:n.prev=11,n.t0=n.catch(3),i(n.t0);case 14:case`end`:return n.stop()}},n,null,[[3,11]])}));return function(e,t,r){return n.apply(this,arguments)}}())}},{key:`mediaSetGetContentUrls`,value:function(e){var t=this;return new q(function(){var n=w.default(T.default.mark(function n(r,i,a){var o,s,c,l;return T.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return o={command:`get`,list:e.map(function(e){return{media_sid:e}})},s=t.network.post(`${t.config.mediaSetUrl}`,null,o,`application/json`),a(function(){return s.cancel()}),n.prev=3,n.next=6,s;case 6:c=n.sent,l=new Map,c.body.forEach(function(e){if(e.code!==200){i(`Failed to obtain detailed information about Media items (failed SID ${e.media_record.sid})`);return}l.set(e.media_record.sid,e.media_record.links.content_direct_temporary)}),r(l),n.next=15;break;case 12:n.prev=12,n.t0=n.catch(3),i(n.t0);case 15:case`end`:return n.stop()}},n,null,[[3,12]])}));return function(e,t,r){return n.apply(this,arguments)}}())}}]),e}(),C.default(ke,`version`,Oe),ke),se([m.validateTypes(m.nonEmptyString),ce(`design:type`,Function),ce(`design:paramtypes`,[String]),ce(`design:returntype`,void 0)],e.default.prototype,`updateToken`,null),se([m.validateTypesAsync(m.nonEmptyString),ce(`design:type`,Function),ce(`design:paramtypes`,[String]),ce(`design:returntype`,q)],e.default.prototype,`get`,null),e.default=se([m.validateConstructorTypes(m.nonEmptyString,m.nonEmptyString,[m.nonEmptyString,m.literal(null)],[m.pureObject,`undefined`]),ce(`design:paramtypes`,[String,String,Object,Object])],e.default),e.CancellablePromise=q,e.Client=e.default,e.McsClient=e.default,e.McsMedia=ve,e.Media=ve})),La=r((()=>{var e=Y(),t=i(),n=yi(),r=Mt(),a=`ArrayBuffer`,o=n[a],s=t[a];e({global:!0,constructor:!0,forced:s!==o},{ArrayBuffer:o}),r(a)})),Ra=r(((e,t)=>{t.exports=window.FormData})),za=r((()=>{var e=Y(),t=d(),n=Ea(),r=h(),i=Pe(),a=Da(),o=t(``.indexOf);e({target:`String`,proto:!0,forced:!a(`includes`)},{includes:function(e){return!!~o(i(r(this)),i(n(e)),arguments.length>1?arguments[1]:void 0)}})})),Ba=r(((e,t)=>{var n=d(),r=Lr(),i=Fr().getWeakData,a=X(),o=W(),s=m(),c=v(),l=Qt(),u=Ke(),f=F(),p=ae(),h=p.set,g=p.getterFor,_=u.find,y=u.findIndex,b=n([].splice),x=0,S=function(e){return e.frozen||=new C},C=function(){this.entries=[]},w=function(e,t){return _(e.entries,function(e){return e[0]===t})};C.prototype={get:function(e){var t=w(this,e);if(t)return t[1]},has:function(e){return!!w(this,e)},set:function(e,t){var n=w(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=y(this.entries,function(t){return t[0]===e});return~t&&b(this.entries,t,1),!!~t}},t.exports={getConstructor:function(e,t,n,u){var d=e(function(e,r){a(e,p),h(e,{type:t,id:x++,frozen:null}),s(r)||l(r,e[u],{that:e,AS_ENTRIES:n})}),p=d.prototype,m=g(t),_=function(e,t,n){var r=m(e),a=i(o(t),!0);return a===!0?S(r).set(t,n):a[r.id]=n,e};return r(p,{delete:function(e){var t=m(this);if(!c(e))return!1;var n=i(e);return n===!0?S(t).delete(e):n&&f(n,t.id)&&delete n[t.id]},has:function(e){var t=m(this);if(!c(e))return!1;var n=i(e);return n===!0?S(t).has(e):n&&f(n,t.id)}}),r(p,n?{get:function(e){var t=m(this);if(c(e)){var n=i(e);if(n===!0)return S(t).get(e);if(n)return n[t.id]}},set:function(e,t){return _(this,e,t)}}:{add:function(e){return _(this,e,!0)}}),d}}})),Va=r((()=>
39{Ir()(`WeakSet`,function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},Ba())})),Ha=r((()=>{Va()})),Ua=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),bn();var t=Mn();function n(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}var r=n(t),i=function(e,t,n){return function(r,i,o){if(typeof o.value!=`function`&&o?.get===void 0)throw Error(`The deprecated decorator can only be applied to methods or getters`);if(typeof o.value==`function`){var s=o.value;o.value=function(){a(`The method ${e} is deprecated${t?`, use `+t+` instead`:``}${n?`, `+n:`.`}`);var r=[...arguments];return s.apply(this,r)};return}var c=o.get;o.get=function(){return a(`The getter ${e} is deprecated${t?`, use `+t+` instead`:``}${n?`, `+n:`.`}`),c?.apply(this)}}},a=function(e){var t=r.default.getLevel();r.default.setLevel(`warn`),r.default.warn(e),r.default.setLevel(t)};e.deprecated=i,e.deprecationWarning=a})),Wa=r((()=>{var e=Y(),t=Ke().find,n=Un(),r=`find`,i=!0;r in[]&&[,][r](function(){i=!1}),e({target:`Array`,proto:!0,forced:i},{find:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}}),n(r)})),Ga=r((()=>{var e=Y(),t=Pr(),n=a(),r=v(),i=Fr().onFreeze,o=Object.freeze;e({target:`Object`,stat:!0,forced:n(function(){o(1)}),sham:!t},{freeze:function(e){return o&&r(e)?o(i(e)):e}})})),Ka=r((t=>{var n=n===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:n;Object.defineProperty(t,"__esModule",{value:!0}),be(),Me(),Ne(),et(),nt(),rt(),at();var r=ot(),i=st(),a=lt(),o=dt(),s=ft(),c=ht(),l=gt(),u=_t();vt(),bt(),Tt(),cn();var d=vn(),f=ut();bn(),Cn(),jn();var p=Mn(),m=(Hn(),e(Nn));Wn(),Gn(),Qe(),Xn(),nr(),sr(),Q();var h=Or(),g=Sr();Cr();var _=jr();hr(),cr(),gr(),_r(),vr();var v=mr();Br();var y=Vr(),b=ya(),x=Sa(),S=wa(),C=Ia();Gr(),Tr(),Oi(),ki(),Mi(),Ni(),Pi(),Ii(),Li(),Ri(),zi(),Bi(),Vi(),Hi(),Ui(),Gi(),Ki(),Ji(),Yi(),Xi(),Zi(),Qi(),$i(),ia(),aa(),oa(),sa(),La(),Ra(),Ca(),za(),Oa(),Ha();var w=Ua();Dr(),Wa(),va();var T=fa(),E=ci();Ga();function D(e){return e&&typeof e==`object`&&`default`in e?e:{default:e}}function O(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var k=D(r),A=D(i),j=D(a),M=D(o),N=D(s),P=D(c),F=D(l),I=D(u),L=D(d),R=D(f),z=O(p),B=D(g),V=D(v),H=D(T);function U(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if((typeof Reflect>`u`?`undefined`:R.default(Reflect))===`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function W(e,t){if((typeof Reflect>`u`?`undefined`:R.default(Reflect))===`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function ee(e,t){return[`${new Date().toISOString()} Conversations ${e}:`].concat(Array.from(t))}var G=z.getLogger(`twilio-conversations`),K=function(){function e(t){I.default(this,e),P.default(this,`prefix`,``),this.prefix=t!=null&&t.length>0?t+` `:``}return F.default(e,[{key:`setLevel`,value:function(e){G.setLevel(e)}},{key:`trace`,value:function(){if(G.getLevel()==G.levels.TRACE){var e=[...arguments];G.debug.apply(null,ee(this.prefix+`T`,e))}}},{key:`debug`,value:function(){var e=[...arguments];G.debug.apply(null,ee(this.prefix+`D`,e))}}
39,{key:`info`,value:function(){var e=[...arguments];G.info.apply(null,ee(this.prefix+`I`,e))}},{key:`warn`,value:function(){var e=[...arguments];G.warn.apply(null,ee(this.prefix+`W`,e))}},{key:`error`,value:function(){var e=[...arguments];G.error.apply(null,ee(this.prefix+`E`,e))}}],[{key:`scope`,value:function(t){return new e(t)}},{key:`setLevel`,value:function(e){G.setLevel(e)}},{key:`trace`,value:function(){if(G.getLevel()==G.levels.TRACE){var e=[...arguments];G.debug.apply(null,ee(`T`,e))}}},{key:`debug`,value:function(){var e=[...arguments];G.debug.apply(null,ee(`D`,e))}},{key:`info`,value:function(){var e=[...arguments];G.info.apply(null,ee(`I`,e))}},{key:`warn`,value:function(){var e=[...arguments];G.warn.apply(null,ee(`W`,e))}},{key:`error`,value:function(){var e=[...arguments];G.error.apply(null,ee(`E`,e))}}]),e}();function te(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 ne(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?te(Object(n),!0).forEach(function(t){P.default(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var re=5,ie=`PT5S`,ae=`PT5S`,oe=100,q=1e3,se=4e3,ce=3,le=!0,ue=100,de=1e3,fe=F.default(function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;I.default(this,e),P.default(this,`typingIndicatorTimeoutDefault`,re*1e3);var i=t.Chat||t.IPMessaging||t||{};this.productId=i.productId,this.links={myConversations:n.links.my_conversations,conversations:n.links.conversations,users:n.links.users,currentUser:n.links.current_user,typing:n.links.typing,mediaService:n.links.media_service,mediaSetService:n.links.media_set_service,messagesReceipts:n.links.messages_receipts},this.limits={mediaAttachmentsCountLimit:n.options.media_attachments_count_limit,mediaAttachmentSizeLimitInMb:n.options.media_attachment_size_limit_in_mb,mediaAttachmentsTotalSizeLimitInMb:n.options.media_attachments_total_size_limit_in_mb,emailHistoriesAllowedContentTypes:n.options.email_histories_allowed_mime_types,emailBodiesAllowedContentTypes:n.options.email_bodies_allowed_mime_types},this.typingIndicatorTimeoutOverride=i.typingIndicatorTimeoutOverride,this.backoffConfiguration=ne({min:q,max:se,maxAttemptsCount:ce},i.backoffConfigOverride),this.retryWhenThrottled=i.retryWhenThrottledOverride===void 0?le:i.retryWhenThrottledOverride,this.userInfosToSubscribe=i.userInfosToSubscribeOverride??n.options.user_infos_to_subscribe??oe,this.reachabilityEnabled=n.options.reachability_enabled,this.userIdentity=n.identity,this.userInfo=n.sync_objects.my_user_info,this.myConversations=n.sync_objects.my_conversations;var a=i.httpCacheIntervalOverride??n.options.http_cache_interval??ie;try{this.httpCacheInterval=m.toSeconds(m.parse(a))}catch{r.error(`Failed to parse http cache interval ${a}, using default value ${ie}`),this.httpCacheInterval=m.toSeconds(m.parse(ie))}var o=i.consumptionReportIntervalOverride??n.options.consumption_report_interval??ae;try{this.consumptionReportInterval=m.toSeconds(m.parse(o))}catch{r.error(`Failed to parse consumption report interval ${o}, using default value ${ae}`),this.consumptionReportInterval=m.toSeconds(m.parse(ae))}this.channelMetadataCacheCapacity=t.channelMetadataCacheCapacity??ue,this.messageRecipientsCacheCapacity=t.messageRecipientsCacheCapacity??de});function pe(e){return JSON.parse(JSON.stringify(e))}function me(e){return e!==void 0&&!isNaN(Number(e))?Number(e):null}function J(e){try{return new Date(e)}catch{return null}}function he(e,t,n){var r={};if(e)try{r=JSON.parse(e)}catch(e){n.warn(t,e)}return r}var ge=function(){function e(t){I.default(this,e),this.base=t.replace(/\/$/,``),this.args=[],this.paths=[]}return F.default(e,[{key:`arg`,value:function(e,t){return t!==void 0&&this.args.push(encodeURIComponent(e)+`=`+encodeURIComponent(t)),this}},{key:`path`,value:function(e){return this.paths.push(encodeURIComponent(e)),this}},{key:`build`,value:function(){var e=this.base;return this.paths.length&&(e+=`/`+this.paths.join(`/`)),this.args.length&&(e+=`?`+this.args.join(`&`)),e}}]),e}();function _e(e,t){if(e===t)return!0;
39if(e===null||t===null||e===void 0||t===void 0)return e===t;if(R.default(e)!==R.default(t))return!1;if(R.default(e)!==`object`)return e===t;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(function(e,n){return _e(e,t[n])});if(Array.isArray(e)||Array.isArray(t))return!1;var n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(function(n){return _e(e[n],t[n])})}var ve=h.custom(function(e){return[[`string`,`number`,`boolean`,`object`].includes(R.default(e)),`a JSON type`]}),Y=h.custom(function(e){return[[`undefined`,`string`,`number`,`boolean`,`object`].includes(R.default(e)),`an optional JSON type`]}),ye=h.objectSchema(`send media options`,{contentType:[h.literal(null),`string`],filename:[`string`,`undefined`],media:[h.literal(`null`),`string`].concat(B.default(typeof Buffer==`function`?[Buffer]:[]),B.default(typeof Blob==`function`?[Blob]:[]))});function xe(e){var t=Se();return function(){var n=N.default(e),r;if(t){var i=N.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M.default(this,r)}}function Se(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Ce=K.scope(`User`),we=function(e){j.default(n,e);var t=xe(n);function n(e,r,i,a){var o;return I.default(this,n),o=t.call(this),P.default(A.default(o),`promiseToFetch`,null),P.default(A.default(o),`updated`,`updated`),P.default(A.default(o),`userSubscribed`,`userSubscribed`),P.default(A.default(o),`userUnsubscribed`,`userUnsubscribed`),o.services=a,o.subscribed=`initializing`,o.setMaxListeners(0),o.state={identity:e,entityName:r,friendlyName:null,attributes:{},online:null,notifiable:null},o._initializationPromise=new Promise(function(e){o._resolveInitializationPromise=e}),i!==null&&o._resolveInitialization(i,e,r,!1),o}return F.default(n,[{key:`identity`,get:function(){return this.state.identity},set:function(e){this.state.identity=e}},{key:`entityName`,set:function(e){this.state.entityName=e}},{key:`attributes`,get:function(){return this.state.attributes}},{key:`friendlyName`,get:function(){return this.state.friendlyName}},{key:`isOnline`,get:function(){return this.state.online}},{key:`isNotifiable`,get:function(){return this.state.notifiable}},{key:`isSubscribed`,get:function(){return this.subscribed==`subscribed`}},{key:`_update`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r,i;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._initializationPromise;case 2:r=[],Ce.debug(`User for`,this.state.identity,`updated:`,t,n),e.t0=t,e.next=e.t0===`friendlyName`?7:e.t0===`attributes`?9:e.t0===`reachability`?12:15;break;case 7:return this.state.friendlyName!==n.value&&(r.push(`friendlyName`),this.state.friendlyName=n.value),e.abrupt(`break`,16);case 9:return i=he(n.value,`Retrieved malformed attributes from the server for user: ${this.state.identity}`,Ce),_e(this.state.attributes,i)||(this.state.attributes=i,r.push(`attributes`)),e.abrupt(`break`,16);case 12:return this.state.online!==n.online&&(this.state.online=n.online,r.push(`reachabilityOnline`)),this.state.notifiable!==n.notifiable&&(this.state.notifiable=n.notifiable,r.push(`reachabilityNotifiable`)),e.abrupt(`break`,16);case 15:return e.abrupt(`return`);case 16:r.length>0&&this.emit(`updated`,{user:this,updateReasons:r});case 17:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`_updateReachabilityInfo`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r=this;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._initializationPromise;case 2:if(this.configuration.reachabilityEnabled){e.next=4;break}return e.abrupt(`return`,Promise.resolve());case 4:return e.abrupt(`return`,t.get(`reachability`).then(n).catch(function(e){Ce.warn(`Failed to get reachability info for `,r.state.identity,e)}));case 5:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`_fetch`,value:function(){var e=k.default(L.default.mark(function e(){var t=this;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._initializationPromise;case 2:if(this.state.entityName){e.next=4;break}return e.abrupt(`return`,this);case 4:return this.promiseToFetch=this.services.syncClient.map({id:this.state.entityName,mode:`open_existing`,includeItems:!0}).then(function(e){return t.entity=e,e.on(`itemUpdated`,function(e){return Ce.debug(t.state.entityName+` (`+t.state.identity+`) itemUpdated: `+e.item.key),t._update(e.item.key,e.item.data)}),e.on(`itemAdded`,function(e){return Ce.debug(t.state.entityName+` (`+t.state.identity+`) itemAdded: `+e.item.key),t._update(e.item.key,e.item.data)}),Promise.all([e.get(`friendlyName`).then(function(e){return t._update(e.key,e.data)}),e.get(`attributes`).then(function(e){return t._update(e.key,e.data)}),t._updateReachabilityInfo(e,function(e){return t._update(e.key,e.data)})])}).then(function(){return Ce.debug(`Fetched for`,t.identity),t.subscribed=`subscribed`,t.emit(`userSubscribed`,t),t}).catch(function(e){throw t.promiseToFetch=null,e}),e.abrupt(`return`,this.promiseToFetch);case 6:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`_ensureFetched`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._initializationPromise;case 2:return e.abrupt(`return`,this.promiseToFetch||this._fetch());case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`updateAttributes`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._initializationPromise;case 2:if(this.subscribed!=`unsubscribed`){e.next=4;break}throw Error(`Can't modify unsubscribed object`);case 4:return e.next=6,this.services.commandExecutor.mutateResource(`post`,this.links.self,{attributes:JSON.stringify(t)});case 6:return e.abrupt(`return`,this);case 7:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`updateFriendlyName`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._initializationPromise;case 2:if(this.subscribed!=`unsubscribed`){e.next=4;break}throw Error(`Can't modify unsubscribed object`);case 4:return e.next=6,this.services.commandExecutor.mutateResource(`post`,this.links.self,{friendly_name:t});case 6:return e.abrupt(`return`,this);case 7:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`unsubscribe`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._initializationPromise;case 2:if(!this.promiseToFetch){e.next=9;break}return e.next=5,this.promiseToFetch;case 5:this.entity.close(),this.promiseToFetch=null,this.subscribed=`unsubscribed`,this.emit
39(`userUnsubscribed`,this);case 9:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`_resolveInitialization`,value:function(e,t,n,r){this.configuration=e,this.identity=t,this.entityName=n,this.links={self:`${this.configuration.links.users}/${encodeURIComponent(this.identity)}`},this._resolveInitializationPromise(),r&&this.emit(`updated`,{user:this,updateReasons:[`friendlyName`,`attributes`,`reachabilityOnline`,`reachabilityNotifiable`]})}}]),n}(_.ReplayEventEmitter);U([h.validateTypesAsync(ve),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Promise)],we.prototype,`updateAttributes`,null),U([h.validateTypesAsync([`string`]),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],we.prototype,`updateFriendlyName`,null);function Te(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Ee(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 40In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function Ee(e,t){if(e){if(typeof e==`string`)return De(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return De(e,t)}}function De(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Oe=function(){function e(t,n){I.default(this,e),this.configuration=t,this.services=n,this.cache=new Map,this.cacheLifetime=this.configuration.httpCacheInterval*100,this.cleanupCache()}return F.default(e,[{key:`isExpired`,value:function(e){return!this.cacheLifetime||Date.now()-e>this.cacheLifetime}},{key:`cleanupCache`,value:function(){var e=Te(this.cache),t;try{for(e.s();!(t=e.n()).done;){var n=V.default(t.value,2),r=n[0],i=n[1];this.isExpired(i.timestamp)&&this.cache.delete(r)}}catch(t){e.e(t)}finally{e.f()}this.cache.size===0&&clearInterval(this.timer)}},{key:`pokeTimer`,value:function(){var e=this;this.timer=this.timer||setInterval(function(){return e.cleanupCache()},this.cacheLifetime*2)}},{key:`executeWithRetry`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return new Promise(function(r,i){var a=[502,503,504];n&&a.push(429);var o=new y.Retrier(t.configuration.backoffConfiguration);o.on(`attempt`,function(){e().then(function(e){return o.succeeded(e)}).catch(function(e){a.indexOf(e.status)>-1||e.message===`Twilsock disconnected`?o.failed(e):(o.removeAllListeners(),o.cancel(),i(e))})}),o.on(`succeeded`,function(e){r(e)}),o.on(`cancelled`,function(e){return i(e)}),o.on(`failed`,function(e){return i(e)}),o.start()})}},{key:`get`,value:function(){var e=k.default(L.default.mark(function e(t){var n=this,r,i,a;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.cache.get(t),!(r&&!this.isExpired(r.timestamp))){e.next=3;break}return e.abrupt(`return`,r.response);case 3:return i={},e.next=6,this.executeWithRetry(function(){return n.services.transport.get(t,i,n.configuration.productId)},this.configuration.retryWhenThrottled);case 6:return a=e.sent,this.cache.set(t,{response:a,timestamp:Date.now()}),this.pokeTimer(),e.abrupt(`return`,a);case 10:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()}]),e}(),ke=F.default(function e(){I.default(this,e)});P.default(ke,`TYPING_INDICATOR`,`twilio.ipmsg.typing_indicator`),P.default(ke,`NEW_MESSAGE`,`twilio.conversations.new_message`),P.default(ke,`ADDED_TO_CONVERSATION`,`twilio.conversations.added_to_conversation`),P.default(ke,`REMOVED_FROM_CONVERSATION`,`twilio.conversations.removed_from_conversation`),P.default(ke,`CONSUMPTION_UPDATE`,`twilio.channel.consumption_update`);function Ae(e){var t=je();return function(){var n=N.default(e),r;if(t){var i=N.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M.default(this,r)}}function je(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Pe=K.scope(`Participant`),Fe=function(e){j.default(n,e);var t=Ae(n);function n(e,r,i,a,o){var s;if(I.default(this,n),s=t.call(this),s.conversation=i,s.links=a,s.services=o,s.state={attributes:he(e.attributes,`Retrieved malformed attributes from the server for participant: `+r,Pe),dateCreated:e.dateCreated?J(e.dateCreated):null,dateUpdated:e.dateCreated?J(e.dateUpdated):null,sid:r,typingTimeout:null,isTyping:!1,identity:e.identity,roleSid:e.roleSid??``,lastReadMessageIndex:Number.isInteger(e.lastConsumedMessageIndex)?e.lastConsumedMessageIndex:null,lastReadTimestamp:e.last
40ConsumptionTimestamp?J(e.lastConsumptionTimestamp):null,type:e.type||`chat`,userInfo:e.userInfo,bindings:e.bindings??{}},!e.identity&&!e.type)throw Error(`Received invalid Participant object from server: Missing identity or type of Participant.`);return s}return F.default(n,[{key:`sid`,get:function(){return this.state.sid}},{key:`attributes`,get:function(){return this.state.attributes}},{key:`dateCreated`,get:function(){return this.state.dateCreated}},{key:`dateUpdated`,get:function(){return this.state.dateUpdated}},{key:`identity`,get:function(){return this.state.identity}},{key:`isTyping`,get:function(){return this.state.isTyping}},{key:`lastReadMessageIndex`,get:function(){return this.state.lastReadMessageIndex}},{key:`lastReadTimestamp`,get:function(){return this.state.lastReadTimestamp}},{key:`roleSid`,get:function(){return this.state.roleSid}},{key:`type`,get:function(){return this.state.type}},{key:`bindings`,get:function(){return this.state.bindings??{}}},{key:`_startTyping`,value:function(e){var t=this;return this.state.typingTimeout&&clearTimeout(this.state.typingTimeout),this.state.isTyping=!0,this.emit(n.typingStarted,this),this.conversation.emit(Z.typingStarted,this),this.state.typingTimeout=Number(setTimeout(function(){return t._endTyping()},e)),this}},{key:`_endTyping`,value:function(){this.state.typingTimeout&&(this.state.isTyping=!1,this.emit(n.typingEnded,this),this.conversation.emit(Z.typingEnded,this),clearInterval(this.state.typingTimeout),this.state.typingTimeout=null)}},{key:`_update`,value:function(e){var t=[],r=he(e.attributes,`Retrieved malformed attributes from the server for participant: `+this.state.sid,Pe);e.attributes&&!_e(this.state.attributes,r)&&(this.state.attributes=r,t.push(`attributes`));var i=J(e.dateUpdated);e.dateUpdated&&i?.getTime()!==(this.state.dateUpdated&&this.state.dateUpdated.getTime())&&(this.state.dateUpdated=i,t.push(`dateUpdated`));var a=J(e.dateCreated);if(e.dateCreated&&a?.getTime()!==(this.state.dateCreated&&this.state.dateCreated.getTime())&&(this.state.dateCreated=a,t.push(`dateCreated`)),e.roleSid&&this.state.roleSid!==e.roleSid&&(this.state.roleSid=e.roleSid,t.push(`roleSid`)),(Number.isInteger(e.lastConsumedMessageIndex)||e.lastConsumedMessageIndex===null)&&this.state.lastReadMessageIndex!==e.lastConsumedMessageIndex&&(this.state.lastReadMessageIndex=e.lastConsumedMessageIndex,t.push(`lastReadMessageIndex`)),e.lastConsumptionTimestamp){var o=new Date(e.lastConsumptionTimestamp);(!this.state.lastReadTimestamp||this.state.lastReadTimestamp.getTime()!==o.getTime())&&(this.state.lastReadTimestamp=o,t.push(`lastReadTimestamp`))}return e.bindings&&!_e(this.state.bindings,e.bindings)&&(this.state.bindings=e.bindings,t.push(`bindings`)),t.length>0&&this.emit(n.updated,{participant:this,updateReasons:t}),this}},{key:`getUser`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;
40)switch(e.prev=e.next){case 0:if(this.type==`chat`){e.next=2;break}throw Error(`Getting User is not supported for this Participant type: `+this.type);case 2:return e.abrupt(`return`,this.services.users.getUser(this.state.identity,this.state.userInfo));case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`remove`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.conversation.removeParticipant(this));case 1:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`updateAttributes`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.commandExecutor.mutateResource(`post`,this.links.self,{attributes:JSON.stringify(t)});case 2:return e.abrupt(`return`,this);case 3:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()}]),n}(_.ReplayEventEmitter);P.default(Fe,`typingStarted`,`typingStarted`),P.default(Fe,`typingEnded`,`typingEnded`),P.default(Fe,`updated`,`updated`),U([h.validateTypesAsync(ve),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Promise)],Fe.prototype,`updateAttributes`,null);function Ie(e){var t=Le();return function(){var n=N.default(e),r;if(t){var i=N.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M.default(this,r)}}function Le(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Re=K.scope(`Participants`),ze=function(e){j.default(n,e);var t=Ie(n);function n(e,r,i,a){var o;return I.default(this,n),o=t.call(this),P.default(A.default(o),`rosterEntityPromise`,null),o.conversation=e,o.participants=r,o.links=i,o.services=a,o}return F.default(n,[{key:`unsubscribe`,value:function(){var e=k.default(L.default.mark(function e(){var t;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.rosterEntityPromise){e.next=6;break}return e.next=3,this.rosterEntityPromise;case 3:t=e.sent,t.close(),this.rosterEntityPromise=null;case 6:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`subscribe`,value:function(e){var t=this,n=typeof e==`string`?this.services.syncClient.map({id:e,mode:`open_existing`}):Promise.resolve(e);return this.rosterEntityPromise=this.rosterEntityPromise||n.then(function(e){e.on(S.SyncMap.itemAdded,function(e){Re.debug(t.conversation.sid+` itemAdded: `+e.item.key),t.upsertParticipant(e.item.key,e.item.data).then(function(e){t.emit(Z.participantJoined,e)})}),e.on(S.SyncMap.itemRemoved,function(e){Re.debug(t.conversation.sid+` itemRemoved: `+e.key);var n=e.key;if(t.participants.has(n)){var r=t.participants.get(n);t.participants.delete(n),r&&t.emit(Z.participantLeft,r)}}),e.on(S.SyncMap.itemUpdated,function(e){Re.debug(t.conversation.sid+` itemUpdated: `+e.item.key),t.upsertParticipant(e.item.key,e.item.data).catch(function(e){return Re.error(e)})});var n=[];return e.getItems().then(function e(r){return r.items.forEach(function(e){n.push(t.upsertParticipant(e.key,e.data))}),r.hasNextPage?r.nextPage().then(e):null}).then(function(){return Promise.all(n)}).then(function(){return e})}).catch(function(e){throw t.rosterEntityPromise=null,t.services.syncClient.connectionState!=`disconnected`&&Re.error(`Failed to get roster object for conversation`,t.conversation.sid,e),Re.debug(`ERROR: Failed to get roster object for conversation`,t.conversation.sid,e),e})}},{key:`upsertParticipantFromResponse`,value:function(){var e=k.default(L.default.mark(function e(t){var n,r,i,a,o,s,c;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.sid,r=t.attributes,i=t.date_created,a=t.date_updated,o=t.identity,s=t.role_sid,c=t.messaging_binding,e.next=3,this.upsertParticipant(n,{attributes:r,dateCreated:new Date(i),dateUpdated:new Date(a),identity:o,roleSid:s,lastConsumedMessageIndex:null,lastConsumptionTimestamp:null,type:c?.type??`chat`});case 3:return e.abrupt(`return`,e.sent);case 4:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`upsertParticipant`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r=this,i,a;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.participants.get(t),!i){e.next=3;break}return e.abrupt(`return`,i._update(n));case 3:return a={self:`${this.links.participants}/${t}`},i=new Fe(n,t,this.conversation,a,this.services),this.participants.set(t,i),i.on(Fe.updated,function(e){return r.emit(Z.participantUpdated,e)}),e.abrupt(`return`,i);case 8:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`getParticipants`,value:function(){var e=k.default(L.default.mark(function e(){var t=this;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.rosterEntityPromise?this.rosterEntityPromise.then(function(){var e=[];
40return t.participants.forEach(function(t){return e.push(t)}),e}):[]);case 1:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getParticipantBySid`,value:function(){var e=k.default(L.default.mark(function e(t){var n=this;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this.rosterEntityPromise?this.rosterEntityPromise.then(function(){var e=n.participants.get(t);if(!e)throw Error(`Participant with SID `+t+` was not found`);return e}):null);case 1:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getParticipantByIdentity`,value:function(){var e=k.default(L.default.mark(function e(t){var n=this,r;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=null,e.abrupt(`return`,this.rosterEntityPromise?this.rosterEntityPromise.then(function(){if(n.participants.forEach(function(e){e.identity===t&&(r=e)}),!r)throw Error(`Participant with identity `+t+` was not found`);return r}):null);case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`add`,value:function(){var e=k.default(L.default.mark(function e(t,n){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.commandExecutor.mutateResource(`post`,this.links.participants,{identity:t,attributes:n===void 0?void 0:JSON.stringify(n)});case 2:return e.abrupt(`return`,e.sent);case 3:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`addNonChatParticipant`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r,i,a=arguments;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>2&&a[2]!==void 0?a[2]:{},i=a.length>3&&a[3]!==void 0?a[3]:{},e.next=4,this.services.commandExecutor.mutateResource(`post`,this.links.participants,{attributes:r===void 0?void 0:JSON.stringify(r),messaging_binding:{address:n,proxy_address:t,name:i?.email?.name,level:i?.email?.level}});case 4:return e.abrupt(`return`,e.sent);case 5:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`remove`,value:function(e){return this.services.commandExecutor.mutateResource(`delete`,`${this.links.participants}/${encodeURIComponent(e)}`)}}]),n}(_.ReplayEventEmitter),Be=function(){function e(t,n){I.default(this,e),P.default(this,`mcsMedia`,null),this.services=n,t instanceof C.McsMedia&&(this.mcsMedia=t),this.state={sid:t.sid,category:t.category,filename:t.filename??null,contentType:t.contentType,size:t.size}}return F.default(e,[{key:`sid`,get:function(){return this.state.sid}},{key:`filename`,get:function(){return this.state.filename}},{key:`contentType`,get:function(){return this.state.contentType}},{key:`size`,get:function(){return this.state.size}},{key:`category`,get:function(){return this.state.category}},{key:`getContentTemporaryUrl`,value:function(){var e=this;return new C.CancellablePromise(function(){var t=k.default(L.default.mark(function t(n,r,i){var a,o,s;return L.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(a=e.mcsMedia?void 0:e._fetchMcsMedia(),o=e.mcsMedia?.getContentUrl(),i(function(){a&&a.cancel(),o&&o.cancel()}),t.prev=3,o){t.next=9;break}return t.next=7,a;case 7:s=t.sent,o=s?.getContentUrl();case 9:if(t.t0=n,!o){t.next=16;break}return t.next=13,o;case 13:t.t1=t.sent,t.next=17;break;case 16:t.t1=null;case 17:t.t2=t.t1,(0,t.t0)(t.t2),t.next=24;break;case 21:t.prev=21,t.t3=t.catch(3),r(t.t3);case 24:case`end`:return t.stop()}},t,null,[[3,21]])}));return function(e,n,r){return t.apply(this,arguments)}}())}},{key:`_fetchMcsMedia`,value:function(){var e=this;return new C.CancellablePromise(function(){var t=k.default(L.default.mark(function t(n,r,i){var a;return L.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e.services.mcsClient===null&&r(Error(`Media Content Service is unavailable`)),a=e.services.mcsClient.get(e.state.sid),i(function(){return a.cancel()}),t.prev=3,t.next=6,a;case 6:e.mcsMedia=t.sent,e.state=e.mcsMedia._state(),n(e.mcsMedia),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(3),r(t.t0);case 14:case`end`:return t.stop()}},t,null,[[3,11]])}));return function(e,n,r){return t.apply(this,arguments)}}())}},{key:`_state`,value:function(){return this.state}}]),e}(),Ve=function(){function e(t){I.default(this,e),this.state=t}return F.default(e,[{key:`total`,get:function(){return this.state.total}},{key:`sent`,get:function(){return this.state.sent}},{key:`delivered`,get:function(){return this.state.delivered}},{key:`read`,get:function(){return this.state.read}},{key:`undelivered`,get:function(){return this.state.undelivered}},{key:`failed`,get:function(){return this.state.failed}},{key:`_update`,value:function(e){this.state=e}},{key:`_isEquals`,value:function(e){var t=this.total===e.total,n=this.sent===e.sent,r=this.delivered===e.delivered,i=this.read===e.read,a=this.undelivered===e.undelivered,o=this.failed===e.failed;return t&&n&&r&&i&&a&&o}}]),e}(),He=function(){function e(t,n,r,i){I.default(this,e),this.state={prevToken:r,nextToken:i,source:n,items:t}}return F.default(e,[{key:`hasNextPage`,get:function(){return!!this.state.nextToken}},{key:`hasPrevPage`,get:function(){return!!this.state.prevToken}}
40,{key:`items`,get:function(){return this.state.items}},{key:`nextPage`,value:function(){return this.hasNextPage?this.state.source(this.state.nextToken):Promise.reject(Error(`No next page`))}},{key:`prevPage`,value:function(){return this.hasPrevPage?this.state.source(this.state.prevToken):Promise.reject(Error(`No previous page`))}}]),e}(),Ue=F.default(function e(t){I.default(this,e),this.sid=t.sid,this.messageSid=t.message_sid,this.conversationSid=t.conversation_sid,this.channelMessageSid=t.channel_message_sid,this.participantSid=t.participant_sid,this.status=t.status||`queued`,this.errorCode=t.error_code||0,this.dateCreated=t.date_created,this.dateUpdated=t.date_updated}),We=function(e){return e.map(function(e){var t=JSON.stringify(e);switch(e.type){case`QUICK_REPLY`:return{type:`reply`,title:e.title,id:e.id??``,index:e.index??0,rawData:t};case`PHONE_NUMBER`:return{type:`phone`,title:e.title,phone:e.phone??``,rawData:t};case`URL`:return{type:`url`,title:e.title,url:e.url??``,rawData:t};default:return{type:`other`,rawData:t}}})},Ge=function(e,t){var n=JSON.stringify(t);switch(e){case`twilio/text`:return{type:`text`,body:t.body,rawData:n};case`twilio/media`:var r=t;return{type:`media`,body:r.body,media:r.media,rawData:n};case`twilio/location`:var i=t;return{type:`location`,longitude:i.longitude,latitude:i.latitude,label:i.label,rawData:n};case`twilio/quick-reply`:var a=t;return{type:`quickReply`,body:a.body,replies:a.actions,rawData:n};case`twilio/call-to-action`:var o=t;return{type:`callToAction`,body:o.body,actions:We(o.actions),rawData:n};case`twilio/list-picker`:var s=t;return{type:`listPicker`,body:s.body,button:s.button,items:s.items,rawData:n};case`twilio/card`:var c=t;return{type:`card`,title:c.title,subtitle:c.subtitle,media:c.media??[],actions:We(c.actions??[]),rawData:n};default:return{type:`other`,rawData:n}}},Ke=function(e){for(var t=new Map,n=0,r=Object.entries(e);n<r.length;n++){var i=V.default(r[n],2),a=i[0],o=i[1];t.set(a,Ge(a,o))}return t},qe=function(){function e(t,n){I.default(this,e),this.name=t,this.value=n}return F.default(e,[{key:`copyWithValue`,value:function(t){return new e(this.name,t)}}]),e}(),Je=F.default(function e(t){I.default(this,e),this.sid=t.sid,this.friendlyName=t.friendly_name,this.variables=Object.entries(JSON.parse(t.variables)).map(function(e){var t=V.default(e,2),n=t[0],r=t[1];return new qe(n,r)}),this.variants=Ke(t.variants),this.dateCreated=new Date(t.date_created),this.dateUpdated=new Date(t.date_updated)});function Ye(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 Xe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ye(Object(n),!0).forEach(function(t){P.default(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ye(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ze(e){var t=$e();return function(){var n=N.default(e),r;if(t){var i=N.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M.default(this,r)}}function $e(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function tt(e,t){it(e,t),t.add(e)}function it(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function ct(e,t,n){if(!t.has(e))throw TypeError(`attempted to get private field on non-instance`);return n}var pt=K.scope(`Message`),mt=n.XMLHttpRequest||{},yt=new WeakSet,xt=new WeakSet,St=function(e){j.default(n,e);var t=Ze(n);function n(e,r,i,a,o,s){var c;return I.default(this,n),c=t.call(this),tt(A.default(c),xt),tt(A.default(c),yt),c.conversation=i,c.links=a,c.configuration=o,c.services=s,c.state={sid:r.sid,index:e,author:r.author,subject:r.subject,contentSid:r.contentSid,body:r.text??null,timestamp:r.timestamp?new Date(r.timestamp):null,dateUpdated:r.dateUpdated?new Date(r.dateUpdated):null,lastUpdatedBy:r.lastUpdatedBy??null,attributes:he(r.attributes,`Got malformed attributes for the message ${r.sid}`,pt),type:r.type??`text`,media:null,medias:null,participantSid:r.memberSid??null,aggregatedDeliveryReceipt:r.delivery?new Ve(r.delivery):null,hasChannelMetadata:r.channelMetadata??
40!1},ct(A.default(c),xt,wt).call(A.default(c),r.medias??null,r.media??null),c}return F.default(n,[{key:`sid`,get:function(){return this.state.sid}},{key:`author`,get:function(){return this.state.author}},{key:`subject`,get:function(){return this.state.subject}},{key:`contentSid`,get:function(){return this.state.contentSid}},{key:`body`,get:function(){return this.state.body}},{key:`dateUpdated`,get:function(){return this.state.dateUpdated}},{key:`index`,get:function(){return this.state.index}},{key:`lastUpdatedBy`,get:function(){return this.state.lastUpdatedBy}},{key:`dateCreated`,get:function(){return this.state.timestamp}},{key:`attributes`,get:function(){return this.state.attributes}},{key:`type`,get:function(){return this.state.type}},{key:`media`,get:function(){return this.state.media}},{key:`attachedMedia`,get:function(){return this.getMediaByCategories([`media`])}},{key:`participantSid`,get:function(){return this.state.participantSid}},{key:`aggregatedDeliveryReceipt`,get:function(){return this.state.aggregatedDeliveryReceipt}},{key:`getMediaByCategory`,value:function(e){return this.getMediaByCategories(e)}},{key:`getMediaByCategories`,value:function(e){return(this.state.medias??[]).filter(function(t){return e.includes(t.category)})}},{key:`getEmailBody`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`text/plain`;return this.getMediaByCategories([`body`])?.filter(function(t){return t.contentType==e}).shift()??null}},{key:`getEmailHistory`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`text/plain`;return this.getMediaByCategories([`history`])?.filter(function(t){return t.contentType==e}).shift()??null}},{key:`_update`,value:function(e){var t=this,n=[];(e.text||typeof e.text==`string`)&&e.text!==this.state.body&&(this.state.body=e.text,n.push(`body`)),e.subject&&e.subject!==this.state.subject&&(this.state.subject=e.subject,n.push(`subject`)),e.lastUpdatedBy&&e.lastUpdatedBy!==this.state.lastUpdatedBy&&(this.state.lastUpdatedBy=e.lastUpdatedBy,n.push(`lastUpdatedBy`)),e.author&&e.author!==this.state.author&&(this.state.author=e.author,n.push(`author`)),e.dateUpdated&&new Date(e.dateUpdated).getTime()!==(this.state.dateUpdated&&this.state.dateUpdated.getTime())&&(this.state.dateUpdated=new Date(e.dateUpdated),n.push(`dateUpdated`)),e.timestamp&&new Date(e.timestamp).getTime()!==(this.state.timestamp&&this.state.timestamp.getTime())&&(this.state.timestamp=new Date(e.timestamp),n.push(`dateCreated`));var r=he(e.attributes,`Got malformed attributes for the message ${this.sid}`,pt);_e(this.state.attributes,r)||(this.state.attributes=r,n.push(`attributes`));var i=e.delivery,a=this.state.aggregatedDeliveryReceipt;i&&i.total&&i.delivered&&i.failed&&i.read&&i.sent&&i.undelivered&&(a?a._isEquals(i)||(a._update(i),n.push(`deliveryReceipt`)):(this.state.aggregatedDeliveryReceipt=new Ve(i),n.push(`deliveryReceipt`))),(!_e((e.medias??[]).map(function(e){return ct(t,yt,Ct).call(t,e)?._state()}).filter(function(e){return e!==null}),(this.state.medias??[]).map(function(e){return e._state()}).filter(function(e){return e!==null}))||!_e(ct(this,yt,Ct).call(this,e.media)?._state(),this.state.media?._state()))&&(ct(this,xt,wt).call(this,e.medias??null,e.media??null),n.push(`media`)),n.length>0&&this.emit(`updated`,{message:this,updateReasons:n})}},{key:`getParticipant`,value:function(){var e=k.default(L.default.mark(function e(){var t=this,n,r;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=null,!this.state.participantSid){e.next=5;break}return e.next=4,this.conversation.getParticipantBySid(this.state.participantSid).catch(function(){return pt.debug(`Participant with sid "${t.participantSid}" not found for message ${t.sid}`),null});case 4:n=e.sent;case 5:if(!(!n&&this.state.author)){e.next=9;break}return e.next=8,this.conversation.getParticipantByIdentity(this.state.author).catch(function(){return pt.debug(`Participant with identity "${t.author}" not found for message ${t.sid}`),null});case 8:n=e.sent;case 9:if(!n){e.next=11;break}return e.abrupt(`return`,n);case 11:throw r=`Participant with `,this.state.participantSid&&(r+=`SID '`+this.state.participantSid+`' `),this.state.author&&(this.state.participantSid&&(r+=`or `),r+=`identity '`+this.state.author+`' `),r===`Participant with `&&(r=`Participant `),r+=`was not found`,Error(r);case 17:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getDetailedDeliveryReceipts`,value:function(){var e=k.default(L.default.mark(function e(){var t,n;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getDetailedDeliveryReceiptsPaginator();case 2:t=e.sent,n=t.items;case 4:if(!t.hasNextPage){e.next=11;break}return e.next=7,t.nextPage();case 7:t=e.sent,n=[].concat(B.default(n),B.default(t.items)),e.next=4;break;case 11:return e.abrupt(`return`,n);case 12:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`remove`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.commandExecutor.mutateResource(`delete`,this.links.self);case 2:return e.abrupt(`return`,this);case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`updateBody`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.commandExecutor.mutateResource(`post`,this.links.self,{body:t});case 2:return e.abrupt(`return`,this);case 3:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`updateAttributes`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.commandExecutor.mutateResource(`post`,this.links.self,{attributes:t===void 0?void 0:JSON.stringify(t)});case 2:return e.abrupt(`return`,this);case 3:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`attachTemporaryUrlsFor`,value:function(){var e=k.default(L.default.mark(function e(t){var n=this,r;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t?.map(function(e){return e.sid}),!(this.services.mcsClient&&r)){e.next=7;break}return e.next=4,this.services.mcsClient.mediaSetGet(r);case 4:return e.abrupt(`return`,e.sent.map(function(e){return new Be(e,n.services)}));case 7:throw Error(`Media Content Service is unavailable`);case 8:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getTemporaryContentUrlsForMedia`,value:function(e){var t=e.map(function(e){return e.sid});return this.getTemporaryContentUrlsForMediaSids(t)}},{key:`getTemporaryContentUrlsForMediaSids`,value:function(e){var t=this;return new C.CancellablePromise(function(){var n=k.default(L.default.mark(function n(r,i,a){var o,s;return L.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(o=t.services.mcsClient.mediaSetGetContentUrls(e??[]),!(!t.services.mcsClient||!e)){n.next=4;break}return i(Error(`Media Content Service is unavailable`)),n.abrupt(`return`);case 4:return a(function(){o.cancel()}),n.prev=5,n.next=8,o;case 8:s=n.sent,r(s),n.next=15;break;case 12:n.prev=12,n.t0=n.catch(5),i(n.t0);case 15:case`end`:return n.stop()}},n,null,[[5,12]])}));return function(e,t,r){return n.apply(this,arguments)}}())}},{key:`getTemporaryContentUrlsForAttachedMedia`,value:function(){var e=this.attachedMedia?.map(function(e){return e.sid})??[];return this.getTemporaryContentUrlsForMediaSids(e)}},{key:`_getDetailedDeliveryReceiptsPaginator`,value:function(){var e=k.default(L.default.mark(function e(t){var n=this,r,i,a;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.configuration.links.messagesReceipts.replace(`%s`,this.conversation.sid).replace(`%s`,this.sid),i=new ge(r).arg(`PageToken`,t?.pageToken).arg(`PageSize`,t?.pageSize).build(),e.next=4,this.services.network.get(i);case 4:return a=e.sent,e.abrupt(`return`,new He(a.body.delivery_receipts.map(function(e){return new Ue(e)}),function(e,t){return n._getDetailedDeliveryReceiptsPaginator({pageToken:e,pageSize:t})},a.body.meta.previous_token,a.body.meta.next_token));case 6:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getContentData`,value:function(){var e=this;return new C.CancellablePromise(function(){var t=k.default(L.default.mark(function t(n,r,i){var a,o,s,c,l,u,d,f,p,m;return L.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.state.contentSid!==null){t.next=3;break}return n(null),t.abrupt(`return`);case 3:if(a=e.getMediaByCategories([`body`]),a!==null){t.next=7;break}return n(null),t.abrupt(`return`);case 7:if(o=`application/x-vnd.com.twilio.rich.`,s=a.filter(function(e){return e.contentType.startsWith(o)}),s.length!==0){t.next=12;break}return n(null),t.abrupt(`return`);case 12:return c=s[0],l=c.getContentTemporaryUrl(),i(function(){l.cancel()}),t.prev=15,t.next=18,l;case 18:u=t.sent,t.next=25;break;
40case 21:return t.prev=21,t.t0=t.catch(15),r(t.t0),t.abrupt(`return`);case 25:if(u!==null){t.next=28;break}return n(null),t.abrupt(`return`);case 28:return d=new Promise(function(e,t){var n=!1,r=new mt;r.open(`GET`,u??``,!0),r.responseType=`text`,r.onreadystatechange=function(){r.readyState!==4||n||e(r.responseText)},r.onerror=function(){t(r.statusText)},i(function(){n=!0,r.abort(),t(Error(`XHR has been aborted`))}),r.send()}),t.prev=29,t.next=32,d;case 32:p=t.sent,f=JSON.parse(p),t.next=40;break;case 36:return t.prev=36,t.t1=t.catch(29),r(t.t1),t.abrupt(`return`);case 40:m=c.contentType.replace(o,``).replace(`.`,`/`),n(Ge(m,f.data));case 42:case`end`:return t.stop()}},t,null,[[15,21],[29,36]])}));return function(e,n,r){return t.apply(this,arguments)}}())}},{key:`getChannelMetadata`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.state.hasChannelMetadata){e.next=2;break}return e.abrupt(`return`,null);case 2:return e.next=4,this.services.channelMetadataClient.getChannelMetadata(this.conversation.sid,this.sid);case 4:return e.abrupt(`return`,e.sent);case 5:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getMessageRecipients`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.messageRecipientsClient.getRecipientsFromMessage(this.conversation.sid,this.sid);case 2:return e.abrupt(`return`,e.sent);case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()}]),n}(_.ReplayEventEmitter);function Ct(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e?t?new Be(Xe(Xe({},e),{},{category:t}),this.services):new Be(e,this.services):null}function wt(e,t){var n=this;this.state.media=ct(this,yt,Ct).call(this,t),this.state.medias=e?e.map(function(e){return ct(n,yt,Ct).call(n,e)}).filter(function(e){return e!==null}):t&&!e?[ct(this,yt,Ct).call(this,t,`media`)].filter(function(e){return e!==null}):null}P.default(St,`updated`,`updated`),U([w.deprecated(`getMediaByCategory`,`getMediaByCategories`),W(`design:type`,Function),W(`design:paramtypes`,[Array]),W(`design:returntype`,Array)],St.prototype,`getMediaByCategory`,null),U([h.validateTypes([h.nonEmptyString,`undefined`]),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Be)],St.prototype,`getEmailBody`,null),U([h.validateTypes([h.nonEmptyString,`undefined`]),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Be)],St.prototype,`getEmailHistory`,null),U([h.validateTypesAsync(`string`),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],St.prototype,`updateBody`,null),U([h.validateTypesAsync(ve),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Promise)],St.prototype,`updateAttributes`,null),U([w.deprecated(`attachTemporaryUrlsFor`,`getTemporaryContentUrlsForMedia`),W(`design:type`,Function),W(`design:paramtypes`,[Array]),W(`design:returntype`,Promise)],St.prototype,`attachTemporaryUrlsFor`,null),U([h.validateTypesAsync(h.nonEmptyArray(`media`,Be)),W(`design:type`,Function),W(`design:paramtypes`,[Array]),W(`design:returntype`,C.CancellablePromise)],St.prototype,`getTemporaryContentUrlsForMedia`,null),U([h.validateTypesAsync(h.nonEmptyArray(`strings`,`string`)),W(`design:type`,Function),W(`design:paramtypes`,[Array]),W(`design:returntype`,C.CancellablePromise)],St.prototype,`getTemporaryContentUrlsForMediaSids`,null);function Et(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 Dt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Et(Object(n),!0).forEach(function(t){P.default(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Et(Object(n)).forEac
40h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ot(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=kt(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 41In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function kt(e,t){if(e){if(typeof e==`string`)return At(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return At(e,t)}}function At(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function jt(e){var t=Mt();return function(){var n=N.default(e),r;if(t){var i=N.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M.default(this,r)}}function Mt(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var X=K.scope(`Messages`),Nt=function(e){j.default(n,e);var t=jt(n);function n(e,r,i){var a;return I.default(this,n),a=t.call(this),a.conversation=e,a.configuration=r,a.services=i,a.messagesByIndex=new Map,a.messagesListPromise=null,a}return F.default(n,[{key:`subscribe`,value:function(){var e=k.default(L.default.mark(function e(t){var n=this,r;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.messagesListPromise){e.next=2;break}return e.abrupt(`return`,this.messagesListPromise);case 2:return this.messagesListPromise=typeof t==`string`?this.services.syncClient.list({id:t,mode:`open_existing`}):Promise.resolve(t),e.prev=3,e.next=6,this.messagesListPromise;case 6:return r=e.sent,r.on(`itemAdded`,function(e){X.debug(`${n.conversation.sid} itemAdded: ${e.item.index}`);var t={self:`${n.conversation._links.messages}/${e.item.data.sid}`,conversation:n.conversation._links.self,messages_receipts:`${n.conversation._links.messages}/${e.item.data.sid}/Receipts`},r=new St(e.item.index,e.item.data,n.conversation,t,n.configuration,n.services);if(n.messagesByIndex.has(r.index)){X.debug(`Message arrived, but is already known and ignored`,n.conversation.sid,r.index);return}n.messagesByIndex.set(r.index,r),r.on(`updated`,function(e){return n.emit(`messageUpdated`,e)}),n.emit(`messageAdded`,r)}),r.on(`itemRemoved`,function(e){X.debug(`#{this.conversation.sid} itemRemoved: ${e.index}`);var t=e.index;if(n.messagesByIndex.has(t)){var r=n.messagesByIndex.get(t);if(!r)return;n.messagesByIndex.delete(r.index),r.removeAllListeners(`updated`),n.emit(`messageRemoved`,r)}}),r.on(`itemUpdated`,function(e){X.debug(`${n.conversation.sid} itemUpdated: ${e.item.index}`);var t=n.messagesByIndex.get(e.item.index);t&&t._update(e.item.data)}),e.abrupt(`return`,r);case 13:throw e.prev=13,e.t0=e.catch(3),this.messagesListPromise=null,this.services.syncClient.connectionState!==`disconnected`&&X.error(`Failed to get messages object for conversation`,this.conversation.sid,e.t0),X.debug(`ERROR: Failed to get messages object for conversation`,this.conversation.sid,e.t0),e.t0;case 19:case`end`:return e.stop()}},e,this,[[3,13]])}));function t(t){return e.apply(this,arguments)}return t}()},{key:`unsubscribe`,value:function(){var e=k.default(L.default.mark(function e(){var t;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.messagesListPromise){e.next=2;break}return e.abrupt(`return`);case 2:return e.next=4,this.messagesListPromise;case 4:t=e.sent,t.close(),this.messagesListPromise=null;case 7:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`sendV2`,value:function(e){var t=this;return X.debug(`Sending message V2`,e.mediaContent,e.attributes,e.emailOptions),new C.CancellablePromise(function(){var n=k.default(L.default.mark(function n(r,i,a){var o,s,c,l,u,d,f,p,m;return L.default.wrap(function(n){for(;;
41)switch(n.prev=n.next){case 0:o=[],s=[],a(function(){s.forEach(function(e){return e.cancel()})}),c=Ot(e.mediaContent),n.prev=4,c.s();case 6:if((l=c.n()).done){n.next=25;break}return u=V.default(l.value,2),d=u[0],f=u[1],n.prev=8,X.debug(`Adding media to a message as ${f instanceof FormData?`FormData`:`SendMediaOptions`}`,f),p=f instanceof FormData?t.services.mcsClient.postFormData(f,d):t.services.mcsClient.post(f.contentType??``,f.media??``,d,f.filename),s.push(p),n.t0=o,n.next=15,p;case 15:n.t1=n.sent,n.t0.push.call(n.t0,n.t1),n.next=23;break;case 19:return n.prev=19,n.t2=n.catch(8),i(n.t2),n.abrupt(`return`);case 23:n.next=6;break;case 25:n.next=30;break;case 27:n.prev=27,n.t3=n.catch(4),c.e(n.t3);case 30:return n.prev=30,c.f(),n.finish(30);case 33:return m=t.services.commandExecutor.mutateResource(`post`,t.conversation._links.messages,{body:e.text,subject:e.emailOptions?.subject,media_sids:o.map(function(e){return e.sid}),attributes:e.attributes===void 0?void 0:JSON.stringify(e.attributes),content_sid:e.contentSid,content_variables:e.contentVariables===void 0?void 0:JSON.stringify(e.contentVariables.reduce(function(e,t){return Dt(Dt({},e),{},P.default({},t.name,t.value))},{}))}),n.prev=34,n.t4=r,n.next=38,m;case 38:n.t5=n.sent,(0,n.t4)(n.t5),n.next=45;break;case 42:n.prev=42,n.t6=n.catch(34),i(n.t6);case 45:case`end`:return n.stop()}},n,null,[[4,27,30,33],[8,19],[34,42]])}));return function(e,t,r){return n.apply(this,arguments)}}())}},{key:`send`,value:function(){var e=k.default(L.default.mark(function e(t){var n,r,i=arguments;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&i[1]!==void 0?i[1]:{},r=i.length>2?i[2]:void 0,X.debug(`Sending text message`,t,n,r),e.abrupt(`return`,this.services.commandExecutor.mutateResource(`post`,this.conversation._links.messages,{body:t??``,attributes:n===void 0?void 0:JSON.stringify(n),subject:r?.subject}));case 4:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`sendMedia`,value:function(){var e=k.default(L.default.mark(function e(t){var n,r,i,a=arguments;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>1&&a[1]!==void 0?a[1]:{},r=a.length>2?a[2]:void 0,X.debug(`Sending media message`,t,n,r),X.debug(`Sending media message as ${t instanceof FormData?`FormData`:`SendMediaOptions`}`,t,n),!(t instanceof FormData)){e.next=10;break}return e.next=7,this.services.mcsClient.postFormData(t);case 7:e.t0=e.sent,e.next=13;break;case 10:return e.next=12,this.services.mcsClient.post(t.contentType??``,t.media??``,`media`,t.filename);case 12:e.t0=e.sent;case 13:return i=e.t0,e.next=16,this.services.commandExecutor.mutateResource(`post`,this.conversation._links.messages,{media_sids:[i.sid],attributes:n===void 0?void 0:JSON.stringify(n)});case 16:return e.abrupt(`return`,e.sent);case 17:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getMessages`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r,i=arguments;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>2&&i[2]!==void 0?i[2]:`backwards`,e.abrupt(`return`,this._getMessages(t,n,r));case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`_wrapPaginator`,value:function(e,t,n){var r=this,i=e===`desc`,a=function(){return t.nextPage().then(function(t){return r._wrapPaginator(e,t,n)})},o=function(){return t.prevPage().then(function(t){return r._wrapPaginator(e,t,n)})};return n(t.items).then(function(e){return{items:e.sort(function(e,t){return e.index-t.index}),hasPrevPage:i?t.hasNextPage:t.hasPrevPage,hasNextPage:i?t.hasPrevPage:t.hasNextPage,prevPage:i?a:o,nextPage:i?o:a}})}},{key:`_upsertMessage`,value:function(e,t){var n=this,r=this.messagesByIndex.get(e);if(r)return r;var i={self:`${this.conversation._links.messages}/${t.sid}`,conversation:this.conversation._links.self,messages_receipts:`${this.conversation._links.messages}/${t.sid}/Receipts`},a=new St(e,t,this.conversation,i,this.configuration,this.services);return this.messagesByIndex.set(a.index,a),a.on(`updated`,function(e){return n.emit(`messageUpdated`,e)}),a}},{key:`_getMessages`,value:function(){var e=k.default(L.default.mark(function e(){var t=this,n,r,i,a,o,s,c=arguments;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>0&&c[0]!==void 0?c[0]:30,r=c.length>1&&c[1]!==void 0?c[1]:`end`,i=c.length>2&&c[2]!==void 0?c[2]:`forward`,a=i===`backwards`?`desc`:`asc`,e.next=6,this.messagesListPromise;case 6:return o=e.sent,e.next=9,o?.getItems({from:r===`end`?void 0:r,pageSize:n,order:a,limit:n});case 9:return s=e.sent,e.next=12,this._wrapPaginator(a,s,function(e){return Promise.all(e.map(function(e){return t._upsertMessage(e.index,e.data)}))});case 12:return e.abrupt(`return`,e.sent);case 13:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()}]),n}(_.ReplayEventEmitter),Pt=function(){function e(t){I.default(this,e),P.default(this,`attributes`,{}),P.default(this,`mediaContent`,[]),P.default(this,`emailOptions`,{}),this.messagesEntity=t}return F.default(e,[{key:`send`,value:function(){var e=this;return new C.CancellablePromise(function(){var t=k.default(L.default.mark(function t(n,r,i){var a,o;return L.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.messagesEntity.sendV2(e),i(function(){return a.cancel()}),t.prev=2,t.next=5,a;case 5:o=t.sent,n(me(o.index)),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),r(t.t0);case 12:case`end`:return t.stop()}},t,null,[[2,9]])}
41));return function(e,n,r){return t.apply(this,arguments)}}())}}]),e}(),Ft=function(){function e(t,n){I.default(this,e),this.limits=t,this.message=new Pt(n),this.emailBodies=new Map,this.emailHistories=new Map}return F.default(e,[{key:`setBody`,value:function(e){return this.message.text=e,this}},{key:`setSubject`,value:function(e){return this.message.emailOptions.subject=e,this}},{key:`setAttributes`,value:function(e){return this.message.attributes=e,this}},{key:`setEmailBody`,value:function(e,t){return this.emailBodies.set(e,t),this}},{key:`setEmailHistory`,value:function(e,t){return this.emailHistories.set(e,t),this}},{key:`setContentTemplate`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return this.message.contentSid=e,this.message.contentVariables=t,this}},{key:`addMedia`,value:function(e){if(typeof FormData>`u`&&e instanceof FormData)throw Error(`Could not add FormData content whilst not in a browser`);if(!(e instanceof FormData)){var t=e;if(!t.contentType||!t.media)throw Error(`Media content in SendMediaOptions must contain non-empty contentType and media`)}return this.message.mediaContent.push([`media`,e]),this}},{key:`build`,value:function(){var e=this;if(this.emailBodies.forEach(function(t,n){if(!e.limits.emailBodiesAllowedContentTypes.includes(n))throw Error(`Unsupported email body content type ${n}`)}),this.emailHistories.forEach(function(t,n){if(!e.limits.emailHistoriesAllowedContentTypes.includes(n))throw Error(`Unsupported email history content type ${n}`)}),this.emailBodies.size>this.limits.emailBodiesAllowedContentTypes.length)throw Error(`Too many email bodies attached to the message (${this.emailBodies.size} > ${this.limits.emailBodiesAllowedContentTypes.length})`);if(this.emailHistories.size>this.limits.emailHistoriesAllowedContentTypes.length)throw Error(`Too many email histories attached to the message (${this.emailHistories.size} > ${this.limits.emailHistoriesAllowedContentTypes.length})`);if(this.message.mediaContent.length>this.limits.mediaAttachmentsCountLimit)throw Error(`Too many media attachments in the message (${this.message.mediaContent.length} > ${this.limits.mediaAttachmentsCountLimit})`);return this.emailBodies.forEach(function(t){e.message.mediaContent.push([`body`,t])}),this.emailHistories.forEach(function(t){e.message.mediaContent.push([`history`,t])}),this.message}},{key:`buildAndSend`,value:function(){return this.build().send()}}]),e}();U([h.validateTypes(`string`),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Ft)],Ft.prototype,`setBody`,null),U([h.validateTypes(`string`),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Ft)],Ft.prototype,`setSubject`,null),U([h.validateTypes(ve),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Ft)],Ft.prototype,`setAttributes`,null),U([h.validateTypes(`string`,[FormData,ye]),W(`design:type`,Function),W(`design:paramtypes`,[String,Object]),W(`design:returntype`,Ft)],Ft.prototype,`setEmailBody`,null),U([h.validateTypes(`string`,[FormData,ye]),W(`design:type`,Function),W(`design:paramtypes`,[String,Object]),W(`design:returntype`,Ft)],Ft.prototype,`setEmailHistory`,null),U([h.validateTypes(`string`,[h.array(`content variables`,qe),`undefined`]),W(`design:type`,Function),W(`design:paramtypes`,[String,Array]),W(`design:returntype`,Ft)],Ft.prototype,`setContentTemplate`,null),U([h.validateTypes([FormData,ye]),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Ft)],Ft.prototype,`addMedia`,null);function It(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Lt(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 42In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function Lt(e,t){if(e){if(typeof e==`string`)return Rt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rt(e,t)}}function Rt(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zt(e){var t=Bt();return function(){var n=N.default(e),r;if(t){var i=N.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M.default(this,r)}}function Bt(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Vt={lastMessage:`lastMessage`,attributes:`attributes`,createdBy:`createdBy`,dateCreated:`dateCreated`,dateUpdated:`dateUpdated`,friendlyName:`friendlyName`,lastConsumedMessageIndex:`lastConsumedMessageIndex`,notificationLevel:`notificationLevel`,sid:`sid`,status:`status`,uniqueName:`uniqueName`,state:`state`,bindings:`bindings`},Z=function(e){j.default(n,e);var t=zt(n);function n(e,r,i,a,o){var s;I.default(this,n),s=t.call(this),s.sid=r,s._links=i,s._configuration=a,s._services=o,s._entityName=e.channel,s._internalState={uniqueName:e.uniqueName||null,status:`notParticipating`,attributes:e.attributes??{},createdBy:e.createdBy,dateCreated:J(e.dateCreated),dateUpdated:J(e.dateUpdated),friendlyName:e.friendlyName||null,lastReadMessageIndex:Number.isInteger(e.lastConsumedMessageIndex)?e.lastConsumedMessageIndex:null,bindings:e.bindings??{}},e.notificationLevel&&(s._internalState.notificationLevel=e.notificationLevel);var c={participants:s._links.participants};return s._participants=new Map,s._participantsEntity=new ze(A.default(s),s._participants,c,s._services),s._participantsEntity.on(n.participantJoined,function(e){return s.emit(n.participantJoined,e)}),s._participantsEntity.on(n.participantLeft,function(e){return s.emit(n.participantLeft,e)}),s._participantsEntity.on(n.participantUpdated,function(e){return s.emit(n.participantUpdated,e)}),s._messagesEntity=new Nt(A.default(s),a,o),s._messagesEntity.on(n.messageAdded,function(e){return s._onMessageAdded(e)}),s._messagesEntity.on(n.messageUpdated,function(e){return s.emit(n.messageUpdated,e)}),s._messagesEntity.on(n.messageRemoved,function(e){return s.emit(n.messageRemoved,e)}),s}return F.default(n,[{key:`uniqueName`,get:function(){return this._internalState.uniqueName}},{key:`status`,get:function(){return this._internalState.status}},{key:`friendlyName`,get:function(){return this._internalState.friendlyName}},{key:`dateUpdated`,get:function(){return this._internalState.dateUpdated}},{key:`dateCreated`,get:function(){return this._internalState.dateCreated}},{key:`createdBy`,get:function(){return this._internalState.createdBy??``}},{key:`attributes`,get:function(){return this._internalState.attributes}},{key:`lastReadMessageIndex`,get:function(){return this._internalState.lastReadMessageIndex}},{key:`lastMessage`,get:function(){return this._internalState.lastMessage??void 0}},{key:`notificationLevel`,get:function(){return this._internalState.notificationLevel??`default`}},{key:`bindings`,get:function(){return this._internalState.bindings}},{key:`limits`,get:function(){return this._configuration.limits}},{key:`state`,get:function(){return this._internalState.state}},{key:`_statusSource`,get:function(){return this._dataSource}},{key:`add`,value:function(){var e=k.default(L.default.mark(function e(t,n){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this._participantsEntity.add(t,n??{}));case 1:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`addNonChatParticipant`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r,i,a=arguments;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>2&&a[2]!==void 0?a[2]:{},i=a.length>3&&a[3]!==void 0?a[3]:{},e.abrupt(`return`,this._participantsEntity.addNonChatParticipant(t,n,r??{},i??{}));case 3:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`advanceLastReadMessageIndex`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._subscribeStreams();case 2:if(!(t<(this.lastReadMessageIndex??0))){e.next=6;break}return e.next=5,this._setLastReadMessageIndex(this.lastReadMessageIndex);case 5:return e.abrupt(`return`,e.sent);case 6:return e.next=8,this._setLastReadMessageIndex(t);case 8:return e.abrupt(`return`,e.sent);case 9:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`delete`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._services.commandExecutor.mutateResource(`delete`,this._links.self);case 2:return e.abrupt(`return`,this);case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getAttributes`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._subscribe();case 2:return e.abrupt(`return`,this.attributes);case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()}
42,{key:`getMessages`,value:function(){var e=k.default(L.default.mark(function e(t,n,r){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._subscribeStreams();case 2:return e.abrupt(`return`,this._messagesEntity.getMessages(t,n,r));case 3:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`getParticipants`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._subscribeStreams();case 2:return e.abrupt(`return`,this._participantsEntity.getParticipants());case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getParticipantsCount`,value:function(){var e=k.default(L.default.mark(function e(){var t,n;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=new ge(this._configuration.links.conversations).path(this.sid).build(),e.next=3,this._services.network.get(t);case 3:return n=e.sent,e.abrupt(`return`,n.body.participants_count??0);case 5:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getParticipantBySid`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt(`return`,this._participantsEntity.getParticipantBySid(t));case 1:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getParticipantByIdentity`,value:function(){var e=k.default(L.default.mark(function e(){var t,n=arguments;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&n[0]!==void 0?n[0]:``,e.abrupt(`return`,this._participantsEntity.getParticipantByIdentity(t??``));case 2:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getMessagesCount`,value:function(){var e=k.default(L.default.mark(function e(){var t,n;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=new ge(this._configuration.links.conversations).path(this.sid).build(),e.next=3,this._services.network.get(t);case 3:return n=e.sent,e.abrupt(`return`,n.body.messages_count??0);case 5:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getUnreadMessagesCount`,value:function(){var e=k.default(L.default.mark(function e(){var t,n,r;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=new ge(this._configuration.links.myConversations).path(this.sid).build(),e.next=3,this._services.network.get(t);case 3:if(n=e.sent,n.body.conversation_sid===this.sid){e.next=6;break}throw Error(`Conversation was not found in the user conversations list`);case 6:if(r=n.body.unread_messages_count,typeof r!=`number`){e.next=9;break}return e.abrupt(`return`,r);case 9:return e.abrupt(`return`,null);case 10:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`join`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._services.commandExecutor.mutateResource(`post`,this._links.participants,{identity:this._configuration.userIdentity});case 2:return e.abrupt(`return`,this);case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`leave`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._internalState.status!==`joined`){e.next=3;break}return e.next=3,this._services.commandExecutor.mutateResource(`delete`,`${this._links.participants}/${encodeURIComponent(this._configuration.userIdentity)}`);case 3:return e.abrupt(`return`,this);case 4:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`removeParticipant`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._participantsEntity.remove(typeof t==`string`?t:t.sid);case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`sendMessage`,value:function(){var e=k.default(L.default.mark(function e(t,n,r){var i,a;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(typeof t!=`string`&&t!==null){e.next=5;break}return e.next=3,this._messagesEntity.send(t,n,r);case 3:return i=e.sent,e.abrupt(`return`,me(i.index)??0);
42case 5:return e.next=7,this._messagesEntity.sendMedia(t,n,r);case 7:return a=e.sent,e.abrupt(`return`,me(a.index)??0);case 9:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`prepareMessage`,value:function(){return new Ft(this.limits,this._messagesEntity)}},{key:`setAllMessagesRead`,value:function(){var e=k.default(L.default.mark(function e(){var t;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._subscribeStreams();case 2:return e.next=4,this.getMessages(1);case 4:if(t=e.sent,!(t.items.length>0)){e.next=7;break}return e.abrupt(`return`,this.advanceLastReadMessageIndex(t.items[0].index));case 7:return e.abrupt(`return`,0);case 8:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`setAllMessagesUnread`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._subscribeStreams();case 2:return e.next=4,this._setLastReadMessageIndex(null);case 4:return e.abrupt(`return`,e.sent);case 5:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`setUserNotificationLevel`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._services.commandExecutor.mutateResource(`post`,`${this._configuration.links.myConversations}/${this.sid}`,{notification_level:t});case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`typing`,value:function(){return this._services.typingIndicator.send(this.sid)}},{key:`updateAttributes`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._services.commandExecutor.mutateResource(`post`,this._links.self,{attributes:t===void 0?void 0:JSON.stringify(t)});case 2:return e.abrupt(`return`,this);case 3:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`updateFriendlyName`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._internalState.friendlyName===t){e.next=3;break}return e.next=3,this._services.commandExecutor.mutateResource(`post`,this._links.self,{friendly_name:t});case 3:return e.abrupt(`return`,this);case 4:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`updateLastReadMessageIndex`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._subscribeStreams();case 2:return e.abrupt(`return`,this._setLastReadMessageIndex(t));case 3:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`updateUniqueName`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._internalState.uniqueName===t){e.next=4;break}return t||=``,e.next=4,this._services.commandExecutor.mutateResource(`post`,this._links.self,{unique_name:t});case 4:return e.abrupt(`return`,this);case 5:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getMessageRecipients`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid,t);case 2:return e.abrupt(`return`,e.sent);case 3:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_subscribe`,value:function(){var e=k.default(L.default.mark(function e(){var t=this;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._entityPromise){e.next=2;break}return e.abrupt(`return`,this._entityPromise);case 2:return this._entityPromise=this._services.syncClient.document({id:this._entityName,mode:`open_existing`}),e.prev=3,e.next=6,this._entityPromise;case 6:return this._entity=e.sent,this._entity.on(S.SyncDocument.updated,function(e){return t._update(e.data)}),this._entity.on(S.SyncDocument.removed,function(){return t.emit(n.removed,t)}),this._update(this._entity.data),e.abrupt(`return`,this._entity);case 13:throw e.prev=13,e.t0=e.catch(3),this._entity=null,this._entityPromise=null,this._services.syncClient.connectionState!=`disconnected`&&n._logger.error(`Failed to get conversation object`,e.t0),n._logger.debug(`ERROR: Failed to get conversation object`,e.t0),e.t0;case 20:case`end`:return e.stop()}},e,this,[[3,13]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`_fetchStreams`,value:function(){var e=k.default(L.default.mark(function e(){var t=this;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._streamsPromise){e.next=2;break}return e.abrupt(`return`,this._streamsPromise);case 2:return this._streamsPromise=new Promise(function(){var e=k.default(L.default.mark(function e(r,i){var a,o,s;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t._subscribe();case 3:e.next=9;break;case 5:return e.prev=5,e.t0=e.catch(0),n._logger.trace(`Failed to subscribe to conversation`,e.t0),e.abrupt(`return`,i(e.t0));case 9:n._logger.trace(`_streamsAvailable, this.entity.data=`,t._entity?.data),a=t._entity?.data,o=t._services.syncClient.list({id:a.messages,mode:`open_existing`}).then(function(e){return t._messagesList=e,e}),s=t._services.syncClient.map({id:a.roster,mode:`open_existing`}).then(function(e){return t._participantsMap=e,e}),Promise.all([o,s]).then(function(){return r(!0)}).catch(function(e){n._logger.trace(`Failed to fetch conversation streams for conversation`,t.sid,e),i(e)});case 14:case`end`:return e.stop()}},e,null,[[0,5]])}));return function(t,n){return e.apply(this,arguments)}}()),e.abrupt(`return`,this._streamsPromise.catch(function(e){throw t._streamsPromise=null,e}));case 4:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`_subscribeStreams`,value:function(){var e=k.default(L.default.mark(function e(){var t,r,i;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._fetchStreams();case 3:return n._logger.trace(`_subscribeStreams, this.entity.data=`,this._entity?.data),t=this._entity?.data,r=t.messages,i=t.roster,e.next=9,Promise.all([this._messagesEntity.subscribe(this._messagesList??r),this._participantsEntity.subscribe(this._participantsMap??i)]);case 9:e.next=16;break;case 11:throw e.prev=11,e.t0=e.catch(0),this._services.syncClient.connectionState!==`disconnected`&&n._logger.error(`Failed to subscribe on conversation objects`,this.sid,e.t0),n._logger.debug(`ERROR: Failed to subscribe on conversation objects`,this.sid,e.t0),e.t0;case 16:case`end`:return e.stop()}},e,this,[[0,11]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`_unsubscribe`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this._entity&&(this._entity.close(),this._entity=null,this._entityPromise=null),e.abrupt(`return`,Promise.all([this._participantsEntity.unsubscribe(),this._messagesEntity.unsubscribe()]));case 2:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`_setStatus`,value:function(e,t){var r=this;if(this._dataSource=t,this._internalState.status!==e){if(this._internalState.status=e,e===`joined`){this._subscribeStreams().catch(function(t){if(n._logger.debug(`ERROR while setting conversation status `+e,t),r._services.syncClient.connectionState!==`disconnected`)throw t});return}this._entityPromise&&this._unsubscribe().catch(function(t){if(n._logger.debug(`ERROR while setting conversation status `+e,t),r._services.syncClient.connectionState!==`disconnected`)throw t})}}},{key:`_update`,value:function(e){n._logger.trace(`_update`,e),n.preprocessUpdate(e,this.sid);for(var t=new Set,r=0,i=Object.keys(e);r<i.length;r++){var a=i[r],o=Vt[a];if(o)switch(o){case Vt.status:if(!e.status||e.status===`unknown`||this._internalState.status===e.status)break;this._internalState.status=e.status,t.add(o);break;case Vt.attributes:if(_e(this._internalState.attributes,e.attributes))break;this._internalState.attributes=e.attributes,t.add(o);break;case Vt.lastConsumedMessageIndex:if(e.lastConsumedMessageIndex===void 0||e.lastConsumedMessageIndex===this._internalState.lastReadMessageIndex)break;
42this._internalState.lastReadMessageIndex=e.lastConsumedMessageIndex,t.add(`lastReadMessageIndex`);break;case Vt.lastMessage:if(this._internalState.lastMessage&&!e.lastMessage){delete this._internalState.lastMessage,t.add(o);break}this._internalState.lastMessage=this._internalState.lastMessage||{},e.lastMessage?.index!==void 0&&e.lastMessage.index!==this._internalState.lastMessage.index&&(this._internalState.lastMessage.index=e.lastMessage.index,t.add(o)),e.lastMessage?.timestamp!==void 0&&this._internalState.lastMessage?.dateCreated?.getTime()!==e.lastMessage.timestamp.getTime()&&(this._internalState.lastMessage.dateCreated=e.lastMessage.timestamp,t.add(o)),_e(this._internalState.lastMessage,{})&&delete this._internalState.lastMessage;break;case Vt.state:var s=e.state||void 0;if(s!==void 0&&(s.dateUpdated=new Date(s.dateUpdated)),_e(this._internalState.state,s))break;this._internalState.state=s,t.add(o);break;case Vt.bindings:if(_e(this._internalState.bindings,e.bindings))break;this._internalState.bindings=e.bindings,t.add(o);break;default:var c=e[a]instanceof Date,l=c&&this._internalState[o]?.getTime()===e[a].getTime(),u=!c&&this[o]===e[a];if(l||u)break;this._internalState[o]=e[a],t.add(o)}}t.size>0&&this.emit(n.updated,{conversation:this,updateReasons:B.default(t)})}},{key:`_onMessageAdded`,value:function(e){var t=It(this._participants.values()),r;try{for(t.s();!(r=t.n()).done;){var i=r.value;if(i.identity===e.author){i._endTyping();break}}}catch(e){t.e(e)}finally{t.f()}this.emit(n.messageAdded,e)}},{key:`_setLastReadMessageIndex`,value:function(){var e=k.default(L.default.mark(function e(t){var n;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._services.commandExecutor.mutateResource(`post`,`${this._configuration.links.myConversations}/${this.sid}`,{last_read_message_index:t});case 2:return n=e.sent,e.abrupt(`return`,n.unread_messages_count);case 4:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()}],[{key:`preprocessUpdate`,value:function(e,t){try{typeof e.attributes==`string`?e.attributes=JSON.parse(e.attributes):e.attributes&&JSON.stringify(e.attributes)}catch{n._logger.warn(`Retrieved malformed attributes from the server for conversation: `+t),e.attributes={}}try{e.dateCreated&&=new Date(e.dateCreated)}catch{n._logger.warn(`Retrieved malformed dateCreated from the server for conversation: `+t),delete e.dateCreated}try{e.dateUpdated&&=new Date(e.dateUpdated)}catch{n._logger.warn(`Retrieved malformed dateUpdated from the server for conversation: `+t),delete e.dateUpdated}try{e.lastMessage&&e.lastMessage.timestamp&&(e.lastMessage.timestamp=new Date(e.lastMessage.timestamp))}catch{n._logger.warn(`Retrieved malformed lastMessage.timestamp from the server for conversation: `+t),delete e.lastMessage.timestamp}}}]),n}(_.ReplayEventEmitter);P.default(Z,`participantJoined`,`participantJoined`),P.default(Z,`participantLeft`,`participantLeft`),P.default(Z,`participantUpdated`,`participantUpdated`),P.default(Z,`messageAdded`,`messageAdded`),P.default(Z,`messageRemoved`,`messageRemoved`),P.default(Z,`messageUpdated`,`messageUpdated`),P.default(Z,`typingEnded`,`typingEnded`),P.default(Z,`typingStarted`,`typingStarted`),P.default(Z,`updated`,`updated`),P.default(Z,`removed`,`removed`),P.default(Z,`_logger`,K.scope(`Conversation`)),U([h.validateTypesAsync(h.nonEmptyString,Y),W(`design:type`,Function),W(`design:paramtypes`,[String,Object]),W(`design:returntype`,Promise)],Z.prototype,`add`,null),U([h.validateTypesAsync(h.nonEmptyString,h.nonEmptyString,Y,Y),W(`design:type`,Function),W(`design:paramtypes`,[String,String,Object,Object]),W(`design:returntype`,Promise)],Z.prototype,`addNonChatParticipant`,null),U([h.validateTypesAsync(h.nonNegativeInteger),W(`design:type`,Function),W(`design:paramtypes`,[Number]),W(`design:returntype`,Promise)],Z.prototype,`advanceLastReadMessageIndex`,null),U([h.validateTypesAsync([`undefined`,h.nonNegativeInteger],[`undefined`,h.nonNegativeInteger],[`undefined`,h.literal(`backwards`,`forward`)]),W(`design:type`,Function),W(`design:paramtypes`,[Number,Number,String]),W(`design:returntype`,Promise)],Z.prototype,`getMessages`,null),U([h.validateTypesAsync(h.nonEmptyString),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],Z.prototype,`getParticipantBySid`,null),U([h.validateTypesAsync(h.nonEmptyString),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],Z.prototype,`getParticipantByIdentity`,null),U([h.validateTypesAsync([h.nonEmptyString,Fe]),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Promise)],Z.prototype,`removeParticipant`,null),U([h.validateTypesAsync([`string`,FormData,h.literal(null),h.objectSchema(`media options`,{c
42ontentType:h.nonEmptyString,media:h.custom(function(e){var t=typeof e==`string`&&e.length>0||e instanceof Uint8Array||e instanceof ArrayBuffer;return typeof Blob==`function`&&(t||=e instanceof Blob),[t,`a non-empty string, an instance of Buffer or an instance of Blob`]})})],Y,[`undefined`,h.literal(null),h.objectSchema(`email attributes`,{subject:[h.nonEmptyString,`undefined`]})]),W(`design:type`,Function),W(`design:paramtypes`,[Object,Object,Object]),W(`design:returntype`,Promise)],Z.prototype,`sendMessage`,null),U([h.validateTypesAsync(h.literal(`default`,`muted`)),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],Z.prototype,`setUserNotificationLevel`,null),U([h.validateTypesAsync(ve),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Promise)],Z.prototype,`updateAttributes`,null),U([h.validateTypesAsync(`string`),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],Z.prototype,`updateFriendlyName`,null),U([h.validateTypesAsync([h.literal(null),h.nonNegativeInteger]),W(`design:type`,Function),W(`design:paramtypes`,[Number]),W(`design:returntype`,Promise)],Z.prototype,`updateLastReadMessageIndex`,null),U([h.validateTypesAsync([`string`,h.literal(null)]),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],Z.prototype,`updateUniqueName`,null);var Ht=function(){function e(){var t=this;I.default(this,e),this._promise=new Promise(function(e,n){t._resolve=e,t._reject=n})}return F.default(e,[{key:`promise`,get:function(){return this._promise}},{key:`update`,value:function(e){this._resolve(e)}},{key:`set`,value:function(e){this.current=e,this._resolve(e)}},{key:`fail`,value:function(e){this._reject(e)}}]),e}();function Ut(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Wt(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 43In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function Wt(e,t){if(e){if(typeof e==`string`)return Gt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gt(e,t)}}function Gt(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Kt(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 qt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Kt(Object(n),!0).forEach(function(t){P.default(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Jt(e){var t=Yt();return function(){var n=N.default(e),r;if(t){var i=N.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M.default(this,r)}}function Yt(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Xt=K.scope(`Conversations`),Zt=function(e){j.default(n,e);var t=Jt(n);function n(e,r){var i;return I.default(this,n),i=t.call(this),P.default(A.default(i),`conversations`,new Map),P.default(A.default(i),`myConversationsRead`,new Ht),P.default(A.default(i),`tombstones`,new Set),P.default(A.default(i),`myConversationsFetched`,!1),i.configuration=e,i.services=r,i}return F.default(n,[{key:`addConversation`,value:function(){var e=k.default(L.default.mark(function e(t){var n,r,i,a,o,s,c;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t?.attributes===void 0?{}:t.attributes,e.next=3,this.services.commandExecutor.mutateResource(`post`,this.configuration.links.conversations,{friendly_name:t.friendlyName,unique_name:t.uniqueName,access:t.access,attributes:n===void 0?void 0:JSON.stringify(n)});case 3:if(r=e.sent,i=r.sid??null,a=r.sync_objects?.conversation??null,o=qt({self:r.url},r.links),s=this.conversations.get(i),!s){e.next=12;break}return e.next=11,s._subscribe();case 11:return e.abrupt(`return`,s);case 12:return c=new Z({channel:a,entityName:``,uniqueName:``,attributes:null,createdBy:``,friendlyName:``,lastConsumedMessageIndex:0,dateCreated:null,dateUpdated:null},i,o,this.configuration,this.services),this.conversations.set(c.sid,c),this._registerForEvents(c),e.next=17,c._subscribe();
43case 17:return this.emit(`conversationAdded`,c),e.abrupt(`return`,c);case 19:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`fetchConversations`,value:function(){var e=k.default(L.default.mark(function e(){var t=this,n,r,i,a,o,s,c;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._getMap();case 3:return n=e.sent,n.on(S.SyncMap.itemAdded,function(e){Xt.debug(`itemAdded: ${e.item.key}`),t._upsertConversation(`sync`,e.item.key,e.item.data)}),n.on(S.SyncMap.itemRemoved,function(e){Xt.debug(`itemRemoved: ${e.key}`);var n=e.key;t.myConversationsFetched||t.tombstones.add(n);var r=t.conversations.get(n);r&&(r.status===`joined`&&(r._setStatus(`notParticipating`,`sync`),t.emit(`conversationLeft`,r)),t.conversations.delete(n),t.emit(`conversationRemoved`,r),r.emit(`removed`,r))}),n.on(S.SyncMap.itemUpdated,function(e){Xt.debug(`itemUpdated: ${e.item.key}`),t._upsertConversation(`sync`,e.item.key,e.item.data)}),e.next=9,this._fetchMyConversations();case 9:r=e.sent,i=[],a=Ut(r);try{for(a.s();!(o=a.n()).done;)s=o.value,i.push(this._upsertConversation(`rest`,s.channel_sid,s))}catch(e){a.e(e)}finally{a.f()}return this.myConversationsRead.set(!0),e.next=16,Promise.all(i);case 16:return this.myConversationsFetched=!0,this.tombstones.clear(),Xt.debug(`The conversations list has been successfully fetched`),e.abrupt(`return`,this);case 22:throw e.prev=22,e.t0=e.catch(0),c=`Failed to fetch the conversations list`,this.services.syncClient.connectionState!==`disconnected`&&Xt.error(c,e.t0),Xt.debug(`ERROR: ${c}`,e.t0),e.t0;case 28:case`end`:return e.stop()}},e,this,[[0,22]])}));function t(){return e.apply(this,arguments)}return t}()},{key:`getConversations`,value:function(){var e=k.default(L.default.mark(function e(){var t=this,n,r;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getMap();case 2:return n=e.sent,e.next=5,n.getItems();case 5:return r=e.sent,e.abrupt(`return`,this._wrapPaginator(r,function(e){return Promise.all(e.map(function(e){return t._upsertConversation(`sync`,e.key,e.data)}))}));case 7:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getConversation`,value:function(){var e=k.default(L.default.mark(function e(t){var n=this,r,i,a;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getMap();case 2:return r=e.sent,e.next=5,r.getItems({key:t});case 5:return i=e.sent,a=i.items.map(function(e){return n._upsertConversation(`sync`,e.key,e.data)}),e.abrupt(`return`,a.length>0?a[0]:null);case 8:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getConversationByUniqueName`,value:function(){var e=k.default(L.default.mark(function e(t){var n,r,i,a,o;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=new ge(this.configuration.links.myConversations).path(t).build(),e.next=3,this.services.network.get(n);case 3:return r=e.sent,i=r.body,a=i.conversation_sid,o={entityName:null,lastConsumedMessageIndex:i.last_read_message_index,status:i?.status||`unknown`,friendlyName:i.friendly_name,dateUpdated:i.date_updated,dateCreated:i.date_created,uniqueName:i.unique_name,createdBy:i.created_by,attributes:i.attributes,channel:i.sync_objects.conversation,roster:i.sync_objects.participants,messages:i.sync_objects.messages,notificationLevel:i?.notification_level,sid:a},e.abrupt(`return`,a?this._upsertConversation(`sync`,a,o):null);case 8:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`peekConversation`,value:function(){var e=k.default(L.default.mark(function e(t){var n,r,i,a;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=new ge(this.configuration.links.conversations).path(t).build(),e.next=3,this.services.network.get(n);case 3:return r=e.sent,i=r.body,a={entityName:null,status:i?.status||`unknown`,friendlyName:i.friendly_name,dateUpdated:i.date_updated,dateCreated:i.date_created,uniqueName:i.unique_name,createdBy:i.created_by,attributes:i.attributes,channel:i.sync_objects.conversation||`${t}.channel`,roster:i.sync_objects.participants,messages:i.sync_objects.messages,notificationLevel:i?.notification_level,sid:t},e.abrupt(`return`,this._upsertConversation(`sync`,t,a));case 7:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`_getMap`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.services.syncClient.map({id:this.configuration.myConversations,mode:`open_existing`});case 2:return e.abrupt(`return`,e.sent);case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`_wrapPaginator`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r=this,i;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n(t.items);case 2:return i=e.sent,e.abrupt(`return`,{items:i.filter(function(e){return e!==null}),hasNextPage:t.hasNextPage,hasPrevPage:t.hasPrevPage,nextPage:function(){return t.nextPage().then(function(e){return r._wrapPaginator(e,n)})},prevPage:function(){return t.prevPage().then(function(e){return r._wrapPaginator(e,n)})}});case 4:case`end`:return e.stop()}},e)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`_updateConversation`,value:function(){var e=k.default(L.default.mark(function e(t,n,r){var i,a,o;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n._statusSource!==void 0&&t!==n._statusSource,a=t!==`rest`||n._statusSource===`sync`,!(i&&a&&t!==`sync`)){e.next=5;break}return Xt.trace(`upsertConversation: conversation is known from sync and came from REST, ignoring`,{sid:n.sid,data:r.status,conversation:n.status}),e.abrupt(`return`);case 5:if(r.status!==`joined`||n.status===`joined`){e.next=15;break}return n._setStatus(`joined`,t),o={},r.notificationLevel!==void 0&&(o.notificationLevel=r.notificationLevel),r.lastConsumedMessageIndex!==void 0&&(o.lastConsumedMessageIndex=r.lastConsumedMessageIndex),_e(o,{})||n._update(o),e.next=13,n._subscribe();
43case 13:return this.emit(`conversationJoined`,n),e.abrupt(`return`);case 15:if(r.status!==`notParticipating`||n.status!==`joined`){e.next=22;break}return n._setStatus(`notParticipating`,t),n._update(r),e.next=20,n._subscribe();case 20:return this.emit(`conversationLeft`,n),e.abrupt(`return`);case 22:if(r.status!==`notParticipating`){e.next=26;break}return e.next=25,n._subscribe();case 25:return e.abrupt(`return`);case 26:n._update(r);case 27:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`_upsertConversation`,value:function(){var e=k.default(L.default.mark(function e(t,n,r){var i,a,o,s;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Xt.trace(`upsertConversation called for ${n}`,r),i=this.conversations.get(n),!i){e.next=9;break}return Xt.trace(`upsertConversation: the conversation ${i.sid} is known;its status is known from the source ${i._statusSource} and the update came from the source ${t}`,i),e.next=6,this._updateConversation(t,i,r);case 6:return e.next=8,i._subscribe();case 8:return e.abrupt(`return`,i);case 9:if(!(t===`rest`&&this.tombstones.has(n))){e.next=12;break}return Xt.trace(`upsertChannel: the conversation is deleted but reappeared again from REST, ignoring`,n),e.abrupt(`return`,null);case 12:return Xt.trace(`upsertConversation: creating a local conversation object with sid `+n,r),a=`${this.configuration.links.conversations}/${n}`,o={self:a,messages:`${a}/Messages`,participants:`${a}/Participants`},s=new Z(r,n,o,this.configuration,this.services),this.conversations.set(n,s),e.prev=17,e.next=20,s._subscribe();case 20:if(r.status!==`joined`){e.next=23;break}return e.next=23,s._fetchStreams();case 23:e.next=32;break;case 25:if(e.prev=25,e.t0=e.catch(17),e.t0.name===`SyncError`){e.next=29;break}throw e.t0;case 29:return Xt.trace(`upsertChannel: the conversation is missing some Sync entity(ies), ignoring`,n,e.t0),this.conversations.delete(n),e.abrupt(`return`,null);case 32:return this._registerForEvents(s),this.emit(`conversationAdded`,s),r.status===`joined`&&(s._setStatus(`joined`,t),this.emit(`conversationJoined`,s)),e.abrupt(`return`,s);case 36:case`end`:return e.stop()}},e,this,[[17,25]])}));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:`_fetchMyConversations`,value:function(){var e=k.default(L.default.mark(function e(){var t,n,r,i,a;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=null;case 2:return r=new ge(this.configuration.links.myConversations),n&&r.arg(`PageToken`,n),e.next=6,this.services.network.get(r.build());case 6:i=e.sent,a=i.body?.conversations.map(function(e){return{descriptor:e,channel_sid:e.conversation_sid,status:e.status,channel:e.sync_objects.conversation,messages:e.sync_objects.messages,roster:e.sync_objects.participants||`${e.conversation_sid}.roster`,lastConsumedMessageIndex:e.last_read_message_index,notificationLevel:e.notification_level}}),n=i.body.meta.next_token,t=[].concat(B.default(t),B.default(a));case 10:if(n){e.next=2;break}case 11:return e.abrupt(`return`,t);case 12:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`_onConversationRemoved`,value:function(e){var t=this.conversations.get(e);t&&(this.conversations.delete(e),this.emit(`conversationRemoved`,t))}},{key:`_registerForEvents`,value:function(e){var t=this;e.on(`removed`,function(){return t._onConversationRemoved(e.sid)}),e.on(`updated`,function(e){return t.emit(`conversationUpdated`,e)}),e.on(`participantJoined`,function(e){return t.emit(`participantJoined`,e)}),e.on(`participantLeft`,function(e){return t.emit(`participantLeft`,e)}),e.on(`participantUpdated`,function(e){return t.emit(`participantUpdated`,e)}),e.on(`messageAdded`,function(e){return t.emit(`messageAdded`,e)}),e.on(`messageUpdated`,function(e){return t.emit(`messageUpdated`,e)}),e.on(`messageRemoved`,function(e){return t.emit(`messageRemoved`,e)}),e.on(`typingStarted`,function(e){return t.emit(`typingStarted`,e)}),e.on(`typingEnded`,function(e){return t.emit(`typingEnded`,e)})}}]),n}(_.ReplayEventEmitter);function Qt(e){var t=$t();return function(){var n=N.default(e),r;if(t){var i=N.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M.default(this,r)}}function $t(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var en=function(e){j.default(n,e);var t=Qt(n);
43function n(e,r,i){var a;return I.default(this,n),a=t.call(this),a.configuration=r,a.services=i,a.fifoStack=[],a.myself=e,a.myself.on(`updated`,function(e){return a.emit(`userUpdated`,e)}),a.myself.on(`userSubscribed`,function(){return a.emit(`userSubscribed`,a.myself)}),a.myself.on(`userUnsubscribed`,function(){a.emit(`userUnsubscribed`,a.myself),a.myself._ensureFetched()}),a.subscribedUsers=new Map,a}return F.default(n,[{key:`handleUnsubscribeUser`,value:function(e){this.subscribedUsers.has(e.identity)&&this.subscribedUsers.delete(e.identity);var t=0;this.fifoStack.find(function(n,r){return n==e.identity&&(t=r,!0)})&&this.fifoStack.splice(t,1),this.emit(`userUnsubscribed`,e)}},{key:`handleSubscribeUser`,value:function(e){if(!this.subscribedUsers.has(e.identity)){if(this.fifoStack.length>=this.configuration.userInfosToSubscribe){var t,n,r=this.fifoStack.shift();(t=this.subscribedUsers)==null||(n=t.get(r))==null||n.unsubscribe()}this.fifoStack.push(e.identity),this.subscribedUsers.set(e.identity,e),this.emit(`userSubscribed`,e)}}},{key:`getUser`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r=this,i,a;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.myself._ensureFetched();case 2:if(t!=this.myself.identity){e.next=4;break}return e.abrupt(`return`,this.myself);case 4:if(i=this.subscribedUsers.get(t),!i){e.next=7;break}return e.abrupt(`return`,i);case 7:if(n==null){e.next=11;break}e.next=14;break;case 11:return e.next=13,this.getSyncUniqueName(t);case 13:n=e.sent;case 14:return a=new we(t,n,this.configuration,this.services),a.on(`updated`,function(e){return r.emit(`userUpdated`,e)}),a.on(`userSubscribed`,function(){return r.handleSubscribeUser(a)}),a.on(`userUnsubscribed`,function(){return r.handleUnsubscribeUser(a)}),e.next=20,a._ensureFetched();case 20:return e.abrupt(`return`,a);case 21:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`getSubscribedUsers`,value:function(){var e=k.default(L.default.mark(function e(){var t;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.myself._ensureFetched();case 2:return t=[this.myself],this.subscribedUsers.forEach(function(e){return t.push(e)}),e.abrupt(`return`,t);case 5:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getSyncUniqueName`,value:function(){var e=k.default(L.default.mark(function e(t){var n,r;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=new ge(this.configuration.links.users).path(t).build(),e.next=3,this.services.network.get(n);case 3:return r=e.sent,e.abrupt(`return`,r.body?.sync_objects.user_info_map??``);case 5:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()}]),n}(_.ReplayEventEmitter),tn=K.scope(`TypingIndicator`),nn=function(){function e(t,n,r){I.default(this,e),this.configuration=n,this.services=r,this.getConversation=t,this.serviceTypingTimeout=null,this.sentUpdates=new Map}return F.default(e,[{key:`typingTimeout`,get:function(){return this.configuration.typingIndicatorTimeoutOverride||this.serviceTypingTimeout||this.configuration.typingIndicatorTimeoutDefault}},{key:`initialize`,value:function(){var e=this;this.services.notificationClient.on(`message`,function(){var t=k.default(L.default.mark(function t(n,r){return L.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n!==ke.TYPING_INDICATOR){t.next=3;break}return t.next=3,e._handleRemoteTyping(r);case 3:case`end`:return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}())}},{key:`_handleRemoteTyping`,value:function(){var e=k.default(L.default.mark(function e(t){var n=this;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:tn.trace(`Got new typing indicator `,t),this.getConversation(t.channel_sid).then(function(e){e&&e._participants.forEac
43h(function(e){if(e.identity===t.identity||e.type===`apple`){var r=n.configuration.typingIndicatorTimeoutOverride?n.configuration.typingIndicatorTimeoutOverride+1e3:t.typing_timeout*1e3;e._startTyping(r)}})}).catch(function(e){throw tn.error(e),e});case 2:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`send`,value:function(e){var t=this.sentUpdates.get(e);return t&&t>Date.now()-this.typingTimeout?Promise.resolve():(this.sentUpdates.set(e,Date.now()),this._send(e))}},{key:`_send`,value:function(e){var t=this;tn.trace(`Sending typing indicator`);var n=this.configuration.links.typing,r={"Content-Type":`application/x-www-form-urlencoded`},i=`ChannelSid=${e}`;return this.services.twilsockClient.post(n,r,i,this.configuration.productId).then(function(e){e.body.hasOwnProperty(`typing_timeout`)&&(t.serviceTypingTimeout=e.body.typing_timeout*1e3)}).catch(function(e){throw tn.error(`Failed to send typing indicator:`,e),e})}}]),e}(),rn=F.default(function e(t){I.default(this,e),this.title=t.title||null,this.body=t.body||null,this.sound=t.sound||null,this.badge=t.badge||null,this.action=t.action||null,this.type=t.type||null,this.data=t.data||{}}),an=`2.7.0`;function on(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 sn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?on(Object(n),!0).forEach(function(t){P.default(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):on(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ln(e){var t=un();return function(){var n=N.default(e),r;if(t){var i=N.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M.default(this,r)}}function un(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var dn=function(e){return e.replace(/(^\/+|\/+$)/g,``)},fn=function(e){return e.status.code===202},pn=function(e){j.default(n,e);var t=ln(n);function n(e){return I.default(this,n),t.call(this,e)}return F.default(n)}(H.default(Error)),mn=function(){function e(t,n,r){I.default(this,e),this._serviceUrl=t,this._services=n,this._productId=r}return F.default(e,[{key:`_preProcessUrl`,value:function(e){var t=dn(e);return/^https?:\/\//.test(e)?t:`${dn(this._serviceUrl)}/${t}`}},{key:`_makeRequest`,value:function(){var e=k.default(L.default.mark(function e(t,n,r,i){var a,o,s,c;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a=this._preProcessUrl(n),o=sn({"Content-Type":`application/json; charset=utf-8`},i||{}),e.t0=t,e.next=e.t0===`get`?5:e.t0===`post`?11:e.t0===`delete`?15:19;break;case 5:return c=a,r&&(c+=`?`+Object.entries(r).map(function(e){return e.map(encodeURIComponent).join(`=`)}).join(`&`)),e.next=9,this._services.transport.get(c,o,this._productId);case 9:return s=e.sent,e.abrupt(`break`,19);case 11:return e.next=13,this._services.transport.post(a,o,JSON.stringify(r),this._productId);case 13:return s=e.sent,e.abrupt(`break`,19);case 15:return e.next=17,this._services.transport.delete(a,o,{},this._productId);case 17:return s=e.sent,e.abrupt(`break`,19);case 19:if(!(s.status.code<200||s.status.code>=300)){e.next=21;break}throw Error(`Request responded with a non-success code ${s.status.code}`);case 21:return e.abrupt(`return`,s);case 22:case`end`:return e.stop()}},e,this)}));function t(t,n,r,i){return e.apply(this,arguments)}return t}()},{key:`fetchResource`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r=this,i,a,o;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=6,a=new y.AsyncRetrier({min:50,max:1600,maxAttemptsCount:i}),e.prev=2,e.next=5,a.run(k.default(L.default.mark(function e(){var i;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r._makeRequest
43(`get`,t,n);case 3:return i=e.sent,e.abrupt(`return`,{type:`success`,data:i.body});case 7:if(e.prev=7,e.t0=e.catch(0),(e.t0===null||e.t0===void 0?void 0:e.t0.body?.status)!==404||(e.t0===null||e.t0===void 0?void 0:e.t0.body?.code)!==50530){e.next=11;break}return e.abrupt(`return`,{type:`noMetadata`});case 11:throw e.t0;case 12:case`end`:return e.stop()}},e,null,[[0,7]])})));case 5:o=e.sent,e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(2),Error(`Fetch resource from "${t}" failed.`);case 11:if(o.type!==`noMetadata`){e.next=13;break}throw new pn(`No metadata found.`);case 13:return e.abrupt(`return`,o.data);case 14:case`end`:return e.stop()}},e,null,[[2,8]])}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`mutateResource`,value:function(){var e=k.default(L.default.mark(function e(t,n,r){var i;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._makeRequest(t,n,r,{"X-Twilio-Mutation-Id":E.v4()});case 2:if(i=e.sent,!fn(i)){e.next=7;break}return e.next=6,this.fetchResource(i.body.resource_url);case 6:return e.abrupt(`return`,e.sent);case 7:return e.abrupt(`return`,i.body);case 8:case`end`:return e.stop()}},e,this)}));function t(t,n,r){return e.apply(this,arguments)}return t}()}]),e}(),hn=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:100,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5e3;I.default(this,e),P.default(this,`_cachedTemplates`,null),this._services=t,this._pageSize=n,this._cacheTtlMs=r}return F.default(e,[{key:`getContentTemplates`,value:function(){var e=k.default(L.default.mark(function e(){var t=this,n,r,i,a,o,s,c;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._cachedTemplates===null){e.next=2;break}return e.abrupt(`return`,this._cachedTemplates);case 2:return e.next=4,this._fetchContentTemplates();case 4:n=e.sent,r=V.default(n,2),i=r[0],a=r[1],o=i;case 9:if(a===null){e.next=19;break}return e.next=12,this._fetchContentTemplates(a);case 12:s=e.sent,c=V.default(s,2),i=c[0],a=c[1],o=[].concat(B.default(o),B.default(i)),e.next=9;break;case 19:return this._cachedTemplates=Object.freeze(o),setTimeout(function(){t._cachedTemplates=null},this._cacheTtlMs),e.abrupt(`return`,o);case 22:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`_fetchContentTemplates`,value:function(){var e=k.default(L.default.mark(function e(t){var n,r,i;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=`Client/v2/ContentTemplates`,r=new ge(n),r.arg(`PageSize`,this._pageSize),t!==void 0&&r.arg(`PageToken`,t),e.next=6,this._services.commandExecutor.fetchResource(r.build());case 6:return i=e.sent,e.abrupt(`return`,[i.templates.map(function(e){return new Je(e)}),i.meta.next_token]);case 8:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()}]),e}();function gn(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=_n(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 44In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function _n(e,t){if(e){if(typeof e==`string`)return yn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yn(e,t)}}function yn(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var xn=function(e){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(I.default(this,t),!(e.maxSize&&e.maxSize>0))throw TypeError("`maxSize` must be a number greater than 0");this.maxSize=e.maxSize,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}return F.default(t,[{key:`_set`,value:function(e,t){if(this.cache.set(e,t),this._size++,this._size>=this.maxSize){if(this._size=0,typeof this.onEviction==`function`){var n=gn(this.oldCache.entries()),r;try{for(n.s();!(r=n.n()).done;){var i=V.default(r.value,2),a=i[0],o=i[1];this.onEviction(a,o)}}catch(e){n.e(e)}finally{n.f()}}this.oldCache=this.cache,this.cache=new Map}}},{key:`get`,value:function(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e)){var t=this.oldCache.get(e);return this.oldCache.delete(e),this._set(e,t),t}}},{key:`set`,value:function(e,t){return this.cache.has(e)?this.cache.set(e,t):this._set(e,t),this}},{key:`has`,value:function(e){return this.cache.has(e)||this.oldCache.has(e)}},{key:`peek`,value:function(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e))return this.oldCache.get(e)}},{key:`delete`,value:function(e){var t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}},{key:`clear`,value:function(){this.cache.clear(),this.oldCache.clear(),this._size=0}},{key:`keys`,value:L.default.mark(function e(){var t,n,r,i;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=gn(this),e.prev=1,t.s();case 3:if((n=t.n()).done){e.next=9;break}return r=V.default(n.value,1),i=r[0],e.next=7,i;case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),t.e(e.t0);case 14:return e.prev=14,t.f(),e.finish(14);case 17:case`end`:return e.stop()}},e,this,[[1,11,14,17]])})},{key:`values`,value:L.default.mark(function e(){var t,n,r,i;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=gn(this),e.prev=1,t.s();case 3:if((n=t.n()).done){e.next=9;break}return r=V.default(n.value,2),i=r[1],e.next=7,i;case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),t.e(e.t0);case 14:return e.prev=14,t.f(),e.finish(14);case 17:case`end`:return e.stop()}},e,this,[[1,11,14,17]])})},{key:e,value:L.default.mark(function e(){var t,n,r,i,a,o,s,c;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=gn(this.cache),e.prev=1,t.s();case 3:if((n=t.n()).done){e.next=9;break}return r=n.value,e.next=7,r;case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),t.e(e.t0);case 14:return e.prev=14,t.f(),e.finish(14);case 17:i=gn(this.oldCache),e.prev=18,i.s();case 20:if((a=i.n()).done){e.next=28;break}
44if(o=a.value,s=V.default(o,1),c=s[0],this.cache.has(c)){e.next=26;break}return e.next=26,o;case 26:e.next=20;break;case 28:e.next=33;break;case 30:e.prev=30,e.t1=e.catch(18),i.e(e.t1);case 33:return e.prev=33,i.f(),e.finish(33);case 36:case`end`:return e.stop()}},e,this,[[1,11,14,17],[18,30,33,36]])})},{key:`size`,get:function(){var e=0,t=gn(this.oldCache.keys()),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;this.cache.has(r)||e++}}catch(e){t.e(e)}finally{t.f()}return Math.min(this._size+e,this.maxSize)}}]),t}(Symbol.iterator),Sn=F.default(function e(t,n){I.default(this,e),this.type=t,this.data=n,Object.freeze(n)}),wn=function(){function e(t,n){I.default(this,e),this._services=t,this._configuration=n,this._cache=new xn({maxSize:n.channelMetadataCacheCapacity})}return F.default(e,[{key:`getChannelMetadata`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r,i,a,o,s;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=`${t},${n}`,i=this._cache.get(r),!i){e.next=4;break}return e.abrupt(`return`,i.item);case 4:return a=`${this._configuration.links.conversations}/${t}/Messages/${n}/ChannelMetadata`,e.prev=5,e.next=8,this._services.commandExecutor.fetchResource(a);case 8:o=e.sent,e.next=17;break;case 11:if(e.prev=11,e.t0=e.catch(5),!(e.t0 instanceof pn)){e.next=16;break}return this._cache.set(r,{item:null}),e.abrupt(`return`,null);case 16:throw Error(e.t0);case 17:return s=new Sn(o.type,o.data),this._cache.set(r,{item:s}),e.abrupt(`return`,s);case 20:case`end`:return e.stop()}},e,this,[[5,11]])}));function t(t,n){return e.apply(this,arguments)}return t}()}]),e}();function Tn(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=En(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. 45In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function En(e,t){if(e){if(typeof e==`string`)return Dn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dn(e,t)}}function Dn(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var On=F.default(function e(t){I.default(this,e),P.default(this,`type`,`email`),this.messageSid=t.message_sid,this.level=t.level,this.name=t.name,this.address=t.address}),kn=F.default(function e(t){I.default(this,e),this.type=t.type,this.messageSid=t.message_sid,this.rawData=JSON.stringify(t)}),An=function(){function e(t,n){I.default(this,e),this._services=t,this._configuration=n,this._cache=new xn({maxSize:n.messageRecipientsCacheCapacity})}return F.default(e,[{key:`getRecipientsFromMessage`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r=this,i,a,o,s,c;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=`${t},${n}`,a=this._cache.get(i),!a){e.next=4;break}return e.abrupt(`return`,a.item);case 4:return o=new ge(this._configuration.links.conversations).path(t).path(`MessageRecipients`).arg(`MessageSid`,n).build(),e.next=7,this._services.commandExecutor.fetchResource(o);case 7:return s=e.sent,c=s.message_recipients.map(function(e){return r._wrapResponse(e)}),c.length>0&&this._cache.set(i,{item:c}),e.abrupt(`return`,c);case 11:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`getRecipientsFromConversation`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r=this,i,a,o,s,c,l,u,d;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=new ge(this._configuration.links.conversations).path(t).path(`MessageRecipients`).arg(`PageToken`,n?.pageToken??void 0).arg(`PageSize`,n?.pageSize??void 0).build(),e.next=3,this._services.commandExecutor.fetchResource(i);case 3:a=e.sent,o=a.message_recipients.map(function(e){return r._wrapResponse(e)}),s=Tn(o);try{for(s.s();!(c=s.n()).done;)l=c.value,u=`${t},${l.messageSid}`,d=this._cache.get(u)?.item??[],this._cache.set(u,{item:[].concat(B.default(d),[l])})}catch(e){s.e(e)}finally{s.f()}return e.abrupt(`return`,new He(o,function(e,n){return r.getRecipientsFromConversation(t,{pageToken:e,pageSize:n})},a.meta.previous_token,a.meta.next_token));case 8:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`_wrapResponse`,value:function(e){switch(e.type){case`email`:return new On(e);default:return new kn(e)}}}]),e}(),Pn;function Fn(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 In(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];
45t%2?Fn(Object(n),!0).forEach(function(t){P.default(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ln(e){var t=Rn();return function(){var n=N.default(e),r;if(t){var i=N.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M.default(this,r)}}function Rn(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var zn,Bn=F.default(function e(){I.default(this,e)});t.Client=zn=(Pn=function(e){j.default(n,e);var t=Ln(n);function n(e){var r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(I.default(this,n),r=t.call(this),P.default(A.default(r),`version`,an),P.default(A.default(r),`connectionState`,`unknown`),P.default(A.default(r),`parsePushNotification`,zn.parsePushNotification),r._fpaToken=e??``,r._options=i??{},!r._options.disableDeepClone){var a=In(In({},r._options),{},{transport:void 0,twilsockClient:void 0});a=pe(a),a.transport=r._options.transport,a.twilsockClient=r._options.twilsockClient,r._options=a}r._options.logLevel=r._options.logLevel??`silent`,zn._logger.setLevel(r._options.logLevel);var o=r._options.productId=`ip_messaging`;if(r._options.clientMetadata=r._options.clientMetadata||{},r._options.clientMetadata.hasOwnProperty(`type`)||(r._options.clientMetadata.type=`conversations`),r._options.clientMetadata.hasOwnProperty(`sdk`)||(r._options.clientMetadata.sdk=`JS`,r._options.clientMetadata.sdkv=an),r._options.Sync=r._options.Sync||{},r._options.Sync.enableSessionStorage===void 0&&(r._options.Sync.enableSessionStorage=!0),r._options.region&&(r._options.Sync.region=r._options.region),!e)throw Error(`A valid Twilio token should be provided`);r._services=new Bn,r._myself=new we(``,``,null,r._services);var s=!r._options.twilsockClient;if(!r._options.initRegistrations){var c=new b.InitRegistration(o);zn.populateInitRegistrations(c),r._options.initRegistrations=[c]}r._services.twilsockClient=r._options.twilsockClient=r._options.twilsockClient??new b.TwilsockClient(e,o,r._options),r._services.twilsockClient.on(zn.tokenAboutToExpire,function(){return r.emit(zn.tokenAboutToExpire)}),r._services.twilsockClient.on(zn.tokenExpired,function(){return r.emit(zn.tokenExpired)}),r._services.twilsockClient.on(zn.connectionError,function(e){return r.emit(zn.connectionError,e)}),r._services.twilsockClient.on(`stateChanged`,function(e){zn._logger.debug(`Handling stateChanged for ConversationsClient: new state ${e}`),e!==r.connectionState&&(r.connectionState=e,r.emit(zn.connectionStateChanged,r.connectionState))}),r._services.transport=r._options.transport=r._options.transport??r._options.twilsockClient,r._services.notificationClient=r._options.notificationsClient=r._options.notificationsClient??new x.Notifications(e,r._options),r._services.syncClient=r._options.syncClient=r._options.syncClient??new S.SyncClient(e,r._options);var l=i?.Chat||i?.IPMessaging||i||{},u=l.region||i?.region,d=l.apiUri||l.typingUri||`https://aim.${u||`us1`}.twilio.com`;r._services.commandExecutor=new mn(d,{transport:r._options.transport},o),r._services.contentClient=new hn(r._services);var f=function(e){r._rejectEnsureReady(e),r.emit(zn.stateChanged,`failed`),r.emit(zn.initFailed,{error:e})},p=function(){f({terminal:!0,message:`Twilsock has disconnected.`}),r._initializeEnsureReady(i?.throwErrorsAlways||!1)};return r._services.twilsockClient.once(`connectionError`,f),r._services.twilsockClient.once(`disconnected`,p),r._services.twilsockClient.once(`connected`,k.default(L.default.mark(function e(){var t,n;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return zn._logger.debug(`ConversationsClient started INITIALIZING`),r._services.twilsockClient.off(`connectionError`,f),r._services.twilsockClient.off(`disconnected`,p),e.prev=3,t=`conversations.client.startup`,r._services.twilsockClient.addPartialTelemetryEvent(new b.TelemetryEventDescription(t,`Conversations client startup`,new Date),t,b.TelemetryPoint.Start),e.next=8,r._initialize();case 8:r._services.twilsockClient.addPartialTelemetryEvent(new b.TelemetryEventDescription(``,``,
45new Date),t,b.TelemetryPoint.End),e.next=17;break;case 11:e.prev=11,e.t0=e.catch(3),n={terminal:!0,message:e.t0.message},r._rejectEnsureReady(n),r.emit(zn.stateChanged,`failed`),r.emit(zn.initFailed,{error:n});case 17:case`end`:return e.stop()}},e,null,[[3,11]])}))),r._initializeEnsureReady(i?.throwErrorsAlways||!1),s&&r._services.twilsockClient.connect(),r}return F.default(n,[{key:`user`,get:function(){return this._myself}},{key:`reachabilityEnabled`,get:function(){if(!this._configuration)throw Error(`Reachability information could not yet be accessed as the client has not yet been initialized. Subscribe to the 'stateChanged' event to properly react to the client initialization.`);return this._configuration.reachabilityEnabled}},{key:`token`,get:function(){return this._fpaToken}},{key:`shutdown`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return e.next=4,this._services.twilsockClient.disconnect();case 4:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`updateToken`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:if(zn._logger.info(`updateToken`),this._fpaToken!==t){e.next=5;break}return e.abrupt(`return`,this);case 5:return e.next=7,this._services.twilsockClient.updateToken(t);case 7:return e.next=9,this._services.notificationClient.updateToken(t);case 9:return e.next=11,this._services.mcsClient.updateToken(t);case 11:return this._fpaToken=t,e.abrupt(`return`,this);case 13:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getConversationBySid`,value:function(){var e=k.default(L.default.mark(function e(t){var n;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return e.next=4,this._conversationsEntity.myConversationsRead.promise;case 4:return e.next=6,this._conversationsEntity.getConversation(t);case 6:if(n=e.sent,n){e.next=12;break}return e.next=10,this.peekConversationBySid(t);case 10:n=e.sent,n&&w.deprecationWarning(`The method getConversationBySid is deprecated to retrieve conversations you're not part of. Use peekConversationBySid instead.`);case 12:if(n){e.next=14;break}throw Error(`Conversation with SID ${t} was not found.`);case 14:return e.abrupt(`return`,n);case 15:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`peekConversationBySid`,value:function(){var e=k.default(L.default.mark(function e(t){var n;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return e.next=4,this._conversationsEntity.peekConversation(t);case 4:if(n=e.sent,n){e.next=7;break}throw Error(`Conversation with SID ${t} was not found.`);case 7:return e.abrupt(`return`,n);case 8:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getConversationByUniqueName`,value:function(){var e=k.default(L.default.mark(function e(t){var n;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return e.next=4,this._conversationsEntity.myConversationsRead.promise;case 4:return e.next=6,this._conversationsEntity.getConversationByUniqueName(t);case 6:if(n=e.sent,n){e.next=9;break}throw Error(`Conversation with unique name ${t} was not found.`);case 9:return e.abrupt(`return`,n);case 10:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getSubscribedConversations`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return e.abrupt(`return`,this._conversationsPromise.then(function(e){return e.getConversations()}));case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`createConversation`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return t||={}
45,e.abrupt(`return`,this._conversationsPromise.then(function(e){return e.addConversation(t)}));case 4:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`setPushRegistrationId`,value:function(){var e=k.default(L.default.mark(function e(t,n){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return this._subscribeToPushNotifications(t),this._services.notificationClient.setPushRegistrationId(t,n),e.next=6,this._services.notificationClient.commitChanges();case 6:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`unsetPushRegistrationId`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return this._unsubscribeFromPushNotifications(t),e.next=5,this._services.notificationClient.commitChanges();case 5:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`removePushRegistrations`,value:function(){var e=k.default(L.default.mark(function e(t,n){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._services.notificationClient.removeRegistrations(t,n);case 2:case`end`:return e.stop()}},e,this)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`handlePushNotification`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:zn._logger.debug(`handlePushNotification, notificationPayload=`,t),this.emit(`pushNotification`,zn.parsePushNotification(t));case 4:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getUser`,value:function(){var e=k.default(L.default.mark(function e(t){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return e.abrupt(`return`,this._services.users.getUser(t));case 3:case`end`:return e.stop()}},e,this)}));function t(t){return e.apply(this,arguments)}return t}()},{key:`getSubscribedUsers`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return e.abrupt(`return`,this._services.users.getSubscribedUsers());case 3:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`getTemporaryContentUrlsForMediaSids`,value:function(e){var t=this;return new C.CancellablePromise(function(){var n=k.default(L.default.mark(function n(r,i,a){var o,s;return L.default.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(!(!t._services.mcsClient||!e)){n.next=3;break}return i(Error(`Media Content Service is unavailable`)),n.abrupt(`return`);case 3:return o=t._services.mcsClient.mediaSetGetContentUrls(e),a(function(){o.cancel()}),n.prev=5,n.next=8,o;case 8:s=n.sent,r(s),n.next=15;break;case 12:n.prev=12,n.t0=n.catch(5),i(n.t0);case 15:case`end`:return n.stop()}},n,null,[[5,12]])}));return function(e,t,r){return n.apply(this,arguments)}}())}},{key:`getTemporaryContentUrlsForMedia`,value:function(e){var t=e.map(function(e){return e.sid});return this.getTemporaryContentUrlsForMediaSids(t)}},{key:`getContentTemplates`,value:function(){var e=k.default(L.default.mark(function e(){return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ensureReady;case 2:return e.next=4,this._services.contentClient.getContentTemplates();case 4:return e.abrupt(`return`,e.sent);case 5:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`_initialize`,value:function(){var e=k.default(L.default.mark(function e(){var t=this,n;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._services.commandExecutor.fetchResource(`Client/v2/Configuration`);case 2:return n=e.sent,this._configuration=new fe(this._options,n,zn._logger),this._services.channelMetadataClient=new wn(this._services,this._configuration),this._services.messageRecipientsClient=new An(this._services,this._configuration),this._myself._resolveInitialization(this._configuration,this._configuration.userIdentity,this._configuration.userInfo,!0),this._services.typingIndicator=new nn(this.getConversationBySid.bind(this),this._configuration,this._services),this._services.network=new Oe(this._configuration,this._services),this._services.users=new en(this._myself,this._configuration,this._services),this._services.users.on(`userSubscribed`,function(e){t.emit(`userSubscribed`,e)}),this._services.users.on(`userUpdated`,function(e){return t.emit(`userUpdated`,e)}),this._services.users.on(`userUnsubscribed`,function(e){t.emit(`userUnsubscribed`,e)}),this._conversationsEntity=new Zt(this._configuration,this._services),this._conversationsEntity.on(`conversationAdded`,function(e){t.emit(`conversationAdded`,e)}),this._conversationsEntity.on(`conversationRemoved`,function(e){t.emit(`conversationRemoved`,e)}),this._conversationsEntity.on(`conversationJoined`,function(e){t.emit(`conversationJoined`,e)}),this._conversationsEntity.on(`conversationLeft`,function(e){t.emit(`conversationLeft`,e)}),this._conversationsEntity.on(`conversationUpdated`,function(e){return t.emit(`conversationUpdated`,e)}),this._conversationsEntity.on(`participantJoined`,function(e){t.emit(`participantJoined`,e)}),this._conversationsEntity.on(`participantLeft`,function(e){t.emit(`participantLeft`,e)}),this._conversationsEntity.on(`participantUpdated`,function(e){return t.emit(`participantUpdated`,e)}),this._conversationsEntity.on(`messageAdded`,function(e){return t.emit(`messageAdded`,e)}),this._conversationsEntity.on(`messageUpdated`,function(e){return t.emit(`messageUpdated`,e)}),this._conversationsEntity.on(`messageRemoved`,function(e){return t.emit(`messageRemoved`,e)}),this._conversationsEntity.on(`typingStarted`,function(e){return t.emit(`typingStarted`,e)}),this._conversationsEntity.on(`typingEnded`,function(e){return t.emit(`typingEnded`,e)}
45),this._conversationsPromise=this._conversationsEntity.fetchConversations().then(function(){return t._conversationsEntity}).catch(function(e){throw console.error(`Failed to fetch conversations _conversationsPromise -> client.ts`,e),e}),e.next=30,this._services.users.myself._ensureFetched();case 30:zn._supportedPushChannels.forEach(function(e){return t._subscribeToPushNotifications(e)}),this._services.typingIndicator.initialize(),this._services.mcsClient=new C.McsClient(this._fpaToken,this._configuration.links.mediaService,this._configuration.links.mediaSetService,In(In({},this._options),{},{transport:void 0})),this._resolveEnsureReady(),this.emit(zn.stateChanged,`initialized`),this.emit(zn.initialized);case 36:case`end`:return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:`_subscribeToPushNotifications`,value:function(e){var t=this;[ke.NEW_MESSAGE,ke.ADDED_TO_CONVERSATION,ke.REMOVED_FROM_CONVERSATION,ke.TYPING_INDICATOR,ke.CONSUMPTION_UPDATE].forEach(function(n){t._services.notificationClient.subscribe(e,n)})}},{key:`_unsubscribeFromPushNotifications`,value:function(e){var t=this;[ke.NEW_MESSAGE,ke.ADDED_TO_CONVERSATION,ke.REMOVED_FROM_CONVERSATION,ke.TYPING_INDICATOR,ke.CONSUMPTION_UPDATE].forEac
45h(function(n){t._services.notificationClient.unsubscribe(e,n)})}},{key:`_initializeEnsureReady`,value:function(e){var t=this;this._ensureReady=new Promise(function(e,n){t._resolveEnsureReady=e,t._rejectEnsureReady=n}).catch(function(t){if(e)throw t})}}],[{key:`create`,value:function(){var e=k.default(L.default.mark(function e(t,n){var r;return L.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n!=null&&n.twilsockClient)){e.next=2;break}throw Error(`Obsolete usage of ConversationsClient.create() factory method: if you pass twilsock from the outside then you must use ConversationsClient constructor and be prepared to work with uninitialized client.`);case 2:return r=new zn(t,n),e.next=5,r._ensureReady;case 5:return e.abrupt(`return`,r);case 6:case`end`:return e.stop()}},e)}));function t(t,n){return e.apply(this,arguments)}return t}()},{key:`parsePushNotification`,value:function(e){if(zn._logger.debug(`parsePushNotification, notificationPayload=`,e),e.aps!==void 0){if(!e.twi_message_type)throw Error(`Provided push notification payload does not contain Programmable Chat push notification type`);var t=zn._parsePushNotificationChatData(e),n=e.aps,r,i=null;return typeof n.alert==`string`?r=n.alert||null:(r=n.alert?.body||null,i=n.alert?.title||null),new rn({title:i,body:r,sound:n.sound||null,badge:n.badge||null,action:n.category||null,type:e.twi_message_type,data:t})}if(e.data!==void 0){var a=e.data;if(!a.twi_message_type)throw Error(`Provided push notification payload does not contain Programmable Chat push notification type`);var o=zn._parsePushNotificationChatData(e.data);return new rn({title:a.twi_title||null,body:a.twi_body||null,sound:a.twi_sound||null,badge:null,action:a.twi_action||null,type:a.twi_message_type,data:o})}throw Error(`Provided push notification payload is not Programmable Chat notification`)}},{key:`_parsePushNotificationChatData`,value:function(e){var t={};for(var n in zn._supportedPushDataFields){var r=e[n];if(r!=null){if(n===`message_index`||n===`media_count`){var i=me(r);i!==null&&(t[zn._supportedPushDataFields[n]]=i);continue}if(n===`media`){if(typeof r==`string`)try{t[zn._supportedPushDataFields[n]]=JSON.parse(r)}catch{zn._logger.debug(`Media message notification parsing error`)}continue}t[zn._supportedPushDataFields[n]]=r}}return t}},{key:`populateInitRegistrations`,value:function(e){e.populateInitRegistrations([ke.TYPING_INDICATOR]),S.SyncClient.populateInitRegistrations(e)}}]),n}(_.ReplayEventEmitter),P.default(Pn,`conversationAdded`,`conversationAdded`),P.default(Pn,`conversationJoined`,`conversationJoined`),P.default(Pn,`conversationLeft`,`conversationLeft`),P.default(Pn,`conversationRemoved`,`conversationRemoved`),P.default(Pn,`conversationUpdated`,`conversationUpdated`),P.default(Pn,`participantJoined`,`participantJoined`),P.default(Pn,`participantLeft`,`participantLeft`),P.default(Pn,`participantUpdated`,`participantUpdated`),P.default(Pn,`messageAdded`,`messageAdded`),P.default(Pn,`messageRemoved`,`messageRemoved`),P.default(Pn,`messageUpdated`,`messageUpdated`),P.default(Pn,`tokenAboutToExpire`,`tokenAboutToExpire`),P.default(Pn,`tokenExpired`,`tokenExpired`),P.default(Pn,`typingEnded`,`typingEnded`),P.default(Pn,`typingStarted`,`typingStarted`),P.default(Pn,`pushNotification`,`pushNotification`),P.default(Pn,`userSubscribed`,`userSubscribed`),P.default(Pn,`userUnsubscribed`,`userUnsubscribed`),P.default(Pn,`userUpdated`,`userUpdated`),P.default(Pn,`stateChanged`,`stateChanged`),P.default(Pn,`initialized`,`initialized`),P.default(Pn,`initFailed`,`initFailed`),P.default(Pn,`connectionStateChanged`,`connectionStateChanged`),P.default(Pn,`connectionError`,`connectionError`),P.default(Pn,`version`,an),P.default(Pn,`_logger`,K.scope(`Client`)),P.default(Pn,`_supportedPushChannels`,[`fcm`,`apn`]),P.default(Pn,`_supportedPushDataFields`,{conversation_sid:`conversationSid`,conversation_title:`conversationTitle`,message_sid:`messageSid`,message_index:`messageIndex`,media_count:`mediaCount`,media:`media`}),Pn),U([w.deprecated(`token`),W(`design:type`,String),W(`design:paramtypes`,[])],t.Client.prototype,`token`,null),U([h.validateTypesAsync(h.nonEmptyString),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],t.Client.prototype,`updateToken`,null),U([h.validateTypesAsync(h.nonEmptyString),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],t.Client.prototype,`getConversationBySid`,null),U([h.validateTypesAsync(h.nonEmptyString),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],t.Client.prototype,`peekConversationBySid`,null),U([h.validateTypesAsync(h.nonEmptyString),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],t.Client.prototype,`getConversationByUniqueName`,null),U([h.validateTypesAsync([`undefined`,h.objectSchema(`conversation options`,{friendlyName:[`string`,`undefined`],isPrivate:[`boolean`,`undefined`],uniqueName:[`string`,`undefined`]})]),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Promise)],t.Client.prototype,`createConversation`,null),U([h.validateTypesAsync(h.literal(`fcm`,`apn`),`string`),W(`design:type`,Function),W(`design:paramtypes`,[String,String]),W(`design:returntype`,Promise)],t.Client.prototype,`setPushRegistrationId`,null),U([h.validateTypesAsync(h.literal(`fcm`,`apn`)),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],t.Client.prototype,`unsetPushRegistrationId`,null),U([h.validateTypesAsync(h.literal(`fcm`,`apn`),h.nonEmptyString),W(`design:type`,Function),W(`design:paramtypes`,[String,String]),W(`design:returntype`,Promise)],t.Client.prototype,`removePushRegistrations`,null),U([h.validateTypesAsync(h.pureObject),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,Promise)],t.Client.prototype,`handlePushNotification`,null),U([h.validateTypesAsync(h.nonEmptyString),W(`design:type`,Function),W(`design:paramtypes`,[String]),W(`design:returntype`,Promise)],t.Client.prototype,`getUser`,null),U([h.validateTypesAsync(h.nonEmptyArray(`strings`,`string`)),W(`design:type`,Function),W(`design:paramtypes`,[Array]),W(`design:returntype`,C.CancellablePromise)],t.Client.prototype,`getTemporaryContentUrlsForMediaSids`,null),U([h.validateTypesAsync(h.nonEmptyArray(`media`,Be)),W(`design:type`,Function),W(`design:paramtypes`,[Array]),W(`design:returntype`,C.CancellablePromise)],t.Client.prototype,`getTemporaryContentUrlsForMedia`,null),U([w.deprecated(`Client.create()`,`new Client()`),h.validateTypesAsync(`string`,[`undefined`,h.pureObject]),W(`design:type`,Function),W(`design:paramtypes`,[String,Object]),W(`design:returntype`,Promise)],t.Client,`create`,null),U([h.validateTypes(h.pureObject),W(`design:type`,Function),W(`design:paramtypes`,[Object]),W(`design:returntype`,rn)],t.Client,`parsePushNotification`,null),t.Client=zn=U([h.validateConstructorTypes(h.nonEmptyString,[h.pureObject,`undefined`]),W(`design:paramtypes`,[String,Object])],t.Client),Object.defineProperty(t,"CancellablePromise",{enumerable:!0,get:function(){return C.CancellablePromise}}),t.AggregatedDeliveryReceipt=Ve,t.ChannelMetadata=Sn,t.ContentTemplate=Je,t.ContentTemplateVariable=qe,t.Conversation=Z,t.DetailedDeliveryReceipt=Ue,t.EmailRecipientDescriptor=On,t.Media=Be,t.Message=St,t.MessageBuilder=Ft,t.NotificationTypes=ke,t.Participant=Fe,t.PushNotification=rn,t.RestPaginator=He,t.UnknownRecipientDescriptor=kn,t.UnsentMessage=Pt,t.User=we}));
45export{Ka as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.