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) 7.56 MB
var SNIPPYLY_VERSION = '4.5.9-beta.3'; (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 ySe=Object.create;var zA=Object.defineProperty,SSe=Object.defineProperties,bSe=Object.getOwnPropertyDescriptor,ISe=Object.getOwnPropertyDescriptors,ESe=Object.getOwnPropertyNames,HA=Object.getOwnPropertySymbols,VY=Object.getPrototypeOf,p8=Object.prototype.hasOwnProperty,UY=Object.prototype.propertyIsEnumerable,xSe=Reflect.get;var BY=(i,o,n)=>o in i?zA(i,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[o]=n,E=(i,o)=>{for(var n in o||={})p8.call(o,n)&&BY(i,n,o[n]);if(HA)for(var n of HA(o))UY.call(o,n)&&BY(i,n,o[n]);return i},D=(i,o)=>SSe(i,ISe(o));var ry=(i,o)=>{var n={};for(var e in i)p8.call(i,e)&&o.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&HA)for(var e of HA(i))o.indexOf(e)<0&&UY.call(i,e)&&(n[e]=i[e]);return n};var TSe=(i,o)=>()=>(o||i((o={exports:{}}).exports,o),o.exports),GA=(i,o)=>{for(var n in o)zA(i,n,{get:o[n],enumerable:!0})},DSe=(i,o,n,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of ESe(o))!p8.call(i,t)&&t!==n&&zA(i,t,{get:()=>o[t],enumerable:!(e=bSe(o,t))||e.enumerable});return i};var jY=(i,o,n)=>(n=i!=null?ySe(VY(i)):{},DSe(o||!i||!i.__esModule?zA(n,"default",{value:i,enumerable:!0}):n,i));var Mp=(i,o,n)=>xSe(VY(i),n,o);var Q=(i,o,n)=>new Promise((e,t)=>{var r=c=>{try{s(n.next(c))}catch(p){t(p)}},a=c=>{try{s(n.throw(c))}catch(p){t(p)}},s=c=>c.done?e(c.value):Promise.resolve(c.value).then(r,a);s((n=n.apply(i,o)).next())});var oY=TSe((s3o,iY)=>{"use strict";var Dt={};Dt.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};Dt.localCName=Dt.generateIdentifier();Dt.splitLines=function(i){return i.trim().split(` `).map(o=>o.trim())};Dt.splitSections=function(i){return i.split(` m=`).map((n,e)=>(e>0?"m="+n:n).trim()+`\r `)};Dt.getDescription=function(i){let o=Dt.splitSections(i);return o&&o[0]};Dt.getMediaSections=function(i){let o=Dt.splitSections(i);return o.shift(),o};Dt.matchPrefix=function(i,o){return Dt.splitLines(i).filter(n=>n.indexOf(o)===0)};Dt.parseCandidate=function(i){let o;i.indexOf("a=candidate:")===0?o=i.substring(12).split(" "):o=i.substring(10).split(" ");let n={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":n.relatedAddress=o[e+1];break;case"rport":n.relatedPort=parseInt(o[e+1],10);break;case"tcptype":n.tcpType=o[e+1];break;case"ufrag":n.ufrag=o[e+1],n.usernameFragment=o[e+1];break;default:n[o[e]]===void 0&&(n[o[e]]=o[e+1]);break}return n};Dt.writeCandidate=function(i){let o=[];o.push(i.foundation);let n=i.component;n==="rtp"?o.push(1):n==="rtcp"?o.push(2):o.push(n),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(" ")};Dt.parseIceOptions=function(i){return i.substring(14).split(" ")};Dt.parseRtpMap=function(i){let o=i.substring(9).split(" "),n={payloadType:parseInt(o.shift(),10)};return o=o[0].split("/"),n.name=o[0],n.clockRate=parseInt(o[1],10),n.channels=o.length===3?parseInt(o[2],10):1,n.numChannels=n.channels,n};Dt.writeRtpMap=function(i){let o=i.payloadType;i.preferredPayloadType!==void 0&&(o=i.preferredPayloadType);let n=i.channels||i.numChannels||1;return"a=rtpmap:"+o+" "+i.name+"/"+i.clockRate+(n!==1?"/"+n:"")+`\r `};Dt.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(" ")}};Dt.writeExtmap=function(i){return"a=extmap:"+(i.id||i.preferredId)+(i.direction&&i.direction!=="sendrecv"?"/"+i.direction:"")+" "+i.uri+(i.attributes?" "+i.attributes:"")+`\r `};Dt.parseFmtp=function(i){let o={},n,e=i.substring(i.indexOf(" ")+1).split(";");for(let t=0;t<e.length;t++)n=e[t].trim().split("="),o[n[0].trim()]=n[1];return o};Dt.writeFmtp=function(i){let o="",n=i.payloadType;if(i.preferredPayloadType!==void 0&&(n=i.preferredPayloadType),i.parameters&&Object.keys(i.parameters).length){let e=[];Object.keys(i.parameters).forEach(t=>{i.parameters[t]!==void 0?e.push(t+"="+i.parameters[t]):e.push(t)}),o+="a=fmtp:"+n+" "+e.join(";")+`\r `}return o};Dt.parseRtcpFb=function(i){let o=i.substring(i.indexOf(" ")+1).split(" ");return{type:o.shift(),parameter:o.join(" ")}};Dt.writeRtcpFb=function(i){let o="",n=i.payloadType;return i.preferredPayloadType!==void 0&&(n=i.preferredPayloadType),i.rtcpFeedback&&i.rtcpFeedback.length&&i.rtcpFeedback.forEach(e=>{o+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+`\r `}),o};Dt.parseSsrcMedia=function(i){let o=i.indexOf(" "),n={ssrc:parseInt(i.substring(7,o),10)},e=i.indexOf(":",o);return e>-1?(n.attribute=i.substring(o+1,e),n.value=i.substring(e+1)):n.attribute=i.substring(o+1),n};Dt.parseSsrcGroup=function(i){let o=i.substring(13).split(" ");return{semantics:o.shift(),ssrcs:o.map(n=>parseInt(n,10))}};Dt.getMid=function(i){let o=Dt.matchPrefix(i,"a=mid:")[0];if(o)return o.substring(6)};Dt.parseFingerprint=function(i){let o=i.substring(14).split(" ");return{algorithm:o[0].toLowerCase(),value:o[1].toUpperCase()}};Dt.getDtlsParameters=function(i,o){return{role:"auto",fingerprints:Dt.matchPrefix(i+o,"a=fingerprint:").map(Dt.parseFingerprint)}};Dt.writeDtlsParameters=function(i,o){let n="a=setup:"+o+`\r `;return i.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+`\r `}),n};Dt.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)}};Dt.writeCryptoLine=function(i){return"a=crypto:"+i.tag+" "+i.cryptoSuite+" "+(typeof i.keyParams=="object"?Dt.writeCryptoKeyParams(i.keyParams):i.keyParams)+(i.sessionParams?" "+i.sessionParams.join(" "):"")+`\r `};Dt.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}};Dt.writeCryptoKeyParams=function(i){return i.keyMethod+":"+i.keySalt+(i.lifeTime?"|"+i.lifeTime:"")+(i.mkiValue&&i.mkiLength?"|"+i.mkiValue+":"+i.mkiLength:"")};Dt.getCryptoParameters=function(i,o){return Dt.matchPrefix(i+o,"a=crypto:").map(Dt.parseCryptoLine)};Dt.getIceParameters=function(i,o){let n=Dt.matchPrefix(i+o,"a=ice-ufrag:")[0],e=Dt.matchPrefix(i+o,"a=ice-pwd:")[0];return n&&e?{usernameFragment:n.substring(12),password:e.substring(10)}:null};Dt.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};Dt.parseRtpParameters=function(i){let o={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},e=Dt.splitLines(i)[0].split(" ");o.profile=e[2];for(let r=3;r<e.length;r++){let a=e[r],s=Dt.matchPrefix(i,"a=rtpmap:"+a+" ")[0];if(s){let c=Dt.parseRtpMap(s),p=Dt.matchPrefix(i,"a=fmtp:"+a+" ");switch(c.parameters=p.length?Dt.parseFmtp(p[0]):{},c.rtcpFeedback=Dt.matchPrefix(i,"a=rtcp-fb:"+a+" ").map(Dt.parseRtcpFb),o.codecs.push(c),c.name.toUpperCase()){case"RED":case"ULPFEC":o.fecMechanisms.push(c.name.toUpperCase());break;default:break}}}Dt.matchPrefix(i,"a=extmap:").forEach(r=>{o.headerExtensions.push(Dt.parseExtmap(r))});let t=Dt.matchPrefix(i,"a=rtcp-fb:* ").map(Dt.parseRtcpFb);return o.codecs.forEach(r=>{t.forEach(a=>{r.rtcpFeedback.find(c=>c.type===a.type&&c.parameter===a.parameter)||r.rtcpFeedback.push(a)})}),o};Dt.writeRtpDescription=function(i,o){let n="";n+="m="+i+" ",n+=o.codecs.length>0?"9":"0",n+=" "+(o.profile||"UDP/TLS/RTP/SAVPF")+" ",n+=o.codecs.map(t=>t.preferredPayloadType!==void 0?t.preferredPayloadType:t.payloadType).join(" ")+`\r `,n+=`c=IN IP4 0.0.0.0\r `,n+=`a=rtcp:9 IN IP4 0.0.0.0\r `,o.codecs.forEach(t=>{n+=Dt.writeRtpMap(t),n+=Dt.writeFmtp(t),n+=Dt.writeRtcpFb(t)});let e=0;return o.codecs.forEach(t=>{t.maxptime>e&&(e=t.maxptime)}),e>0&&(n+="a=maxptime:"+e+`\r `),o.headerExtensions&&o.headerExtensions.forEach(t=>{n+=Dt.writeExtmap(t)}),n};Dt.parseRtpEncodingParameters=function(i){let o=[],n=Dt.parseRtpParameters(i),e=n.fecMechanisms.indexOf("RED")!==-1,t=n.fecMechanisms.indexOf("ULPFEC")!==-1,r=Dt.matchPrefix(i,"a=ssrc:").map(g=>Dt.parseSsrcMedia(g)).filter(g=>g.attribute==="cname"),a=r.length>0&&r[0].ssrc,s,c=Dt.matchPrefix(i,"a=ssrc-group:FID").map(g=>g.substring(17).split(" ").map(I=>parseInt(I,10)));c.length>0&&c[0].length>1&&c[0][0]===a&&(s=c[0][1]),n.codecs.forEach(g=>{if(g.name.toUpperCase()==="RTX"&&g.parameters.apt){let f={ssrc:a,codecPayloadType:parseInt(g.parameters.apt,10)};a&&s&&(f.rtx={ssrc:s}),o.push(f),e&&(f=JSON.parse(JSON.stringify(f)),f.fec={ssrc:a,mechanism:t?"red+ulpfec":"red"},o.push(f))}}),o.length===0&&a&&o.push({ssrc:a});let p=Dt.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-2e3*8:p=void 0,o.forEach(g=>{g.maxBitrate=p})),o};Dt.parseRtcpParameters=function(i){let o={},n=Dt.matchPrefix(i,"a=ssrc:").map(r=>Dt.parseSsrcMedia(r)).filter(r=>r.attribute==="cname")[0];n&&(o.cname=n.value,o.ssrc=n.ssrc);let e=Dt.matchPrefix(i,"a=rtcp-rsize");o.reducedSize=e.length>0,o.compound=e.length===0;let t=Dt.matchPrefix(i,"a=rtcp-mux");return o.mux=t.length>0,o};Dt.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};Dt.parseMsid=function(i){let o,n=Dt.matchPrefix(i,"a=msid:");if(n.length===1)return o=n[0].substring(7).split(" "),{stream:o[0],track:o[1]};let e=Dt.matchPrefix(i,"a=ssrc:").map(t=>Dt.parseSsrcMedia(t)).filter(t=>t.attribute==="msid");if(e.length>0)return o=e[0].value.split(" "),{stream:o[0],track:o[1]}};Dt.parseSctpDescription=function(i){let o=Dt.parseMLine(i),n=Dt.matchPrefix(i,"a=max-message-size:"),e;n.length>0&&(e=parseInt(n[0].substring(19),10)),isNaN(e)&&(e=65536);let t=Dt.matchPrefix(i,"a=sctp-port:");if(t.length>0)return{port:parseInt(t[0].substring(12),10),protocol:o.fmt,maxMessageSize:e};let r=Dt.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}}};Dt.writeSctpDescription=function(i,o){let n=[];return i.protocol!=="DTLS/SCTP"?n=["m="+i.kind+" 9 "+i.protocol+" "+o.protocol+`\r `,`c=IN IP4 0.0.0.0\r `,"a=sctp-port:"+o.port+`\r `]:n=["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&&n.push("a=max-message-size:"+o.maxMessageSize+`\r `),n.join("")};Dt.generateSessionId=function(){return Math.random().toString().substr(2,22)};Dt.writeSessionBoilerplate=function(i,o,n){let e,t=o!==void 0?o:2;return i?e=i:e=Dt.generateSessionId(),`v=0\r o=`+(n||"thisisadapterortc")+" "+e+" "+t+` IN IP4 127.0.0.1\r s=-\r t=0 0\r `};Dt.getDirection=function(i,o){let n=Dt.splitLines(i);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substring(2);default:}return o?Dt.getDirection(o):"sendrecv"};Dt.getKind=function(i){return Dt.splitLines(i)[0].split(" ")[0].substring(2)};Dt.isRejected=function(i){return i.split(" ",2)[1]==="0"};Dt.parseMLine=function(i){let n=Dt.splitLines(i)[0].substring(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}};Dt.parseOLine=function(i){let n=Dt.matchPrefix(i,"o=")[0].substring(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}};Dt.isValidSDP=function(i){if(typeof i!="string"||i.length===0)return!1;let o=Dt.splitLines(i);for(let n=0;n<o.length;n++)if(o[n].length<2||o[n].charAt(1)!=="=")return!1;return!0};typeof iY=="object"&&(iY.exports=Dt)});var g8;function WA(){return g8}function bd(i){let o=g8;return g8=i,o}var $Y=Symbol("NotFound");function Nf(i){return i===$Y||i?.name==="\u0275NotFound"}var Ba=null,qA=!1,u8=1,wSe=null,Os=Symbol("SIGNAL");function Mn(i){let o=Ba;return Ba=i,o}function XA(){return Ba}var Au={version:0,lastCleanEpoch:0,dirty:!1,producers:void 0,producersTail:void 0,consumers:void 0,consumersTail:void 0,recomputing:!1,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,kind:"unknown",producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function QA(i){if(qA)throw new Error("");if(Ba===null)return;Ba.consumerOnSignalRead(i);let o=Ba.producersTail;if(o!==void 0&&o.producer===i)return;let n,e=Ba.recomputing;if(e&&(n=o!==void 0?o.nextProducer:Ba.producers,n!==void 0&&n.producer===i)){Ba.producersTail=n,n.lastReadVersion=i.version;return}let t=i.consumersTail;if(t!==void 0&&t.consumer===Ba&&(!e||ASe(t,Ba)))return;let r=Bf(Ba),a={producer:i,consumer:Ba,nextProducer:n,prevConsumer:t,lastReadVersion:i.version,nextConsumer:void 0};Ba.producersTail=a,o!==void 0?o.nextProducer=a:Ba.producers=a,r&&WY(i,a)}function HY(){u8++}function JA(i){if(!(Bf(i)&&!i.dirty)&&!(!i.dirty&&i.lastCleanEpoch===u8)){if(!i.producerMustRecompute(i)&&!ly(i)){ZA(i);return}i.producerRecomputeValue(i),ZA(i)}}function h8(i){if(i.consumers===void 0)return;let o=qA;qA=!0;try{for(let n=i.consumers;n!==void 0;n=n.nextConsumer){let e=n.consumer;e.dirty||OSe(e)}}finally{qA=o}}function f8(){return Ba?.consumerAllowSignalWrites!==!1}function OSe(i){i.dirty=!0,h8(i),i.consumerMarkedDirty?.(i)}function ZA(i){i.dirty=!1,i.lastCleanEpoch=u8}function Ff(i){return i&&zY(i),Mn(i)}function zY(i){i.producersTail=void 0,i.recomputing=!0}function sy(i,o){Mn(o),i&&GY(i)}function GY(i){i.recomputing=!1;let o=i.producersTail,n=o!==void 0?o.nextProducer:i.producers;if(n!==void 0){if(Bf(i))do n=v8(n);while(n!==void 0);o!==void 0?o.nextProducer=void 0:i.producers=void 0}}function ly(i){for(let o=i.producers;o!==void 0;o=o.nextProducer){let n=o.producer,e=o.lastReadVersion;if(e!==n.version||(JA(n),e!==n.version))return!0}return!1}function Lf(i){if(Bf(i)){let o=i.producers;for(;o!==void 0;)o=v8(o)}i.producers=void 0,i.producersTail=void 0,i.consumers=void 0,i.consumersTail=void 0}function WY(i,o){let n=i.consumersTail,e=Bf(i);if(n!==void 0?(o.nextConsumer=n.nextConsumer,n.nextConsumer=o):(o.nextConsumer=void 0,i.consumers=o),o.prevConsumer=n,i.consumersTail=o,!e)for(let t=i.producers;t!==void 0;t=t.nextProducer)WY(t.producer,t)}function v8(i){let o=i.producer,n=i.nextProducer,e=i.nextConsumer,t=i.prevConsumer;if(i.nextConsumer=void 0,i.prevConsumer=void 0,e!==void 0?e.prevConsumer=t:o.consumersTail=t,t!==void 0)t.nextConsumer=e;else if(o.consumers=e,!Bf(o)){let r=o.producers;for(;r!==void 0;)r=v8(r)}return n}function Bf(i){return i.consumerIsAlwaysLive||i.consumers!==void 0}function e4(i){wSe?.(i)}function ASe(i,o){let n=o.producersTail;if(n!==void 0){let e=o.producers;do{if(e===i)return!0;if(e===n)break;e=e.nextProducer}while(e!==void 0)}return!1}function t4(i,o){return Object.is(i,o)}function n4(i,o){let n=Object.create(PSe);n.computation=i,o!==void 0&&(n.equal=o);let e=()=>{if(JA(n),QA(n),n.value===ay)throw n.error;return n.value};return e[Os]=n,e4(n),e}var YA=Symbol("UNSET"),KA=Symbol("COMPUTING"),ay=Symbol("ERRORED"),PSe=D(E({},Au),{value:YA,dirty:!0,error:null,equal:t4,kind:"computed",producerMustRecompute(i){return i.value===YA||i.value===KA},producerRecomputeValue(i){if(i.value===KA)throw new Error("");let o=i.value;i.value=KA;let n=Ff(i),e,t=!1;try{e=i.computation(),Mn(null),t=o!==YA&&o!==ay&&e!==ay&&i.equal(o,e)}catch(r){e=ay,i.error=r}finally{sy(i,n)}if(t){i.value=o;return}i.value=e,i.version++}});function MSe(){throw new Error}var qY=MSe;function YY(i){qY(i)}function C8(i){qY=i}var kSe=null;function _8(i,o){let n=Object.create(ZY);n.value=i,o!==void 0&&(n.equal=o);let e=()=>KY(n);return e[Os]=n,e4(n),[e,a=>i4(n,a),a=>y8(n,a)]}function KY(i){return QA(i),i.value}function i4(i,o){f8()||YY(i),i.equal(i.value,o)||(i.value=o,RSe(i))}function y8(i,o){f8()||YY(i),i4(i,o(i.value))}var ZY=D(E({},Au),{equal:t4,value:void 0,kind:"signal"});function RSe(i){i.version++,HY(),h8(i),kSe?.(i)}function xn(i){return typeof i=="function"}function kp(i){let n=i(e=>{Error.call(e),e.stack=new Error().stack});return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var o4=kp(i=>function(n){i(this),this.message=n?`${n.length} errors occurred during unsubscription: ${n.map((e,t)=>`${t+1}) ${e.toString()}`).join(` `)}`:"",this.name="UnsubscriptionError",this.errors=n});function Pu(i,o){if(i){let n=i.indexOf(o);0<=n&&i.splice(n,1)}}var Tn=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:n}=this;if(n)if(this._parentage=null,Array.isArray(n))for(let r of n)r.remove(this);else n.remove(this);let{initialTeardown:e}=this;if(xn(e))try{e()}catch(r){o=r instanceof o4?r.errors:[r]}let{_finalizers:t}=this;if(t){this._finalizers=null;for(let r of t)try{XY(r)}catch(a){o=o??[],a instanceof o4?o=[...o,...a.errors]:o.push(a)}}if(o)throw new o4(o)}}add(o){var n;if(o&&o!==this)if(this.closed)XY(o);else{if(o instanceof i){if(o.closed||o._hasParent(this))return;o._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(o)}}_hasParent(o){let{_parentage:n}=this;return n===o||Array.isArray(n)&&n.includes(o)}_addParent(o){let{_parentage:n}=this;this._parentage=Array.isArray(n)?(n.push(o),n):n?[n,o]:o}_removeParent(o){let{_parentage:n}=this;n===o?this._parentage=null:Array.isArray(n)&&Pu(n,o)}remove(o){let{_finalizers:n}=this;n&&Pu(n,o),o instanceof i&&o._removeParent(this)}};Tn.EMPTY=(()=>{let i=new Tn;return i.closed=!0,i})();var S8=Tn.EMPTY;function r4(i){return i instanceof Tn||i&&"closed"in i&&xn(i.remove)&&xn(i.add)&&xn(i.unsubscribe)}function XY(i){xn(i)?i():i.unsubscribe()}var bc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Vf={setTimeout(i,o,...n){let{delegate:e}=Vf;return e?.setTimeout?e.setTimeout(i,o,...n):setTimeout(i,o,...n)},clearTimeout(i){let{delegate:o}=Vf;return(o?.clearTimeout||clearTimeout)(i)},delegate:void 0};function a4(i){Vf.setTimeout(()=>{let{onUnhandledError:o}=bc;if(o)o(i);else throw i})}function Mu(){}var QY=b8("C",void 0,void 0);function JY(i){return b8("E",void 0,i)}function eK(i){return b8("N",i,void 0)}function b8(i,o,n){return{kind:i,value:o,error:n}}var ku=null;function Uf(i){if(bc.useDeprecatedSynchronousErrorHandling){let o=!ku;if(o&&(ku={errorThrown:!1,error:null}),i(),o){let{errorThrown:n,error:e}=ku;if(ku=null,n)throw e}}else i()}function tK(i){bc.useDeprecatedSynchronousErrorHandling&&ku&&(ku.errorThrown=!0,ku.error=i)}var Ru=class extends Tn{constructor(o){super(),this.isStopped=!1,o?(this.destination=o,r4(o)&&o.add(this)):this.destination=LSe}static create(o,n,e){return new Ic(o,n,e)}next(o){this.isStopped?E8(eK(o),this):this._next(o)}error(o){this.isStopped?E8(JY(o),this):(this.isStopped=!0,this._error(o))}complete(){this.isStopped?E8(QY,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()}}},NSe=Function.prototype.bind;function I8(i,o){return NSe.call(i,o)}var x8=class{constructor(o){this.partialObserver=o}next(o){let{partialObserver:n}=this;if(n.next)try{n.next(o)}catch(e){s4(e)}}error(o){let{partialObserver:n}=this;if(n.error)try{n.error(o)}catch(e){s4(e)}else s4(o)}complete(){let{partialObserver:o}=this;if(o.complete)try{o.complete()}catch(n){s4(n)}}},Ic=class extends Ru{constructor(o,n,e){super();let t;if(xn(o)||!o)t={next:o??void 0,error:n??void 0,complete:e??void 0};else{let r;this&&bc.useDeprecatedNextContext?(r=Object.create(o),r.unsubscribe=()=>this.unsubscribe(),t={next:o.next&&I8(o.next,r),error:o.error&&I8(o.error,r),complete:o.complete&&I8(o.complete,r)}):t=o}this.destination=new x8(t)}};function s4(i){bc.useDeprecatedSynchronousErrorHandling?tK(i):a4(i)}function FSe(i){throw i}function E8(i,o){let{onStoppedNotification:n}=bc;n&&Vf.setTimeout(()=>n(i,o))}var LSe={closed:!0,next:Mu,error:FSe,complete:Mu};var jf=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Ec(i){return i}function nK(i){return i.length===0?Ec:i.length===1?i[0]:function(n){return i.reduce((e,t)=>t(e),n)}}var Ut=(()=>{class i{constructor(n){n&&(this._subscribe=n)}lift(n){let e=new i;return e.source=this,e.operator=n,e}subscribe(n,e,t){let r=VSe(n)?n:new Ic(n,e,t);return Uf(()=>{let{operator:a,source:s}=this;r.add(a?a.call(r,s):s?this._subscribe(r):this._trySubscribe(r))}),r}_trySubscribe(n){try{return this._subscribe(n)}catch(e){n.error(e)}}forEach(n,e){return e=iK(e),new e((t,r)=>{let a=new Ic({next:s=>{try{n(s)}catch(c){r(c),a.unsubscribe()}},error:r,complete:t});this.subscribe(a)})}_subscribe(n){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(n)}[jf](){return this}pipe(...n){return nK(n)(this)}toPromise(n){return n=iK(n),new n((e,t)=>{let r;this.subscribe(a=>r=a,a=>t(a),()=>e(r))})}}return i.create=o=>new i(o),i})();function iK(i){var o;return(o=i??bc.Promise)!==null&&o!==void 0?o:Promise}function BSe(i){return i&&xn(i.next)&&xn(i.error)&&xn(i.complete)}function VSe(i){return i&&i instanceof Ru||BSe(i)&&r4(i)}function T8(i){return xn(i?.lift)}function Bn(i){return o=>{if(T8(o))return o.lift(function(n){try{return i(n,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}function wn(i,o,n,e,t){return new D8(i,o,n,e,t)}var D8=class extends Ru{constructor(o,n,e,t,r,a){super(o),this.onFinalize=r,this.shouldUnsubscribe=a,this._next=n?function(s){try{n(s)}catch(c){o.error(c)}}:super._next,this._error=t?function(s){try{t(s)}catch(c){o.error(c)}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:n}=this;super.unsubscribe(),!n&&((o=this.onFinalize)===null||o===void 0||o.call(this))}}};function oK(){return Bn((i,o)=>{let n=null;i._refCount++;let e=wn(o,void 0,void 0,void 0,()=>{if(!i||i._refCount<=0||0<--i._refCount){n=null;return}let t=i._connection,r=n;n=null,t&&(!r||t===r)&&t.unsubscribe(),o.unsubscribe()});i.subscribe(e),e.closed||(n=i.connect())})}var cy=class extends Ut{constructor(o,n){super(),this.source=o,this.subjectFactory=n,this._subject=null,this._refCount=0,this._connection=null,T8(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 Tn;let n=this.getSubject();o.add(this.source.subscribe(wn(n,void 0,()=>{this._teardown(),n.complete()},e=>{this._teardown(),n.error(e)},()=>this._teardown()))),o.closed&&(this._connection=null,o=Tn.EMPTY)}return o}refCount(){return oK()(this)}};var $f={schedule(i){let o=requestAnimationFrame,n=cancelAnimationFrame,{delegate:e}=$f;e&&(o=e.requestAnimationFrame,n=e.cancelAnimationFrame);let t=o(r=>{n=void 0,i(r)});return new Tn(()=>n?.(t))},requestAnimationFrame(...i){let{delegate:o}=$f;return(o?.requestAnimationFrame||requestAnimationFrame)(...i)},cancelAnimationFrame(...i){let{delegate:o}=$f;return(o?.cancelAnimationFrame||cancelAnimationFrame)(...i)},delegate:void 0};var rK=kp(i=>function(){i(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var tt=(()=>{class i extends Ut{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(n){let e=new l4(this,this);return e.operator=n,e}_throwIfClosed(){if(this.closed)throw new rK}next(n){Uf(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let e of this.currentObservers)e.next(n)}})}error(n){Uf(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=n;let{observers:e}=this;for(;e.length;)e.shift().error(n)}})}complete(){Uf(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:n}=this;for(;n.length;)n.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0}_trySubscribe(n){return this._throwIfClosed(),super._trySubscribe(n)}_subscribe(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)}_innerSubscribe(n){let{hasError:e,isStopped:t,observers:r}=this;return e||t?S8:(this.currentObservers=null,r.push(n),new Tn(()=>{this.currentObservers=null,Pu(r,n)}))}_checkFinalizedStatuses(n){let{hasError:e,thrownError:t,isStopped:r}=this;e?n.error(t):r&&n.complete()}asObservable(){let n=new Ut;return n.source=this,n}}return i.create=(o,n)=>new l4(o,n),i})(),l4=class extends tt{constructor(o,n){super(),this.destination=o,this.source=n}next(o){var n,e;(e=(n=this.destination)===null||n===void 0?void 0:n.next)===null||e===void 0||e.call(n,o)}error(o){var n,e;(e=(n=this.destination)===null||n===void 0?void 0:n.error)===null||e===void 0||e.call(n,o)}complete(){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.complete)===null||n===void 0||n.call(o)}_subscribe(o){var n,e;return(e=(n=this.source)===null||n===void 0?void 0:n.subscribe(o))!==null&&e!==void 0?e:S8}};var ve=class extends tt{constructor(o){super(),this._value=o}get value(){return this.getValue()}_subscribe(o){let n=super._subscribe(o);return!n.closed&&o.next(this._value),n}getValue(){let{hasError:o,thrownError:n,_value:e}=this;if(o)throw n;return this._throwIfClosed(),e}next(o){super.next(this._value=o)}};var Nu={now(){return(Nu.delegate||Date).now()},delegate:void 0};var Rp=class extends tt{constructor(o=1/0,n=1/0,e=Nu){super(),this._bufferSize=o,this._windowTime=n,this._timestampProvider=e,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=n===1/0,this._bufferSize=Math.max(1,o),this._windowTime=Math.max(1,n)}next(o){let{isStopped:n,_buffer:e,_infiniteTimeWindow:t,_timestampProvider:r,_windowTime:a}=this;n||(e.push(o),!t&&e.push(r.now()+a)),this._trimBuffer(),super.next(o)}_subscribe(o){this._throwIfClosed(),this._trimBuffer();let n=this._innerSubscribe(o),{_infiniteTimeWindow:e,_buffer:t}=this,r=t.slice();for(let a=0;a<r.length&&!o.closed;a+=e?1:2)o.next(r[a]);return this._checkFinalizedStatuses(o),n}_trimBuffer(){let{_bufferSize:o,_timestampProvider:n,_buffer:e,_infiniteTimeWindow:t}=this,r=(t?1:2)*o;if(o<1/0&&r<e.length&&e.splice(0,e.length-r),!t){let a=n.now(),s=0;for(let c=1;c<e.length&&e[c]<=a;c+=2)s=c;s&&e.splice(0,s+1)}}};var c4=class extends Tn{constructor(o,n){super()}schedule(o,n=0){return this}};var dy={setInterval(i,o,...n){let{delegate:e}=dy;return e?.setInterval?e.setInterval(i,o,...n):setInterval(i,o,...n)},clearInterval(i){let{delegate:o}=dy;return(o?.clearInterval||clearInterval)(i)},delegate:void 0};var Id=class extends c4{constructor(o,n){super(o,n),this.scheduler=o,this.work=n,this.pending=!1}schedule(o,n=0){var e;if(this.closed)return this;this.state=o;let t=this.id,r=this.scheduler;return t!=null&&(this.id=this.recycleAsyncId(r,t,n)),this.pending=!0,this.delay=n,this.id=(e=this.id)!==null&&e!==void 0?e:this.requestAsyncId(r,this.id,n),this}requestAsyncId(o,n,e=0){return dy.setInterval(o.flush.bind(o,this),e)}recycleAsyncId(o,n,e=0){if(e!=null&&this.delay===e&&this.pending===!1)return n;n!=null&&dy.clearInterval(n)}execute(o,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let e=this._execute(o,n);if(e)return e;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(o,n){let e=!1,t;try{this.work(o)}catch(r){e=!0,t=r||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),t}unsubscribe(){if(!this.closed){let{id:o,scheduler:n}=this,{actions:e}=n;this.work=this.state=this.scheduler=null,this.pending=!1,Pu(e,this),o!=null&&(this.id=this.recycleAsyncId(n,o,null)),this.delay=null,super.unsubscribe()}}};var USe=1,w8,O8={};function aK(i){return i in O8?(delete O8[i],!0):!1}var sK={setImmediate(i){let o=USe++;return O8[o]=!0,w8||(w8=Promise.resolve()),w8.then(()=>aK(o)&&i()),o},clearImmediate(i){aK(i)}};var{setImmediate:jSe,clearImmediate:$Se}=sK,my={setImmediate(...i){let{delegate:o}=my;return(o?.setImmediate||jSe)(...i)},clearImmediate(i){let{delegate:o}=my;return(o?.clearImmediate||$Se)(i)},delegate:void 0};var d4=class extends Id{constructor(o,n){super(o,n),this.scheduler=o,this.work=n}requestAsyncId(o,n,e=0){return e!==null&&e>0?super.requestAsyncId(o,n,e):(o.actions.push(this),o._scheduled||(o._scheduled=my.setImmediate(o.flush.bind(o,void 0))))}recycleAsyncId(o,n,e=0){var t;if(e!=null?e>0:this.delay>0)return super.recycleAsyncId(o,n,e);let{actions:r}=o;n!=null&&((t=r[r.length-1])===null||t===void 0?void 0:t.id)!==n&&(my.clearImmediate(n),o._scheduled===n&&(o._scheduled=void 0))}};var Hf=class i{constructor(o,n=i.now){this.schedulerActionCtor=o,this.now=n}schedule(o,n=0,e){return new this.schedulerActionCtor(this,o).schedule(e,n)}};Hf.now=Nu.now;var Ed=class extends Hf{constructor(o,n=Hf.now){super(o,n),this.actions=[],this._active=!1}flush(o){let{actions:n}=this;if(this._active){n.push(o);return}let e;this._active=!0;do if(e=o.execute(o.state,o.delay))break;while(o=n.shift());if(this._active=!1,e){for(;o=n.shift();)o.unsubscribe();throw e}}};var m4=class extends Ed{flush(o){this._active=!0;let n=this._scheduled;this._scheduled=void 0;let{actions:e}=this,t;o=o||e.shift();do if(t=o.execute(o.state,o.delay))break;while((o=e[0])&&o.id===n&&e.shift());if(this._active=!1,t){for(;(o=e[0])&&o.id===n&&e.shift();)o.unsubscribe();throw t}}};var A8=new m4(d4);var Va=new Ed(Id),P8=Va;var p4=class extends Id{constructor(o,n){super(o,n),this.scheduler=o,this.work=n}schedule(o,n=0){return n>0?super.schedule(o,n):(this.delay=n,this.state=o,this.scheduler.flush(this),this)}execute(o,n){return n>0||this.closed?super.execute(o,n):this._execute(o,n)}requestAsyncId(o,n,e=0){return e!=null&&e>0||e==null&&this.delay>0?super.requestAsyncId(o,n,e):(o.flush(this),0)}};var g4=class extends Ed{};var M8=new g4(p4);var u4=class extends Id{constructor(o,n){super(o,n),this.scheduler=o,this.work=n}requestAsyncId(o,n,e=0){return e!==null&&e>0?super.requestAsyncId(o,n,e):(o.actions.push(this),o._scheduled||(o._scheduled=$f.requestAnimationFrame(()=>o.flush(void 0))))}recycleAsyncId(o,n,e=0){var t;if(e!=null?e>0:this.delay>0)return super.recycleAsyncId(o,n,e);let{actions:r}=o;n!=null&&n===o._scheduled&&((t=r[r.length-1])===null||t===void 0?void 0:t.id)!==n&&($f.cancelAnimationFrame(n),o._scheduled=void 0)}};var h4=class extends Ed{flush(o){this._active=!0;let n;o?n=o.id:(n=this._scheduled,this._scheduled=void 0);let{actions:e}=this,t;o=o||e.shift();do if(t=o.execute(o.state,o.delay))break;while((o=e[0])&&o.id===n&&e.shift());if(this._active=!1,t){for(;(o=e[0])&&o.id===n&&e.shift();)o.unsubscribe();throw t}}};var Mm=new h4(u4);var Rl=new Ut(i=>i.complete());function f4(i){return i&&xn(i.schedule)}function k8(i){return i[i.length-1]}function v4(i){return xn(k8(i))?i.pop():void 0}function xd(i){return f4(k8(i))?i.pop():void 0}function lK(i,o){return typeof k8(i)=="number"?i.pop():o}function R8(i,o){var n={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&o.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,e=Object.getOwnPropertySymbols(i);t<e.length;t++)o.indexOf(e[t])<0&&Object.prototype.propertyIsEnumerable.call(i,e[t])&&(n[e[t]]=i[e[t]]);return n}function dK(i,o,n,e){function t(r){return r instanceof n?r:new n(function(a){a(r)})}return new(n||(n=Promise))(function(r,a){function s(g){try{p(e.next(g))}catch(f){a(f)}}function c(g){try{p(e.throw(g))}catch(f){a(f)}}function p(g){g.done?r(g.value):t(g.value).then(s,c)}p((e=e.apply(i,o||[])).next())})}function cK(i){var o=typeof Symbol=="function"&&Symbol.iterator,n=o&&i[o],e=0;if(n)return n.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 Fu(i){return this instanceof Fu?(this.v=i,this):new Fu(i)}function mK(i,o,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n.apply(i,o||[]),t,r=[];return t=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),t[Symbol.asyncIterator]=function(){return this},t;function a(T){return function(N){return Promise.resolve(N).then(T,f)}}function s(T,N){e[T]&&(t[T]=function(G){return new Promise(function(z,J){r.push([T,G,z,J])>1||c(T,G)})},N&&(t[T]=N(t[T])))}function c(T,N){try{p(e[T](N))}catch(G){I(r[0][3],G)}}function p(T){T.value instanceof Fu?Promise.resolve(T.value.v).then(g,f):I(r[0][2],T)}function g(T){c("next",T)}function f(T){c("throw",T)}function I(T,N){T(N),r.shift(),r.length&&c(r[0][0],r[0][1])}}function pK(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=i[Symbol.asyncIterator],n;return o?o.call(i):(i=typeof cK=="function"?cK(i):i[Symbol.iterator](),n={},e("next"),e("throw"),e("return"),n[Symbol.asyncIterator]=function(){return this},n);function e(r){n[r]=i[r]&&function(a){return new Promise(function(s,c){a=i[r](a),t(s,c,a.done,a.value)})}}function t(r,a,s,c){Promise.resolve(c).then(function(p){r({value:p,done:s})},a)}}var zf=i=>i&&typeof i.length=="number"&&typeof i!="function";function C4(i){return xn(i?.then)}function _4(i){return xn(i[jf])}function y4(i){return Symbol.asyncIterator&&xn(i?.[Symbol.asyncIterator])}function S4(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 HSe(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var b4=HSe();function I4(i){return xn(i?.[b4])}function E4(i){return mK(this,arguments,function*(){let n=i.getReader();try{for(;;){let{value:e,done:t}=yield Fu(n.read());if(t)return yield Fu(void 0);yield yield Fu(e)}}finally{n.releaseLock()}})}function x4(i){return xn(i?.getReader)}function Ii(i){if(i instanceof Ut)return i;if(i!=null){if(_4(i))return zSe(i);if(zf(i))return GSe(i);if(C4(i))return WSe(i);if(y4(i))return gK(i);if(I4(i))return qSe(i);if(x4(i))return YSe(i)}throw S4(i)}function zSe(i){return new Ut(o=>{let n=i[jf]();if(xn(n.subscribe))return n.subscribe(o);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function GSe(i){return new Ut(o=>{for(let n=0;n<i.length&&!o.closed;n++)o.next(i[n]);o.complete()})}function WSe(i){return new Ut(o=>{i.then(n=>{o.closed||(o.next(n),o.complete())},n=>o.error(n)).then(null,a4)})}function qSe(i){return new Ut(o=>{for(let n of i)if(o.next(n),o.closed)return;o.complete()})}function gK(i){return new Ut(o=>{KSe(i,o).catch(n=>o.error(n))})}function YSe(i){return gK(E4(i))}function KSe(i,o){var n,e,t,r;return dK(this,void 0,void 0,function*(){try{for(n=pK(i);e=yield n.next(),!e.done;){let a=e.value;if(o.next(a),o.closed)return}}catch(a){t={error:a}}finally{try{e&&!e.done&&(r=n.return)&&(yield r.call(n))}finally{if(t)throw t.error}}o.complete()})}function Ua(i,o,n,e=0,t=!1){let r=o