UNPKG

@veltdev/sdk

Version:

Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.

37 lines (36 loc) 6.96 MB
var SNIPPYLY_VERSION = '4.5.0-beta.32'; (function(m,w){"use strict";function rt(){var e=K.splice(0,K.length);for(ie=0;e.length;)e.shift().call(null,e.shift())}function me(e,t){for(var n=0,r=e.length;n<r;n++)Te(e[n],t)}function ot(e){for(var t,n=0,r=e.length;n<r;n++)t=e[n],U(t,q[pe(t)])}function fe(e){return function(t){Lt(t)&&(Te(t,e),L.length&&me(t.querySelectorAll(L),e))}}function pe(e){var t=le.call(e,"is"),n=e.nodeName.toUpperCase(),r=v.call(D,t?Y+t.toUpperCase():x+n);return t&&-1<r&&!De(n,t)?-1:r}function De(e,t){return-1<L.indexOf(e+'[is="'+t+'"]')}function Ie(e){var t=e.currentTarget,n=e.attrChange,r=e.attrName,o=e.target,l=e[W]||2,a=e[He]||3;!ce||o&&o!==t||!t[y]||r==="style"||e.prevValue===e.newValue&&(e.newValue!==""||n!==l&&n!==a)||t[y](r,n===l?null:e.prevValue,n===a?null:e.newValue)}function Fe(e){var t=fe(e);return function(n){K.push(t,n.target),ie&&clearTimeout(ie),ie=setTimeout(rt,1)}}function de(e){nt&&(nt=!1,e.currentTarget.removeEventListener(Ze,de)),L.length&&me((e.target||u).querySelectorAll(L),e.detail===E?E:b),R&&at()}function lt(e,t){var n=this;Ye.call(n,e,t),Me.call(n,{target:n})}function Se(e,t,n){var r=t.apply(e,n),o=pe(r);return-1<o&&U(r,q[o]),n.pop()&&L.length&&ot(r.querySelectorAll(L)),r}function he(e,t){Tt(e,t),$?$.observe(e,gt):(ue&&(e.setAttribute=lt,e[H]=Ee(e),e[g](st,Me)),e[g](N,Ie)),e[k]&&ce&&(e.created=!0,e[k](),e.created=!1)}function at(){for(var e,t=0,n=G.length;t<n;t++)e=G[t],V.contains(e)||(n--,G.splice(t--,1),Te(e,E))}function Ve(e){throw new Error("A "+e+" type is already registered")}function Te(e,t){var n,r,o=pe(e);-1<o&&!Mt.call(e,"TEMPLATE")&&(Q(e,q[o]),o=0,t!==b||e[b]?t!==E||e[E]||(e[b]=!1,e[E]=!0,r="disconnected",o=1):(e[E]=!1,e[b]=!0,r="connected",o=1,R&&v.call(G,e)<0&&G.push(e)),o&&(n=e[t+O]||e[r+O])&&n.call(e))}function z(){}function Pe(e,t,n){var r=n&&n[_]||"",o=t.prototype,l=Ce(o),a=t.observedAttributes||ye,s={prototype:l};oe(l,k,{value:function(){if(te)te=!1;else if(!this[B]){this[B]=!0,new t(this),o[k]&&o[k].call(this);var i=j[ne.get(t)];(!Z||i.create.length>1)&&_e(this)}}}),oe(l,y,{value:function(i){-1<v.call(a,i)&&o[y]&&o[y].apply(this,arguments)}}),o[qe]&&oe(l,ut,{value:o[qe]}),o[Be]&&oe(l,ct,{value:o[Be]}),r&&(s[_]=r),e=e.toUpperCase(),j[e]={constructor:t,create:r?[r,re(e)]:[e]},ne.set(t,e),u[S](e.toLowerCase(),s),Le(e),P[e].r()}function Re(e){var t=j[e.toUpperCase()];return t&&t.constructor}function Ue(e){return typeof e=="string"?e:e&&e.is||""}function _e(e){for(var t,n=e[y],r=n?e.attributes:ye,o=r.length;o--;)t=r[o],n.call(e,t.name||t.nodeName,null,t.value||t.nodeValue)}function Le(e){return e=e.toUpperCase(),e in P||(P[e]={},P[e].p=new Xe(function(t){P[e].r=t})),P[e].p}function ke(){C&&delete m.customElements,I(m,"customElements",{configurable:!0,value:new z}),I(m,"CustomElementRegistry",{configurable:!0,value:z});for(var e=it.get(/^HTML[A-Z]*[a-z]/),t=e.length;t--;function(n){var r=m[n];if(r){m[n]=function(o){var l,a;return o||(o=this),o[B]||(te=!0,l=j[ne.get(o.constructor)],a=Z&&l.create.length===1,o=a?Reflect.construct(r,ye,l.constructor):u.createElement.apply(u,l.create),o[B]=!0,te=!1,a||_e(o)),o},m[n].prototype=r.prototype;try{r.prototype.constructor=m[n]}catch{dt=!0,I(r,B,{value:m[n]})}}}(e[t]));u.createElement=function(n,r){var o=Ue(r);return o?Ae.call(this,n,re(o)):Ae.call(this,n)},et||(Oe=!0,u[S](""))}var u=m.document,T=m.Object,it=function(e){var t,n,r,o,l=/^[A-Z]+[a-z]/,a=function(p){var f,h=[];for(f in i)p.test(f)&&h.push(f);return h},s=function(p,f){(f=f.toLowerCase())in i||(i[p]=(i[p]||[]).concat(f),i[f]=i[f.toUpperCase()]=p)},i=(T.create||T)(null),c={};for(n in e)for(o in e[n])for(r=e[n][o],i[o]=r,t=0;t<r.length;t++)i[r[t].toLowerCase()]=i[r[t].toUpperCase()]=o;return c.get=function(p){return typeof p=="string"?i[p]||(l.test(p)?[]:""):a(p)},c.set=function(p,f){return l.test(p)?s(p,f):s(f,p),c},c}({collections:{HTMLAllCollection:["all"],HTMLCollection:["forms"],HTMLFormControlsCollection:["elements"],HTMLOptionsCollection:["options"]},elements:{Element:["element"],HTMLAnchorElement:["a"],HTMLAppletElement:["applet"],HTMLAreaElement:["area"],HTMLAttachmentElement:["attachment"],HTMLAudioElement:["audio"],HTMLBRElement:["br"],HTMLBaseElement:["base"],HTMLBodyElement:["body"],HTMLButtonElement:["button"],HTMLCanvasElement:["canvas"],HTMLContentElement:["content"],HTMLDListElement:["dl"],HTMLDataElement:["data"],HTMLDataListElement:["datalist"],HTMLDetailsElement:["details"],HTMLDialogElement:["dialog"],HTMLDirectoryElement:["dir"],HTMLDivElement:["div"],HTMLDocument:["document"],HTMLElement:["element","abbr","address","article","aside","b","bdi","bdo","cite","code","command","dd","dfn","dt","em","figcaption","figure","footer","header","i","kbd","mark","nav","noscript","rp","rt","ruby","s","samp","section","small","strong","sub","summary","sup","u","var","wbr"],HTMLEmbedElement:["embed"],HTMLFieldSetElement:["fieldset"],HTMLFontElement:["font"],HTMLFormElement:["form"],HTMLFrameElement:["frame"],HTMLFrameSetElement:["frameset"],HTMLHRElement:["hr"],HTMLHeadElement:["head"],HTMLHeadingElement:["h1","h2","h3","h4","h5","h6"],HTMLHtmlElement:["html"],HTMLIFrameElement:["iframe"],HTMLImageElement:["img"],HTMLInputElement:["input"],HTMLKeygenElement:["keygen"],HTMLLIElement:["li"],HTMLLabelElement:["label"],HTMLLegendElement:["legend"],HTMLLinkElement:["link"],HTMLMapElement:["map"],HTMLMarqueeElement:["marquee"],HTMLMediaElement:["media"],HTMLMenuElement:["menu"],HTMLMenuItemElement:["menuitem"],HTMLMetaElement:["meta"],HTMLMeterElement:["meter"],HTMLModElement:["del","ins"],HTMLOListElement:["ol"],HTMLObjectElement:["object"],HTMLOptGroupElement:["optgroup"],HTMLOptionElement:["option"],HTMLOutputElement:["output"],HTMLParagraphElement:["p"],HTMLParamElement:["param"],HTMLPictureElement:["picture"],HTMLPreElement:["pre"],HTMLProgressElement:["progress"],HTMLQuoteElement:["blockquote","q","quote"],HTMLScriptElement:["script"],HTMLSelectElement:["select"],HTMLShadowElement:["shadow"],HTMLSlotElement:["slot"],HTMLSourceElement:["source"],HTMLSpanElement:["span"],HTMLStyleElement:["style"],HTMLTableCaptionElement:["caption"],HTMLTableCellElement:["td","th"],HTMLTableColElement:["col","colgroup"],HTMLTableElement:["table"],HTMLTableRowElement:["tr"],HTMLTableSectionElement:["thead","tbody","tfoot"],HTMLTemplateElement:["template"],HTMLTextAreaElement:["textarea"],HTMLTimeElement:["time"],HTMLTitleElement:["title"],HTMLTrackElement:["track"],HTMLUListElement:["ul"],HTMLUnknownElement:["unknown","vhgroupv","vkeygen"],HTMLVideoElement:["video"]},nodes:{Attr:["node"],Audio:["audio"],CDATASection:["node"],CharacterData:["node"],Comment:["#comment"],Document:["#document"],DocumentFragment:["#document-fragment"],DocumentType:["node"],HTMLDocument:["#document"],Image:["img"],Option:["option"],ProcessingInstruction:["node"],ShadowRoot:["#shadow-root"],Text:["#text"],XMLDocument:["xml"]}});typeof w!="object"&&(w={type:w||"auto"});var K,Me,X,Ee,$,ve,Q,U,A,S="registerElement",xe=1e5*m.Math.random()>>0,H="__"+S+xe,g="addEventListener",b="attached",O="Callback",E="detached",_="extends",y="attributeChanged"+O,ut=b+O,qe="connected"+O,Be="disconnected"+O,k="created"+O,ct=E+O,W="ADDITION",He="REMOVAL",N="DOMAttrModified",Ze="DOMContentLoaded",st="DOMSubtreeModified",x="<",Y="=",mt=/^[A-Z][._A-Z0-9]*-[-._A-Z0-9]*$/,ft=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],D=[],q=[],L="",V=u.documentElement,v=D.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},ge=T.prototype,be=ge.hasOwnProperty,J=ge.isPrototypeOf,I=T.defineProperty,ye=[],ee=T.getOwnPropertyDescriptor,je=T.getOwnPropertyNames,pt=T.getPrototypeOf,Ge=T.setPrototypeOf,ze=!!T.__proto__,dt=!1,B="__dreCEv1",C=m.customElements,Z=!/^force/.test(w.type)&&!!(C&&C.define&&C.get&&C.whenDefined),Ke=T.create||T,ht=m.Map||function(){var e,t=[],n=[];return{get:function(r){return n[v.call(t,r)]},set:function(r,o){e=v.call(t,r),e<0?n[t.push(r)-1]=o:n[e]=o}}},Xe=m.Promise||function(e){function t(l){for(r=!0;n.length;)n.shift()(l)}var n=[],r=!1,o={catch:function(){return o},then:function(l){return n.push(l),r&&setTimeout(t,1),o}};return e(t),o},te=!1,j=Ke(null),P=Ke(null),ne=new ht,re=function(e){return e.toLowerCase()},Ce=T.create||function e(t){return t?(e.prototype=t,new e):this},Tt=Ge||(ze?function(e,t){return e.__proto__=t,e}:je&&ee?function(){function e(t,n){for(var r,o=je(n),l=0,a=o.length;l<a;l++)r=o[l],be.call(t,r)||I(t,r,ee(n,r))}return function(t,n){do e(t,n);while((n=pt(n))&&!J.call(n,t));return t}}():function(e,t){for(var n in t)e[n]=t[n];return e}),F=m.MutationObserver||m.WebKitMutationObserver,$e=m.HTMLAnchorElement,d=(m.HTMLElement||m.Element||m.Node).prototype,R=!J.call(d,V),oe=R?function(e,t,n){return e[t]=n.value,e}:I,Lt=R?function(e){return e.nodeType===1}:function(e){return J.call(d,e)},G=R&&[],Qe=d.attachShadow,We=d.cloneNode,Mt=d.closest||function(e){for(var t=this;t&&t.nodeName!==e;)t=t.parentNode;return t},we=d.dispatchEvent,le=d.getAttribute,Et=d.hasAttribute,vt=d.removeAttribute,Ye=d.setAttribute,ae=u.createElement,Ht=u.importNode,Ae=ae,gt=F&&{attributes:!0,characterData:!0,attributeOldValue:!0},Je=F||function(e){ue=!1,V.removeEventListener(N,Je)},ie=0,et=S in u&&!/^force-all/.test(w.type),tt=!0,Oe=!1,ue=!0,nt=!0,ce=!0;if(F&&(A=u.createElement("div"),A.innerHTML="<div><div></div></div>",new F(function(e,t){if(e[0]&&e[0].type=="childList"&&!e[0].removedNodes[0].childNodes.length){A=ee(d,"innerHTML");var n=A&&A.set;n&&I(d,"innerHTML",{set:function(r){for(;this.lastChild;)this.removeChild(this.lastChild);n.call(this,r)}})}t.disconnect(),A=null}).observe(A,{childList:!0,subtree:!0}),A.innerHTML=""),et||(Ge||ze?(Q=function(e,t){J.call(t,e)||he(e,t)},U=he):(Q=function(e,t){e[H]||(e[H]=T(!0),he(e,t))},U=Q),R?(ue=!1,function(){var e=ee(d,g),t=e.value,n=function(l){var a=new CustomEvent(N,{bubbles:!0});a.attrName=l,a.prevValue=le.call(this,l),a.newValue=null,a[He]=a.attrChange=2,vt.call(this,l),we.call(this,a)},r=function(l,a){var s=Et.call(this,l),i=s&&le.call(this,l),c=new CustomEvent(N,{bubbles:!0});Ye.call(this,l,a),c.attrName=l,c.prevValue=s?i:null,c.newValue=a,s?c.MODIFICATION=c.attrChange=1:c[W]=c.attrChange=0,we.call(this,c)},o=function(l){var a,s=l.currentTarget,i=s[H],c=l.propertyName;i.hasOwnProperty(c)&&(i=i[c],a=new CustomEvent(N,{bubbles:!0}),a.attrName=i.name,a.prevValue=i.value||null,a.newValue=i.value=s[c]||null,a.prevValue==null?a[W]=a.attrChange=0:a.MODIFICATION=a.attrChange=1,we.call(s,a))};e.value=function(l,a,s){l===N&&this[y]&&this.setAttribute!==r&&(this[H]={className:{name:"class",value:this.className}},this.setAttribute=r,this.removeAttribute=n,t.call(this,"propertychange",o)),t.call(this,l,a,s)},I(d,g,e)}()):F||(V[g](N,Je),V.setAttribute(H,1),V.removeAttribute(H),ue&&(Me=function(e){var t,n,r,o=this;if(o===e.target){t=o[H],o[H]=n=Ee(o);for(r in n){if(!(r in t))return X(0,o,r,t[r],n[r],W);if(n[r]!==t[r])return X(1,o,r,t[r],n[r],"MODIFICATION")}for(r in t)if(!(r in n))return X(2,o,r,t[r],n[r],He)}},X=function(e,t,n,r,o,l){var a={attrChange:e,currentTarget:t,attrName:n,prevValue:r,newValue:o};a[l]=e,Ie(a)},Ee=function(e){for(var t,n,r={},o=e.attributes,l=0,a=o.length;l<a;l++)t=o[l],(n=t.name)!=="setAttribute"&&(r[n]=t.value);return r})),u[S]=function(e,t){if(n=e.toUpperCase(),tt&&(tt=!1,F?($=function(i,c){function p(f,h){for(var M=0,se=f.length;M<se;h(f[M++]));}return new F(function(f){for(var h,M,se,Ne=0,bt=f.length;Ne<bt;Ne++)h=f[Ne],h.type==="childList"?(p(h.addedNodes,i),p(h.removedNodes,c)):(M=h.target,ce&&M[y]&&h.attributeName!=="style"&&(se=le.call(M,h.attributeName))!==h.oldValue&&M[y](h.attributeName,h.oldValue,se))})}(fe(b),fe(E)),ve=function(i){return $.observe(i,{childList:!0,subtree:!0}),i},ve(u),Qe&&(d.attachShadow=function(){return ve(Qe.apply(this,arguments))})):(K=[],u[g]("DOMNodeInserted",Fe(b)),u[g]("DOMNodeRemoved",Fe(E))),u[g](Ze,de),u[g]("readystatechange",de),u.importNode=function(i,c){switch(i.nodeType){case 1:return Se(u,Ht,[i,!!c]);case 11:for(var p=u.createDocumentFragment(),f=i.childNodes,h=f.length,M=0;M<h;M++)p.appendChild(u.importNode(f[M],!!c));return p;default:return We.call(i,!!c)}},d.cloneNode=function(i){return Se(this,We,[!!i])}),Oe)return Oe=!1;if(-2<v.call(D,Y+n)+v.call(D,x+n)&&Ve(e),!mt.test(n)||-1<v.call(ft,n))throw new Error("The type "+e+" is invalid");var n,r,o=function(){return a?u.createElement(s,n):u.createElement(s)},l=t||ge,a=be.call(l,_),s=a?t[_].toUpperCase():n;return a&&-1<v.call(D,x+s)&&Ve(s),r=D.push((a?Y:x)+n)-1,L=L.concat(L.length?",":"",a?s+'[is="'+e.toLowerCase()+'"]':s),o.prototype=q[r]=be.call(l,"prototype")?l.prototype:Ce(d),L.length&&me(u.querySelectorAll(L),b),o},u.createElement=Ae=function(e,t){var n=Ue(t),r=n?ae.call(u,e,re(n)):ae.call(u,e),o=""+e,l=v.call(D,(n?Y:x)+(n||o).toUpperCase()),a=-1<l;return n&&(r.setAttribute("is",n=n.toLowerCase()),a&&(a=De(o.toUpperCase(),n))),ce=!u.createElement.innerHTMLHelper,a&&U(r,q[l]),r}),addEventListener("beforeunload",function(){delete u.createElement,delete u.importNode,delete u[S]},!1),z.prototype={constructor:z,define:Z?function(e,t,n){if(n)Pe(e,t,n);else{var r=e.toUpperCase();j[r]={constructor:t,create:[r]},ne.set(t,r),C.define(e,t)}}:Pe,get:Z?function(e){return C.get(e)||Re(e)}:Re,whenDefined:Z?function(e){return Xe.race([C.whenDefined(e),Le(e)])}:Le},!C||/^force/.test(w.type))ke();else if(!w.noBuiltIn)try{(function(e,t,n){var r=new RegExp(`^<a\\s+is=('|")`+n+"\\1></a>$");if(t[_]="a",e.prototype=Ce($e.prototype),e.prototype.constructor=e,m.customElements.define(n,e,t),!r.test(u.createElement("a",{is:n}).outerHTML)||!r.test(new e().outerHTML))throw t})(function e(){return Reflect.construct($e,[],e)},{},"document-register-element-a"+xe)}catch{ke()}if(!w.noBuiltIn)try{if(ae.call(u,"a","a").outerHTML.indexOf("is")<0)throw{}}catch{re=function(t){return{is:t.toLowerCase()}}}})(window); var sCe=Object.create;var Vw=Object.defineProperty,lCe=Object.defineProperties,cCe=Object.getOwnPropertyDescriptor,mCe=Object.getOwnPropertyDescriptors,dCe=Object.getOwnPropertyNames,Bw=Object.getOwnPropertySymbols,UG=Object.getPrototypeOf,B7=Object.prototype.hasOwnProperty,jG=Object.prototype.propertyIsEnumerable,pCe=Reflect.get;var VG=(i,o,t)=>o in i?Vw(i,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[o]=t,I=(i,o)=>{for(var t in o||={})B7.call(o,t)&&VG(i,t,o[t]);if(Bw)for(var t of Bw(o))jG.call(o,t)&&VG(i,t,o[t]);return i},T=(i,o)=>lCe(i,mCe(o));var V7=(i,o)=>{var t={};for(var e in i)B7.call(i,e)&&o.indexOf(e)<0&&(t[e]=i[e]);if(i!=null&&Bw)for(var e of Bw(i))o.indexOf(e)<0&&jG.call(i,e)&&(t[e]=i[e]);return t};var gCe=(i,o)=>()=>(o||i((o={exports:{}}).exports,o),o.exports),Uw=(i,o)=>{for(var t in o)Vw(i,t,{get:o[t],enumerable:!0})},uCe=(i,o,t,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of dCe(o))!B7.call(i,n)&&n!==t&&Vw(i,n,{get:()=>o[n],enumerable:!(e=cCe(o,n))||e.enumerable});return i};var $G=(i,o,t)=>(t=i!=null?sCe(UG(i)):{},uCe(o||!i||!i.__esModule?Vw(t,"default",{value:i,enumerable:!0}):t,i));var jd=(i,o,t)=>pCe(UG(i),t,o);var Q=(i,o,t)=>new Promise((e,n)=>{var r=m=>{try{s(t.next(m))}catch(p){n(p)}},a=m=>{try{s(t.throw(m))}catch(p){n(p)}},s=m=>m.done?e(m.value):Promise.resolve(m.value).then(r,a);s((t=t.apply(i,o)).next())});var oG=gCe((hlo,iG)=>{"use strict";var yt={};yt.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};yt.localCName=yt.generateIdentifier();yt.splitLines=function(i){return i.trim().split(` `).map(o=>o.trim())};yt.splitSections=function(i){return i.split(` m=`).map((t,e)=>(e>0?"m="+t:t).trim()+`\r `)};yt.getDescription=function(i){let o=yt.splitSections(i);return o&&o[0]};yt.getMediaSections=function(i){let o=yt.splitSections(i);return o.shift(),o};yt.matchPrefix=function(i,o){return yt.splitLines(i).filter(t=>t.indexOf(o)===0)};yt.parseCandidate=function(i){let o;i.indexOf("a=candidate:")===0?o=i.substring(12).split(" "):o=i.substring(10).split(" ");let t={foundation:o[0],component:{1:"rtp",2:"rtcp"}[o[1]]||o[1],protocol:o[2].toLowerCase(),priority:parseInt(o[3],10),ip:o[4],address:o[4],port:parseInt(o[5],10),type:o[7]};for(let e=8;e<o.length;e+=2)switch(o[e]){case"raddr":t.relatedAddress=o[e+1];break;case"rport":t.relatedPort=parseInt(o[e+1],10);break;case"tcptype":t.tcpType=o[e+1];break;case"ufrag":t.ufrag=o[e+1],t.usernameFragment=o[e+1];break;default:t[o[e]]===void 0&&(t[o[e]]=o[e+1]);break}return t};yt.writeCandidate=function(i){let o=[];o.push(i.foundation);let t=i.component;t==="rtp"?o.push(1):t==="rtcp"?o.push(2):o.push(t),o.push(i.protocol.toUpperCase()),o.push(i.priority),o.push(i.address||i.ip),o.push(i.port);let e=i.type;return o.push("typ"),o.push(e),e!=="host"&&i.relatedAddress&&i.relatedPort&&(o.push("raddr"),o.push(i.relatedAddress),o.push("rport"),o.push(i.relatedPort)),i.tcpType&&i.protocol.toLowerCase()==="tcp"&&(o.push("tcptype"),o.push(i.tcpType)),(i.usernameFragment||i.ufrag)&&(o.push("ufrag"),o.push(i.usernameFragment||i.ufrag)),"candidate:"+o.join(" ")};yt.parseIceOptions=function(i){return i.substring(14).split(" ")};yt.parseRtpMap=function(i){let o=i.substring(9).split(" "),t={payloadType:parseInt(o.shift(),10)};return o=o[0].split("/"),t.name=o[0],t.clockRate=parseInt(o[1],10),t.channels=o.length===3?parseInt(o[2],10):1,t.numChannels=t.channels,t};yt.writeRtpMap=function(i){let o=i.payloadType;i.preferredPayloadType!==void 0&&(o=i.preferredPayloadType);let t=i.channels||i.numChannels||1;return"a=rtpmap:"+o+" "+i.name+"/"+i.clockRate+(t!==1?"/"+t:"")+`\r `};yt.parseExtmap=function(i){let o=i.substring(9).split(" ");return{id:parseInt(o[0],10),direction:o[0].indexOf("/")>0?o[0].split("/")[1]:"sendrecv",uri:o[1],attributes:o.slice(2).join(" ")}};yt.writeExtmap=function(i){return"a=extmap:"+(i.id||i.preferredId)+(i.direction&&i.direction!=="sendrecv"?"/"+i.direction:"")+" "+i.uri+(i.attributes?" "+i.attributes:"")+`\r `};yt.parseFmtp=function(i){let o={},t,e=i.substring(i.indexOf(" ")+1).split(";");for(let n=0;n<e.length;n++)t=e[n].trim().split("="),o[t[0].trim()]=t[1];return o};yt.writeFmtp=function(i){let o="",t=i.payloadType;if(i.preferredPayloadType!==void 0&&(t=i.preferredPayloadType),i.parameters&&Object.keys(i.parameters).length){let e=[];Object.keys(i.parameters).forEach(n=>{i.parameters[n]!==void 0?e.push(n+"="+i.parameters[n]):e.push(n)}),o+="a=fmtp:"+t+" "+e.join(";")+`\r `}return o};yt.parseRtcpFb=function(i){let o=i.substring(i.indexOf(" ")+1).split(" ");return{type:o.shift(),parameter:o.join(" ")}};yt.writeRtcpFb=function(i){let o="",t=i.payloadType;return i.preferredPayloadType!==void 0&&(t=i.preferredPayloadType),i.rtcpFeedback&&i.rtcpFeedback.length&&i.rtcpFeedback.forEach(e=>{o+="a=rtcp-fb:"+t+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+`\r `}),o};yt.parseSsrcMedia=function(i){let o=i.indexOf(" "),t={ssrc:parseInt(i.substring(7,o),10)},e=i.indexOf(":",o);return e>-1?(t.attribute=i.substring(o+1,e),t.value=i.substring(e+1)):t.attribute=i.substring(o+1),t};yt.parseSsrcGroup=function(i){let o=i.substring(13).split(" ");return{semantics:o.shift(),ssrcs:o.map(t=>parseInt(t,10))}};yt.getMid=function(i){let o=yt.matchPrefix(i,"a=mid:")[0];if(o)return o.substring(6)};yt.parseFingerprint=function(i){let o=i.substring(14).split(" ");return{algorithm:o[0].toLowerCase(),value:o[1].toUpperCase()}};yt.getDtlsParameters=function(i,o){return{role:"auto",fingerprints:yt.matchPrefix(i+o,"a=fingerprint:").map(yt.parseFingerprint)}};yt.writeDtlsParameters=function(i,o){let t="a=setup:"+o+`\r `;return i.fingerprints.forEach(e=>{t+="a=fingerprint:"+e.algorithm+" "+e.value+`\r `}),t};yt.parseCryptoLine=function(i){let o=i.substring(9).split(" ");return{tag:parseInt(o[0],10),cryptoSuite:o[1],keyParams:o[2],sessionParams:o.slice(3)}};yt.writeCryptoLine=function(i){return"a=crypto:"+i.tag+" "+i.cryptoSuite+" "+(typeof i.keyParams=="object"?yt.writeCryptoKeyParams(i.keyParams):i.keyParams)+(i.sessionParams?" "+i.sessionParams.join(" "):"")+`\r `};yt.parseCryptoKeyParams=function(i){if(i.indexOf("inline:")!==0)return null;let o=i.substring(7).split("|");return{keyMethod:"inline",keySalt:o[0],lifeTime:o[1],mkiValue:o[2]?o[2].split(":")[0]:void 0,mkiLength:o[2]?o[2].split(":")[1]:void 0}};yt.writeCryptoKeyParams=function(i){return i.keyMethod+":"+i.keySalt+(i.lifeTime?"|"+i.lifeTime:"")+(i.mkiValue&&i.mkiLength?"|"+i.mkiValue+":"+i.mkiLength:"")};yt.getCryptoParameters=function(i,o){return yt.matchPrefix(i+o,"a=crypto:").map(yt.parseCryptoLine)};yt.getIceParameters=function(i,o){let t=yt.matchPrefix(i+o,"a=ice-ufrag:")[0],e=yt.matchPrefix(i+o,"a=ice-pwd:")[0];return t&&e?{usernameFragment:t.substring(12),password:e.substring(10)}:null};yt.writeIceParameters=function(i){let o="a=ice-ufrag:"+i.usernameFragment+`\r a=ice-pwd:`+i.password+`\r `;return i.iceLite&&(o+=`a=ice-lite\r `),o};yt.parseRtpParameters=function(i){let o={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},e=yt.splitLines(i)[0].split(" ");o.profile=e[2];for(let r=3;r<e.length;r++){let a=e[r],s=yt.matchPrefix(i,"a=rtpmap:"+a+" ")[0];if(s){let m=yt.parseRtpMap(s),p=yt.matchPrefix(i,"a=fmtp:"+a+" ");switch(m.parameters=p.length?yt.parseFmtp(p[0]):{},m.rtcpFeedback=yt.matchPrefix(i,"a=rtcp-fb:"+a+" ").map(yt.parseRtcpFb),o.codecs.push(m),m.name.toUpperCase()){case"RED":case"ULPFEC":o.fecMechanisms.push(m.name.toUpperCase());break;default:break}}}yt.matchPrefix(i,"a=extmap:").forEach(r=>{o.headerExtensions.push(yt.parseExtmap(r))});let n=yt.matchPrefix(i,"a=rtcp-fb:* ").map(yt.parseRtcpFb);return o.codecs.forEach(r=>{n.forEach(a=>{r.rtcpFeedback.find(m=>m.type===a.type&&m.parameter===a.parameter)||r.rtcpFeedback.push(a)})}),o};yt.writeRtpDescription=function(i,o){let t="";t+="m="+i+" ",t+=o.codecs.length>0?"9":"0",t+=" "+(o.profile||"UDP/TLS/RTP/SAVPF")+" ",t+=o.codecs.map(n=>n.preferredPayloadType!==void 0?n.preferredPayloadType:n.payloadType).join(" ")+`\r `,t+=`c=IN IP4 0.0.0.0\r `,t+=`a=rtcp:9 IN IP4 0.0.0.0\r `,o.codecs.forEach(n=>{t+=yt.writeRtpMap(n),t+=yt.writeFmtp(n),t+=yt.writeRtcpFb(n)});let e=0;return o.codecs.forEach(n=>{n.maxptime>e&&(e=n.maxptime)}),e>0&&(t+="a=maxptime:"+e+`\r `),o.headerExtensions&&o.headerExtensions.forEach(n=>{t+=yt.writeExtmap(n)}),t};yt.parseRtpEncodingParameters=function(i){let o=[],t=yt.parseRtpParameters(i),e=t.fecMechanisms.indexOf("RED")!==-1,n=t.fecMechanisms.indexOf("ULPFEC")!==-1,r=yt.matchPrefix(i,"a=ssrc:").map(h=>yt.parseSsrcMedia(h)).filter(h=>h.attribute==="cname"),a=r.length>0&&r[0].ssrc,s,m=yt.matchPrefix(i,"a=ssrc-group:FID").map(h=>h.substring(17).split(" ").map(E=>parseInt(E,10)));m.length>0&&m[0].length>1&&m[0][0]===a&&(s=m[0][1]),t.codecs.forEach(h=>{if(h.name.toUpperCase()==="RTX"&&h.parameters.apt){let C={ssrc:a,codecPayloadType:parseInt(h.parameters.apt,10)};a&&s&&(C.rtx={ssrc:s}),o.push(C),e&&(C=JSON.parse(JSON.stringify(C)),C.fec={ssrc:a,mechanism:n?"red+ulpfec":"red"},o.push(C))}}),o.length===0&&a&&o.push({ssrc:a});let p=yt.matchPrefix(i,"b=");return p.length&&(p[0].indexOf("b=TIAS:")===0?p=parseInt(p[0].substring(7),10):p[0].indexOf("b=AS:")===0?p=parseInt(p[0].substring(5),10)*1e3*.95-50*40*8:p=void 0,o.forEach(h=>{h.maxBitrate=p})),o};yt.parseRtcpParameters=function(i){let o={},t=yt.matchPrefix(i,"a=ssrc:").map(r=>yt.parseSsrcMedia(r)).filter(r=>r.attribute==="cname")[0];t&&(o.cname=t.value,o.ssrc=t.ssrc);let e=yt.matchPrefix(i,"a=rtcp-rsize");o.reducedSize=e.length>0,o.compound=e.length===0;let n=yt.matchPrefix(i,"a=rtcp-mux");return o.mux=n.length>0,o};yt.writeRtcpParameters=function(i){let o="";return i.reducedSize&&(o+=`a=rtcp-rsize\r `),i.mux&&(o+=`a=rtcp-mux\r `),i.ssrc!==void 0&&i.cname&&(o+="a=ssrc:"+i.ssrc+" cname:"+i.cname+`\r `),o};yt.parseMsid=function(i){let o,t=yt.matchPrefix(i,"a=msid:");if(t.length===1)return o=t[0].substring(7).split(" "),{stream:o[0],track:o[1]};let e=yt.matchPrefix(i,"a=ssrc:").map(n=>yt.parseSsrcMedia(n)).filter(n=>n.attribute==="msid");if(e.length>0)return o=e[0].value.split(" "),{stream:o[0],track:o[1]}};yt.parseSctpDescription=function(i){let o=yt.parseMLine(i),t=yt.matchPrefix(i,"a=max-message-size:"),e;t.length>0&&(e=parseInt(t[0].substring(19),10)),isNaN(e)&&(e=65536);let n=yt.matchPrefix(i,"a=sctp-port:");if(n.length>0)return{port:parseInt(n[0].substring(12),10),protocol:o.fmt,maxMessageSize:e};let r=yt.matchPrefix(i,"a=sctpmap:");if(r.length>0){let a=r[0].substring(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:e}}};yt.writeSctpDescription=function(i,o){let t=[];return i.protocol!=="DTLS/SCTP"?t=["m="+i.kind+" 9 "+i.protocol+" "+o.protocol+`\r `,`c=IN IP4 0.0.0.0\r `,"a=sctp-port:"+o.port+`\r `]:t=["m="+i.kind+" 9 "+i.protocol+" "+o.port+`\r `,`c=IN IP4 0.0.0.0\r `,"a=sctpmap:"+o.port+" "+o.protocol+` 65535\r `],o.maxMessageSize!==void 0&&t.push("a=max-message-size:"+o.maxMessageSize+`\r `),t.join("")};yt.generateSessionId=function(){return Math.random().toString().substr(2,22)};yt.writeSessionBoilerplate=function(i,o,t){let e,n=o!==void 0?o:2;return i?e=i:e=yt.generateSessionId(),`v=0\r o=`+(t||"thisisadapterortc")+" "+e+" "+n+` IN IP4 127.0.0.1\r s=-\r t=0 0\r `};yt.getDirection=function(i,o){let t=yt.splitLines(i);for(let e=0;e<t.length;e++)switch(t[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return t[e].substring(2);default:}return o?yt.getDirection(o):"sendrecv"};yt.getKind=function(i){return yt.splitLines(i)[0].split(" ")[0].substring(2)};yt.isRejected=function(i){return i.split(" ",2)[1]==="0"};yt.parseMLine=function(i){let t=yt.splitLines(i)[0].substring(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}};yt.parseOLine=function(i){let t=yt.matchPrefix(i,"o=")[0].substring(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}};yt.isValidSDP=function(i){if(typeof i!="string"||i.length===0)return!1;let o=yt.splitLines(i);for(let t=0;t<o.length;t++)if(o[t].length<2||o[t].charAt(1)!=="=")return!1;return!0};typeof iG=="object"&&(iG.exports=yt)});function H7(i,o){return Object.is(i,o)}var kr=null,jw=!1,z7=1,Hl=Symbol("SIGNAL");function qn(i){let o=kr;return kr=i,o}function G7(){return kr}var wh={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,kind:"unknown",producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Hw(i){if(jw)throw new Error("");if(kr===null)return;kr.consumerOnSignalRead(i);let o=kr.nextProducerIndex++;if(qw(kr),o<kr.producerNode.length&&kr.producerNode[o]!==i&&R_(kr)){let t=kr.producerNode[o];Ww(t,kr.producerIndexOfThis[o])}kr.producerNode[o]!==i&&(kr.producerNode[o]=i,kr.producerIndexOfThis[o]=R_(kr)?zG(i,kr,o):0),kr.producerLastReadVersion[o]=i.version}function HG(){z7++}function W7(i){if(!(R_(i)&&!i.dirty)&&!(!i.dirty&&i.lastCleanEpoch===z7)){if(!i.producerMustRecompute(i)&&!Gw(i)){$7(i);return}i.producerRecomputeValue(i),$7(i)}}function q7(i){if(i.liveConsumerNode===void 0)return;let o=jw;jw=!0;try{for(let t of i.liveConsumerNode)t.dirty||hCe(t)}finally{jw=o}}function Y7(){return kr?.consumerAllowSignalWrites!==!1}function hCe(i){i.dirty=!0,q7(i),i.consumerMarkedDirty?.(i)}function $7(i){i.dirty=!1,i.lastCleanEpoch=z7}function N_(i){return i&&(i.nextProducerIndex=0),qn(i)}function zw(i,o){if(qn(o),!(!i||i.producerNode===void 0||i.producerIndexOfThis===void 0||i.producerLastReadVersion===void 0)){if(R_(i))for(let t=i.nextProducerIndex;t<i.producerNode.length;t++)Ww(i.producerNode[t],i.producerIndexOfThis[t]);for(;i.producerNode.length>i.nextProducerIndex;)i.producerNode.pop(),i.producerLastReadVersion.pop(),i.producerIndexOfThis.pop()}}function Gw(i){qw(i);for(let o=0;o<i.producerNode.length;o++){let t=i.producerNode[o],e=i.producerLastReadVersion[o];if(e!==t.version||(W7(t),e!==t.version))return!0}return!1}function F_(i){if(qw(i),R_(i))for(let o=0;o<i.producerNode.length;o++)Ww(i.producerNode[o],i.producerIndexOfThis[o]);i.producerNode.length=i.producerLastReadVersion.length=i.producerIndexOfThis.length=0,i.liveConsumerNode&&(i.liveConsumerNode.length=i.liveConsumerIndexOfThis.length=0)}function zG(i,o,t){if(GG(i),i.liveConsumerNode.length===0&&WG(i))for(let e=0;e<i.producerNode.length;e++)i.producerIndexOfThis[e]=zG(i.producerNode[e],i,e);return i.liveConsumerIndexOfThis.push(t),i.liveConsumerNode.push(o)-1}function Ww(i,o){if(GG(i),i.liveConsumerNode.length===1&&WG(i))for(let e=0;e<i.producerNode.length;e++)Ww(i.producerNode[e],i.producerIndexOfThis[e]);let t=i.liveConsumerNode.length-1;if(i.liveConsumerNode[o]=i.liveConsumerNode[t],i.liveConsumerIndexOfThis[o]=i.liveConsumerIndexOfThis[t],i.liveConsumerNode.length--,i.liveConsumerIndexOfThis.length--,o<i.liveConsumerNode.length){let e=i.liveConsumerIndexOfThis[o],n=i.liveConsumerNode[o];qw(n),n.producerIndexOfThis[e]=o}}function R_(i){return i.consumerIsAlwaysLive||(i?.liveConsumerNode?.length??0)>0}function qw(i){i.producerNode??=[],i.producerIndexOfThis??=[],i.producerLastReadVersion??=[]}function GG(i){i.liveConsumerNode??=[],i.liveConsumerIndexOfThis??=[]}function WG(i){return i.producerNode!==void 0}function K7(i,o){let t=Object.create(fCe);t.computation=i,o!==void 0&&(t.equal=o);let e=()=>{if(W7(t),Hw(t),t.value===$w)throw t.error;return t.value};return e[Hl]=t,e}var U7=Symbol("UNSET"),j7=Symbol("COMPUTING"),$w=Symbol("ERRORED"),fCe=T(I({},wh),{value:U7,dirty:!0,error:null,equal:H7,kind:"computed",producerMustRecompute(i){return i.value===U7||i.value===j7},producerRecomputeValue(i){if(i.value===j7)throw new Error("Detected cycle in computations.");let o=i.value;i.value=j7;let t=N_(i),e,n=!1;try{e=i.computation(),qn(null),n=o!==U7&&o!==$w&&e!==$w&&i.equal(o,e)}catch(r){e=$w,i.error=r}finally{zw(i,t)}if(n){i.value=o;return}i.value=e,i.version++}});function vCe(){throw new Error}var qG=vCe;function YG(i){qG(i)}function Z7(i){qG=i}var CCe=null;function X7(i,o){let t=Object.create(J7);t.value=i,o!==void 0&&(t.equal=o);let e=()=>(Hw(t),t.value);return e[Hl]=t,e}function Yw(i,o){Y7()||YG(i),i.equal(i.value,o)||(i.value=o,_Ce(i))}function Q7(i,o){Y7()||YG(i),Yw(i,o(i.value))}var J7=T(I({},wh),{equal:H7,value:void 0,kind:"signal"});function _Ce(i){i.version++,HG(),q7(i),CCe?.()}function ek(i){let o=qn(null);try{return i()}finally{qn(o)}}var tk;function L_(){return tk}function Qm(i){let o=tk;return tk=i,o}var Kw=Symbol("NotFound");function ln(i){return typeof i=="function"}function Zw(i){let t=i(e=>{Error.call(e),e.stack=new Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Xw=Zw(i=>function(t){i(this),this.message=t?`${t.length} errors occurred during unsubscription: ${t.map((e,n)=>`${n+1}) ${e.toString()}`).join(` `)}`:"",this.name="UnsubscriptionError",this.errors=t});function Tg(i,o){if(i){let t=i.indexOf(o);0<=t&&i.splice(t,1)}}var cn=class i{constructor(o){this.initialTeardown=o,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let o;if(!this.closed){this.closed=!0;let{_parentage:t}=this;if(t)if(this._parentage=null,Array.isArray(t))for(let r of t)r.remove(this);else t.remove(this);let{initialTeardown:e}=this;if(ln(e))try{e()}catch(r){o=r instanceof Xw?r.errors:[r]}let{_finalizers:n}=this;if(n){this._finalizers=null;for(let r of n)try{KG(r)}catch(a){o=o??[],a instanceof Xw?o=[...o,...a.errors]:o.push(a)}}if(o)throw new Xw(o)}}add(o){var t;if(o&&o!==this)if(this.closed)KG(o);else{if(o instanceof i){if(o.closed||o._hasParent(this))return;o._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(o)}}_hasParent(o){let{_parentage:t}=this;return t===o||Array.isArray(t)&&t.includes(o)}_addParent(o){let{_parentage:t}=this;this._parentage=Array.isArray(t)?(t.push(o),t):t?[t,o]:o}_removeParent(o){let{_parentage:t}=this;t===o?this._parentage=null:Array.isArray(t)&&Tg(t,o)}remove(o){let{_finalizers:t}=this;t&&Tg(t,o),o instanceof i&&o._removeParent(this)}};cn.EMPTY=(()=>{let i=new cn;return i.closed=!0,i})();var nk=cn.EMPTY;function Qw(i){return i instanceof cn||i&&"closed"in i&&ln(i.remove)&&ln(i.add)&&ln(i.unsubscribe)}function KG(i){ln(i)?i():i.unsubscribe()}var zl={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Oh={setTimeout(i,o,...t){let{delegate:e}=Oh;return e?.setTimeout?e.setTimeout(i,o,...t):setTimeout(i,o,...t)},clearTimeout(i){let{delegate:o}=Oh;return(o?.clearTimeout||clearTimeout)(i)},delegate:void 0};function Jw(i){Oh.setTimeout(()=>{let{onUnhandledError:o}=zl;if(o)o(i);else throw i})}function Dg(){}var ZG=ik("C",void 0,void 0);function XG(i){return ik("E",void 0,i)}function QG(i){return ik("N",i,void 0)}function ik(i,o,t){return{kind:i,value:o,error:t}}var wg=null;function Ah(i){if(zl.useDeprecatedSynchronousErrorHandling){let o=!wg;if(o&&(wg={errorThrown:!1,error:null}),i(),o){let{errorThrown:t,error:e}=wg;if(wg=null,t)throw e}}else i()}function JG(i){zl.useDeprecatedSynchronousErrorHandling&&wg&&(wg.errorThrown=!0,wg.error=i)}var Og=class extends cn{constructor(o){super(),this.isStopped=!1,o?(this.destination=o,Qw(o)&&o.add(this)):this.destination=xCe}static create(o,t,e){return new Jm(o,t,e)}next(o){this.isStopped?rk(QG(o),this):this._next(o)}error(o){this.isStopped?rk(XG(o),this):(this.isStopped=!0,this._error(o))}complete(){this.isStopped?rk(ZG,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(o){this.destination.next(o)}_error(o){try{this.destination.error(o)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},ICe=Function.prototype.bind;function ok(i,o){return ICe.call(i,o)}var ak=class{constructor(o){this.partialObserver=o}next(o){let{partialObserver:t}=this;if(t.next)try{t.next(o)}catch(e){e4(e)}}error(o){let{partialObserver:t}=this;if(t.error)try{t.error(o)}catch(e){e4(e)}else e4(o)}complete(){let{partialObserver:o}=this;if(o.complete)try{o.complete()}catch(t){e4(t)}}},Jm=class extends Og{constructor(o,t,e){super();let n;if(ln(o)||!o)n={next:o??void 0,error:t??void 0,complete:e??void 0};else{let r;this&&zl.useDeprecatedNextContext?(r=Object.create(o),r.unsubscribe=()=>this.unsubscribe(),n={next:o.next&&ok(o.next,r),error:o.error&&ok(o.error,r),complete:o.complete&&ok(o.complete,r)}):n=o}this.destination=new ak(n)}};function e4(i){zl.useDeprecatedSynchronousErrorHandling?JG(i):Jw(i)}function ECe(i){throw i}function rk(i,o){let{onStoppedNotification:t}=zl;t&&Oh.setTimeout(()=>t(i,o))}var xCe={closed:!0,next:Dg,error:ECe,complete:Dg};var Ph=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Gl(i){return i}function eW(i){return i.length===0?Gl:i.length===1?i[0]:function(t){return i.reduce((e,n)=>n(e),t)}}var Lt=(()=>{class i{constructor(t){t&&(this._subscribe=t)}lift(t){let e=new i;return e.source=this,e.operator=t,e}subscribe(t,e,n){let r=DCe(t)?t:new Jm(t,e,n);return Ah(()=>{let{operator:a,source:s}=this;r.add(a?a.call(r,s):s?this._subscribe(r):this._trySubscribe(r))}),r}_trySubscribe(t){try{return this._subscribe(t)}catch(e){t.error(e)}}forEach(t,e){return e=tW(e),new e((n,r)=>{let a=new Jm({next:s=>{try{t(s)}catch(m){r(m),a.unsubscribe()}},error:r,complete:n});this.subscribe(a)})}_subscribe(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)}[Ph](){return this}pipe(...t){return eW(t)(this)}toPromise(t){return t=tW(t),new t((e,n)=>{let r;this.subscribe(a=>r=a,a=>n(a),()=>e(r))})}}return i.create=o=>new i(o),i})();function tW(i){var o;return(o=i??zl.Promise)!==null&&o!==void 0?o:Promise}function TCe(i){return i&&ln(i.next)&&ln(i.error)&&ln(i.complete)}function DCe(i){return i&&i instanceof Og||TCe(i)&&Qw(i)}function sk(i){return ln(i?.lift)}function kn(i){return o=>{if(sk(o))return o.lift(function(t){try{return i(t,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}function En(i,o,t,e,n){return new lk(i,o,t,e,n)}var lk=class extends Og{constructor(o,t,e,n,r,a){super(o),this.onFinalize=r,this.shouldUnsubscribe=a,this._next=t?function(s){try{t(s)}catch(m){o.error(m)}}:super._next,this._error=n?function(s){try{n(s)}catch(m){o.error(m)}finally{this.unsubscribe()}}:super._error,this._complete=e?function(){try{e()}catch(s){o.error(s)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var o;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:t}=this;super.unsubscribe(),!t&&((o=this.onFinalize)===null||o===void 0||o.call(this))}}};function nW(){return kn((i,o)=>{let t=null;i._refCount++;let e=En(o,void 0,void 0,void 0,()=>{if(!i||i._refCount<=0||0<--i._refCount){t=null;return}let n=i._connection,r=t;t=null,n&&(!r||n===r)&&n.unsubscribe(),o.unsubscribe()});i.subscribe(e),e.closed||(t=i.connect())})}var B_=class extends Lt{constructor(o,t){super(),this.source=o,this.subjectFactory=t,this._subject=null,this._refCount=0,this._connection=null,sk(o)&&(this.lift=o.lift)}_subscribe(o){return this.getSubject().subscribe(o)}getSubject(){let o=this._subject;return(!o||o.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;let{_connection:o}=this;this._subject=this._connection=null,o?.unsubscribe()}connect(){let o=this._connection;if(!o){o=this._connection=new cn;let t=this.getSubject();o.add(this.source.subscribe(En(t,void 0,()=>{this._teardown(),t.complete()},e=>{this._teardown(),t.error(e)},()=>this._teardown()))),o.closed&&(this._connection=null,o=cn.EMPTY)}return o}refCount(){return nW()(this)}};var Mh={schedule(i){let o=requestAnimationFrame,t=cancelAnimationFrame,{delegate:e}=Mh;e&&(o=e.requestAnimationFrame,t=e.cancelAnimationFrame);let n=o(r=>{t=void 0,i(r)});return new cn(()=>t?.(n))},requestAnimationFrame(...i){let{delegate:o}=Mh;return(o?.requestAnimationFrame||requestAnimationFrame)(...i)},cancelAnimationFrame(...i){let{delegate:o}=Mh;return(o?.cancelAnimationFrame||cancelAnimationFrame)(...i)},delegate:void 0};var iW=Zw(i=>function(){i(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var Xe=(()=>{class i extends Lt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(t){let e=new t4(this,this);return e.operator=t,e}_throwIfClosed(){if(this.closed)throw new iW}next(t){Ah(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let e of this.currentObservers)e.next(t)}})}error(t){Ah(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=t;let{observers:e}=this;for(;e.length;)e.shift().error(t)}})}complete(){Ah(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:t}=this;for(;t.length;)t.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0}_trySubscribe(t){return this._throwIfClosed(),super._trySubscribe(t)}_subscribe(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)}_innerSubscribe(t){let{hasError:e,isStopped:n,observers:r}=this;return e||n?nk:(this.currentObservers=null,r.push(t),new cn(()=>{this.currentObservers=null,Tg(r,t)}))}_checkFinalizedStatuses(t){let{hasError:e,thrownError:n,isStopped:r}=this;e?t.error(n):r&&t.complete()}asObservable(){let t=new Lt;return t.source=this,t}}return i.create=(o,t)=>new t4(o,t),i})(),t4=class extends Xe{constructor(o,t){super(),this.destination=o,this.source=t}next(o){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.next)===null||e===void 0||e.call(t,o)}error(o){var t,e;(e=(t=this.destination)===null||t===void 0?void 0:t.error)===null||e===void 0||e.call(t,o)}complete(){var o,t;(t=(o=this.destination)===null||o===void 0?void 0:o.complete)===null||t===void 0||t.call(o)}_subscribe(o){var t,e;return(e=(t=this.source)===null||t===void 0?void 0:t.subscribe(o))!==null&&e!==void 0?e:nk}};var _e=class extends Xe{constructor(o){super(),this._value=o}get value(){return this.getValue()}_subscribe(o){let t=super._subscribe(o);return!t.closed&&o.next(this._value),t}getValue(){let{hasError:o,thrownError:t,_value:e}=this;if(o)throw t;return this._throwIfClosed(),e}next(o){super.next(this._value=o)}};var Ag={now(){return(Ag.delegate||Date).now()},delegate:void 0};var $d=class extends Xe{constructor(o=1/0,t=1/0,e=Ag){super(),this._bufferSize=o,this._windowTime=t,this._timestampProvider=e,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=t===1/0,this._bufferSize=Math.max(1,o),this._windowTime=Math.max(1,t)}next(o){let{isStopped:t,_buffer:e,_infiniteTimeWindow:n,_timestampProvider:r,_windowTime:a}=this;t||(e.push(o),!n&&e.push(r.now()+a)),this._trimBuffer(),super.next(o)}_subscribe(o){this._throwIfClosed(),this._trimBuffer();let t=this._innerSubscribe(o),{_infiniteTimeWindow:e,_buffer:n}=this,r=n.slice();for(let a=0;a<r.length&&!o.closed;a+=e?1:2)o.next(r[a]);return this._checkFinalizedStatuses(o),t}_trimBuffer(){let{_bufferSize:o,_timestampProvider:t,_buffer:e,_infiniteTimeWindow:n}=this,r=(n?1:2)*o;if(o<1/0&&r<e.length&&e.splice(0,e.length-r),!n){let a=t.now(),s=0;for(let m=1;m<e.length&&e[m]<=a;m+=2)s=m;s&&e.splice(0,s+1)}}};var n4=class extends cn{constructor(o,t){super()}schedule(o,t=0){return this}};var V_={setInterval(i,o,...t){let{delegate:e}=V_;return e?.setInterval?e.setInterval(i,o,...t):setInterval(i,o,...t)},clearInterval(i){let{delegate:o}=V_;return(o?.clearInterval||clearInterval)(i)},delegate:void 0};var Hc=class extends n4{constructor(o,t){super(o,t),this.scheduler=o,this.work=t,this.pending=!1}schedule(o,t=0){var e;if(this.closed)return this;this.state=o;let n=this.id,r=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=(e=this.id)!==null&&e!==void 0?e:this.requestAsyncId(r,this.id,t),this}requestAsyncId(o,t,e=0){return V_.setInterval(o.flush.bind(o,this),e)}recycleAsyncId(o,t,e=0){if(e!=null&&this.delay===e&&this.pending===!1)return t;t!=null&&V_.clearInterval(t)}execute(o,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let e=this._execute(o,t);if(e)return e;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(o,t){let e=!1,n;try{this.work(o)}catch(r){e=!0,n=r||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:o,scheduler:t}=this,{actions:e}=t;this.work=this.state=this.scheduler=null,this.pending=!1,Tg(e,this),o!=null&&(this.id=this.recycleAsyncId(t,o,null)),this.delay=null,super.unsubscribe()}}};var wCe=1,ck,mk={};function oW(i){return i in mk?(delete mk[i],!0):!1}var rW={setImmediate(i){let o=wCe++;return mk[o]=!0,ck||(ck=Promise.resolve()),ck.then(()=>oW(o)&&i()),o},clearImmediate(i){oW(i)}};var{setImmediate:OCe,clearImmediate:ACe}=rW,U_={setImmediate(...i){let{delegate:o}=U_;return(o?.setImmediate||OCe)(...i)},clearImmediate(i){let{delegate:o}=U_;return(o?.clearImmediate||ACe)(i)},delegate:void 0};var i4=class extends Hc{constructor(o,t){super(o,t),this.scheduler=o,this.work=t}requestAsyncId(o,t,e=0){return e!==null&&e>0?super.requestAsyncId(o,t,e):(o.actions.push(this),o._scheduled||(o._scheduled=U_.setImmediate(o.flush.bind(o,void 0))))}recycleAsyncId(o,t,e=0){var n;if(e!=null?e>0:this.delay>0)return super.recycleAsyncId(o,t,e);let{actions:r}=o;t!=null&&((n=r[r.length-1])===null||n===void 0?void 0:n.id)!==t&&(U_.clearImmediate(t),o._scheduled===t&&(o._scheduled=void 0))}};var kh=class i{constructor(o,t=i.now){this.schedulerActionCtor=o,this.now=t}schedule(o,t=0,e){return new this.schedulerActionCtor(this,o).schedule(e,t)}};kh.now=Ag.now;var zc=class extends kh{constructor(o,t=kh.now){super(o,t),this.actions=[],this._active=!1}flush(o){let{actions:t}=this;if(this._active){t.push(o);return}let e;this._active=!0;do if(e=o.execute(o.state,o.delay))break;while(o=t.shift());if(this._active=!1,e){for(;o=t.shift();)o.unsubscribe();throw e}}};var o4=class extends zc{flush(o){this._active=!0;let t=this._scheduled;this._scheduled=void 0;let{actions:e}=this,n;o=o||e.shift();do if(n=o.execute(o.state,o.delay))break;while((o=e[0])&&o.id===t&&e.shift());if(this._active=!1,n){for(;(o=e[0])&&o.id===t&&e.shift();)o.unsubscribe();throw n}}};var dk=new o4(i4);var as=new zc(Hc),pk=as;var r4=class extends Hc{constructor(o,t){super(o,t),this.scheduler=o,this.work=t}schedule(o,t=0){return t>0?super.schedule(o,t):(this.delay=t,this.state=o,this.scheduler.flush(this),this)}execute(o,t){return t>0||this.closed?super.execute(o,t):this._execute(o,t)}requestAsyncId(o,t,e=0){return e!=null&&e>0||e==null&&this.delay>0?super.requestAsyncId(o,t,e):(o.flush(this),0)}};var a4=class extends zc{};var gk=new a4(r4);var s4=class extends Hc{constructor(o,t){super(o,t),this.scheduler=o,this.work=t}requestAsyncId(o,t,e=0){return e!==null&&e>0?super.requestAsyncId(o,t,e):(o.actions.push(this),o._scheduled||(o._scheduled=Mh.requestAnimationFrame(()=>o.flush(void 0))))}recycleAsyncId(o,t,e=0){var n;if(e!=null?e>0:this.delay>0)return super.recycleAsyncId(o,t,e);let{actions:r}=o;t!=null&&t===o._scheduled&&((n=r[r.length-1])===null||n===void 0?void 0:n.id)!==t&&(Mh.cancelAnimationFrame(t),o._scheduled=void 0)}};var l4=class extends zc{flush(o){this._active=!0;let t;o?t=o.id:(t=this._scheduled,this._scheduled=void 0);let{actions:e}=this,n;o=o||e.shift();do if(n=o.execute(o.state,o.delay))break;while((o=e[0])&&o.id===t&&e.shift());if(this._active=!1,n){for(;(o=e[0])&&o.id===t&&e.shift();)o.unsubscribe();throw n}}};var ed=new l4(s4);var Pg=new Lt(i=>i.complete());function c4(i){return i&&ln(i.schedule)}function uk(i){return i[i.length-1]}function m4(i){return ln(uk(i))?i.pop():void 0}function Gc(i){return c4(uk(i))?i.pop():void 0}function aW(i,o){return typeof uk(i)=="number"?i.pop():o}function hk(i,o){var t={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&o.indexOf(e)<0&&(t[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,e=Object.getOwnPropertySymbols(i);n<e.length;n++)o.indexOf(e[n])<0&&Object.prototype.propertyIsEnumerable.call(i,e[n])&&(t[e[n]]=i[e[n]]);return t}function lW(i,o,t,e){function n(r){return r instanceof t?r:new t(function(a){a(r)})}return new(t||(t=Promise))(function(r,a){function s(h){try{p(e.next(h))}catch(C){a(C)}}function m(h){try{p(e.throw(h))}catch(C){a(C)}}function p(h){h.done?r(h.value):n(h.value).then(s,m)}p((e=e.apply(i,o||[])).next())})}function sW(i){var o=typeof Symbol=="function"&&Symbol.iterator,t=o&&i[o],e=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&e>=i.length&&(i=void 0),{value:i&&i[e++],done:!i}}};throw new TypeError(o?"Object is not iterable.":"Symbol.iterator is not defined.")}function Mg(i){return this instanceof Mg?(this.v=i,this):new Mg(i)}function cW(i,o,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t.apply(i,o||[]),n,r=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(D){return function(L){return Promise.resolve(L).then(D,C)}}function s(D,L){e[D]&&(n[D]=function(H){return new Promise(function(K,oe){r.push([D,H,K,oe])>1||m(D,H)})},L&&(n[D]=L(n[D])))}function m(D,L){try{p(e[D](L))}catch(H){E(r[0][3],H)}}function p(D){D.value instanceof Mg?Promise.resolve(D.value.v).then(h,C):E(r[0][2],D)}function h(D){m("next",D)}function C(D){m("throw",D)}function E(D,L){D(L),r.shift(),r.length&&m(r[0][0],r[0][1])}}function mW(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=i[Symbol.asyncIterator],t;return o?o.call(i):(i=typeof sW=="function"?sW(i):i[Symbol.iterator](),t={},e("next"),e("throw"),e("return"),t[Symbol.asyncIterator]=function(){return this},t);function e(r){t[r]=i[r]&&function(a){return new Promise(function(s,m){a=i[r](a),n(s,m,a.done,a.value)})}}function n(r,a,s,m){Promise.resolve(m).then(function(p){r({value:p,done:s})},a)}}var Rh=i=>i&&typeof i.length=="number"&&typeof i!="function";function d4(i){return ln(i?.then)}function p4(i){return ln(i[Ph])}function g4(i){return Symbol.asyncIterator&&ln(i?.[Symbol.asyncIterator])}function u4(i){return new TypeError(`You provided ${i!==null&&typeof i=="object"?"an invalid object":`'${i}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function PCe(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var h4=PCe();function f4(i){return ln(i?.[h4])}function v4(i){return cW(this,arguments,function*(){let t=i.getReader();try{for(;;){let{value:e,done:n}=yield Mg(t.read());if(n)return yield Mg(void 0);yield yield Mg(e)}}finally{t.releaseLock()}})}function C4(i){return ln(i?.getReader)}function Si(i){if(i instanceof Lt)return i;if(i!=null){if(p4(i))return MCe(i);if(Rh(i))return kCe(i);if(d4(i))return RCe(i);if(g4(i))return dW(i);if(f4(i))return NCe(i);if(C4(i))return FCe(i)}throw u4(i)}function MCe(i){return new Lt(o=>{let t=i[Ph]();if(ln(t.subscribe))return t.subscribe(o);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function kCe(i){return new Lt(o=>{for(let t=0;t<i.length&&!o.closed;t++)o.next(i[t]);o.complete()})}function RCe(i){return new Lt(o=>{i.then(t=>{o.closed||(o.next(t),o.complete())},t=>o.error(t)).then(null,Jw)})}function NCe(i){return new Lt(o=>{for(let t of i)if(o.next(t),o.closed)return;o.complete()})}function dW(i){return new Lt(o=>{LCe(i,o).catch(t=>o.error(t))})}function FCe(i){return dW(v4(i))}function LCe(i,o){var t,e,n,r;return lW(this,void 0,void 0,fu