@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.46 MB
JavaScript
var SNIPPYLY_VERSION = '4.5.4-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 s1e=Object.create;var FO=Object.defineProperty,l1e=Object.defineProperties,c1e=Object.getOwnPropertyDescriptor,d1e=Object.getOwnPropertyDescriptors,m1e=Object.getOwnPropertyNames,NO=Object.getOwnPropertySymbols,WW=Object.getPrototypeOf,Q7=Object.prototype.hasOwnProperty,qW=Object.prototype.propertyIsEnumerable,p1e=Reflect.get;var GW=(i,o,n)=>o in i?FO(i,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[o]=n,I=(i,o)=>{for(var n in o||={})Q7.call(o,n)&&GW(i,n,o[n]);if(NO)for(var n of NO(o))qW.call(o,n)&&GW(i,n,o[n]);return i},T=(i,o)=>l1e(i,d1e(o));var Z_=(i,o)=>{var n={};for(var e in i)Q7.call(i,e)&&o.indexOf(e)<0&&(n[e]=i[e]);if(i!=null&&NO)for(var e of NO(i))o.indexOf(e)<0&&qW.call(i,e)&&(n[e]=i[e]);return n};var g1e=(i,o)=>()=>(o||i((o={exports:{}}).exports,o),o.exports),LO=(i,o)=>{for(var n in o)FO(i,n,{get:o[n],enumerable:!0})},u1e=(i,o,n,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of m1e(o))!Q7.call(i,t)&&t!==n&&FO(i,t,{get:()=>o[t],enumerable:!(e=c1e(o,t))||e.enumerable});return i};var YW=(i,o,n)=>(n=i!=null?s1e(WW(i)):{},u1e(o||!i||!i.__esModule?FO(n,"default",{value:i,enumerable:!0}):n,i));var ep=(i,o,n)=>p1e(WW(i),n,o);var J=(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 dW=g1e((vyo,cW)=>{"use strict";var It={};It.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};It.localCName=It.generateIdentifier();It.splitLines=function(i){return i.trim().split(`
`).map(o=>o.trim())};It.splitSections=function(i){return i.split(`
m=`).map((n,e)=>(e>0?"m="+n:n).trim()+`\r
`)};It.getDescription=function(i){let o=It.splitSections(i);return o&&o[0]};It.getMediaSections=function(i){let o=It.splitSections(i);return o.shift(),o};It.matchPrefix=function(i,o){return It.splitLines(i).filter(n=>n.indexOf(o)===0)};It.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};It.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(" ")};It.parseIceOptions=function(i){return i.substring(14).split(" ")};It.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};It.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
`};It.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(" ")}};It.writeExtmap=function(i){return"a=extmap:"+(i.id||i.preferredId)+(i.direction&&i.direction!=="sendrecv"?"/"+i.direction:"")+" "+i.uri+(i.attributes?" "+i.attributes:"")+`\r
`};It.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};It.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};It.parseRtcpFb=function(i){let o=i.substring(i.indexOf(" ")+1).split(" ");return{type:o.shift(),parameter:o.join(" ")}};It.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};It.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};It.parseSsrcGroup=function(i){let o=i.substring(13).split(" ");return{semantics:o.shift(),ssrcs:o.map(n=>parseInt(n,10))}};It.getMid=function(i){let o=It.matchPrefix(i,"a=mid:")[0];if(o)return o.substring(6)};It.parseFingerprint=function(i){let o=i.substring(14).split(" ");return{algorithm:o[0].toLowerCase(),value:o[1].toUpperCase()}};It.getDtlsParameters=function(i,o){return{role:"auto",fingerprints:It.matchPrefix(i+o,"a=fingerprint:").map(It.parseFingerprint)}};It.writeDtlsParameters=function(i,o){let n="a=setup:"+o+`\r
`;return i.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+`\r
`}),n};It.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)}};It.writeCryptoLine=function(i){return"a=crypto:"+i.tag+" "+i.cryptoSuite+" "+(typeof i.keyParams=="object"?It.writeCryptoKeyParams(i.keyParams):i.keyParams)+(i.sessionParams?" "+i.sessionParams.join(" "):"")+`\r
`};It.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}};It.writeCryptoKeyParams=function(i){return i.keyMethod+":"+i.keySalt+(i.lifeTime?"|"+i.lifeTime:"")+(i.mkiValue&&i.mkiLength?"|"+i.mkiValue+":"+i.mkiLength:"")};It.getCryptoParameters=function(i,o){return It.matchPrefix(i+o,"a=crypto:").map(It.parseCryptoLine)};It.getIceParameters=function(i,o){let n=It.matchPrefix(i+o,"a=ice-ufrag:")[0],e=It.matchPrefix(i+o,"a=ice-pwd:")[0];return n&&e?{usernameFragment:n.substring(12),password:e.substring(10)}:null};It.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};It.parseRtpParameters=function(i){let o={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},e=It.splitLines(i)[0].split(" ");o.profile=e[2];for(let r=3;r<e.length;r++){let a=e[r],s=It.matchPrefix(i,"a=rtpmap:"+a+" ")[0];if(s){let c=It.parseRtpMap(s),p=It.matchPrefix(i,"a=fmtp:"+a+" ");switch(c.parameters=p.length?It.parseFmtp(p[0]):{},c.rtcpFeedback=It.matchPrefix(i,"a=rtcp-fb:"+a+" ").map(It.parseRtcpFb),o.codecs.push(c),c.name.toUpperCase()){case"RED":case"ULPFEC":o.fecMechanisms.push(c.name.toUpperCase());break;default:break}}}It.matchPrefix(i,"a=extmap:").forEach(r=>{o.headerExtensions.push(It.parseExtmap(r))});let t=It.matchPrefix(i,"a=rtcp-fb:* ").map(It.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};It.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+=It.writeRtpMap(t),n+=It.writeFmtp(t),n+=It.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+=It.writeExtmap(t)}),n};It.parseRtpEncodingParameters=function(i){let o=[],n=It.parseRtpParameters(i),e=n.fecMechanisms.indexOf("RED")!==-1,t=n.fecMechanisms.indexOf("ULPFEC")!==-1,r=It.matchPrefix(i,"a=ssrc:").map(u=>It.parseSsrcMedia(u)).filter(u=>u.attribute==="cname"),a=r.length>0&&r[0].ssrc,s,c=It.matchPrefix(i,"a=ssrc-group:FID").map(u=>u.substring(17).split(" ").map(E=>parseInt(E,10)));c.length>0&&c[0].length>1&&c[0][0]===a&&(s=c[0][1]),n.codecs.forEach(u=>{if(u.name.toUpperCase()==="RTX"&&u.parameters.apt){let C={ssrc:a,codecPayloadType:parseInt(u.parameters.apt,10)};a&&s&&(C.rtx={ssrc:s}),o.push(C),e&&(C=JSON.parse(JSON.stringify(C)),C.fec={ssrc:a,mechanism:t?"red+ulpfec":"red"},o.push(C))}}),o.length===0&&a&&o.push({ssrc:a});let p=It.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(u=>{u.maxBitrate=p})),o};It.parseRtcpParameters=function(i){let o={},n=It.matchPrefix(i,"a=ssrc:").map(r=>It.parseSsrcMedia(r)).filter(r=>r.attribute==="cname")[0];n&&(o.cname=n.value,o.ssrc=n.ssrc);let e=It.matchPrefix(i,"a=rtcp-rsize");o.reducedSize=e.length>0,o.compound=e.length===0;let t=It.matchPrefix(i,"a=rtcp-mux");return o.mux=t.length>0,o};It.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};It.parseMsid=function(i){let o,n=It.matchPrefix(i,"a=msid:");if(n.length===1)return o=n[0].substring(7).split(" "),{stream:o[0],track:o[1]};let e=It.matchPrefix(i,"a=ssrc:").map(t=>It.parseSsrcMedia(t)).filter(t=>t.attribute==="msid");if(e.length>0)return o=e[0].value.split(" "),{stream:o[0],track:o[1]}};It.parseSctpDescription=function(i){let o=It.parseMLine(i),n=It.matchPrefix(i,"a=max-message-size:"),e;n.length>0&&(e=parseInt(n[0].substring(19),10)),isNaN(e)&&(e=65536);let t=It.matchPrefix(i,"a=sctp-port:");if(t.length>0)return{port:parseInt(t[0].substring(12),10),protocol:o.fmt,maxMessageSize:e};let r=It.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}}};It.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("")};It.generateSessionId=function(){return Math.random().toString().substr(2,22)};It.writeSessionBoilerplate=function(i,o,n){let e,t=o!==void 0?o:2;return i?e=i:e=It.generateSessionId(),`v=0\r
o=`+(n||"thisisadapterortc")+" "+e+" "+t+` IN IP4 127.0.0.1\r
s=-\r
t=0 0\r
`};It.getDirection=function(i,o){let n=It.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?It.getDirection(o):"sendrecv"};It.getKind=function(i){return It.splitLines(i)[0].split(" ")[0].substring(2)};It.isRejected=function(i){return i.split(" ",2)[1]==="0"};It.parseMLine=function(i){let n=It.splitLines(i)[0].substring(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}};It.parseOLine=function(i){let n=It.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]}};It.isValidSDP=function(i){if(typeof i!="string"||i.length===0)return!1;let o=It.splitLines(i);for(let n=0;n<o.length;n++)if(o[n].length<2||o[n].charAt(1)!=="=")return!1;return!0};typeof cW=="object"&&(cW.exports=It)});function n8(i,o){return Object.is(i,o)}var Nr=null,BO=!1,i8=1,tc=Symbol("SIGNAL");function ei(i){let o=Nr;return Nr=i,o}function o8(){return Nr}var jh={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 UO(i){if(BO)throw new Error("");if(Nr===null)return;Nr.consumerOnSignalRead(i);let o=Nr.nextProducerIndex++;if(zO(Nr),o<Nr.producerNode.length&&Nr.producerNode[o]!==i&&X_(Nr)){let n=Nr.producerNode[o];HO(n,Nr.producerIndexOfThis[o])}Nr.producerNode[o]!==i&&(Nr.producerNode[o]=i,Nr.producerIndexOfThis[o]=X_(Nr)?ZW(i,Nr,o):0),Nr.producerLastReadVersion[o]=i.version}function KW(){i8++}function r8(i){if(!(X_(i)&&!i.dirty)&&!(!i.dirty&&i.lastCleanEpoch===i8)){if(!i.producerMustRecompute(i)&&!$O(i)){t8(i);return}i.producerRecomputeValue(i),t8(i)}}function a8(i){if(i.liveConsumerNode===void 0)return;let o=BO;BO=!0;try{for(let n of i.liveConsumerNode)n.dirty||h1e(n)}finally{BO=o}}function s8(){return Nr?.consumerAllowSignalWrites!==!1}function h1e(i){i.dirty=!0,a8(i),i.consumerMarkedDirty?.(i)}function t8(i){i.dirty=!1,i.lastCleanEpoch=i8}function Q_(i){return i&&(i.nextProducerIndex=0),ei(i)}function jO(i,o){if(ei(o),!(!i||i.producerNode===void 0||i.producerIndexOfThis===void 0||i.producerLastReadVersion===void 0)){if(X_(i))for(let n=i.nextProducerIndex;n<i.producerNode.length;n++)HO(i.producerNode[n],i.producerIndexOfThis[n]);for(;i.producerNode.length>i.nextProducerIndex;)i.producerNode.pop(),i.producerLastReadVersion.pop(),i.producerIndexOfThis.pop()}}function $O(i){zO(i);for(let o=0;o<i.producerNode.length;o++){let n=i.producerNode[o],e=i.producerLastReadVersion[o];if(e!==n.version||(r8(n),e!==n.version))return!0}return!1}function J_(i){if(zO(i),X_(i))for(let o=0;o<i.producerNode.length;o++)HO(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 ZW(i,o,n){if(XW(i),i.liveConsumerNode.length===0&&QW(i))for(let e=0;e<i.producerNode.length;e++)i.producerIndexOfThis[e]=ZW(i.producerNode[e],i,e);return i.liveConsumerIndexOfThis.push(n),i.liveConsumerNode.push(o)-1}function HO(i,o){if(XW(i),i.liveConsumerNode.length===1&&QW(i))for(let e=0;e<i.producerNode.length;e++)HO(i.producerNode[e],i.producerIndexOfThis[e]);let n=i.liveConsumerNode.length-1;if(i.liveConsumerNode[o]=i.liveConsumerNode[n],i.liveConsumerIndexOfThis[o]=i.liveConsumerIndexOfThis[n],i.liveConsumerNode.length--,i.liveConsumerIndexOfThis.length--,o<i.liveConsumerNode.length){let e=i.liveConsumerIndexOfThis[o],t=i.liveConsumerNode[o];zO(t),t.producerIndexOfThis[e]=o}}function X_(i){return i.consumerIsAlwaysLive||(i?.liveConsumerNode?.length??0)>0}function zO(i){i.producerNode??=[],i.producerIndexOfThis??=[],i.producerLastReadVersion??=[]}function XW(i){i.liveConsumerNode??=[],i.liveConsumerIndexOfThis??=[]}function QW(i){return i.producerNode!==void 0}function l8(i,o){let n=Object.create(f1e);n.computation=i,o!==void 0&&(n.equal=o);let e=()=>{if(r8(n),UO(n),n.value===VO)throw n.error;return n.value};return e[tc]=n,e}var J7=Symbol("UNSET"),e8=Symbol("COMPUTING"),VO=Symbol("ERRORED"),f1e=T(I({},jh),{value:J7,dirty:!0,error:null,equal:n8,kind:"computed",producerMustRecompute(i){return i.value===J7||i.value===e8},producerRecomputeValue(i){if(i.value===e8)throw new Error("Detected cycle in computations.");let o=i.value;i.value=e8;let n=Q_(i),e,t=!1;try{e=i.computation(),ei(null),t=o!==J7&&o!==VO&&e!==VO&&i.equal(o,e)}catch(r){e=VO,i.error=r}finally{jO(i,n)}if(t){i.value=o;return}i.value=e,i.version++}});function v1e(){throw new Error}var JW=v1e;function eq(i){JW(i)}function c8(i){JW=i}var C1e=null;function d8(i,o){let n=Object.create(p8);n.value=i,o!==void 0&&(n.equal=o);let e=()=>(UO(n),n.value);return e[tc]=n,e}function GO(i,o){s8()||eq(i),i.equal(i.value,o)||(i.value=o,_1e(i))}function m8(i,o){s8()||eq(i),GO(i,o(i.value))}var p8=T(I({},jh),{equal:n8,value:void 0,kind:"signal"});function _1e(i){i.version++,KW(),a8(i),C1e?.()}function g8(i){let o=ei(null);try{return i()}finally{ei(o)}}var u8;function e1(){return u8}function cm(i){let o=u8;return u8=i,o}var WO=Symbol("NotFound");function bn(i){return typeof i=="function"}function qO(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 YO=qO(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 Ug(i,o){if(i){let n=i.indexOf(o);0<=n&&i.splice(n,1)}}var In=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(bn(e))try{e()}catch(r){o=r instanceof YO?r.errors:[r]}let{_finalizers:t}=this;if(t){this._finalizers=null;for(let r of t)try{tq(r)}catch(a){o=o??[],a instanceof YO?o=[...o,...a.errors]:o.push(a)}}if(o)throw new YO(o)}}add(o){var n;if(o&&o!==this)if(this.closed)tq(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)&&Ug(n,o)}remove(o){let{_finalizers:n}=this;n&&Ug(n,o),o instanceof i&&o._removeParent(this)}};In.EMPTY=(()=>{let i=new In;return i.closed=!0,i})();var h8=In.EMPTY;function KO(i){return i instanceof In||i&&"closed"in i&&bn(i.remove)&&bn(i.add)&&bn(i.unsubscribe)}function tq(i){bn(i)?i():i.unsubscribe()}var nc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var $h={setTimeout(i,o,...n){let{delegate:e}=$h;return e?.setTimeout?e.setTimeout(i,o,...n):setTimeout(i,o,...n)},clearTimeout(i){let{delegate:o}=$h;return(o?.clearTimeout||clearTimeout)(i)},delegate:void 0};function ZO(i){$h.setTimeout(()=>{let{onUnhandledError:o}=nc;if(o)o(i);else throw i})}function jg(){}var nq=f8("C",void 0,void 0);function iq(i){return f8("E",void 0,i)}function oq(i){return f8("N",i,void 0)}function f8(i,o,n){return{kind:i,value:o,error:n}}var $g=null;function Hh(i){if(nc.useDeprecatedSynchronousErrorHandling){let o=!$g;if(o&&($g={errorThrown:!1,error:null}),i(),o){let{errorThrown:n,error:e}=$g;if($g=null,n)throw e}}else i()}function rq(i){nc.useDeprecatedSynchronousErrorHandling&&$g&&($g.errorThrown=!0,$g.error=i)}var Hg=class extends In{constructor(o){super(),this.isStopped=!1,o?(this.destination=o,KO(o)&&o.add(this)):this.destination=x1e}static create(o,n,e){return new dm(o,n,e)}next(o){this.isStopped?C8(oq(o),this):this._next(o)}error(o){this.isStopped?C8(iq(o),this):(this.isStopped=!0,this._error(o))}complete(){this.isStopped?C8(nq,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()}}},I1e=Function.prototype.bind;function v8(i,o){return I1e.call(i,o)}var _8=class{constructor(o){this.partialObserver=o}next(o){let{partialObserver:n}=this;if(n.next)try{n.next(o)}catch(e){XO(e)}}error(o){let{partialObserver:n}=this;if(n.error)try{n.error(o)}catch(e){XO(e)}else XO(o)}complete(){let{partialObserver:o}=this;if(o.complete)try{o.complete()}catch(n){XO(n)}}},dm=class extends Hg{constructor(o,n,e){super();let t;if(bn(o)||!o)t={next:o??void 0,error:n??void 0,complete:e??void 0};else{let r;this&&nc.useDeprecatedNextContext?(r=Object.create(o),r.unsubscribe=()=>this.unsubscribe(),t={next:o.next&&v8(o.next,r),error:o.error&&v8(o.error,r),complete:o.complete&&v8(o.complete,r)}):t=o}this.destination=new _8(t)}};function XO(i){nc.useDeprecatedSynchronousErrorHandling?rq(i):ZO(i)}function E1e(i){throw i}function C8(i,o){let{onStoppedNotification:n}=nc;n&&$h.setTimeout(()=>n(i,o))}var x1e={closed:!0,next:jg,error:E1e,complete:jg};var zh=typeof Symbol=="function"&&Symbol.observable||"@@observable";function ic(i){return i}function aq(i){return i.length===0?ic: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=D1e(n)?n:new dm(n,e,t);return Hh(()=>{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=sq(e),new e((t,r)=>{let a=new dm({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)}[zh](){return this}pipe(...n){return aq(n)(this)}toPromise(n){return n=sq(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 sq(i){var o;return(o=i??nc.Promise)!==null&&o!==void 0?o:Promise}function T1e(i){return i&&bn(i.next)&&bn(i.error)&&bn(i.complete)}function D1e(i){return i&&i instanceof Hg||T1e(i)&&KO(i)}function y8(i){return bn(i?.lift)}function $n(i){return o=>{if(y8(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 Mn(i,o,n,e,t){return new S8(i,o,n,e,t)}var S8=class extends Hg{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 lq(){return $n((i,o)=>{let n=null;i._refCount++;let e=Mn(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 t1=class extends Ut{constructor(o,n){super(),this.source=o,this.subjectFactory=n,this._subject=null,this._refCount=0,this._connection=null,y8(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 In;let n=this.getSubject();o.add(this.source.subscribe(Mn(n,void 0,()=>{this._teardown(),n.complete()},e=>{this._teardown(),n.error(e)},()=>this._teardown()))),o.closed&&(this._connection=null,o=In.EMPTY)}return o}refCount(){return lq()(this)}};var Gh={schedule(i){let o=requestAnimationFrame,n=cancelAnimationFrame,{delegate:e}=Gh;e&&(o=e.requestAnimationFrame,n=e.cancelAnimationFrame);let t=o(r=>{n=void 0,i(r)});return new In(()=>n?.(t))},requestAnimationFrame(...i){let{delegate:o}=Gh;return(o?.requestAnimationFrame||requestAnimationFrame)(...i)},cancelAnimationFrame(...i){let{delegate:o}=Gh;return(o?.cancelAnimationFrame||cancelAnimationFrame)(...i)},delegate:void 0};var cq=qO(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 QO(this,this);return e.operator=n,e}_throwIfClosed(){if(this.closed)throw new cq}next(n){Hh(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let e of this.currentObservers)e.next(n)}})}error(n){Hh(()=>{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(){Hh(()=>{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?h8:(this.currentObservers=null,r.push(n),new In(()=>{this.currentObservers=null,Ug(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 QO(o,n),i})(),QO=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:h8}};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 zg={now(){return(zg.delegate||Date).now()},delegate:void 0};var tp=class extends tt{constructor(o=1/0,n=1/0,e=zg){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 JO=class extends In{constructor(o,n){super()}schedule(o,n=0){return this}};var n1={setInterval(i,o,...n){let{delegate:e}=n1;return e?.setInterval?e.setInterval(i,o,...n):setInterval(i,o,...n)},clearInterval(i){let{delegate:o}=n1;return(o?.clearInterval||clearInterval)(i)},delegate:void 0};var Qc=class extends JO{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 n1.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&&n1.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,Ug(e,this),o!=null&&(this.id=this.recycleAsyncId(n,o,null)),this.delay=null,super.unsubscribe()}}};var w1e=1,b8,I8={};function dq(i){return i in I8?(delete I8[i],!0):!1}var mq={setImmediate(i){let o=w1e++;return I8[o]=!0,b8||(b8=Promise.resolve()),b8.then(()=>dq(o)&&i()),o},clearImmediate(i){dq(i)}};var{setImmediate:O1e,clearImmediate:A1e}=mq,i1={setImmediate(...i){let{delegate:o}=i1;return(o?.setImmediate||O1e)(...i)},clearImmediate(i){let{delegate:o}=i1;return(o?.clearImmediate||A1e)(i)},delegate:void 0};var e4=class extends Qc{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=i1.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&&(i1.clearImmediate(n),o._scheduled===n&&(o._scheduled=void 0))}};var Wh=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)}};Wh.now=zg.now;var Jc=class extends Wh{constructor(o,n=Wh.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 t4=class extends Jc{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 E8=new t4(e4);var fs=new Jc(Qc),x8=fs;var n4=class extends Qc{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 i4=class extends Jc{};var T8=new i4(n4);var o4=class extends Qc{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=Gh.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&&(Gh.cancelAnimationFrame(n),o._scheduled=void 0)}};var r4=class extends Jc{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 r4(o4);var Gg=new Ut(i=>i.complete());function a4(i){return i&&bn(i.schedule)}function D8(i){return i[i.length-1]}function s4(i){return bn(D8(i))?i.pop():void 0}function ed(i){return a4(D8(i))?i.pop():void 0}function pq(i,o){return typeof D8(i)=="number"?i.pop():o}function w8(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 uq(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(u){try{p(e.next(u))}catch(C){a(C)}}function c(u){try{p(e.throw(u))}catch(C){a(C)}}function p(u){u.done?r(u.value):t(u.value).then(s,c)}p((e=e.apply(i,o||[])).next())})}function gq(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 Wg(i){return this instanceof Wg?(this.v=i,this):new Wg(i)}function hq(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(D){return function(L){return Promise.resolve(L).then(D,C)}}function s(D,L){e[D]&&(t[D]=function(z){return new Promise(function(W,Q){r.push([D,z,W,Q])>1||c(D,z)})},L&&(t[D]=L(t[D])))}function c(D,L){try{p(e[D](L))}catch(z){E(r[0][3],z)}}function p(D){D.value instanceof Wg?Promise.resolve(D.value.v).then(u,C):E(r[0][2],D)}function u(D){c("next",D)}function C(D){c("throw",D)}function E(D,L){D(L),r.shift(),r.length&&c(r[0][0],r[0][1])}}function fq(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 gq=="function"?gq(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 qh=i=>i&&typeof i.length=="number"&&typeof i!="function";function l4(i){return bn(i?.then)}function c4(i){return bn(i[zh])}function d4(i){return Symbol.asyncIterator&&bn(i?.[Symbol.asyncIterator])}function m4(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 P1e(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var p4=P1e();function g4(i){return bn(i?.[p4])}function u4(i){return hq(this,arguments,function*(){let n=i.getReader();try{for(;;){let{value:e,done:t}=yield Wg(n.read());if(t)return yield Wg(void 0);yield yield Wg(e)}}finally{n.releaseLock()}})}function h4(i){return bn(i?.getReader)}function wi(i){if(i instanceof Ut)return i;if(i!=null){if(c4(i))return M1e(i);if(qh(i))return k1e(i);if(l4(i))return R1e(i);if(d4(i))return vq(i);if(g4(i))return N1e(i);if(h4(i))return F1e(i)}throw m4(i)}function M1e(i){return new Ut(o=>{let n=i[zh]();if(bn(n.subscribe))return n.subscribe(o);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function k1e(i){return new Ut(o=>{for(let n=0;n<i.length&&!o.closed;n++)o.next(i[n]);o.complete()})}function R1e(i){return new Ut(o=>{i.then(n=>{o.closed||(o.next(n),o.complete())},n=>o.error(n)).then(null,ZO)})}function N1e(i){return new Ut(o=>{for(let n of i)if(o.next(n),o.closed)return;o.complete()})}function vq(i){return new Ut(o=>{L1e(i,o).catch(n=>o.error(n))})}function F1e(i){return vq(u4(i))}function L1e(i,o){var n,e,t,r;return uq(this,void 0,void 0,funct