UNPKG

voicebot-react-native-expo

Version:

This is a voicebot-react-native package of Kipps AI voice bot for React Native Expo

3 lines 73.4 kB
"use strict";const l=require("livekit-client"),Dn=require("react");function Un(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const W=Un(Dn),Ye=Math.min,ce=Math.max,Ce=Math.round,Z=e=>({x:e,y:e}),Nn={left:"right",right:"left",bottom:"top",top:"bottom"},$n={start:"end",end:"start"};function mt(e,t,n){return ce(e,Ye(t,n))}function Me(e,t){return typeof e=="function"?e(t):e}function re(e){return e.split("-")[0]}function De(e){return e.split("-")[1]}function Ut(e){return e==="x"?"y":"x"}function Nt(e){return e==="y"?"height":"width"}function Ue(e){return["top","bottom"].includes(re(e))?"y":"x"}function $t(e){return Ut(Ue(e))}function jn(e,t,n){n===void 0&&(n=!1);const r=De(e),i=$t(e),o=Nt(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=ke(a)),[a,ke(a)]}function Fn(e){const t=ke(e);return[Ge(e),t,Ge(t)]}function Ge(e){return e.replace(/start|end/g,t=>$n[t])}function Wn(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:a;default:return[]}}function Bn(e,t,n,r){const i=De(e);let o=Wn(re(e),n==="start",r);return i&&(o=o.map(a=>a+"-"+i),t&&(o=o.concat(o.map(Ge)))),o}function ke(e){return e.replace(/left|right|bottom|top/g,t=>Nn[t])}function Vn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Hn(e){return typeof e!="number"?Vn(e):{top:e,right:e,bottom:e,left:e}}function Ae(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function bt(e,t,n){let{reference:r,floating:i}=e;const o=Ue(t),a=$t(t),s=Nt(a),c=re(t),u=o==="y",f=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[s]/2-i[s]/2;let p;switch(c){case"top":p={x:f,y:r.y-i.height};break;case"bottom":p={x:f,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(De(t)){case"start":p[a]-=h*(n&&u?-1:1);break;case"end":p[a]+=h*(n&&u?-1:1);break}return p}const zn=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,s=o.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:d}=bt(u,r,c),h=r,p={},b=0;for(let v=0;v<s.length;v++){const{name:g,fn:m}=s[v],{x:S,y,data:L,reset:P}=await m({x:f,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:u,platform:a,elements:{reference:e,floating:t}});f=S??f,d=y??d,p={...p,[g]:{...p[g],...L}},P&&b<=50&&(b++,typeof P=="object"&&(P.placement&&(h=P.placement),P.rects&&(u=P.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):P.rects),{x:f,y:d}=bt(u,h,c)),v=-1)}return{x:f,y:d,placement:h,strategy:i,middlewareData:p}};async function jt(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:a,elements:s,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=Me(t,e),b=Hn(p),g=s[h?d==="floating"?"reference":"floating":d],m=Ae(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:u,rootBoundary:f,strategy:c})),S=d==="floating"?{...a.floating,x:r,y:i}:a.reference,y=await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),L=await(o.isElement==null?void 0:o.isElement(y))?await(o.getScale==null?void 0:o.getScale(y))||{x:1,y:1}:{x:1,y:1},P=Ae(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:S,offsetParent:y,strategy:c}):S);return{top:(m.top-P.top+b.top)/L.y,bottom:(P.bottom-m.bottom+b.bottom)/L.y,left:(m.left-P.left+b.left)/L.x,right:(P.right-m.right+b.right)/L.x}}const Yn=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:a,initialPlacement:s,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...g}=Me(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const m=re(i),S=re(s)===s,y=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=h||(S||!v?[ke(s)]:Fn(s));!h&&b!=="none"&&L.push(...Bn(s,v,b,y));const P=[s,...L],ne=await jt(t,g),Y=[];let x=((r=o.flip)==null?void 0:r.overflows)||[];if(f&&Y.push(ne[m]),d){const E=jn(i,a,y);Y.push(ne[E[0]],ne[E[1]])}if(x=[...x,{placement:i,overflows:Y}],!Y.every(E=>E<=0)){var T,_;const E=(((T=o.flip)==null?void 0:T.index)||0)+1,F=P[E];if(F)return{data:{index:E,overflows:x},reset:{placement:F}};let q=(_=x.filter(J=>J.overflows[0]<=0).sort((J,ae)=>J.overflows[1]-ae.overflows[1])[0])==null?void 0:_.placement;if(!q)switch(p){case"bestFit":{var w;const J=(w=x.map(ae=>[ae.placement,ae.overflows.filter(me=>me>0).reduce((me,Mn)=>me+Mn,0)]).sort((ae,me)=>ae[1]-me[1])[0])==null?void 0:w[0];J&&(q=J);break}case"initialPlacement":q=s;break}if(i!==q)return{reset:{placement:q}}}return{}}}};async function Gn(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=re(n),s=De(n),c=Ue(n)==="y",u=["left","top"].includes(a)?-1:1,f=o&&c?-1:1,d=Me(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:b}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&typeof b=="number"&&(p=s==="end"?b*-1:b),c?{x:p*f,y:h*u}:{x:h*u,y:p*f}}const Kn=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:a,middlewareData:s}=t,c=await Gn(t,e);return a===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:a}}}}},Qn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:s={fn:g=>{let{x:m,y:S}=g;return{x:m,y:S}}},...c}=Me(e,t),u={x:n,y:r},f=await jt(t,c),d=Ue(re(i)),h=Ut(d);let p=u[h],b=u[d];if(o){const g=h==="y"?"top":"left",m=h==="y"?"bottom":"right",S=p+f[g],y=p-f[m];p=mt(S,p,y)}if(a){const g=d==="y"?"top":"left",m=d==="y"?"bottom":"right",S=b+f[g],y=b-f[m];b=mt(S,b,y)}const v=s.fn({...t,[h]:p,[d]:b});return{...v,data:{x:v.x-n,y:v.y-r}}}}};function Ne(){return typeof window<"u"}function ve(e){return Ft(e)?(e.nodeName||"").toLowerCase():"#document"}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function K(e){var t;return(t=(Ft(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ft(e){return Ne()?e instanceof Node||e instanceof U(e).Node:!1}function B(e){return Ne()?e instanceof Element||e instanceof U(e).Element:!1}function z(e){return Ne()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function gt(e){return!Ne()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function Ee(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=V(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function qn(e){return["table","td","th"].includes(ve(e))}function $e(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function it(e){const t=ot(),n=B(e)?V(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Jn(e){let t=ee(e);for(;z(t)&&!fe(t);){if(it(t))return t;if($e(t))return null;t=ee(t)}return null}function ot(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function fe(e){return["html","body","#document"].includes(ve(e))}function V(e){return U(e).getComputedStyle(e)}function je(e){return B(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ee(e){if(ve(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gt(e)&&e.host||K(e);return gt(t)?t.host:t}function Wt(e){const t=ee(e);return fe(t)?e.ownerDocument?e.ownerDocument.body:e.body:z(t)&&Ee(t)?t:Wt(t)}function Ke(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Wt(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),a=U(i);if(o){const s=Qe(a);return t.concat(a,a.visualViewport||[],Ee(i)?i:[],s&&n?Ke(s):[])}return t.concat(i,Ke(i,[],n))}function Qe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Bt(e){const t=V(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=z(e),o=i?e.offsetWidth:n,a=i?e.offsetHeight:r,s=Ce(n)!==o||Ce(r)!==a;return s&&(n=o,r=a),{width:n,height:r,$:s}}function Vt(e){return B(e)?e:e.contextElement}function ue(e){const t=Vt(e);if(!z(t))return Z(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=Bt(t);let a=(o?Ce(n.width):n.width)/r,s=(o?Ce(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const Xn=Z(0);function Ht(e){const t=U(e);return!ot()||!t.visualViewport?Xn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==U(e)?!1:t}function ge(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=Vt(e);let a=Z(1);t&&(r?B(r)&&(a=ue(r)):a=ue(e));const s=Zn(o,n,r)?Ht(o):Z(0);let c=(i.left+s.x)/a.x,u=(i.top+s.y)/a.y,f=i.width/a.x,d=i.height/a.y;if(o){const h=U(o),p=r&&B(r)?U(r):r;let b=h,v=Qe(b);for(;v&&r&&p!==b;){const g=ue(v),m=v.getBoundingClientRect(),S=V(v),y=m.left+(v.clientLeft+parseFloat(S.paddingLeft))*g.x,L=m.top+(v.clientTop+parseFloat(S.paddingTop))*g.y;c*=g.x,u*=g.y,f*=g.x,d*=g.y,c+=y,u+=L,b=U(v),v=Qe(b)}}return Ae({width:f,height:d,x:c,y:u})}function er(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",a=K(r),s=t?$e(t.floating):!1;if(r===a||s&&o)return n;let c={scrollLeft:0,scrollTop:0},u=Z(1);const f=Z(0),d=z(r);if((d||!d&&!o)&&((ve(r)!=="body"||Ee(a))&&(c=je(r)),z(r))){const h=ge(r);u=ue(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x,y:n.y*u.y-c.scrollTop*u.y+f.y}}function tr(e){return Array.from(e.getClientRects())}function qe(e,t){const n=je(e).scrollLeft;return t?t.left+n:ge(K(e)).left+n}function nr(e){const t=K(e),n=je(e),r=e.ownerDocument.body,i=ce(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=ce(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+qe(e);const s=-n.scrollTop;return V(r).direction==="rtl"&&(a+=ce(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:a,y:s}}function rr(e,t){const n=U(e),r=K(e),i=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,s=0,c=0;if(i){o=i.width,a=i.height;const u=ot();(!u||u&&t==="fixed")&&(s=i.offsetLeft,c=i.offsetTop)}return{width:o,height:a,x:s,y:c}}function ir(e,t){const n=ge(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=z(e)?ue(e):Z(1),a=e.clientWidth*o.x,s=e.clientHeight*o.y,c=i*o.x,u=r*o.y;return{width:a,height:s,x:c,y:u}}function yt(e,t,n){let r;if(t==="viewport")r=rr(e,n);else if(t==="document")r=nr(K(e));else if(B(t))r=ir(t,n);else{const i=Ht(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Ae(r)}function zt(e,t){const n=ee(e);return n===t||!B(n)||fe(n)?!1:V(n).position==="fixed"||zt(n,t)}function or(e,t){const n=t.get(e);if(n)return n;let r=Ke(e,[],!1).filter(s=>B(s)&&ve(s)!=="body"),i=null;const o=V(e).position==="fixed";let a=o?ee(e):e;for(;B(a)&&!fe(a);){const s=V(a),c=it(a);!c&&s.position==="fixed"&&(i=null),(o?!c&&!i:!c&&s.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Ee(a)&&!c&&zt(e,a))?r=r.filter(f=>f!==a):i=s,a=ee(a)}return t.set(e,r),r}function ar(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?$e(t)?[]:or(t,this._c):[].concat(n),r],s=a[0],c=a.reduce((u,f)=>{const d=yt(t,f,i);return u.top=ce(d.top,u.top),u.right=Ye(d.right,u.right),u.bottom=Ye(d.bottom,u.bottom),u.left=ce(d.left,u.left),u},yt(t,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function sr(e){const{width:t,height:n}=Bt(e);return{width:t,height:n}}function cr(e,t,n){const r=z(t),i=K(t),o=n==="fixed",a=ge(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const c=Z(0);if(r||!r&&!o)if((ve(t)!=="body"||Ee(i))&&(s=je(t)),r){const p=ge(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&(c.x=qe(i));let u=0,f=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();f=p.top+s.scrollTop,u=p.left+s.scrollLeft-qe(i,p)}const d=a.left+s.scrollLeft-c.x-u,h=a.top+s.scrollTop-c.y-f;return{x:d,y:h,width:a.width,height:a.height}}function Be(e){return V(e).position==="static"}function wt(e,t){if(!z(e)||V(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return K(e)===n&&(n=n.ownerDocument.body),n}function Yt(e,t){const n=U(e);if($e(e))return n;if(!z(e)){let i=ee(e);for(;i&&!fe(i);){if(B(i)&&!Be(i))return i;i=ee(i)}return n}let r=wt(e,t);for(;r&&qn(r)&&Be(r);)r=wt(r,t);return r&&fe(r)&&Be(r)&&!it(r)?n:r||Jn(e)||n}const ur=async function(e){const t=this.getOffsetParent||Yt,n=this.getDimensions,r=await n(e.floating);return{reference:cr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lr(e){return V(e).direction==="rtl"}const fr={convertOffsetParentRelativeRectToViewportRelativeRect:er,getDocumentElement:K,getClippingRect:ar,getOffsetParent:Yt,getElementRects:ur,getClientRects:tr,getDimensions:sr,getScale:ue,isElement:B,isRTL:lr},dr=Kn,pr=Qn,vr=Yn,hr=(e,t,n)=>{const r=new Map,i={platform:fr,...n},o={...i.platform,_c:r};return zn(e,t,{...i,platform:o})};var Gt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qt={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.log=n()})(Gt,function(){var t=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],o={},a=null;function s(v,g){var m=v[g];if(typeof m.bind=="function")return m.bind(v);try{return Function.prototype.bind.call(m,v)}catch{return function(){return Function.prototype.apply.apply(m,[v,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(v){return v==="debug"&&(v="log"),typeof console===n?!1:v==="trace"&&r?c:console[v]!==void 0?s(console,v):console.log!==void 0?s(console,"log"):t}function f(){for(var v=this.getLevel(),g=0;g<i.length;g++){var m=i[g];this[m]=g<v?t:this.methodFactory(m,v,this.name)}if(this.log=this.debug,typeof console===n&&v<this.levels.SILENT)return"No console available for logging"}function d(v){return function(){typeof console!==n&&(f.call(this),this[v].apply(this,arguments))}}function h(v,g,m){return u(v)||d.apply(this,arguments)}function p(v,g){var m=this,S,y,L,P="loglevel";typeof v=="string"?P+=":"+v:typeof v=="symbol"&&(P=void 0);function ne(w){var E=(i[w]||"silent").toUpperCase();if(!(typeof window===n||!P)){try{window.localStorage[P]=E;return}catch{}try{window.document.cookie=encodeURIComponent(P)+"="+E+";"}catch{}}}function Y(){var w;if(!(typeof window===n||!P)){try{w=window.localStorage[P]}catch{}if(typeof w===n)try{var E=window.document.cookie,F=encodeURIComponent(P),q=E.indexOf(F+"=");q!==-1&&(w=/^([^;]+)/.exec(E.slice(q+F.length+1))[1])}catch{}return m.levels[w]===void 0&&(w=void 0),w}}function x(){if(!(typeof window===n||!P)){try{window.localStorage.removeItem(P)}catch{}try{window.document.cookie=encodeURIComponent(P)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function T(w){var E=w;if(typeof E=="string"&&m.levels[E.toUpperCase()]!==void 0&&(E=m.levels[E.toUpperCase()]),typeof E=="number"&&E>=0&&E<=m.levels.SILENT)return E;throw new TypeError("log.setLevel() called with invalid level: "+w)}m.name=v,m.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},m.methodFactory=g||h,m.getLevel=function(){return L??y??S},m.setLevel=function(w,E){return L=T(w),E!==!1&&ne(L),f.call(m)},m.setDefaultLevel=function(w){y=T(w),Y()||m.setLevel(w,!1)},m.resetLevel=function(){L=null,x(),f.call(m)},m.enableAll=function(w){m.setLevel(m.levels.TRACE,w)},m.disableAll=function(w){m.setLevel(m.levels.SILENT,w)},m.rebuild=function(){if(a!==m&&(S=T(a.getLevel())),f.call(m),a===m)for(var w in o)o[w].rebuild()},S=T(a?a.getLevel():"WARN");var _=Y();_!=null&&(L=T(_)),f.call(m)}a=new p,a.getLogger=function(g){if(typeof g!="symbol"&&typeof g!="string"||g==="")throw new TypeError("You must supply a name when creating a logger.");var m=o[g];return m||(m=o[g]=new p(g,a.methodFactory)),m};var b=typeof window!==n?window.log:void 0;return a.noConflict=function(){return typeof window!==n&&window.log===a&&(window.log=b),a},a.getLoggers=function(){return o},a.default=a,a})})(Qt);var mr=Qt.exports;const br=Kt(mr);var Je=function(e,t){return Je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},Je(e,t)};function Q(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Je(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function gr(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(f){try{u(r.next(f))}catch(d){a(d)}}function c(f){try{u(r.throw(f))}catch(d){a(d)}}function u(f){f.done?o(f.value):i(f.value).then(s,c)}u((r=r.apply(e,t||[])).next())})}function qt(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(f){return c([u,f])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(f){u=[6,f],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function de(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function pe(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o}function ye(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function le(e){return this instanceof le?(this.v=e,this):new le(e)}function yr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(p){return function(b){return Promise.resolve(b).then(p,d)}}function s(p,b){r[p]&&(i[p]=function(v){return new Promise(function(g,m){o.push([p,v,g,m])>1||c(p,v)})},b&&(i[p]=b(i[p])))}function c(p,b){try{u(r[p](b))}catch(v){h(o[0][3],v)}}function u(p){p.value instanceof le?Promise.resolve(p.value.v).then(f,d):h(o[0][2],p)}function f(p){c("next",p)}function d(p){c("throw",p)}function h(p,b){p(b),o.shift(),o.length&&c(o[0][0],o[0][1])}}function wr(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof de=="function"?de(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(a){return new Promise(function(s,c){a=e[o](a),i(s,c,a.done,a.value)})}}function i(o,a,s,c){Promise.resolve(c).then(function(u){o({value:u,done:s})},a)}}function C(e){return typeof e=="function"}function at(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Ve=at(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription: `+n.map(function(r,i){return i+1+") "+r.toString()}).join(` `):"",this.name="UnsubscriptionError",this.errors=n}});function Oe(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Se=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,i,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=de(a),c=s.next();!c.done;c=s.next()){var u=c.value;u.remove(this)}}catch(v){t={error:v}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}else a.remove(this);var f=this.initialTeardown;if(C(f))try{f()}catch(v){o=v instanceof Ve?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var h=de(d),p=h.next();!p.done;p=h.next()){var b=p.value;try{Et(b)}catch(v){o=o??[],v instanceof Ve?o=ye(ye([],pe(o)),pe(v.errors)):o.push(v)}}}catch(v){r={error:v}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}if(o)throw new Ve(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Et(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Oe(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Oe(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),Jt=Se.EMPTY;function Xt(e){return e instanceof Se||e&&"closed"in e&&C(e.remove)&&C(e.add)&&C(e.unsubscribe)}function Et(e){C(e)?e():e.unsubscribe()}var Zt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},en={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,ye([e,t],pe(n)))},clearTimeout:function(e){var t=en.delegate;return((t==null?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function tn(e){en.setTimeout(function(){throw e})}function Le(){}function Pe(e){e()}var st=function(e){Q(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,Xt(n)&&n.add(r)):r.destination=xr,r}return t.create=function(n,r,i){return new Xe(n,r,i)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Se),Er=Function.prototype.bind;function He(e,t){return Er.call(e,t)}var Sr=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){Te(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){Te(r)}else Te(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){Te(n)}},e}(),Xe=function(e){Q(t,e);function t(n,r,i){var o=e.call(this)||this,a;if(C(n)||!n)a={next:n??void 0,error:r??void 0,complete:i??void 0};else{var s;o&&Zt.useDeprecatedNextContext?(s=Object.create(n),s.unsubscribe=function(){return o.unsubscribe()},a={next:n.next&&He(n.next,s),error:n.error&&He(n.error,s),complete:n.complete&&He(n.complete,s)}):a=n}return o.destination=new Sr(a),o}return t}(st);function Te(e){tn(e)}function Tr(e){throw e}var xr={closed:!0,next:Le,error:Tr,complete:Le},ct=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function ut(e){return e}function Pr(e){return e.length===0?ut:e.length===1?e[0]:function(n){return e.reduce(function(r,i){return i(r)},n)}}var A=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var i=this,o=kr(t)?t:new Xe(t,n,r);return Pe(function(){var a=i,s=a.operator,c=a.source;o.add(s?s.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=St(n),new n(function(i,o){var a=new Xe({next:function(s){try{t(s)}catch(c){o(c),a.unsubscribe()}},error:o,complete:i});r.subscribe(a)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[ct]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Pr(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=St(t),new t(function(r,i){var o;n.subscribe(function(a){return o=a},function(a){return i(a)},function(){return r(o)})})},e.create=function(t){return new e(t)},e}();function St(e){var t;return(t=e??Zt.Promise)!==null&&t!==void 0?t:Promise}function Cr(e){return e&&C(e.next)&&C(e.error)&&C(e.complete)}function kr(e){return e&&e instanceof st||Cr(e)&&Xt(e)}function Ar(e){return C(e==null?void 0:e.lift)}function j(e){return function(t){if(Ar(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function N(e,t,n,r,i){return new Or(e,t,n,r,i)}var Or=function(e){Q(t,e);function t(n,r,i,o,a,s){var c=e.call(this,n)||this;return c.onFinalize=a,c.shouldUnsubscribe=s,c._next=r?function(u){try{r(u)}catch(f){n.error(f)}}:e.prototype._next,c._error=o?function(u){try{o(u)}catch(f){n.error(f)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}catch(u){n.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(st),Lr=at(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),te=function(e){Q(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new Tt(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new Lr},t.prototype.next=function(n){var r=this;Pe(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var a=de(r.currentObservers),s=a.next();!s.done;s=a.next()){var c=s.value;c.next(n)}}catch(u){i={error:u}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}}})},t.prototype.error=function(n){var r=this;Pe(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},t.prototype.complete=function(){var n=this;Pe(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,i=this,o=i.hasError,a=i.isStopped,s=i.observers;return o||a?Jt:(this.currentObservers=null,s.push(n),new Se(function(){r.currentObservers=null,Oe(s,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,o=r.thrownError,a=r.isStopped;i?n.error(o):a&&n.complete()},t.prototype.asObservable=function(){var n=new A;return n.source=this,n},t.create=function(n,r){return new Tt(n,r)},t}(A),Tt=function(e){Q(t,e);function t(n,r){var i=e.call(this)||this;return i.destination=n,i.source=r,i}return t.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},t.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:Jt},t}(te),nn=function(e){Q(t,e);function t(n){var r=e.call(this)||this;return r._value=n,r}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(n){var r=e.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},t.prototype.getValue=function(){var n=this,r=n.hasError,i=n.thrownError,o=n._value;if(r)throw i;return this._throwIfClosed(),o},t.prototype.next=function(n){e.prototype.next.call(this,this._value=n)},t}(te),_r={now:function(){return Date.now()},delegate:void 0},Ir=function(e){Q(t,e);function t(n,r){return e.call(this)||this}return t.prototype.schedule=function(n,r){return this},t}(Se),xt={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,ye([e,t],pe(n)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},Rr=function(e){Q(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.scheduler=n,i.work=r,i.pending=!1,i}return t.prototype.schedule=function(n,r){var i;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var o=this.id,a=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(a,o,r)),this.pending=!0,this.delay=r,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(a,this.id,r),this},t.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),xt.setInterval(n.flush.bind(n,this),i)},t.prototype.recycleAsyncId=function(n,r,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return r;r!=null&&xt.clearInterval(r)},t.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(n,r);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(n,r){var i=!1,o;try{this.work(n)}catch(a){i=!0,o=a||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),o},t.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,i=n.scheduler,o=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Oe(o,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Ir),Pt=function(){function e(t,n){n===void 0&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(t,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},e.now=_r.now,e}(),Mr=function(e){Q(t,e);function t(n,r){r===void 0&&(r=Pt.now);var i=e.call(this,n,r)||this;return i.actions=[],i._active=!1,i}return t.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var i;this._active=!0;do if(i=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,i){for(;n=r.shift();)n.unsubscribe();throw i}},t}(Pt),Dr=new Mr(Rr),Ur=new A(function(e){return e.complete()});function Nr(e){return e&&C(e.schedule)}function rn(e){return e[e.length-1]}function Fe(e){return Nr(rn(e))?e.pop():void 0}function $r(e,t){return typeof rn(e)=="number"?e.pop():t}var lt=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function on(e){return C(e==null?void 0:e.then)}function an(e){return C(e[ct])}function sn(e){return Symbol.asyncIterator&&C(e==null?void 0:e[Symbol.asyncIterator])}function cn(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function jr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var un=jr();function ln(e){return C(e==null?void 0:e[un])}function fn(e){return yr(this,arguments,function(){var n,r,i,o;return qt(this,function(a){switch(a.label){case 0:n=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,le(n.read())];case 3:return r=a.sent(),i=r.value,o=r.done,o?[4,le(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,le(i)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function dn(e){return C(e==null?void 0:e.getReader)}function H(e){if(e instanceof A)return e;if(e!=null){if(an(e))return Fr(e);if(lt(e))return Wr(e);if(on(e))return Br(e);if(sn(e))return pn(e);if(ln(e))return Vr(e);if(dn(e))return Hr(e)}throw cn(e)}function Fr(e){return new A(function(t){var n=e[ct]();if(C(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Wr(e){return new A(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function Br(e){return new A(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,tn)})}function Vr(e){return new A(function(t){var n,r;try{for(var i=de(e),o=i.next();!o.done;o=i.next()){var a=o.value;if(t.next(a),t.closed)return}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()})}function pn(e){return new A(function(t){zr(e,t).catch(function(n){return t.error(n)})})}function Hr(e){return pn(fn(e))}function zr(e,t){var n,r,i,o;return gr(this,void 0,void 0,function(){var a,s;return qt(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=wr(e),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(a=r.value,t.next(a),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=c.sent(),i={error:s},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function X(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var o=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!i)return o}function vn(e,t){return t===void 0&&(t=0),j(function(n,r){n.subscribe(N(r,function(i){return X(r,e,function(){return r.next(i)},t)},function(){return X(r,e,function(){return r.complete()},t)},function(i){return X(r,e,function(){return r.error(i)},t)}))})}function hn(e,t){return t===void 0&&(t=0),j(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function Yr(e,t){return H(e).pipe(hn(t),vn(t))}function Gr(e,t){return H(e).pipe(hn(t),vn(t))}function Kr(e,t){return new A(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function Qr(e,t){return new A(function(n){var r;return X(n,t,function(){r=e[un](),X(n,t,function(){var i,o,a;try{i=r.next(),o=i.value,a=i.done}catch(s){n.error(s);return}a?n.complete():n.next(o)},0,!0)}),function(){return C(r==null?void 0:r.return)&&r.return()}})}function mn(e,t){if(!e)throw new Error("Iterable cannot be null");return new A(function(n){X(n,t,function(){var r=e[Symbol.asyncIterator]();X(n,t,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function qr(e,t){return mn(fn(e),t)}function Jr(e,t){if(e!=null){if(an(e))return Yr(e,t);if(lt(e))return Kr(e,t);if(on(e))return Gr(e,t);if(sn(e))return mn(e,t);if(ln(e))return Qr(e,t);if(dn(e))return qr(e,t)}throw cn(e)}function ft(e,t){return t?Jr(e,t):H(e)}function Ct(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Fe(e);return ft(e,n)}function Xr(e){return e instanceof Date&&!isNaN(e)}var Zr=at(function(e){return function(n){n===void 0&&(n=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=n}});function ei(e,t){var n=Xr(e)?{first:e}:typeof e=="number"?{each:e}:e,r=n.first,i=n.each,o=n.with,a=o===void 0?ti:o,s=n.scheduler,c=s===void 0?Dr:s,u=n.meta,f=u===void 0?null:u;if(r==null&&i==null)throw new TypeError("No timeout provided.");return j(function(d,h){var p,b,v=null,g=0,m=function(S){b=X(h,c,function(){try{p.unsubscribe(),H(a({meta:f,lastValue:v,seen:g})).subscribe(h)}catch(y){h.error(y)}},S)};p=d.subscribe(N(h,function(S){b==null||b.unsubscribe(),g++,h.next(v=S),i>0&&m(i)},void 0,void 0,function(){b!=null&&b.closed||b==null||b.unsubscribe(),v=null})),!g&&m(r!=null?typeof r=="number"?r:+r-c.now():i)})}function ti(e){throw new Zr(e)}function k(e,t){return j(function(n,r){var i=0;n.subscribe(N(r,function(o){r.next(e.call(t,o,i++))}))})}var ni=Array.isArray;function ri(e,t){return ni(t)?e.apply(void 0,ye([],pe(t))):e(t)}function ii(e){return k(function(t){return ri(e,t)})}function oi(e,t,n,r,i,o,a,s){var c=[],u=0,f=0,d=!1,h=function(){d&&!c.length&&!u&&t.complete()},p=function(v){return u<r?b(v):c.push(v)},b=function(v){u++;var g=!1;H(n(v,f++)).subscribe(N(t,function(m){t.next(m)},function(){g=!0},void 0,function(){if(g)try{u--;for(var m=function(){var S=c.shift();a||b(S)};c.length&&u<r;)m();h()}catch(S){t.error(S)}}))};return e.subscribe(N(t,p,function(){d=!0,h()})),function(){}}function dt(e,t,n){return n===void 0&&(n=1/0),C(t)?dt(function(r,i){return k(function(o,a){return t(r,o,i,a)})(H(e(r,i)))},n):(typeof t=="number"&&(n=t),j(function(r,i){return oi(r,i,e,n)}))}function bn(e){return e===void 0&&(e=1/0),dt(ut,e)}function ai(){return bn(1)}function _e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ai()(ft(e,Fe(e)))}var si=["addListener","removeListener"],ci=["addEventListener","removeEventListener"],ui=["on","off"];function Ze(e,t,n,r){if(C(n)&&(r=n,n=void 0),r)return Ze(e,t,n).pipe(ii(r));var i=pe(di(e)?ci.map(function(s){return function(c){return e[s](t,c,n)}}):li(e)?si.map(kt(e,t)):fi(e)?ui.map(kt(e,t)):[],2),o=i[0],a=i[1];if(!o&&lt(e))return dt(function(s){return Ze(s,t,n)})(H(e));if(!o)throw new TypeError("Invalid event target");return new A(function(s){var c=function(){for(var u=[],f=0;f<arguments.length;f++)u[f]=arguments[f];return s.next(1<u.length?u:u[0])};return o(c),function(){return a(c)}})}function kt(e,t){return function(n){return function(r){return e[n](t,r)}}}function li(e){return C(e.addListener)&&C(e.removeListener)}function fi(e){return C(e.on)&&C(e.off)}function di(e){return C(e.addEventListener)&&C(e.removeEventListener)}function pi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Fe(e),r=$r(e,1/0),i=e;return i.length?i.length===1?H(i[0]):bn(r)(ft(i,n)):Ur}function pt(e,t){return j(function(n,r){var i=0;n.subscribe(N(r,function(o){return e.call(t,o,i++)&&r.next(o)}))})}function vi(e,t,n,r,i){return function(o,a){var s=n,c=t,u=0;o.subscribe(N(a,function(f){var d=u++;c=s?e(c,f,d):(s=!0,f),a.next(c)},i))}}function hi(e,t){return t===void 0&&(t=ut),e=e??mi,j(function(n,r){var i,o=!0;n.subscribe(N(r,function(a){var s=t(a);(o||!e(i,s))&&(o=!1,i=s,r.next(a))}))})}function mi(e,t){return e===t}function bi(e){return j(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}function gi(e,t){return j(vi(e,t,arguments.length>=2,!0))}function yi(e){return j(function(t,n){var r=!1,i=N(n,function(){i==null||i.unsubscribe(),r=!0},Le);H(e).subscribe(i),t.subscribe(N(n,function(o){return r&&n.next(o)}))})}function I(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Fe(e);return j(function(r,i){(n?_e(e,r,n):_e(e,r)).subscribe(i)})}function gn(e,t){return j(function(n,r){var i=null,o=0,a=!1,s=function(){return a&&!i&&r.complete()};n.subscribe(N(r,function(c){i==null||i.unsubscribe();var u=0,f=o++;H(e(c,f)).subscribe(i=N(r,function(d){return r.next(t?t(c,d,f,u++):d)},function(){i=null,s()}))},function(){a=!0,s()}))})}function At(e){return j(function(t,n){H(e).subscribe(N(n,function(){return n.complete()},Le)),!n.closed&&t.subscribe(n)})}var wi=Object.defineProperty,Ei=Object.defineProperties,Si=Object.getOwnPropertyDescriptors,Ot=Object.getOwnPropertySymbols,Ti=Object.prototype.hasOwnProperty,xi=Object.prototype.propertyIsEnumerable,Lt=(e,t,n)=>t in e?wi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G=(e,t)=>{for(var n in t||(t={}))Ti.call(t,n)&&Lt(e,n,t[n]);if(Ot)for(var n of Ot(t))xi.call(t,n)&&Lt(e,n,t[n]);return e},be=(e,t)=>Ei(e,Si(t)),$=(e,t,n)=>new Promise((r,i)=>{var o=c=>{try{s(n.next(c))}catch(u){i(u)}},a=c=>{try{s(n.throw(c))}catch(u){i(u)}},s=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,a);s((n=n.apply(e,t)).next())}),yn="lk";function M(e){return typeof e>"u"?!1:Pi(e)||Ci(e)}function Pi(e){var t;return e?e.hasOwnProperty("participant")&&e.hasOwnProperty("source")&&e.hasOwnProperty("track")&&typeof((t=e.publication)==null?void 0:t.track)<"u":!1}function Ci(e){return e?e.hasOwnProperty("participant")&&e.hasOwnProperty("source")&&e.hasOwnProperty("publication")&&typeof e.publication<"u":!1}function we(e){return e?e.hasOwnProperty("participant")&&e.hasOwnProperty("source")&&typeof e.publication>"u":!1}function R(e){if(typeof e=="string"||typeof e=="number")return`${e}`;if(we(e))return`${e.participant.identity}_${e.source}_placeholder`;if(M(e))return`${e.participant.identity}_${e.publication.source}_${e.publication.trackSid}`;throw new Error(`Can't generate a id for the given track reference: ${e}`)}function ki(e,t){return e===void 0||t===void 0?!1:M(e)&&M(t)?e.publication.trackSid===t.publication.trackSid:R(e)===R(t)}function Ai(e,t){return typeof t>"u"?!1:M(e)?t.some(n=>n.participant.identity===e.participant.identity&&M(n)&&n.publication.trackSid===e.publication.trackSid):we(e)?t.some(n=>n.participant.identity===e.participant.identity&&we(n)&&n.source===e.source):!1}function Oi(e,t){return we(e)&&M(t)&&t.participant.identity===e.participant.identity&&t.source===e.source}function Li(e){return e instanceof l.LocalParticipant}function _i(){const e=document.createElement("p");e.style.width="100%",e.style.height="200px";const t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);const n=e.offsetWidth;t.style.overflow="scroll";let r=e.offsetWidth;return n===r&&(r=t.clientWidth),document.body.removeChild(t),n-r}function Ii(){return typeof document<"u"}function Ri(e){e=G({},e);const t="(?:(?:[a-z]+:)?//)?",n="(?:\\S+(?::\\S*)?@)?",r=new RegExp("(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}","g").source,u=`(?:${t}|www\\.)${n}(?:localhost|${r}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))\\.?)(?::\\d{2,5})?(?:[/?#][^\\s"]*)?`;return e.exact?new RegExp(`(?:^${u}$)`,"i"):new RegExp(u,"ig")}var _t="[^\\.\\s@:](?:[^\\s@:]*[^\\s@:\\.])?@[^\\.\\s@]+(?:\\.[^\\.\\s@]+)*";function Mi({exact:e}={}){return e?new RegExp(`^${_t}$`):new RegExp(_t,"g")}function Di(e,t){return $(this,null,function*(){const{x:n,y:r}=yield hr(e,t,{placement:"top",middleware:[dr(6),vr(),pr({padding:5})]});return{x:n,y:r}})}function Ui(e,t){return!e.contains(t.target)}var Ni=()=>({email:Mi(),url:Ri({})});function $i(e,t){const n=Object.entries(t).map(([o,a],s)=>Array.from(e.matchAll(a)).map(({index:c,0:u})=>({type:o,weight:s,content:u,index:c??0}))).flat().sort((o,a)=>{const s=o.index-a.index;return s!==0?s:o.weight-a.weight}).filter(({index:o},a,s)=>{if(a===0)return!0;const c=s[a-1];return c.index+c.content.length<=o}),r=[];let i=0;for(const{type:o,content:a,index:s}of n)s>i&&r.push(e.substring(i,s)),r.push({type:o,content:a}),i=s+a.length;return e.length>i&&r.push(e.substring(i)),r}var ji=[l.RoomEvent.ConnectionStateChanged,l.RoomEvent.RoomMetadataChanged,l.RoomEvent.ActiveSpeakersChanged,l.RoomEvent.ConnectionQualityChanged,l.RoomEvent.ParticipantConnected,l.RoomEvent.ParticipantDisconnected,l.RoomEvent.ParticipantPermissionsChanged,l.RoomEvent.ParticipantMetadataChanged,l.RoomEvent.ParticipantNameChanged,l.RoomEvent.ParticipantAttributesChanged,l.RoomEvent.TrackMuted,l.RoomEvent.TrackUnmuted,l.RoomEvent.TrackPublished,l.RoomEvent.TrackUnpublished,l.RoomEvent.TrackStreamStateChanged,l.RoomEvent.TrackSubscriptionFailed,l.RoomEvent.TrackSubscriptionPermissionChanged,l.RoomEvent.TrackSubscriptionStatusChanged],wn=[...ji,l.RoomEvent.LocalTrackPublished,l.RoomEvent.LocalTrackUnpublished],Fi=[l.ParticipantEvent.TrackPublished,l.ParticipantEvent.TrackUnpublished,l.ParticipantEvent.TrackMuted,l.ParticipantEvent.TrackUnmuted,l.ParticipantEvent.TrackStreamStateChanged,l.ParticipantEvent.TrackSubscribed,l.ParticipantEvent.TrackUnsubscribed,l.ParticipantEvent.TrackSubscriptionPermissionChanged,l.ParticipantEvent.TrackSubscriptionFailed,l.ParticipantEvent.LocalTrackPublished,l.ParticipantEvent.LocalTrackUnpublished],Wi=[l.ParticipantEvent.ConnectionQualityChanged,l.ParticipantEvent.IsSpeakingChanged,l.ParticipantEvent.ParticipantMetadataChanged,l.ParticipantEvent.ParticipantPermissionsChanged,l.ParticipantEvent.TrackMuted,l.ParticipantEvent.TrackUnmuted,l.ParticipantEvent.TrackPublished,l.ParticipantEvent.TrackUnpublished,l.ParticipantEvent.TrackStreamStateChanged,l.ParticipantEvent.TrackSubscriptionFailed,l.ParticipantEvent.TrackSubscriptionPermissionChanged,l.ParticipantEvent.TrackSubscriptionStatusChanged],En=[...Wi,l.ParticipantEvent.LocalTrackPublished,l.ParticipantEvent.LocalTrackUnpublished],O=br.getLogger("lk-components-js");O.setDefaultLevel("WARN");function Bi(e,t={}){var n;O.setLevel(e),l.setLogLevel((n=t.liveKitClientLogLevel)!=null?n:e)}function Vi(e,t={}){var n;const r=O.methodFactory;O.methodFactory=(i,o,a)=>{const s=r(i,o,a),c=l.LogLevel[i],u=c>=o&&c<l.LogLevel.silent;return(f,d)=>{d?s(f,d):s(f),u&&e(c,f,d)}},O.setLevel(O.getLevel()),l.setLogExtension((n=t.liveKitClientLogExtension)!=null?n:e)}var Hi=[{columns:1,rows:1},{columns:1,rows:2,orientation:"portrait"},{columns:2,rows:1,orientation:"landscape"},{columns:2,rows:2,minWidth:560},{columns:3,rows:3,minWidth:700},{columns:4,rows:4,minWidth:960},{columns:5,rows:5,minWidth:1100}];function Sn(e,t,n,r){if(e.length<1)throw new Error("At least one grid layout definition must be provided.");const i=zi(e);if(n<=0||r<=0)return i[0];let o=0;const a=n/r>1?"landscape":"portrait";let s=i.find((c,u,f)=>{o=u;const d=f.findIndex((h,p)=>{const b=!h.orientation||h.orientation===a,v=p>u,g=h.maxTiles===c.maxTiles;return v&&g&&b})!==-1;return c.maxTiles>=t&&!d});if(s===void 0)if(s=i[i.length-1],s)O.warn(`No layout found for: participantCount: ${t}, width/height: ${n}/${r} fallback to biggest available layout (${s}).`);else throw new Error("No layout or fallback layout found.");if((n<s.minWidth||r<s.minHeight)&&o>0){const c=i[o-1];s=Sn(i.slice(0,o),c.maxTiles,n,r)}return s}function zi(e){return[...e].map(t=>{var n,r;return{name:`${t.columns}x${t.rows}`,columns:t.columns,rows:t.rows,maxTiles:t.columns*t.rows,minWidth:(n=t.minWidth)!=null?n:0,minHeight:(r=t.minHeight)!=null?r:0,orientation:t.orientation}}).sort((t,n)=>t.maxTiles!==n.maxTiles?t.maxTiles-n.maxTiles:t.minWidth!==0||n.minWidth!