obi-sdk 0.12.0 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.umd.js CHANGED
@@ -1,9 +1,9 @@
1
- (function(ot,Kt){typeof exports=="object"&&typeof module<"u"?Kt(exports,require("react"),require("lit")):typeof define=="function"&&define.amd?define(["exports","react","lit"],Kt):(ot=typeof globalThis<"u"?globalThis:ot||self,Kt(ot.ObiSDKReact={},ot.React,ot.lit))})(this,function(ot,Kt,L){"use strict";/**
1
+ (function(ot,Vt){typeof exports=="object"&&typeof module<"u"?Vt(exports,require("react"),require("lit")):typeof define=="function"&&define.amd?define(["exports","react","lit"],Vt):(ot=typeof globalThis<"u"?globalThis:ot||self,Vt(ot.ObiSDKReact={},ot.React,ot.lit))})(this,function(ot,Vt,L){"use strict";/**
2
2
  * @license
3
3
  * Copyright 2018 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const _m=new Set(["children","localName","ref","style","className"]),xl=new WeakMap,Rl=(A,e,t,n,i)=>{const r=i?.[e];r===void 0?(A[e]=t,t==null&&e in HTMLElement.prototype&&A.removeAttribute(e)):t!==n&&((s,o,a)=>{let c=xl.get(s);c===void 0&&xl.set(s,c=new Map);let l=c.get(o);a!==void 0?l===void 0?(c.set(o,l={handleEvent:a}),s.addEventListener(o,l)):l.handleEvent=a:l!==void 0&&(c.delete(o),s.removeEventListener(o,l))})(A,r,t)},zn=({react:A,tagName:e,elementClass:t,events:n,displayName:i})=>{const r=new Set(Object.keys(n??{})),s=A.forwardRef((o,a)=>{const c=A.useRef(new Map),l=A.useRef(null),u={},d={};for(const[h,f]of Object.entries(o))_m.has(h)?u[h==="className"?"class":h]=f:r.has(h)||h in t.prototype?d[h]=f:u[h]=f;return A.useLayoutEffect(()=>{if(l.current===null)return;const h=new Map;for(const f in d)Rl(l.current,f,o[f],c.current.get(f),n),c.current.delete(f),h.set(f,o[f]);for(const[f,g]of c.current)Rl(l.current,f,void 0,g,n);c.current=h}),A.useLayoutEffect(()=>{l.current?.removeAttribute("defer-hydration")},[]),u.suppressHydrationWarning=!0,A.createElement(e,{...u,ref:A.useCallback(h=>{l.current=h,typeof a=="function"?a(h):a!==null&&(a.current=h)},[a])})});return s.displayName=i??t.name,s};function xm(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var Pl={exports:{}};(function(A){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(a,c,l){this.fn=a,this.context=c,this.once=l||!1}function r(a,c,l,u,d){if(typeof l!="function")throw new TypeError("The listener must be a function");var h=new i(l,u||a,d),f=t?t+c:c;return a._events[f]?a._events[f].fn?a._events[f]=[a._events[f],h]:a._events[f].push(h):(a._events[f]=h,a._eventsCount++),a}function s(a,c){--a._eventsCount===0?a._events=new n:delete a._events[c]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],l,u;if(this._eventsCount===0)return c;for(u in l=this._events)e.call(l,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(l)):c},o.prototype.listeners=function(c){var l=t?t+c:c,u=this._events[l];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,h=u.length,f=new Array(h);d<h;d++)f[d]=u[d].fn;return f},o.prototype.listenerCount=function(c){var l=t?t+c:c,u=this._events[l];return u?u.fn?1:u.length:0},o.prototype.emit=function(c,l,u,d,h,f){var g=t?t+c:c;if(!this._events[g])return!1;var p=this._events[g],B=arguments.length,y,b;if(p.fn){switch(p.once&&this.removeListener(c,p.fn,void 0,!0),B){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,l),!0;case 3:return p.fn.call(p.context,l,u),!0;case 4:return p.fn.call(p.context,l,u,d),!0;case 5:return p.fn.call(p.context,l,u,d,h),!0;case 6:return p.fn.call(p.context,l,u,d,h,f),!0}for(b=1,y=new Array(B-1);b<B;b++)y[b-1]=arguments[b];p.fn.apply(p.context,y)}else{var v=p.length,C;for(b=0;b<v;b++)switch(p[b].once&&this.removeListener(c,p[b].fn,void 0,!0),B){case 1:p[b].fn.call(p[b].context);break;case 2:p[b].fn.call(p[b].context,l);break;case 3:p[b].fn.call(p[b].context,l,u);break;case 4:p[b].fn.call(p[b].context,l,u,d);break;default:if(!y)for(C=1,y=new Array(B-1);C<B;C++)y[C-1]=arguments[C];p[b].fn.apply(p[b].context,y)}}return!0},o.prototype.on=function(c,l,u){return r(this,c,l,u,!1)},o.prototype.once=function(c,l,u){return r(this,c,l,u,!0)},o.prototype.removeListener=function(c,l,u,d){var h=t?t+c:c;if(!this._events[h])return this;if(!l)return s(this,h),this;var f=this._events[h];if(f.fn)f.fn===l&&(!d||f.once)&&(!u||f.context===u)&&s(this,h);else{for(var g=0,p=[],B=f.length;g<B;g++)(f[g].fn!==l||d&&!f[g].once||u&&f[g].context!==u)&&p.push(f[g]);p.length?this._events[h]=p.length===1?p[0]:p:s(this,h)}return this},o.prototype.removeAllListeners=function(c){var l;return c?(l=t?t+c:c,this._events[l]&&s(this,l)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,A.exports=o})(Pl);var Rm=Pl.exports;const Pm=xm(Rm);function Lm(A,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!=="default"&&!(n in A)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(A,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(A)}var Dm=Object.defineProperty,Om=(A,e,t)=>e in A?Dm(A,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):A[e]=t,Ll=(A,e,t)=>Om(A,typeof e!="symbol"?e+"":e,t);let We=class{constructor(){Ll(this,"_locking"),Ll(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const t=new Promise(i=>e=()=>{this._locks-=1,i()}),n=this._locking.then(()=>e);return this._locking=this._locking.then(()=>t),n}};function he(A,e){if(!A)throw new Error(e)}const Hm=34028234663852886e22,Mm=-34028234663852886e22,Nm=4294967295,Km=2147483647,Gm=-2147483648;function er(A){if(typeof A!="number")throw new Error("invalid int 32: "+typeof A);if(!Number.isInteger(A)||A>Km||A<Gm)throw new Error("invalid int 32: "+A)}function vo(A){if(typeof A!="number")throw new Error("invalid uint 32: "+typeof A);if(!Number.isInteger(A)||A>Nm||A<0)throw new Error("invalid uint 32: "+A)}function Dl(A){if(typeof A!="number")throw new Error("invalid float 32: "+typeof A);if(Number.isFinite(A)&&(A>Hm||A<Mm))throw new Error("invalid float 32: "+A)}const Ol=Symbol("@bufbuild/protobuf/enum-type");function Vm(A){const e=A[Ol];return he(e,"missing enum type on enum object"),e}function Hl(A,e,t,n){A[Ol]=Ml(e,t.map(i=>({no:i.no,name:i.name,localName:A[i.no]})))}function Ml(A,e,t){const n=Object.create(null),i=Object.create(null),r=[];for(const s of e){const o=Nl(s);r.push(o),n[s.name]=o,i[s.no]=o}return{typeName:A,values:r,findName(s){return n[s]},findNumber(s){return i[s]}}}function jm(A,e,t){const n={};for(const i of e){const r=Nl(i);n[r.localName]=r.no,n[r.no]=r.localName}return Hl(n,A,e),n}function Nl(A){return"localName"in A?A:Object.assign(Object.assign({},A),{localName:A.name})}class Co{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const n=this.getType(),i=n.runtime.bin,r=i.makeReadOptions(t);return i.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,t){const n=this.getType(),i=n.runtime.json,r=i.makeReadOptions(t);return i.readMessage(n,e,r,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(i){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(i instanceof Error?i.message:String(i)))}return this.fromJson(n,t)}toBinary(e){const t=this.getType(),n=t.runtime.bin,i=n.makeWriteOptions(e),r=i.writerFactory();return n.writeMessage(this,r,i),r.finish()}toJson(e){const t=this.getType(),n=t.runtime.json,i=n.makeWriteOptions(e);return n.writeMessage(this,i)}toJsonString(e){var t;const n=this.toJson(e);return JSON.stringify(n,null,(t=e?.prettySpaces)!==null&&t!==void 0?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function $m(A,e,t,n){var i;const r=(i=n?.localName)!==null&&i!==void 0?i:e.substring(e.lastIndexOf(".")+1),s={[r]:function(o){A.util.initFields(this),A.util.initPartial(o,this)}}[r];return Object.setPrototypeOf(s.prototype,new Co),Object.assign(s,{runtime:A,typeName:e,fields:A.util.newFieldList(t),fromBinary(o,a){return new s().fromBinary(o,a)},fromJson(o,a){return new s().fromJson(o,a)},fromJsonString(o,a){return new s().fromJsonString(o,a)},equals(o,a){return A.util.equals(s,o,a)}}),s}function Wm(){let A=0,e=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(A|=(i&127)<<n,!(i&128))return this.assertBounds(),[A,e]}let t=this.buf[this.pos++];if(A|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[A,e];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,!(i&128))return this.assertBounds(),[A,e]}throw new Error("invalid varint")}function wo(A,e,t){for(let r=0;r<28;r=r+7){const s=A>>>r,o=!(!(s>>>7)&&e==0),a=(o?s|128:s)&255;if(t.push(a),!o)return}const n=A>>>28&15|(e&7)<<4,i=!!(e>>3);if(t.push((i?n|128:n)&255),!!i){for(let r=3;r<31;r=r+7){const s=e>>>r,o=!!(s>>>7),a=(o?s|128:s)&255;if(t.push(a),!o)return}t.push(e>>>31&1)}}const tr=4294967296;function Kl(A){const e=A[0]==="-";e&&(A=A.slice(1));const t=1e6;let n=0,i=0;function r(s,o){const a=Number(A.slice(s,o));i*=t,n=n*t+a,n>=tr&&(i=i+(n/tr|0),n=n%tr)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),e?Vl(n,i):yo(n,i)}function Jm(A,e){let t=yo(A,e);const n=t.hi&2147483648;n&&(t=Vl(t.lo,t.hi));const i=Gl(t.lo,t.hi);return n?"-"+i:i}function Gl(A,e){if({lo:A,hi:e}=Xm(A,e),e<=2097151)return String(tr*e+A);const t=A&16777215,n=(A>>>24|e<<8)&16777215,i=e>>16&65535;let r=t+n*6777216+i*6710656,s=n+i*8147497,o=i*2;const a=1e7;return r>=a&&(s+=Math.floor(r/a),r%=a),s>=a&&(o+=Math.floor(s/a),s%=a),o.toString()+jl(s)+jl(r)}function Xm(A,e){return{lo:A>>>0,hi:e>>>0}}function yo(A,e){return{lo:A|0,hi:e|0}}function Vl(A,e){return e=~e,A?A=~A+1:e+=1,yo(A,e)}const jl=A=>{const e=String(A);return"0000000".slice(e.length)+e};function $l(A,e){if(A>=0){for(;A>127;)e.push(A&127|128),A=A>>>7;e.push(A)}else{for(let t=0;t<9;t++)e.push(A&127|128),A=A>>7;e.push(1)}}function qm(){let A=this.buf[this.pos++],e=A&127;if(!(A&128))return this.assertBounds(),e;if(A=this.buf[this.pos++],e|=(A&127)<<7,!(A&128))return this.assertBounds(),e;if(A=this.buf[this.pos++],e|=(A&127)<<14,!(A&128))return this.assertBounds(),e;if(A=this.buf[this.pos++],e|=(A&127)<<21,!(A&128))return this.assertBounds(),e;A=this.buf[this.pos++],e|=(A&15)<<28;for(let t=5;A&128&&t<10;t++)A=this.buf[this.pos++];if(A&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function Ym(){const A=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof A.getBigInt64=="function"&&typeof A.getBigUint64=="function"&&typeof A.setBigInt64=="function"&&typeof A.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){const i=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),o=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){const c=typeof a=="bigint"?a:BigInt(a);if(c>r||c<i)throw new Error("int64 invalid: ".concat(a));return c},uParse(a){const c=typeof a=="bigint"?a:BigInt(a);if(c>o||c<s)throw new Error("uint64 invalid: ".concat(a));return c},enc(a){return A.setBigInt64(0,this.parse(a),!0),{lo:A.getInt32(0,!0),hi:A.getInt32(4,!0)}},uEnc(a){return A.setBigInt64(0,this.uParse(a),!0),{lo:A.getInt32(0,!0),hi:A.getInt32(4,!0)}},dec(a,c){return A.setInt32(0,a,!0),A.setInt32(4,c,!0),A.getBigInt64(0,!0)},uDec(a,c){return A.setInt32(0,a,!0),A.setInt32(4,c,!0),A.getBigUint64(0,!0)}}}const t=i=>he(/^-?[0-9]+$/.test(i),"int64 invalid: ".concat(i)),n=i=>he(/^[0-9]+$/.test(i),"uint64 invalid: ".concat(i));return{zero:"0",supported:!1,parse(i){return typeof i!="string"&&(i=i.toString()),t(i),i},uParse(i){return typeof i!="string"&&(i=i.toString()),n(i),i},enc(i){return typeof i!="string"&&(i=i.toString()),t(i),Kl(i)},uEnc(i){return typeof i!="string"&&(i=i.toString()),n(i),Kl(i)},dec(i,r){return Jm(i,r)},uDec(i,r){return Gl(i,r)}}}const ue=Ym();var T;(function(A){A[A.DOUBLE=1]="DOUBLE",A[A.FLOAT=2]="FLOAT",A[A.INT64=3]="INT64",A[A.UINT64=4]="UINT64",A[A.INT32=5]="INT32",A[A.FIXED64=6]="FIXED64",A[A.FIXED32=7]="FIXED32",A[A.BOOL=8]="BOOL",A[A.STRING=9]="STRING",A[A.BYTES=12]="BYTES",A[A.UINT32=13]="UINT32",A[A.SFIXED32=15]="SFIXED32",A[A.SFIXED64=16]="SFIXED64",A[A.SINT32=17]="SINT32",A[A.SINT64=18]="SINT64"})(T||(T={}));var iA;(function(A){A[A.BIGINT=0]="BIGINT",A[A.STRING=1]="STRING"})(iA||(iA={}));function rA(A,e,t){if(e===t)return!0;if(A==T.BYTES){if(!(e instanceof Uint8Array)||!(t instanceof Uint8Array)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}switch(A){case T.UINT64:case T.FIXED64:case T.INT64:case T.SFIXED64:case T.SINT64:return e==t}return!1}function hn(A,e){switch(A){case T.BOOL:return!1;case T.UINT64:case T.FIXED64:case T.INT64:case T.SFIXED64:case T.SINT64:return e==0?ue.zero:"0";case T.DOUBLE:case T.FLOAT:return 0;case T.BYTES:return new Uint8Array(0);case T.STRING:return"";default:return 0}}function Wl(A,e){switch(A){case T.BOOL:return e===!1;case T.STRING:return e==="";case T.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var me;(function(A){A[A.Varint=0]="Varint",A[A.Bit64=1]="Bit64",A[A.LengthDelimited=2]="LengthDelimited",A[A.StartGroup=3]="StartGroup",A[A.EndGroup=4]="EndGroup",A[A.Bit32=5]="Bit32"})(me||(me={}));class zm{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let t=new Uint8Array(e),n=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],n),n+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(vo(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return er(e),$l(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Dl(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){vo(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){er(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return er(e),e=(e<<1^e>>31)>>>0,$l(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=ue.enc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=ue.uEnc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=ue.enc(e);return wo(t.lo,t.hi,this.buf),this}sint64(e){let t=ue.enc(e),n=t.hi>>31,i=t.lo<<1^n,r=(t.hi<<1|t.lo>>>31)^n;return wo(i,r,this.buf),this}uint64(e){let t=ue.uEnc(e);return wo(t.lo,t.hi,this.buf),this}}class Zm{constructor(e,t){this.varint64=Wm,this.uint32=qm,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case me.Varint:for(;this.buf[this.pos++]&128;);break;case me.Bit64:this.pos+=4;case me.Bit32:this.pos+=4;break;case me.LengthDelimited:let i=this.uint32();this.pos+=i;break;case me.StartGroup:for(;;){const[r,s]=this.tag();if(s===me.EndGroup){if(t!==void 0&&r!==t)throw new Error("invalid end group tag");break}this.skip(s,r)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return ue.dec(...this.varint64())}uint64(){return ue.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,ue.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return ue.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return ue.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function eB(A,e,t,n){let i;return{typeName:e,extendee:t,get field(){if(!i){const r=typeof n=="function"?n():n;r.name=e.split(".").pop(),r.jsonName="[".concat(e,"]"),i=A.util.newFieldList([r]).list()[0]}return i},runtime:A}}function Jl(A){const e=A.field.localName,t=Object.create(null);return t[e]=tB(A),[t,()=>t[e]]}function tB(A){const e=A.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return hn(e.T,e.L);case"message":const t=e.T,n=new t;return t.fieldWrapper?t.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}function AB(A,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let t=A.length-1;t>=0;--t)if(A[t].no==e.no)return[A[t]];return[]}return A.filter(t=>t.no===e.no)}let Gt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ar=[];for(let A=0;A<Gt.length;A++)Ar[Gt[A].charCodeAt(0)]=A;Ar["-".charCodeAt(0)]=Gt.indexOf("+"),Ar["_".charCodeAt(0)]=Gt.indexOf("/");const Xl={dec(A){let e=A.length*3/4;A[A.length-2]=="="?e-=2:A[A.length-1]=="="&&(e-=1);let t=new Uint8Array(e),n=0,i=0,r,s=0;for(let o=0;o<A.length;o++){if(r=Ar[A.charCodeAt(o)],r===void 0)switch(A[o]){case"=":i=0;case`
6
- `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:s=r,i=1;break;case 1:t[n++]=s<<2|(r&48)>>4,s=r,i=2;break;case 2:t[n++]=(s&15)<<4|(r&60)>>2,s=r,i=3;break;case 3:t[n++]=(s&3)<<6|r,i=0;break}}if(i==1)throw Error("invalid base64 string.");return t.subarray(0,n)},enc(A){let e="",t=0,n,i=0;for(let r=0;r<A.length;r++)switch(n=A[r],t){case 0:e+=Gt[n>>2],i=(n&3)<<4,t=1;break;case 1:e+=Gt[i|n>>4],i=(n&15)<<2,t=2;break;case 2:e+=Gt[i|n>>6],e+=Gt[n&63],t=0;break}return t&&(e+=Gt[i],e+="=",t==1&&(e+="=")),e}};function nB(A,e,t){Yl(e,A);const n=e.runtime.bin.makeReadOptions(t),i=AB(A.getType().runtime.bin.listUnknownFields(A),e.field),[r,s]=Jl(e);for(const o of i)e.runtime.bin.readField(r,n.readerFactory(o.data),e.field,o.wireType,n);return s()}function iB(A,e,t,n){Yl(e,A);const i=e.runtime.bin.makeReadOptions(n),r=e.runtime.bin.makeWriteOptions(n);if(ql(A,e)){const c=A.getType().runtime.bin.listUnknownFields(A).filter(l=>l.no!=e.field.no);A.getType().runtime.bin.discardUnknownFields(A);for(const l of c)A.getType().runtime.bin.onUnknownField(A,l.no,l.wireType,l.data)}const s=r.writerFactory();let o=e.field;!o.opt&&!o.repeated&&(o.kind=="enum"||o.kind=="scalar")&&(o=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(o,t,s,r);const a=i.readerFactory(s.finish());for(;a.pos<a.len;){const[c,l]=a.tag(),u=a.skip(l,c);A.getType().runtime.bin.onUnknownField(A,c,l,u)}}function ql(A,e){const t=A.getType();return e.extendee.typeName===t.typeName&&!!t.runtime.bin.listUnknownFields(A).find(n=>n.no==e.field.no)}function Yl(A,e){he(A.extendee.typeName==e.getType().typeName,"extension ".concat(A.typeName," can only be applied to message ").concat(A.extendee.typeName))}function zl(A,e){const t=A.localName;if(A.repeated)return e[t].length>0;if(A.oneof)return e[A.oneof.localName].case===t;switch(A.kind){case"enum":case"scalar":return A.opt||A.req?e[t]!==void 0:A.kind=="enum"?e[t]!==A.T.values[0].no:!Wl(A.T,e[t]);case"message":return e[t]!==void 0;case"map":return Object.keys(e[t]).length>0}}function Zl(A,e){const t=A.localName,n=!A.opt&&!A.req;if(A.repeated)e[t]=[];else if(A.oneof)e[A.oneof.localName]={case:void 0};else switch(A.kind){case"map":e[t]={};break;case"enum":e[t]=n?A.T.values[0].no:void 0;break;case"scalar":e[t]=n?hn(A.T,A.L):void 0;break;case"message":e[t]=void 0;break}}function OA(A,e){if(A===null||typeof A!="object"||!Object.getOwnPropertyNames(Co.prototype).every(n=>n in A&&typeof A[n]=="function"))return!1;const t=A.getType();return t===null||typeof t!="function"||!("typeName"in t)||typeof t.typeName!="string"?!1:e===void 0?!0:t.typeName==e.typeName}function eu(A,e){return OA(e)||!A.fieldWrapper?e:A.fieldWrapper.wrapField(e)}T.DOUBLE,T.FLOAT,T.INT64,T.UINT64,T.INT32,T.UINT32,T.BOOL,T.STRING,T.BYTES;const tu={ignoreUnknownFields:!1},Au={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function rB(A){return A?Object.assign(Object.assign({},tu),A):tu}function sB(A){return A?Object.assign(Object.assign({},Au),A):Au}const nr=Symbol(),ir=Symbol();function oB(){return{makeReadOptions:rB,makeWriteOptions:sB,readMessage(A,e,t,n){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(A.typeName," from JSON: ").concat(It(e)));n=n??new A;const i=new Map,r=t.typeRegistry;for(const[s,o]of Object.entries(e)){const a=A.fields.findJsonName(s);if(a){if(a.oneof){if(o===null&&a.kind=="scalar")continue;const c=i.get(a.oneof);if(c!==void 0)throw new Error("cannot decode message ".concat(A.typeName,' from JSON: multiple keys for oneof "').concat(a.oneof.name,'" present: "').concat(c,'", "').concat(s,'"'));i.set(a.oneof,s)}nu(n,o,a,t,A)}else{let c=!1;if(r?.findExtension&&s.startsWith("[")&&s.endsWith("]")){const l=r.findExtension(s.substring(1,s.length-1));if(l&&l.extendee.typeName==A.typeName){c=!0;const[u,d]=Jl(l);nu(u,o,l.field,t,l),iB(n,l,d(),t)}}if(!c&&!t.ignoreUnknownFields)throw new Error("cannot decode message ".concat(A.typeName,' from JSON: key "').concat(s,'" is unknown'))}}return n},writeMessage(A,e){const t=A.getType(),n={};let i;try{for(i of t.fields.byNumber()){if(!zl(i,A)){if(i.req)throw"required field not set";if(!e.emitDefaultValues||!cB(i))continue}const s=i.oneof?A[i.oneof.localName].value:A[i.localName],o=iu(i,s,e);o!==void 0&&(n[e.useProtoFieldName?i.name:i.jsonName]=o)}const r=e.typeRegistry;if(r?.findExtensionFor)for(const s of t.runtime.bin.listUnknownFields(A)){const o=r.findExtensionFor(t.typeName,s.no);if(o&&ql(A,o)){const a=nB(A,o,e),c=iu(o.field,a,e);c!==void 0&&(n[o.field.jsonName]=c)}}}catch(r){const s=i?"cannot encode field ".concat(t.typeName,".").concat(i.name," to JSON"):"cannot encode message ".concat(t.typeName," to JSON"),o=r instanceof Error?r.message:String(r);throw new Error(s+(o.length>0?": ".concat(o):""))}return n},readScalar(A,e,t){return Zn(A,e,t??iA.BIGINT,!0)},writeScalar(A,e,t){if(e!==void 0&&(t||Wl(A,e)))return rr(A,e)},debug:It}}function It(A){if(A===null)return"null";switch(typeof A){case"object":return Array.isArray(A)?"array":"object";case"string":return A.length>100?"string":'"'.concat(A.split('"').join('\\"'),'"');default:return String(A)}}function nu(A,e,t,n,i){let r=t.localName;if(t.repeated){if(he(t.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(e)));const s=A[r];for(const o of e){if(o===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(o)));switch(t.kind){case"message":s.push(t.T.fromJson(o,n));break;case"enum":const a=bo(t.T,o,n.ignoreUnknownFields,!0);a!==ir&&s.push(a);break;case"scalar":try{s.push(Zn(t.T,o,t.L,!0))}catch(c){let l="cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(o));throw c instanceof Error&&c.message.length>0&&(l+=": ".concat(c.message)),new Error(l)}break}}}else if(t.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(e)));const s=A[r];for(const[o,a]of Object.entries(e)){if(a===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: map value null"));let c;try{c=aB(t.K,o)}catch(l){let u="cannot decode map key for field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(e));throw l instanceof Error&&l.message.length>0&&(u+=": ".concat(l.message)),new Error(u)}switch(t.V.kind){case"message":s[c]=t.V.T.fromJson(a,n);break;case"enum":const l=bo(t.V.T,a,n.ignoreUnknownFields,!0);l!==ir&&(s[c]=l);break;case"scalar":try{s[c]=Zn(t.V.T,a,iA.BIGINT,!0)}catch(u){let d="cannot decode map value for field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(e));throw u instanceof Error&&u.message.length>0&&(d+=": ".concat(u.message)),new Error(d)}break}}}else switch(t.oneof&&(A=A[t.oneof.localName]={case:r},r="value"),t.kind){case"message":const s=t.T;if(e===null&&s.typeName!="google.protobuf.Value")return;let o=A[r];OA(o)?o.fromJson(e,n):(A[r]=o=s.fromJson(e,n),s.fieldWrapper&&!t.oneof&&(A[r]=s.fieldWrapper.unwrapField(o)));break;case"enum":const a=bo(t.T,e,n.ignoreUnknownFields,!1);switch(a){case nr:Zl(t,A);break;case ir:break;default:A[r]=a;break}break;case"scalar":try{const c=Zn(t.T,e,t.L,!1);switch(c){case nr:Zl(t,A);break;default:A[r]=c;break}}catch(c){let l="cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(e));throw c instanceof Error&&c.message.length>0&&(l+=": ".concat(c.message)),new Error(l)}break}}function aB(A,e){if(A===T.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return Zn(A,e,iA.BIGINT,!0).toString()}function Zn(A,e,t,n){if(e===null)return n?hn(A,t):nr;switch(A){case T.DOUBLE:case T.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const i=Number(e);if(Number.isNaN(i)||!Number.isFinite(i))break;return A==T.FLOAT&&Dl(i),i;case T.INT32:case T.FIXED32:case T.SFIXED32:case T.SINT32:case T.UINT32:let r;if(typeof e=="number"?r=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(r=Number(e)),r===void 0)break;return A==T.UINT32||A==T.FIXED32?vo(r):er(r),r;case T.INT64:case T.SFIXED64:case T.SINT64:if(typeof e!="number"&&typeof e!="string")break;const s=ue.parse(e);return t?s.toString():s;case T.FIXED64:case T.UINT64:if(typeof e!="number"&&typeof e!="string")break;const o=ue.uParse(e);return t?o.toString():o;case T.BOOL:if(typeof e!="boolean")break;return e;case T.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case T.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return Xl.dec(e)}throw new Error}function bo(A,e,t,n){if(e===null)return A.typeName=="google.protobuf.NullValue"?0:n?A.values[0].no:nr;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const i=A.findName(e);if(i!==void 0)return i.no;if(t)return ir;break}throw new Error("cannot decode enum ".concat(A.typeName," from JSON: ").concat(It(e)))}function cB(A){return A.repeated||A.kind=="map"?!0:!(A.oneof||A.kind=="message"||A.opt||A.req)}function iu(A,e,t){if(A.kind=="map"){he(typeof e=="object"&&e!=null);const n={},i=Object.entries(e);switch(A.V.kind){case"scalar":for(const[s,o]of i)n[s.toString()]=rr(A.V.T,o);break;case"message":for(const[s,o]of i)n[s.toString()]=o.toJson(t);break;case"enum":const r=A.V.T;for(const[s,o]of i)n[s.toString()]=Eo(r,o,t.enumAsInteger);break}return t.emitDefaultValues||i.length>0?n:void 0}if(A.repeated){he(Array.isArray(e));const n=[];switch(A.kind){case"scalar":for(let i=0;i<e.length;i++)n.push(rr(A.T,e[i]));break;case"enum":for(let i=0;i<e.length;i++)n.push(Eo(A.T,e[i],t.enumAsInteger));break;case"message":for(let i=0;i<e.length;i++)n.push(e[i].toJson(t));break}return t.emitDefaultValues||n.length>0?n:void 0}switch(A.kind){case"scalar":return rr(A.T,e);case"enum":return Eo(A.T,e,t.enumAsInteger);case"message":return eu(A.T,e).toJson(t)}}function Eo(A,e,t){var n;if(he(typeof e=="number"),A.typeName=="google.protobuf.NullValue")return null;if(t)return e;const i=A.findNumber(e);return(n=i?.name)!==null&&n!==void 0?n:e}function rr(A,e){switch(A){case T.INT32:case T.SFIXED32:case T.SINT32:case T.FIXED32:case T.UINT32:return he(typeof e=="number"),e;case T.FLOAT:case T.DOUBLE:return he(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case T.STRING:return he(typeof e=="string"),e;case T.BOOL:return he(typeof e=="boolean"),e;case T.UINT64:case T.FIXED64:case T.INT64:case T.SFIXED64:case T.SINT64:return he(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case T.BYTES:return he(e instanceof Uint8Array),Xl.enc(e)}}const fn=Symbol("@bufbuild/protobuf/unknown-fields"),ru={readUnknownFields:!0,readerFactory:A=>new Zm(A)},su={writeUnknownFields:!0,writerFactory:()=>new zm};function lB(A){return A?Object.assign(Object.assign({},ru),A):ru}function uB(A){return A?Object.assign(Object.assign({},su),A):su}function dB(){return{makeReadOptions:lB,makeWriteOptions:uB,listUnknownFields(A){var e;return(e=A[fn])!==null&&e!==void 0?e:[]},discardUnknownFields(A){delete A[fn]},writeUnknownFields(A,e){const n=A[fn];if(n)for(const i of n)e.tag(i.no,i.wireType).raw(i.data)},onUnknownField(A,e,t,n){const i=A;Array.isArray(i[fn])||(i[fn]=[]),i[fn].push({no:e,wireType:t,data:n})},readMessage(A,e,t,n,i){const r=A.getType(),s=i?e.len:e.pos+t;let o,a;for(;e.pos<s&&([o,a]=e.tag(),!(i===!0&&a==me.EndGroup));){const c=r.fields.find(o);if(!c){const l=e.skip(a,o);n.readUnknownFields&&this.onUnknownField(A,o,a,l);continue}ou(A,e,c,a,n)}if(i&&(a!=me.EndGroup||o!==t))throw new Error("invalid end group tag")},readField:ou,writeMessage(A,e,t){const n=A.getType();for(const i of n.fields.byNumber()){if(!zl(i,A)){if(i.req)throw new Error("cannot encode field ".concat(n.typeName,".").concat(i.name," to binary: required field not set"));continue}const r=i.oneof?A[i.oneof.localName].value:A[i.localName];au(i,r,e,t)}return t.writeUnknownFields&&this.writeUnknownFields(A,e),e},writeField(A,e,t,n){e!==void 0&&au(A,e,t,n)}}}function ou(A,e,t,n,i){let{repeated:r,localName:s}=t;switch(t.oneof&&(A=A[t.oneof.localName],A.case!=s&&delete A.value,A.case=s,s="value"),t.kind){case"scalar":case"enum":const o=t.kind=="enum"?T.INT32:t.T;let a=or;if(t.kind=="scalar"&&t.L>0&&(a=fB),r){let d=A[s];if(n==me.LengthDelimited&&o!=T.STRING&&o!=T.BYTES){let f=e.uint32()+e.pos;for(;e.pos<f;)d.push(a(e,o))}else d.push(a(e,o))}else A[s]=a(e,o);break;case"message":const c=t.T;r?A[s].push(sr(e,new c,i,t)):OA(A[s])?sr(e,A[s],i,t):(A[s]=sr(e,new c,i,t),c.fieldWrapper&&!t.oneof&&!t.repeated&&(A[s]=c.fieldWrapper.unwrapField(A[s])));break;case"map":let[l,u]=hB(t,e,i);A[s][l]=u;break}}function sr(A,e,t,n){const i=e.getType().runtime.bin,r=n?.delimited;return i.readMessage(e,A,r?n.no:A.uint32(),t,r),e}function hB(A,e,t){const n=e.uint32(),i=e.pos+n;let r,s;for(;e.pos<i;){const[o]=e.tag();switch(o){case 1:r=or(e,A.K);break;case 2:switch(A.V.kind){case"scalar":s=or(e,A.V.T);break;case"enum":s=e.int32();break;case"message":s=sr(e,new A.V.T,t,void 0);break}break}}if(r===void 0&&(r=hn(A.K,iA.BIGINT)),typeof r!="string"&&typeof r!="number"&&(r=r.toString()),s===void 0)switch(A.V.kind){case"scalar":s=hn(A.V.T,iA.BIGINT);break;case"enum":s=A.V.T.values[0].no;break;case"message":s=new A.V.T;break}return[r,s]}function fB(A,e){const t=or(A,e);return typeof t=="bigint"?t.toString():t}function or(A,e){switch(e){case T.STRING:return A.string();case T.BOOL:return A.bool();case T.DOUBLE:return A.double();case T.FLOAT:return A.float();case T.INT32:return A.int32();case T.INT64:return A.int64();case T.UINT64:return A.uint64();case T.FIXED64:return A.fixed64();case T.BYTES:return A.bytes();case T.FIXED32:return A.fixed32();case T.SFIXED32:return A.sfixed32();case T.SFIXED64:return A.sfixed64();case T.SINT64:return A.sint64();case T.UINT32:return A.uint32();case T.SINT32:return A.sint32()}}function au(A,e,t,n){he(e!==void 0);const i=A.repeated;switch(A.kind){case"scalar":case"enum":let r=A.kind=="enum"?T.INT32:A.T;if(i)if(he(Array.isArray(e)),A.packed)pB(t,r,A.no,e);else for(const s of e)ei(t,r,A.no,s);else ei(t,r,A.no,e);break;case"message":if(i){he(Array.isArray(e));for(const s of e)cu(t,n,A,s)}else cu(t,n,A,e);break;case"map":he(typeof e=="object"&&e!=null);for(const[s,o]of Object.entries(e))gB(t,n,A,s,o);break}}function gB(A,e,t,n,i){A.tag(t.no,me.LengthDelimited),A.fork();let r=n;switch(t.K){case T.INT32:case T.FIXED32:case T.UINT32:case T.SFIXED32:case T.SINT32:r=Number.parseInt(n);break;case T.BOOL:he(n=="true"||n=="false"),r=n=="true";break}switch(ei(A,t.K,1,r),t.V.kind){case"scalar":ei(A,t.V.T,2,i);break;case"enum":ei(A,T.INT32,2,i);break;case"message":he(i!==void 0),A.tag(2,me.LengthDelimited).bytes(i.toBinary(e));break}A.join()}function cu(A,e,t,n){const i=eu(t.T,n);t.delimited?A.tag(t.no,me.StartGroup).raw(i.toBinary(e)).tag(t.no,me.EndGroup):A.tag(t.no,me.LengthDelimited).bytes(i.toBinary(e))}function ei(A,e,t,n){he(n!==void 0);let[i,r]=lu(e);A.tag(t,i)[r](n)}function pB(A,e,t,n){if(!n.length)return;A.tag(t,me.LengthDelimited).fork();let[,i]=lu(e);for(let r=0;r<n.length;r++)A[i](n[r]);A.join()}function lu(A){let e=me.Varint;switch(A){case T.BYTES:case T.STRING:e=me.LengthDelimited;break;case T.DOUBLE:case T.FIXED64:case T.SFIXED64:e=me.Bit64;break;case T.FIXED32:case T.SFIXED32:case T.FLOAT:e=me.Bit32;break}const t=T[A].toLowerCase();return[e,t]}function mB(){return{setEnumType:Hl,initPartial(A,e){if(A===void 0)return;const t=e.getType();for(const n of t.fields.byMember()){const i=n.localName,r=e,s=A;if(s[i]!=null)switch(n.kind){case"oneof":const o=s[i].case;if(o===void 0)continue;const a=n.findField(o);let c=s[i].value;a&&a.kind=="message"&&!OA(c,a.T)?c=new a.T(c):a&&a.kind==="scalar"&&a.T===T.BYTES&&(c=ti(c)),r[i]={case:o,value:c};break;case"scalar":case"enum":let l=s[i];n.T===T.BYTES&&(l=n.repeated?l.map(ti):ti(l)),r[i]=l;break;case"map":switch(n.V.kind){case"scalar":case"enum":if(n.V.T===T.BYTES)for(const[h,f]of Object.entries(s[i]))r[i][h]=ti(f);else Object.assign(r[i],s[i]);break;case"message":const d=n.V.T;for(const h of Object.keys(s[i])){let f=s[i][h];d.fieldWrapper||(f=new d(f)),r[i][h]=f}break}break;case"message":const u=n.T;if(n.repeated)r[i]=s[i].map(d=>OA(d,u)?d:new u(d));else{const d=s[i];u.fieldWrapper?u.typeName==="google.protobuf.BytesValue"?r[i]=ti(d):r[i]=d:r[i]=OA(d,u)?d:new u(d)}break}}},equals(A,e,t){return e===t?!0:!e||!t?!1:A.fields.byMember().every(n=>{const i=e[n.localName],r=t[n.localName];if(n.repeated){if(i.length!==r.length)return!1;switch(n.kind){case"message":return i.every((s,o)=>n.T.equals(s,r[o]));case"scalar":return i.every((s,o)=>rA(n.T,s,r[o]));case"enum":return i.every((s,o)=>rA(T.INT32,s,r[o]))}throw new Error("repeated cannot contain ".concat(n.kind))}switch(n.kind){case"message":return n.T.equals(i,r);case"enum":return rA(T.INT32,i,r);case"scalar":return rA(n.T,i,r);case"oneof":if(i.case!==r.case)return!1;const s=n.findField(i.case);if(s===void 0)return!0;switch(s.kind){case"message":return s.T.equals(i.value,r.value);case"enum":return rA(T.INT32,i.value,r.value);case"scalar":return rA(s.T,i.value,r.value)}throw new Error("oneof cannot contain ".concat(s.kind));case"map":const o=Object.keys(i).concat(Object.keys(r));switch(n.V.kind){case"message":const a=n.V.T;return o.every(l=>a.equals(i[l],r[l]));case"enum":return o.every(l=>rA(T.INT32,i[l],r[l]));case"scalar":const c=n.V.T;return o.every(l=>rA(c,i[l],r[l]))}break}})},clone(A){const e=A.getType(),t=new e,n=t;for(const i of e.fields.byMember()){const r=A[i.localName];let s;if(i.repeated)s=r.map(ar);else if(i.kind=="map"){s=n[i.localName];for(const[o,a]of Object.entries(r))s[o]=ar(a)}else i.kind=="oneof"?s=i.findField(r.case)?{case:r.case,value:ar(r.value)}:{case:void 0}:s=ar(r);n[i.localName]=s}for(const i of e.runtime.bin.listUnknownFields(A))e.runtime.bin.onUnknownField(n,i.no,i.wireType,i.data);return t}}}function ar(A){if(A===void 0)return A;if(OA(A))return A.clone();if(A instanceof Uint8Array){const e=new Uint8Array(A.byteLength);return e.set(A),e}return A}function ti(A){return A instanceof Uint8Array?A:new Uint8Array(A)}function BB(A,e,t){return{syntax:A,json:oB(),bin:dB(),util:Object.assign(Object.assign({},mB()),{newFieldList:e,initFields:t}),makeMessageType(n,i,r){return $m(this,n,i,r)},makeEnum:jm,makeEnumType:Ml,getEnumType:Vm,makeExtension(n,i,r){return eB(this,n,i,r)}}}class vB{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const t={};for(const n of this.list())t[n.jsonName]=t[n.name]=n;this.jsonNames=t}return this.jsonNames[e]}find(e){if(!this.numbers){const t={};for(const n of this.list())t[n.no]=n;this.numbers=t}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,t)=>e.no-t.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}}function uu(A,e){const t=du(A);return e?t:SB(EB(t))}function CB(A){return uu(A,!1)}const wB=du;function du(A){let e=!1;const t=[];for(let n=0;n<A.length;n++){let i=A.charAt(n);switch(i){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":t.push(i),e=!1;break;default:e&&(e=!1,i=i.toUpperCase()),t.push(i);break}}return t.join("")}const yB=new Set(["constructor","toString","toJSON","valueOf"]),bB=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),hu=A=>"".concat(A,"$"),EB=A=>bB.has(A)?hu(A):A,SB=A=>yB.has(A)?hu(A):A;class UB{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=CB(e)}addField(e){he(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let t=0;t<this.fields.length;t++)this._lookup[this.fields[t].localName]=this.fields[t]}return this._lookup[e]}}function TB(A,e){var t,n,i,r,s,o;const a=[];let c;for(const l of typeof A=="function"?A():A){const u=l;if(u.localName=uu(l.name,l.oneof!==void 0),u.jsonName=(t=l.jsonName)!==null&&t!==void 0?t:wB(l.name),u.repeated=(n=l.repeated)!==null&&n!==void 0?n:!1,l.kind=="scalar"&&(u.L=(i=l.L)!==null&&i!==void 0?i:iA.BIGINT),u.delimited=(r=l.delimited)!==null&&r!==void 0?r:!1,u.req=(s=l.req)!==null&&s!==void 0?s:!1,u.opt=(o=l.opt)!==null&&o!==void 0?o:!1,l.packed===void 0&&(u.packed=l.kind=="enum"||l.kind=="scalar"&&l.T!=T.BYTES&&l.T!=T.STRING),l.oneof!==void 0){const d=typeof l.oneof=="string"?l.oneof:l.oneof.name;(!c||c.name!=d)&&(c=new UB(d)),u.oneof=c,c.addField(u)}a.push(u)}return a}const E=BB("proto3",A=>new vB(A,e=>TB(e)),A=>{for(const e of A.getType().fields.byMember()){if(e.opt)continue;const t=e.localName,n=A;if(e.repeated){n[t]=[];continue}switch(e.kind){case"oneof":n[t]={case:void 0};break;case"enum":n[t]=0;break;case"map":n[t]={};break;case"scalar":n[t]=hn(e.T,e.L);break}}});class Je extends Co{constructor(e){super(),this.seconds=ue.zero,this.nanos=0,E.util.initPartial(e,this)}fromJson(e,t){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(E.json.debug(e)));const n=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const i=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(i))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(i<Date.parse("0001-01-01T00:00:00Z")||i>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=ue.parse(i/1e3),this.nanos=0,n[7]&&(this.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9),this}toJson(e){const t=Number(this.seconds)*1e3;if(t<Date.parse("0001-01-01T00:00:00Z")||t>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let n="Z";if(this.nanos>0){const i=(this.nanos+1e9).toString().substring(1);i.substring(3)==="000000"?n="."+i.substring(0,3)+"Z":i.substring(6)==="000"?n="."+i.substring(0,6)+"Z":n="."+i+"Z"}return new Date(t).toISOString().replace(".000Z",n)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return Je.fromDate(new Date)}static fromDate(e){const t=e.getTime();return new Je({seconds:ue.parse(Math.floor(t/1e3)),nanos:t%1e3*1e6})}static fromBinary(e,t){return new Je().fromBinary(e,t)}static fromJson(e,t){return new Je().fromJson(e,t)}static fromJsonString(e,t){return new Je().fromJsonString(e,t)}static equals(e,t){return E.util.equals(Je,e,t)}}Je.runtime=E,Je.typeName="google.protobuf.Timestamp",Je.fields=E.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const QB=E.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Je},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:FB,repeated:!0},{no:5,name:"events",kind:"message",T:IB,repeated:!0}]),FB=E.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:kB,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),kB=E.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Je},{no:3,name:"value",kind:"scalar",T:2}]),IB=E.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:Je},{no:7,name:"normalized_end_timestamp",kind:"message",T:Je,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),fu=E.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),pt=E.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),we=E.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),gn=E.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),Ai=E.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),ni=E.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),mt=E.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"}]),pn=E.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),_B=E.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),Bt=E.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),cr=E.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:lr,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:Tu}]),lr=E.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),xB=E.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:E.getEnumType(we),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}]),HA=E.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:E.getEnumType(mn)},{no:4,name:"tracks",kind:"message",T:Bn,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:xB},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:E.getEnumType(ur)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:E.getEnumType(mt)},{no:18,name:"kind_details",kind:"enum",T:E.getEnumType(RB),repeated:!0}]),mn=E.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),ur=E.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),RB=E.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),At=E.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),PB=E.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:MA,repeated:!0}]),Bn=E.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:E.getEnumType(pt)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:E.getEnumType(we)},{no:10,name:"layers",kind:"message",T:MA,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:PB,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:E.getEnumType(At)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:Tu},{no:19,name:"audio_features",kind:"enum",T:E.getEnumType(Bt),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:E.getEnumType(fu)}]),MA=E.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:E.getEnumType(gn)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13}]),Xe=E.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:E.getEnumType(Y)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:pu,oneof:"value"},{no:3,name:"speaker",kind:"message",T:LB,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:mu,oneof:"value"},{no:7,name:"transcription",kind:"message",T:DB,oneof:"value"},{no:8,name:"metrics",kind:"message",T:QB,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:So,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:Bu,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:vu,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:Cu,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:To,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Qo,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:Fo,oneof:"value"}]),Y=E.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),LB=E.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:gu,repeated:!0}]),gu=E.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),pu=E.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),mu=E.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),DB=E.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:OB,repeated:!0}]),OB=E.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),So=E.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),Bu=E.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}]),vu=E.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),Cu=E.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:wu,oneof:"value"}]),wu=E.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),yu=E.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),HB=E.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:E.getEnumType(bu)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),bu=E.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),MB=E.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:E.getEnumType(Eu)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9}]),Eu=E.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"}]),Su=E.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:Uu},{no:2,name:"screen",kind:"message",T:Uu},{no:3,name:"resume_connection",kind:"enum",T:E.getEnumType(ni)},{no:4,name:"disabled_codecs",kind:"message",T:NB},{no:5,name:"force_relay",kind:"enum",T:E.getEnumType(ni)}]),Uu=E.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:E.getEnumType(ni)}]),NB=E.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:lr,repeated:!0},{no:2,name:"publish",kind:"message",T:lr,repeated:!0}]),Tu=E.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),Uo=E.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),Qu=E.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:E.getEnumType(Uo)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),Fu=E.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),To=E.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:E.getEnumType(At)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:Qu,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:Fu,oneof:"content_header"}],{localName:"DataStream_Header"}),Qo=E.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),Fo=E.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),vt=E.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),ko=E.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),KB=E.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),GB=E.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:NA,oneof:"message"},{no:2,name:"answer",kind:"message",T:NA,oneof:"message"},{no:3,name:"trickle",kind:"message",T:xo,oneof:"message"},{no:4,name:"add_track",kind:"message",T:_o,oneof:"message"},{no:5,name:"mute",kind:"message",T:Ro,oneof:"message"},{no:6,name:"subscription",kind:"message",T:dr,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:Iu,oneof:"message"},{no:8,name:"leave",kind:"message",T:hr,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:xu,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:Du,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:Ou,oneof:"message"},{no:13,name:"simulate",kind:"message",T:_t,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:Ru,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:Mu,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:_u,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:JB,oneof:"message"}]),ku=E.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:VB,oneof:"message"},{no:2,name:"answer",kind:"message",T:NA,oneof:"message"},{no:3,name:"offer",kind:"message",T:NA,oneof:"message"},{no:4,name:"trickle",kind:"message",T:xo,oneof:"message"},{no:5,name:"update",kind:"message",T:WB,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Po,oneof:"message"},{no:8,name:"leave",kind:"message",T:hr,oneof:"message"},{no:9,name:"mute",kind:"message",T:Ro,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:XB,oneof:"message"},{no:11,name:"room_update",kind:"message",T:qB,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:zB,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:e0,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:A0,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:n0,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:$B,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:jB,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:r0,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:a0,oneof:"message"},{no:22,name:"request_response",kind:"message",T:c0,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:l0,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:i0,oneof:"message"}]),Io=E.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}]),_o=E.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:E.getEnumType(pt)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:E.getEnumType(we)},{no:9,name:"layers",kind:"message",T:MA,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:Io,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:E.getEnumType(At)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:E.getEnumType(fu)},{no:17,name:"audio_features",kind:"enum",T:E.getEnumType(Bt),repeated:!0}]),xo=E.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:E.getEnumType(vt)},{no:3,name:"final",kind:"scalar",T:8}]),Ro=E.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),VB=E.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:cr},{no:2,name:"participant",kind:"message",T:HA},{no:3,name:"other_participants",kind:"message",T:HA,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:Pu,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:Su},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:HB},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:lr,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),jB=E.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:Pu,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:Su}]),Po=E.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Bn}]),$B=E.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),NA=E.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9}]),WB=E.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:HA,repeated:!0}]),dr=E.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:yu,repeated:!0}]),Iu=E.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:E.getEnumType(gn)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),_u=E.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:E.getEnumType(Bt),repeated:!0}]),JB=E.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),hr=E.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:E.getEnumType(mt)},{no:3,name:"action",kind:"enum",T:E.getEnumType(vn)},{no:4,name:"regions",kind:"message",T:s0}]),vn=E.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),xu=E.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:MA,repeated:!0}]),Ru=E.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),Pu=E.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),XB=E.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:gu,repeated:!0}]),qB=E.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:cr}]),YB=E.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:E.getEnumType(Ai)},{no:3,name:"score",kind:"scalar",T:2}]),zB=E.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:YB,repeated:!0}]),ZB=E.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:E.getEnumType(ko)}]),e0=E.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:ZB,repeated:!0}]),Lo=E.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:E.getEnumType(gn)},{no:2,name:"enabled",kind:"scalar",T:8}]),t0=E.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:Lo,repeated:!0}]),A0=E.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:Lo,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:t0,repeated:!0}]),Lu=E.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),Du=E.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:Lu,repeated:!0}]),n0=E.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),i0=E.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:cr},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:HA},{no:4,name:"other_participants",kind:"message",T:HA,repeated:!0}]),Ou=E.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:NA},{no:2,name:"subscription",kind:"message",T:dr},{no:3,name:"publish_tracks",kind:"message",T:Po,repeated:!0},{no:4,name:"data_channels",kind:"message",T:Hu,repeated:!0},{no:5,name:"offer",kind:"message",T:NA},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0}]),Hu=E.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:E.getEnumType(vt)}]),_t=E.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:E.getEnumType(KB),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),Mu=E.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),r0=E.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),s0=E.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:o0,repeated:!0}]),o0=E.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),a0=E.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:E.getEnumType(_B)}]),c0=E.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:E.getEnumType(Do)},{no:3,name:"message",kind:"scalar",T:9}]),Do=E.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"}]),l0=E.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]);function u0(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var fr={exports:{}},d0=fr.exports,Nu;function h0(){return Nu||(Nu=1,function(A){(function(e,t){A.exports?A.exports=t():e.log=t()})(d0,function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},s=null;function o(g,p){var B=g[p];if(typeof B.bind=="function")return B.bind(g);try{return Function.prototype.bind.call(B,g)}catch{return function(){return Function.prototype.apply.apply(B,[g,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(g){return g==="debug"&&(g="log"),typeof console===t?!1:g==="trace"&&n?a:console[g]!==void 0?o(console,g):console.log!==void 0?o(console,"log"):e}function l(){for(var g=this.getLevel(),p=0;p<i.length;p++){var B=i[p];this[B]=p<g?e:this.methodFactory(B,g,this.name)}if(this.log=this.debug,typeof console===t&&g<this.levels.SILENT)return"No console available for logging"}function u(g){return function(){typeof console!==t&&(l.call(this),this[g].apply(this,arguments))}}function d(g,p,B){return c(g)||u.apply(this,arguments)}function h(g,p){var B=this,y,b,v,C="loglevel";typeof g=="string"?C+=":"+g:typeof g=="symbol"&&(C=void 0);function w(H){var M=(i[H]||"silent").toUpperCase();if(!(typeof window===t||!C)){try{window.localStorage[C]=M;return}catch{}try{window.document.cookie=encodeURIComponent(C)+"="+M+";"}catch{}}}function S(){var H;if(!(typeof window===t||!C)){try{H=window.localStorage[C]}catch{}if(typeof H===t)try{var M=window.document.cookie,K=encodeURIComponent(C),Le=M.indexOf(K+"=");Le!==-1&&(H=/^([^;]+)/.exec(M.slice(Le+K.length+1))[1])}catch{}return B.levels[H]===void 0&&(H=void 0),H}}function F(){if(!(typeof window===t||!C)){try{window.localStorage.removeItem(C)}catch{}try{window.document.cookie=encodeURIComponent(C)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function _(H){var M=H;if(typeof M=="string"&&B.levels[M.toUpperCase()]!==void 0&&(M=B.levels[M.toUpperCase()]),typeof M=="number"&&M>=0&&M<=B.levels.SILENT)return M;throw new TypeError("log.setLevel() called with invalid level: "+H)}B.name=g,B.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},B.methodFactory=p||d,B.getLevel=function(){return v??b??y},B.setLevel=function(H,M){return v=_(H),M!==!1&&w(v),l.call(B)},B.setDefaultLevel=function(H){b=_(H),S()||B.setLevel(H,!1)},B.resetLevel=function(){v=null,F(),l.call(B)},B.enableAll=function(H){B.setLevel(B.levels.TRACE,H)},B.disableAll=function(H){B.setLevel(B.levels.SILENT,H)},B.rebuild=function(){if(s!==B&&(y=_(s.getLevel())),l.call(B),s===B)for(var H in r)r[H].rebuild()},y=_(s?s.getLevel():"WARN");var D=S();D!=null&&(v=_(D)),l.call(B)}s=new h,s.getLogger=function(p){if(typeof p!="symbol"&&typeof p!="string"||p==="")throw new TypeError("You must supply a name when creating a logger.");var B=r[p];return B||(B=r[p]=new h(p,s.methodFactory)),B};var f=typeof window!==t?window.log:void 0;return s.noConflict=function(){return typeof window!==t&&window.log===s&&(window.log=f),s},s.getLoggers=function(){return r},s.default=s,s})}(fr)),fr.exports}var gr=h0(),Oo;(function(A){A[A.trace=0]="trace",A[A.debug=1]="debug",A[A.info=2]="info",A[A.warn=3]="warn",A[A.error=4]="error",A[A.silent=5]="silent"})(Oo||(Oo={}));var Ct;(function(A){A.Default="livekit",A.Room="livekit-room",A.Participant="livekit-participant",A.Track="livekit-track",A.Publication="livekit-track-publication",A.Engine="livekit-engine",A.Signal="livekit-signal",A.PCManager="livekit-pc-manager",A.PCTransport="livekit-pc-transport",A.E2EE="lk-e2ee"})(Ct||(Ct={}));let j=gr.getLogger("livekit");Object.values(Ct).map(A=>gr.getLogger(A)),j.setDefaultLevel(Oo.info);function Vt(A){const e=gr.getLogger(A);return e.setDefaultLevel(j.getLevel()),e}const f0=gr.getLogger("lk-e2ee"),ii=7e3,g0=[0,300,2*2*300,3*3*300,4*4*300,ii,ii,ii,ii,ii];class p0{constructor(e){this._retryDelays=e!==void 0?[...e]:g0}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const t=this._retryDelays[e.retryCount];return e.retryCount<=1?t:t+Math.random()*1e3}}function m0(A,e){var t={};for(var n in A)Object.prototype.hasOwnProperty.call(A,n)&&e.indexOf(n)<0&&(t[n]=A[n]);if(A!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(A);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(A,n[i])&&(t[n[i]]=A[n[i]]);return t}function m(A,e,t,n){function i(r){return r instanceof t?r:new t(function(s){s(r)})}return new(t||(t=Promise))(function(r,s){function o(l){try{c(n.next(l))}catch(u){s(u)}}function a(l){try{c(n.throw(l))}catch(u){s(u)}}function c(l){l.done?r(l.value):i(l.value).then(o,a)}c((n=n.apply(A,e||[])).next())})}function Ku(A){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&A[e],n=0;if(t)return t.call(A);if(A&&typeof A.length=="number")return{next:function(){return A&&n>=A.length&&(A=void 0),{value:A&&A[n++],done:!A}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function sA(A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=A[Symbol.asyncIterator],t;return e?e.call(A):(A=typeof Ku=="function"?Ku(A):A[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=A[r]&&function(s){return new Promise(function(o,a){s=A[r](s),i(o,a,s.done,s.value)})}}function i(r,s,o,a){Promise.resolve(a).then(function(c){r({value:c,done:o})},s)}}typeof SuppressedError=="function"&&SuppressedError;var pr={exports:{}},Gu;function B0(){if(Gu)return pr.exports;Gu=1;var A=typeof Reflect=="object"?Reflect:null,e=A&&typeof A.apply=="function"?A.apply:function(C,w,S){return Function.prototype.apply.call(C,w,S)},t;A&&typeof A.ownKeys=="function"?t=A.ownKeys:Object.getOwnPropertySymbols?t=function(C){return Object.getOwnPropertyNames(C).concat(Object.getOwnPropertySymbols(C))}:t=function(C){return Object.getOwnPropertyNames(C)};function n(v){console&&console.warn&&console.warn(v)}var i=Number.isNaN||function(C){return C!==C};function r(){r.init.call(this)}pr.exports=r,pr.exports.once=B,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var s=10;function o(v){if(typeof v!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof v)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(v){if(typeof v!="number"||v<0||i(v))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+v+".");s=v}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(C){if(typeof C!="number"||C<0||i(C))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+C+".");return this._maxListeners=C,this};function a(v){return v._maxListeners===void 0?r.defaultMaxListeners:v._maxListeners}r.prototype.getMaxListeners=function(){return a(this)},r.prototype.emit=function(C){for(var w=[],S=1;S<arguments.length;S++)w.push(arguments[S]);var F=C==="error",_=this._events;if(_!==void 0)F=F&&_.error===void 0;else if(!F)return!1;if(F){var D;if(w.length>0&&(D=w[0]),D instanceof Error)throw D;var H=new Error("Unhandled error."+(D?" ("+D.message+")":""));throw H.context=D,H}var M=_[C];if(M===void 0)return!1;if(typeof M=="function")e(M,this,w);else for(var K=M.length,Le=f(M,K),S=0;S<K;++S)e(Le[S],this,w);return!0};function c(v,C,w,S){var F,_,D;if(o(w),_=v._events,_===void 0?(_=v._events=Object.create(null),v._eventsCount=0):(_.newListener!==void 0&&(v.emit("newListener",C,w.listener?w.listener:w),_=v._events),D=_[C]),D===void 0)D=_[C]=w,++v._eventsCount;else if(typeof D=="function"?D=_[C]=S?[w,D]:[D,w]:S?D.unshift(w):D.push(w),F=a(v),F>0&&D.length>F&&!D.warned){D.warned=!0;var H=new Error("Possible EventEmitter memory leak detected. "+D.length+" "+String(C)+" listeners added. Use emitter.setMaxListeners() to increase limit");H.name="MaxListenersExceededWarning",H.emitter=v,H.type=C,H.count=D.length,n(H)}return v}r.prototype.addListener=function(C,w){return c(this,C,w,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(C,w){return c(this,C,w,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(v,C,w){var S={fired:!1,wrapFn:void 0,target:v,type:C,listener:w},F=l.bind(S);return F.listener=w,S.wrapFn=F,F}r.prototype.once=function(C,w){return o(w),this.on(C,u(this,C,w)),this},r.prototype.prependOnceListener=function(C,w){return o(w),this.prependListener(C,u(this,C,w)),this},r.prototype.removeListener=function(C,w){var S,F,_,D,H;if(o(w),F=this._events,F===void 0)return this;if(S=F[C],S===void 0)return this;if(S===w||S.listener===w)--this._eventsCount===0?this._events=Object.create(null):(delete F[C],F.removeListener&&this.emit("removeListener",C,S.listener||w));else if(typeof S!="function"){for(_=-1,D=S.length-1;D>=0;D--)if(S[D]===w||S[D].listener===w){H=S[D].listener,_=D;break}if(_<0)return this;_===0?S.shift():g(S,_),S.length===1&&(F[C]=S[0]),F.removeListener!==void 0&&this.emit("removeListener",C,H||w)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(C){var w,S,F;if(S=this._events,S===void 0)return this;if(S.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):S[C]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete S[C]),this;if(arguments.length===0){var _=Object.keys(S),D;for(F=0;F<_.length;++F)D=_[F],D!=="removeListener"&&this.removeAllListeners(D);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(w=S[C],typeof w=="function")this.removeListener(C,w);else if(w!==void 0)for(F=w.length-1;F>=0;F--)this.removeListener(C,w[F]);return this};function d(v,C,w){var S=v._events;if(S===void 0)return[];var F=S[C];return F===void 0?[]:typeof F=="function"?w?[F.listener||F]:[F]:w?p(F):f(F,F.length)}r.prototype.listeners=function(C){return d(this,C,!0)},r.prototype.rawListeners=function(C){return d(this,C,!1)},r.listenerCount=function(v,C){return typeof v.listenerCount=="function"?v.listenerCount(C):h.call(v,C)},r.prototype.listenerCount=h;function h(v){var C=this._events;if(C!==void 0){var w=C[v];if(typeof w=="function")return 1;if(w!==void 0)return w.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function f(v,C){for(var w=new Array(C),S=0;S<C;++S)w[S]=v[S];return w}function g(v,C){for(;C+1<v.length;C++)v[C]=v[C+1];v.pop()}function p(v){for(var C=new Array(v.length),w=0;w<C.length;++w)C[w]=v[w].listener||v[w];return C}function B(v,C){return new Promise(function(w,S){function F(D){v.removeListener(C,_),S(D)}function _(){typeof v.removeListener=="function"&&v.removeListener("error",F),w([].slice.call(arguments))}b(v,C,_,{once:!0}),C!=="error"&&y(v,F,{once:!0})})}function y(v,C,w){typeof v.on=="function"&&b(v,"error",C,w)}function b(v,C,w,S){if(typeof v.on=="function")S.once?v.once(C,w):v.on(C,w);else if(typeof v.addEventListener=="function")v.addEventListener(C,function F(_){S.once&&v.removeEventListener(C,F),w(_)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof v)}return pr.exports}var xt=B0();let Vu=!0,ju=!0;function mr(A,e,t){const n=A.match(e);return n&&n.length>=t&&parseInt(n[t],10)}function KA(A,e,t){if(!A.RTCPeerConnection)return;const n=A.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(s,o){if(s!==e)return i.apply(this,arguments);const a=c=>{const l=t(c);l&&(o.handleEvent?o.handleEvent(l):o(l))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(o,a),i.apply(this,[s,a])};const r=n.removeEventListener;n.removeEventListener=function(s,o){if(s!==e||!this._eventMap||!this._eventMap[e])return r.apply(this,arguments);if(!this._eventMap[e].has(o))return r.apply(this,arguments);const a=this._eventMap[e].get(o);return this._eventMap[e].delete(o),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,r.apply(this,[s,a])},Object.defineProperty(n,"on"+e,{get(){return this["_on"+e]},set(s){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),s&&this.addEventListener(e,this["_on"+e]=s)},enumerable:!0,configurable:!0})}function v0(A){return typeof A!="boolean"?new Error("Argument type: "+typeof A+". Please use a boolean."):(Vu=A,A?"adapter.js logging disabled":"adapter.js logging enabled")}function C0(A){return typeof A!="boolean"?new Error("Argument type: "+typeof A+". Please use a boolean."):(ju=!A,"adapter.js deprecation warnings "+(A?"disabled":"enabled"))}function $u(){if(typeof window=="object"){if(Vu)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Ho(A,e){ju&&console.warn(A+" is deprecated, please use "+e+" instead.")}function w0(A){const e={browser:null,version:null};if(typeof A>"u"||!A.navigator||!A.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:t}=A;if(t.userAgentData&&t.userAgentData.brands){const n=t.userAgentData.brands.find(i=>i.brand==="Chromium");if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(t.mozGetUserMedia)e.browser="firefox",e.version=mr(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||A.isSecureContext===!1&&A.webkitRTCPeerConnection)e.browser="chrome",e.version=mr(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(A.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=mr(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=A.RTCRtpTransceiver&&"currentDirection"in A.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function Wu(A){return Object.prototype.toString.call(A)==="[object Object]"}function Ju(A){return Wu(A)?Object.keys(A).reduce(function(e,t){const n=Wu(A[t]),i=n?Ju(A[t]):A[t],r=n&&!Object.keys(i).length;return i===void 0||r?e:Object.assign(e,{[t]:i})},{}):A}function Mo(A,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(n=>{n.endsWith("Id")?Mo(A,A.get(e[n]),t):n.endsWith("Ids")&&e[n].forEach(i=>{Mo(A,A.get(i),t)})}))}function Xu(A,e,t){const n=t?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const r=[];return A.forEach(s=>{s.type==="track"&&s.trackIdentifier===e.id&&r.push(s)}),r.forEach(s=>{A.forEach(o=>{o.type===n&&o.trackId===s.id&&Mo(A,o,i)})}),i}const qu=$u;function Yu(A,e){const t=A&&A.navigator;if(!t.mediaDevices)return;const n=function(o){if(typeof o!="object"||o.mandatory||o.optional)return o;const a={};return Object.keys(o).forEach(c=>{if(c==="require"||c==="advanced"||c==="mediaSource")return;const l=typeof o[c]=="object"?o[c]:{ideal:o[c]};l.exact!==void 0&&typeof l.exact=="number"&&(l.min=l.max=l.exact);const u=function(d,h){return d?d+h.charAt(0).toUpperCase()+h.slice(1):h==="deviceId"?"sourceId":h};if(l.ideal!==void 0){a.optional=a.optional||[];let d={};typeof l.ideal=="number"?(d[u("min",c)]=l.ideal,a.optional.push(d),d={},d[u("max",c)]=l.ideal,a.optional.push(d)):(d[u("",c)]=l.ideal,a.optional.push(d))}l.exact!==void 0&&typeof l.exact!="number"?(a.mandatory=a.mandatory||{},a.mandatory[u("",c)]=l.exact):["min","max"].forEach(d=>{l[d]!==void 0&&(a.mandatory=a.mandatory||{},a.mandatory[u(d,c)]=l[d])})}),o.advanced&&(a.optional=(a.optional||[]).concat(o.advanced)),a},i=function(o,a){if(e.version>=61)return a(o);if(o=JSON.parse(JSON.stringify(o)),o&&typeof o.audio=="object"){const c=function(l,u,d){u in l&&!(d in l)&&(l[d]=l[u],delete l[u])};o=JSON.parse(JSON.stringify(o)),c(o.audio,"autoGainControl","googAutoGainControl"),c(o.audio,"noiseSuppression","googNoiseSuppression"),o.audio=n(o.audio)}if(o&&typeof o.video=="object"){let c=o.video.facingMode;c=c&&(typeof c=="object"?c:{ideal:c});const l=e.version<66;if(c&&(c.exact==="user"||c.exact==="environment"||c.ideal==="user"||c.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!l)){delete o.video.facingMode;let u;if(c.exact==="environment"||c.ideal==="environment"?u=["back","rear"]:(c.exact==="user"||c.ideal==="user")&&(u=["front"]),u)return t.mediaDevices.enumerateDevices().then(d=>{d=d.filter(f=>f.kind==="videoinput");let h=d.find(f=>u.some(g=>f.label.toLowerCase().includes(g)));return!h&&d.length&&u.includes("back")&&(h=d[d.length-1]),h&&(o.video.deviceId=c.exact?{exact:h.deviceId}:{ideal:h.deviceId}),o.video=n(o.video),qu("chrome: "+JSON.stringify(o)),a(o)})}o.video=n(o.video)}return qu("chrome: "+JSON.stringify(o)),a(o)},r=function(o){return e.version>=64?o:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[o.name]||o.name,message:o.message,constraint:o.constraint||o.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},s=function(o,a,c){i(o,l=>{t.webkitGetUserMedia(l,a,u=>{c&&c(r(u))})})};if(t.getUserMedia=s.bind(t),t.mediaDevices.getUserMedia){const o=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(a){return i(a,c=>o(c).then(l=>{if(c.audio&&!l.getAudioTracks().length||c.video&&!l.getVideoTracks().length)throw l.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return l},l=>Promise.reject(r(l))))}}}function zu(A){A.MediaStream=A.MediaStream||A.webkitMediaStream}function Zu(A){if(typeof A=="object"&&A.RTCPeerConnection&&!("ontrack"in A.RTCPeerConnection.prototype)){Object.defineProperty(A.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",i=>{let r;A.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.track.id):r={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=r,s.transceiver={receiver:r},s.streams=[n.stream],this.dispatchEvent(s)}),n.stream.getTracks().forEach(i=>{let r;A.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.id):r={track:i};const s=new Event("track");s.track=i,s.receiver=r,s.transceiver={receiver:r},s.streams=[n.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else KA(A,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ed(A){if(typeof A=="object"&&A.RTCPeerConnection&&!("getSenders"in A.RTCPeerConnection.prototype)&&"createDTMFSender"in A.RTCPeerConnection.prototype){const e=function(i,r){return{track:r,get dtmf(){return this._dtmf===void 0&&(r.kind==="audio"?this._dtmf=i.createDTMFSender(r):this._dtmf=null),this._dtmf},_pc:i}};if(!A.RTCPeerConnection.prototype.getSenders){A.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addTrack=function(o,a){let c=i.apply(this,arguments);return c||(c=e(this,o),this._senders.push(c)),c};const r=A.RTCPeerConnection.prototype.removeTrack;A.RTCPeerConnection.prototype.removeTrack=function(o){r.apply(this,arguments);const a=this._senders.indexOf(o);a!==-1&&this._senders.splice(a,1)}}const t=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(r){this._senders=this._senders||[],t.apply(this,[r]),r.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const n=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(r){this._senders=this._senders||[],n.apply(this,[r]),r.getTracks().forEach(s=>{const o=this._senders.find(a=>a.track===s);o&&this._senders.splice(this._senders.indexOf(o),1)})}}else if(typeof A=="object"&&A.RTCPeerConnection&&"getSenders"in A.RTCPeerConnection.prototype&&"createDTMFSender"in A.RTCPeerConnection.prototype&&A.RTCRtpSender&&!("dtmf"in A.RTCRtpSender.prototype)){const e=A.RTCPeerConnection.prototype.getSenders;A.RTCPeerConnection.prototype.getSenders=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n},Object.defineProperty(A.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function td(A){if(!(typeof A=="object"&&A.RTCPeerConnection&&A.RTCRtpSender&&A.RTCRtpReceiver))return;if(!("getStats"in A.RTCRtpSender.prototype)){const t=A.RTCPeerConnection.prototype.getSenders;t&&(A.RTCPeerConnection.prototype.getSenders=function(){const r=t.apply(this,[]);return r.forEach(s=>s._pc=this),r});const n=A.RTCPeerConnection.prototype.addTrack;n&&(A.RTCPeerConnection.prototype.addTrack=function(){const r=n.apply(this,arguments);return r._pc=this,r}),A.RTCRtpSender.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>Xu(s,r.track,!0))}}if(!("getStats"in A.RTCRtpReceiver.prototype)){const t=A.RTCPeerConnection.prototype.getReceivers;t&&(A.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(r=>r._pc=this),i}),KA(A,"track",n=>(n.receiver._pc=n.srcElement,n)),A.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(r=>Xu(r,i.track,!1))}}if(!("getStats"in A.RTCRtpSender.prototype&&"getStats"in A.RTCRtpReceiver.prototype))return;const e=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof A.MediaStreamTrack){const n=arguments[0];let i,r,s;return this.getSenders().forEach(o=>{o.track===n&&(i?s=!0:i=o)}),this.getReceivers().forEach(o=>(o.track===n&&(r?s=!0:r=o),o.track===n)),s||i&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function Ad(A){A.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addTrack=function(s,o){if(!o)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const a=e.apply(this,arguments);return this._shimmedLocalStreams[o.id]?this._shimmedLocalStreams[o.id].indexOf(a)===-1&&this._shimmedLocalStreams[o.id].push(a):this._shimmedLocalStreams[o.id]=[o,a],a};const t=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(c=>{if(this.getSenders().find(u=>u.track===c))throw new DOMException("Track already exists.","InvalidAccessError")});const o=this.getSenders();t.apply(this,arguments);const a=this.getSenders().filter(c=>o.indexOf(c)===-1);this._shimmedLocalStreams[s.id]=[s].concat(a)};const n=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],n.apply(this,arguments)};const i=A.RTCPeerConnection.prototype.removeTrack;A.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(o=>{const a=this._shimmedLocalStreams[o].indexOf(s);a!==-1&&this._shimmedLocalStreams[o].splice(a,1),this._shimmedLocalStreams[o].length===1&&delete this._shimmedLocalStreams[o]}),i.apply(this,arguments)}}function nd(A,e){if(!A.RTCPeerConnection)return;if(A.RTCPeerConnection.prototype.addTrack&&e.version>=65)return Ad(A);const t=A.RTCPeerConnection.prototype.getLocalStreams;A.RTCPeerConnection.prototype.getLocalStreams=function(){const l=t.apply(this);return this._reverseStreams=this._reverseStreams||{},l.map(u=>this._reverseStreams[u.id])};const n=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(l){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},l.getTracks().forEach(u=>{if(this.getSenders().find(h=>h.track===u))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[l.id]){const u=new A.MediaStream(l.getTracks());this._streams[l.id]=u,this._reverseStreams[u.id]=l,l=u}n.apply(this,[l])};const i=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(l){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[l.id]||l]),delete this._reverseStreams[this._streams[l.id]?this._streams[l.id].id:l.id],delete this._streams[l.id]},A.RTCPeerConnection.prototype.addTrack=function(l,u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const d=[].slice.call(arguments,1);if(d.length!==1||!d[0].getTracks().find(g=>g===l))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(g=>g.track===l))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const f=this._streams[u.id];if(f)f.addTrack(l),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const g=new A.MediaStream([l]);this._streams[u.id]=g,this._reverseStreams[g.id]=u,this.addStream(g)}return this.getSenders().find(g=>g.track===l)};function r(c,l){let u=l.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const h=c._reverseStreams[d],f=c._streams[h.id];u=u.replace(new RegExp(f.id,"g"),h.id)}),new RTCSessionDescription({type:l.type,sdp:u})}function s(c,l){let u=l.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const h=c._reverseStreams[d],f=c._streams[h.id];u=u.replace(new RegExp(h.id,"g"),f.id)}),new RTCSessionDescription({type:l.type,sdp:u})}["createOffer","createAnswer"].forEach(function(c){const l=A.RTCPeerConnection.prototype[c],u={[c](){const d=arguments;return arguments.length&&typeof arguments[0]=="function"?l.apply(this,[f=>{const g=r(this,f);d[0].apply(null,[g])},f=>{d[1]&&d[1].apply(null,f)},arguments[2]]):l.apply(this,arguments).then(f=>r(this,f))}};A.RTCPeerConnection.prototype[c]=u[c]});const o=A.RTCPeerConnection.prototype.setLocalDescription;A.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?o.apply(this,arguments):(arguments[0]=s(this,arguments[0]),o.apply(this,arguments))};const a=Object.getOwnPropertyDescriptor(A.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(A.RTCPeerConnection.prototype,"localDescription",{get(){const c=a.get.apply(this);return c.type===""?c:r(this,c)}}),A.RTCPeerConnection.prototype.removeTrack=function(l){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!l._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(l._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let d;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(g=>l.track===g)&&(d=this._streams[h])}),d&&(d.getTracks().length===1?this.removeStream(this._reverseStreams[d.id]):d.removeTrack(l.track),this.dispatchEvent(new Event("negotiationneeded")))}}function No(A,e){!A.RTCPeerConnection&&A.webkitRTCPeerConnection&&(A.RTCPeerConnection=A.webkitRTCPeerConnection),A.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const n=A.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new(t==="addIceCandidate"?A.RTCIceCandidate:A.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};A.RTCPeerConnection.prototype[t]=i[t]})}function id(A,e){KA(A,"negotiationneeded",t=>{const n=t.target;if(!((e.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics==="plan-b")&&n.signalingState!=="stable"))return t})}var rd=Object.freeze({__proto__:null,fixNegotiationNeeded:id,shimAddTrackRemoveTrack:nd,shimAddTrackRemoveTrackWithNative:Ad,shimGetSendersWithDtmf:ed,shimGetUserMedia:Yu,shimMediaStream:zu,shimOnTrack:Zu,shimPeerConnection:No,shimSenderReceiverGetStats:td});function sd(A,e){const t=A&&A.navigator,n=A&&A.MediaStreamTrack;if(t.getUserMedia=function(i,r,s){Ho("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),t.mediaDevices.getUserMedia(i).then(r,s)},!(e.version>55&&"autoGainControl"in t.mediaDevices.getSupportedConstraints())){const i=function(s,o,a){o in s&&!(a in s)&&(s[a]=s[o],delete s[o])},r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);if(t.mediaDevices.getUserMedia=function(s){return typeof s=="object"&&typeof s.audio=="object"&&(s=JSON.parse(JSON.stringify(s)),i(s.audio,"autoGainControl","mozAutoGainControl"),i(s.audio,"noiseSuppression","mozNoiseSuppression")),r(s)},n&&n.prototype.getSettings){const s=n.prototype.getSettings;n.prototype.getSettings=function(){const o=s.apply(this,arguments);return i(o,"mozAutoGainControl","autoGainControl"),i(o,"mozNoiseSuppression","noiseSuppression"),o}}if(n&&n.prototype.applyConstraints){const s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(o){return this.kind==="audio"&&typeof o=="object"&&(o=JSON.parse(JSON.stringify(o)),i(o,"autoGainControl","mozAutoGainControl"),i(o,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[o])}}}}function y0(A,e){A.navigator.mediaDevices&&"getDisplayMedia"in A.navigator.mediaDevices||A.navigator.mediaDevices&&(A.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){const i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return n.video===!0?n.video={mediaSource:e}:n.video.mediaSource=e,A.navigator.mediaDevices.getUserMedia(n)})}function od(A){typeof A=="object"&&A.RTCTrackEvent&&"receiver"in A.RTCTrackEvent.prototype&&!("transceiver"in A.RTCTrackEvent.prototype)&&Object.defineProperty(A.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Ko(A,e){if(typeof A!="object"||!(A.RTCPeerConnection||A.mozRTCPeerConnection))return;!A.RTCPeerConnection&&A.mozRTCPeerConnection&&(A.RTCPeerConnection=A.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const r=A.RTCPeerConnection.prototype[i],s={[i](){return arguments[0]=new(i==="addIceCandidate"?A.RTCIceCandidate:A.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};A.RTCPeerConnection.prototype[i]=s[i]});const t={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){const[r,s,o]=arguments;return n.apply(this,[r||null]).then(a=>{if(e.version<53&&!s)try{a.forEach(c=>{c.type=t[c.type]||c.type})}catch(c){if(c.name!=="TypeError")throw c;a.forEach((l,u)=>{a.set(u,Object.assign({},l,{type:t[l.type]||l.type}))})}return a}).then(s,o)}}function ad(A){if(!(typeof A=="object"&&A.RTCPeerConnection&&A.RTCRtpSender)||A.RTCRtpSender&&"getStats"in A.RTCRtpSender.prototype)return;const e=A.RTCPeerConnection.prototype.getSenders;e&&(A.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(r=>r._pc=this),i});const t=A.RTCPeerConnection.prototype.addTrack;t&&(A.RTCPeerConnection.prototype.addTrack=function(){const i=t.apply(this,arguments);return i._pc=this,i}),A.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function cd(A){if(!(typeof A=="object"&&A.RTCPeerConnection&&A.RTCRtpSender)||A.RTCRtpSender&&"getStats"in A.RTCRtpReceiver.prototype)return;const e=A.RTCPeerConnection.prototype.getReceivers;e&&(A.RTCPeerConnection.prototype.getReceivers=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n}),KA(A,"track",t=>(t.receiver._pc=t.srcElement,t)),A.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function ld(A){!A.RTCPeerConnection||"removeStream"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.removeStream=function(t){Ho("removeStream","removeTrack"),this.getSenders().forEach(n=>{n.track&&t.getTracks().includes(n.track)&&this.removeTrack(n)})})}function ud(A){A.DataChannel&&!A.RTCDataChannel&&(A.RTCDataChannel=A.DataChannel)}function dd(A){if(!(typeof A=="object"&&A.RTCPeerConnection))return;const e=A.RTCPeerConnection.prototype.addTransceiver;e&&(A.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let n=arguments[1]&&arguments[1].sendEncodings;n===void 0&&(n=[]),n=[...n];const i=n.length>0;i&&n.forEach(s=>{if("rid"in s&&!/^[a-z0-9]{0,16}$/i.test(s.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in s&&!(parseFloat(s.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in s&&!(parseFloat(s.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const r=e.apply(this,arguments);if(i){const{sender:s}=r,o=s.getParameters();(!("encodings"in o)||o.encodings.length===1&&Object.keys(o.encodings[0]).length===0)&&(o.encodings=n,s.sendEncodings=n,this.setParametersPromises.push(s.setParameters(o).then(()=>{delete s.sendEncodings}).catch(()=>{delete s.sendEncodings})))}return r})}function hd(A){if(!(typeof A=="object"&&A.RTCRtpSender))return;const e=A.RTCRtpSender.prototype.getParameters;e&&(A.RTCRtpSender.prototype.getParameters=function(){const n=e.apply(this,arguments);return"encodings"in n||(n.encodings=[].concat(this.sendEncodings||[{}])),n})}function fd(A){if(!(typeof A=="object"&&A.RTCPeerConnection))return;const e=A.RTCPeerConnection.prototype.createOffer;A.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function gd(A){if(!(typeof A=="object"&&A.RTCPeerConnection))return;const e=A.RTCPeerConnection.prototype.createAnswer;A.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var pd=Object.freeze({__proto__:null,shimAddTransceiver:dd,shimCreateAnswer:gd,shimCreateOffer:fd,shimGetDisplayMedia:y0,shimGetParameters:hd,shimGetUserMedia:sd,shimOnTrack:od,shimPeerConnection:Ko,shimRTCDataChannel:ud,shimReceiverGetStats:cd,shimRemoveStream:ld,shimSenderGetStats:ad});function md(A){if(!(typeof A!="object"||!A.RTCPeerConnection)){if("getLocalStreams"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in A.RTCPeerConnection.prototype)){const e=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addStream=function(n){this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(i=>e.call(this,i,n)),n.getVideoTracks().forEach(i=>e.call(this,i,n))},A.RTCPeerConnection.prototype.addTrack=function(n){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return r&&r.forEach(o=>{this._localStreams?this._localStreams.includes(o)||this._localStreams.push(o):this._localStreams=[o]}),e.apply(this,arguments)}}"removeStream"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const n=this._localStreams.indexOf(t);if(n===-1)return;this._localStreams.splice(n,1);const i=t.getTracks();this.getSenders().forEach(r=>{i.includes(r.track)&&this.removeTrack(r)})})}}function Bd(A){if(!(typeof A!="object"||!A.RTCPeerConnection)&&("getRemoteStreams"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in A.RTCPeerConnection.prototype))){Object.defineProperty(A.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=n=>{n.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const r=new Event("addstream");r.stream=i,this.dispatchEvent(r)})})}});const e=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){const n=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(r=>{if(n._remoteStreams||(n._remoteStreams=[]),n._remoteStreams.indexOf(r)>=0)return;n._remoteStreams.push(r);const s=new Event("addstream");s.stream=r,n.dispatchEvent(s)})}),e.apply(n,arguments)}}}function vd(A){if(typeof A!="object"||!A.RTCPeerConnection)return;const e=A.RTCPeerConnection.prototype,t=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,r=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(c,l){const u=arguments.length>=2?arguments[2]:arguments[0],d=t.apply(this,[u]);return l?(d.then(c,l),Promise.resolve()):d},e.createAnswer=function(c,l){const u=arguments.length>=2?arguments[2]:arguments[0],d=n.apply(this,[u]);return l?(d.then(c,l),Promise.resolve()):d};let o=function(a,c,l){const u=i.apply(this,[a]);return l?(u.then(c,l),Promise.resolve()):u};e.setLocalDescription=o,o=function(a,c,l){const u=r.apply(this,[a]);return l?(u.then(c,l),Promise.resolve()):u},e.setRemoteDescription=o,o=function(a,c,l){const u=s.apply(this,[a]);return l?(u.then(c,l),Promise.resolve()):u},e.addIceCandidate=o}function Cd(A){const e=A&&A.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,n=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=i=>n(wd(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(n,i,r){e.mediaDevices.getUserMedia(n).then(i,r)}.bind(e))}function wd(A){return A&&A.video!==void 0?Object.assign({},A,{video:Ju(A.video)}):A}function yd(A){if(!A.RTCPeerConnection)return;const e=A.RTCPeerConnection;A.RTCPeerConnection=function(n,i){if(n&&n.iceServers){const r=[];for(let s=0;s<n.iceServers.length;s++){let o=n.iceServers[s];o.urls===void 0&&o.url?(Ho("RTCIceServer.url","RTCIceServer.urls"),o=JSON.parse(JSON.stringify(o)),o.urls=o.url,delete o.url,r.push(o)):r.push(n.iceServers[s])}n.iceServers=r}return new e(n,i)},A.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(A.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function bd(A){typeof A=="object"&&A.RTCTrackEvent&&"receiver"in A.RTCTrackEvent.prototype&&!("transceiver"in A.RTCTrackEvent.prototype)&&Object.defineProperty(A.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Ed(A){const e=A.RTCPeerConnection.prototype.createOffer;A.RTCPeerConnection.prototype.createOffer=function(n){if(n){typeof n.offerToReceiveAudio<"u"&&(n.offerToReceiveAudio=!!n.offerToReceiveAudio);const i=this.getTransceivers().find(s=>s.receiver.track.kind==="audio");n.offerToReceiveAudio===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):n.offerToReceiveAudio===!0&&!i&&this.addTransceiver("audio",{direction:"recvonly"}),typeof n.offerToReceiveVideo<"u"&&(n.offerToReceiveVideo=!!n.offerToReceiveVideo);const r=this.getTransceivers().find(s=>s.receiver.track.kind==="video");n.offerToReceiveVideo===!1&&r?r.direction==="sendrecv"?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":r.direction==="recvonly"&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):n.offerToReceiveVideo===!0&&!r&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function Sd(A){typeof A!="object"||A.AudioContext||(A.AudioContext=A.webkitAudioContext)}var Ud=Object.freeze({__proto__:null,shimAudioContext:Sd,shimCallbacksAPI:vd,shimConstraints:wd,shimCreateOfferLegacy:Ed,shimGetUserMedia:Cd,shimLocalStreamsAPI:md,shimRTCIceServerUrls:yd,shimRemoteStreamsAPI:Bd,shimTrackEventTransceiver:bd}),Go={exports:{}},Td;function b0(){return Td||(Td=1,function(A){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
5
+ */const _m=new Set(["children","localName","ref","style","className"]),xl=new WeakMap,Rl=(A,e,t,n,i)=>{const r=i?.[e];r===void 0?(A[e]=t,t==null&&e in HTMLElement.prototype&&A.removeAttribute(e)):t!==n&&((s,o,a)=>{let c=xl.get(s);c===void 0&&xl.set(s,c=new Map);let l=c.get(o);a!==void 0?l===void 0?(c.set(o,l={handleEvent:a}),s.addEventListener(o,l)):l.handleEvent=a:l!==void 0&&(c.delete(o),s.removeEventListener(o,l))})(A,r,t)},zn=({react:A,tagName:e,elementClass:t,events:n,displayName:i})=>{const r=new Set(Object.keys(n??{})),s=A.forwardRef((o,a)=>{const c=A.useRef(new Map),l=A.useRef(null),u={},d={};for(const[h,f]of Object.entries(o))_m.has(h)?u[h==="className"?"class":h]=f:r.has(h)||h in t.prototype?d[h]=f:u[h]=f;return A.useLayoutEffect(()=>{if(l.current===null)return;const h=new Map;for(const f in d)Rl(l.current,f,o[f],c.current.get(f),n),c.current.delete(f),h.set(f,o[f]);for(const[f,g]of c.current)Rl(l.current,f,void 0,g,n);c.current=h}),A.useLayoutEffect(()=>{l.current?.removeAttribute("defer-hydration")},[]),u.suppressHydrationWarning=!0,A.createElement(e,{...u,ref:A.useCallback(h=>{l.current=h,typeof a=="function"?a(h):a!==null&&(a.current=h)},[a])})});return s.displayName=i??t.name,s};function xm(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var Pl={exports:{}};(function(A){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(a,c,l){this.fn=a,this.context=c,this.once=l||!1}function r(a,c,l,u,d){if(typeof l!="function")throw new TypeError("The listener must be a function");var h=new i(l,u||a,d),f=t?t+c:c;return a._events[f]?a._events[f].fn?a._events[f]=[a._events[f],h]:a._events[f].push(h):(a._events[f]=h,a._eventsCount++),a}function s(a,c){--a._eventsCount===0?a._events=new n:delete a._events[c]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],l,u;if(this._eventsCount===0)return c;for(u in l=this._events)e.call(l,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(l)):c},o.prototype.listeners=function(c){var l=t?t+c:c,u=this._events[l];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,h=u.length,f=new Array(h);d<h;d++)f[d]=u[d].fn;return f},o.prototype.listenerCount=function(c){var l=t?t+c:c,u=this._events[l];return u?u.fn?1:u.length:0},o.prototype.emit=function(c,l,u,d,h,f){var g=t?t+c:c;if(!this._events[g])return!1;var p=this._events[g],B=arguments.length,y,b;if(p.fn){switch(p.once&&this.removeListener(c,p.fn,void 0,!0),B){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,l),!0;case 3:return p.fn.call(p.context,l,u),!0;case 4:return p.fn.call(p.context,l,u,d),!0;case 5:return p.fn.call(p.context,l,u,d,h),!0;case 6:return p.fn.call(p.context,l,u,d,h,f),!0}for(b=1,y=new Array(B-1);b<B;b++)y[b-1]=arguments[b];p.fn.apply(p.context,y)}else{var v=p.length,C;for(b=0;b<v;b++)switch(p[b].once&&this.removeListener(c,p[b].fn,void 0,!0),B){case 1:p[b].fn.call(p[b].context);break;case 2:p[b].fn.call(p[b].context,l);break;case 3:p[b].fn.call(p[b].context,l,u);break;case 4:p[b].fn.call(p[b].context,l,u,d);break;default:if(!y)for(C=1,y=new Array(B-1);C<B;C++)y[C-1]=arguments[C];p[b].fn.apply(p[b].context,y)}}return!0},o.prototype.on=function(c,l,u){return r(this,c,l,u,!1)},o.prototype.once=function(c,l,u){return r(this,c,l,u,!0)},o.prototype.removeListener=function(c,l,u,d){var h=t?t+c:c;if(!this._events[h])return this;if(!l)return s(this,h),this;var f=this._events[h];if(f.fn)f.fn===l&&(!d||f.once)&&(!u||f.context===u)&&s(this,h);else{for(var g=0,p=[],B=f.length;g<B;g++)(f[g].fn!==l||d&&!f[g].once||u&&f[g].context!==u)&&p.push(f[g]);p.length?this._events[h]=p.length===1?p[0]:p:s(this,h)}return this},o.prototype.removeAllListeners=function(c){var l;return c?(l=t?t+c:c,this._events[l]&&s(this,l)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,A.exports=o})(Pl);var Rm=Pl.exports;const Pm=xm(Rm);function Lm(A,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if(n!=="default"&&!(n in A)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(A,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(A)}var Dm=Object.defineProperty,Om=(A,e,t)=>e in A?Dm(A,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):A[e]=t,Ll=(A,e,t)=>Om(A,typeof e!="symbol"?e+"":e,t);let We=class{constructor(){Ll(this,"_locking"),Ll(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const t=new Promise(i=>e=()=>{this._locks-=1,i()}),n=this._locking.then(()=>e);return this._locking=this._locking.then(()=>t),n}};function he(A,e){if(!A)throw new Error(e)}const Hm=34028234663852886e22,Mm=-34028234663852886e22,Nm=4294967295,Km=2147483647,Vm=-2147483648;function er(A){if(typeof A!="number")throw new Error("invalid int 32: "+typeof A);if(!Number.isInteger(A)||A>Km||A<Vm)throw new Error("invalid int 32: "+A)}function vo(A){if(typeof A!="number")throw new Error("invalid uint 32: "+typeof A);if(!Number.isInteger(A)||A>Nm||A<0)throw new Error("invalid uint 32: "+A)}function Dl(A){if(typeof A!="number")throw new Error("invalid float 32: "+typeof A);if(Number.isFinite(A)&&(A>Hm||A<Mm))throw new Error("invalid float 32: "+A)}const Ol=Symbol("@bufbuild/protobuf/enum-type");function Gm(A){const e=A[Ol];return he(e,"missing enum type on enum object"),e}function Hl(A,e,t,n){A[Ol]=Ml(e,t.map(i=>({no:i.no,name:i.name,localName:A[i.no]})))}function Ml(A,e,t){const n=Object.create(null),i=Object.create(null),r=[];for(const s of e){const o=Nl(s);r.push(o),n[s.name]=o,i[s.no]=o}return{typeName:A,values:r,findName(s){return n[s]},findNumber(s){return i[s]}}}function jm(A,e,t){const n={};for(const i of e){const r=Nl(i);n[r.localName]=r.no,n[r.no]=r.localName}return Hl(n,A,e),n}function Nl(A){return"localName"in A?A:Object.assign(Object.assign({},A),{localName:A.name})}class Co{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const n=this.getType(),i=n.runtime.bin,r=i.makeReadOptions(t);return i.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,t){const n=this.getType(),i=n.runtime.json,r=i.makeReadOptions(t);return i.readMessage(n,e,r,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(i){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(i instanceof Error?i.message:String(i)))}return this.fromJson(n,t)}toBinary(e){const t=this.getType(),n=t.runtime.bin,i=n.makeWriteOptions(e),r=i.writerFactory();return n.writeMessage(this,r,i),r.finish()}toJson(e){const t=this.getType(),n=t.runtime.json,i=n.makeWriteOptions(e);return n.writeMessage(this,i)}toJsonString(e){var t;const n=this.toJson(e);return JSON.stringify(n,null,(t=e?.prettySpaces)!==null&&t!==void 0?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function $m(A,e,t,n){var i;const r=(i=n?.localName)!==null&&i!==void 0?i:e.substring(e.lastIndexOf(".")+1),s={[r]:function(o){A.util.initFields(this),A.util.initPartial(o,this)}}[r];return Object.setPrototypeOf(s.prototype,new Co),Object.assign(s,{runtime:A,typeName:e,fields:A.util.newFieldList(t),fromBinary(o,a){return new s().fromBinary(o,a)},fromJson(o,a){return new s().fromJson(o,a)},fromJsonString(o,a){return new s().fromJsonString(o,a)},equals(o,a){return A.util.equals(s,o,a)}}),s}function Wm(){let A=0,e=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(A|=(i&127)<<n,!(i&128))return this.assertBounds(),[A,e]}let t=this.buf[this.pos++];if(A|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[A,e];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,!(i&128))return this.assertBounds(),[A,e]}throw new Error("invalid varint")}function wo(A,e,t){for(let r=0;r<28;r=r+7){const s=A>>>r,o=!(!(s>>>7)&&e==0),a=(o?s|128:s)&255;if(t.push(a),!o)return}const n=A>>>28&15|(e&7)<<4,i=!!(e>>3);if(t.push((i?n|128:n)&255),!!i){for(let r=3;r<31;r=r+7){const s=e>>>r,o=!!(s>>>7),a=(o?s|128:s)&255;if(t.push(a),!o)return}t.push(e>>>31&1)}}const tr=4294967296;function Kl(A){const e=A[0]==="-";e&&(A=A.slice(1));const t=1e6;let n=0,i=0;function r(s,o){const a=Number(A.slice(s,o));i*=t,n=n*t+a,n>=tr&&(i=i+(n/tr|0),n=n%tr)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),e?Gl(n,i):yo(n,i)}function Jm(A,e){let t=yo(A,e);const n=t.hi&2147483648;n&&(t=Gl(t.lo,t.hi));const i=Vl(t.lo,t.hi);return n?"-"+i:i}function Vl(A,e){if({lo:A,hi:e}=Xm(A,e),e<=2097151)return String(tr*e+A);const t=A&16777215,n=(A>>>24|e<<8)&16777215,i=e>>16&65535;let r=t+n*6777216+i*6710656,s=n+i*8147497,o=i*2;const a=1e7;return r>=a&&(s+=Math.floor(r/a),r%=a),s>=a&&(o+=Math.floor(s/a),s%=a),o.toString()+jl(s)+jl(r)}function Xm(A,e){return{lo:A>>>0,hi:e>>>0}}function yo(A,e){return{lo:A|0,hi:e|0}}function Gl(A,e){return e=~e,A?A=~A+1:e+=1,yo(A,e)}const jl=A=>{const e=String(A);return"0000000".slice(e.length)+e};function $l(A,e){if(A>=0){for(;A>127;)e.push(A&127|128),A=A>>>7;e.push(A)}else{for(let t=0;t<9;t++)e.push(A&127|128),A=A>>7;e.push(1)}}function qm(){let A=this.buf[this.pos++],e=A&127;if(!(A&128))return this.assertBounds(),e;if(A=this.buf[this.pos++],e|=(A&127)<<7,!(A&128))return this.assertBounds(),e;if(A=this.buf[this.pos++],e|=(A&127)<<14,!(A&128))return this.assertBounds(),e;if(A=this.buf[this.pos++],e|=(A&127)<<21,!(A&128))return this.assertBounds(),e;A=this.buf[this.pos++],e|=(A&15)<<28;for(let t=5;A&128&&t<10;t++)A=this.buf[this.pos++];if(A&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function Ym(){const A=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof A.getBigInt64=="function"&&typeof A.getBigUint64=="function"&&typeof A.setBigInt64=="function"&&typeof A.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){const i=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),o=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){const c=typeof a=="bigint"?a:BigInt(a);if(c>r||c<i)throw new Error("int64 invalid: ".concat(a));return c},uParse(a){const c=typeof a=="bigint"?a:BigInt(a);if(c>o||c<s)throw new Error("uint64 invalid: ".concat(a));return c},enc(a){return A.setBigInt64(0,this.parse(a),!0),{lo:A.getInt32(0,!0),hi:A.getInt32(4,!0)}},uEnc(a){return A.setBigInt64(0,this.uParse(a),!0),{lo:A.getInt32(0,!0),hi:A.getInt32(4,!0)}},dec(a,c){return A.setInt32(0,a,!0),A.setInt32(4,c,!0),A.getBigInt64(0,!0)},uDec(a,c){return A.setInt32(0,a,!0),A.setInt32(4,c,!0),A.getBigUint64(0,!0)}}}const t=i=>he(/^-?[0-9]+$/.test(i),"int64 invalid: ".concat(i)),n=i=>he(/^[0-9]+$/.test(i),"uint64 invalid: ".concat(i));return{zero:"0",supported:!1,parse(i){return typeof i!="string"&&(i=i.toString()),t(i),i},uParse(i){return typeof i!="string"&&(i=i.toString()),n(i),i},enc(i){return typeof i!="string"&&(i=i.toString()),t(i),Kl(i)},uEnc(i){return typeof i!="string"&&(i=i.toString()),n(i),Kl(i)},dec(i,r){return Jm(i,r)},uDec(i,r){return Vl(i,r)}}}const ue=Ym();var T;(function(A){A[A.DOUBLE=1]="DOUBLE",A[A.FLOAT=2]="FLOAT",A[A.INT64=3]="INT64",A[A.UINT64=4]="UINT64",A[A.INT32=5]="INT32",A[A.FIXED64=6]="FIXED64",A[A.FIXED32=7]="FIXED32",A[A.BOOL=8]="BOOL",A[A.STRING=9]="STRING",A[A.BYTES=12]="BYTES",A[A.UINT32=13]="UINT32",A[A.SFIXED32=15]="SFIXED32",A[A.SFIXED64=16]="SFIXED64",A[A.SINT32=17]="SINT32",A[A.SINT64=18]="SINT64"})(T||(T={}));var iA;(function(A){A[A.BIGINT=0]="BIGINT",A[A.STRING=1]="STRING"})(iA||(iA={}));function rA(A,e,t){if(e===t)return!0;if(A==T.BYTES){if(!(e instanceof Uint8Array)||!(t instanceof Uint8Array)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}switch(A){case T.UINT64:case T.FIXED64:case T.INT64:case T.SFIXED64:case T.SINT64:return e==t}return!1}function hn(A,e){switch(A){case T.BOOL:return!1;case T.UINT64:case T.FIXED64:case T.INT64:case T.SFIXED64:case T.SINT64:return e==0?ue.zero:"0";case T.DOUBLE:case T.FLOAT:return 0;case T.BYTES:return new Uint8Array(0);case T.STRING:return"";default:return 0}}function Wl(A,e){switch(A){case T.BOOL:return e===!1;case T.STRING:return e==="";case T.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var me;(function(A){A[A.Varint=0]="Varint",A[A.Bit64=1]="Bit64",A[A.LengthDelimited=2]="LengthDelimited",A[A.StartGroup=3]="StartGroup",A[A.EndGroup=4]="EndGroup",A[A.Bit32=5]="Bit32"})(me||(me={}));class zm{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let t=new Uint8Array(e),n=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],n),n+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(vo(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return er(e),$l(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Dl(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){vo(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){er(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return er(e),e=(e<<1^e>>31)>>>0,$l(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=ue.enc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=ue.uEnc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=ue.enc(e);return wo(t.lo,t.hi,this.buf),this}sint64(e){let t=ue.enc(e),n=t.hi>>31,i=t.lo<<1^n,r=(t.hi<<1|t.lo>>>31)^n;return wo(i,r,this.buf),this}uint64(e){let t=ue.uEnc(e);return wo(t.lo,t.hi,this.buf),this}}class Zm{constructor(e,t){this.varint64=Wm,this.uint32=qm,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case me.Varint:for(;this.buf[this.pos++]&128;);break;case me.Bit64:this.pos+=4;case me.Bit32:this.pos+=4;break;case me.LengthDelimited:let i=this.uint32();this.pos+=i;break;case me.StartGroup:for(;;){const[r,s]=this.tag();if(s===me.EndGroup){if(t!==void 0&&r!==t)throw new Error("invalid end group tag");break}this.skip(s,r)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return ue.dec(...this.varint64())}uint64(){return ue.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,ue.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return ue.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return ue.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function eB(A,e,t,n){let i;return{typeName:e,extendee:t,get field(){if(!i){const r=typeof n=="function"?n():n;r.name=e.split(".").pop(),r.jsonName="[".concat(e,"]"),i=A.util.newFieldList([r]).list()[0]}return i},runtime:A}}function Jl(A){const e=A.field.localName,t=Object.create(null);return t[e]=tB(A),[t,()=>t[e]]}function tB(A){const e=A.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return hn(e.T,e.L);case"message":const t=e.T,n=new t;return t.fieldWrapper?t.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}function AB(A,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let t=A.length-1;t>=0;--t)if(A[t].no==e.no)return[A[t]];return[]}return A.filter(t=>t.no===e.no)}let Gt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ar=[];for(let A=0;A<Gt.length;A++)Ar[Gt[A].charCodeAt(0)]=A;Ar["-".charCodeAt(0)]=Gt.indexOf("+"),Ar["_".charCodeAt(0)]=Gt.indexOf("/");const Xl={dec(A){let e=A.length*3/4;A[A.length-2]=="="?e-=2:A[A.length-1]=="="&&(e-=1);let t=new Uint8Array(e),n=0,i=0,r,s=0;for(let o=0;o<A.length;o++){if(r=Ar[A.charCodeAt(o)],r===void 0)switch(A[o]){case"=":i=0;case`
6
+ `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:s=r,i=1;break;case 1:t[n++]=s<<2|(r&48)>>4,s=r,i=2;break;case 2:t[n++]=(s&15)<<4|(r&60)>>2,s=r,i=3;break;case 3:t[n++]=(s&3)<<6|r,i=0;break}}if(i==1)throw Error("invalid base64 string.");return t.subarray(0,n)},enc(A){let e="",t=0,n,i=0;for(let r=0;r<A.length;r++)switch(n=A[r],t){case 0:e+=Gt[n>>2],i=(n&3)<<4,t=1;break;case 1:e+=Gt[i|n>>4],i=(n&15)<<2,t=2;break;case 2:e+=Gt[i|n>>6],e+=Gt[n&63],t=0;break}return t&&(e+=Gt[i],e+="=",t==1&&(e+="=")),e}};function nB(A,e,t){Yl(e,A);const n=e.runtime.bin.makeReadOptions(t),i=AB(A.getType().runtime.bin.listUnknownFields(A),e.field),[r,s]=Jl(e);for(const o of i)e.runtime.bin.readField(r,n.readerFactory(o.data),e.field,o.wireType,n);return s()}function iB(A,e,t,n){Yl(e,A);const i=e.runtime.bin.makeReadOptions(n),r=e.runtime.bin.makeWriteOptions(n);if(ql(A,e)){const c=A.getType().runtime.bin.listUnknownFields(A).filter(l=>l.no!=e.field.no);A.getType().runtime.bin.discardUnknownFields(A);for(const l of c)A.getType().runtime.bin.onUnknownField(A,l.no,l.wireType,l.data)}const s=r.writerFactory();let o=e.field;!o.opt&&!o.repeated&&(o.kind=="enum"||o.kind=="scalar")&&(o=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(o,t,s,r);const a=i.readerFactory(s.finish());for(;a.pos<a.len;){const[c,l]=a.tag(),u=a.skip(l,c);A.getType().runtime.bin.onUnknownField(A,c,l,u)}}function ql(A,e){const t=A.getType();return e.extendee.typeName===t.typeName&&!!t.runtime.bin.listUnknownFields(A).find(n=>n.no==e.field.no)}function Yl(A,e){he(A.extendee.typeName==e.getType().typeName,"extension ".concat(A.typeName," can only be applied to message ").concat(A.extendee.typeName))}function zl(A,e){const t=A.localName;if(A.repeated)return e[t].length>0;if(A.oneof)return e[A.oneof.localName].case===t;switch(A.kind){case"enum":case"scalar":return A.opt||A.req?e[t]!==void 0:A.kind=="enum"?e[t]!==A.T.values[0].no:!Wl(A.T,e[t]);case"message":return e[t]!==void 0;case"map":return Object.keys(e[t]).length>0}}function Zl(A,e){const t=A.localName,n=!A.opt&&!A.req;if(A.repeated)e[t]=[];else if(A.oneof)e[A.oneof.localName]={case:void 0};else switch(A.kind){case"map":e[t]={};break;case"enum":e[t]=n?A.T.values[0].no:void 0;break;case"scalar":e[t]=n?hn(A.T,A.L):void 0;break;case"message":e[t]=void 0;break}}function HA(A,e){if(A===null||typeof A!="object"||!Object.getOwnPropertyNames(Co.prototype).every(n=>n in A&&typeof A[n]=="function"))return!1;const t=A.getType();return t===null||typeof t!="function"||!("typeName"in t)||typeof t.typeName!="string"?!1:e===void 0?!0:t.typeName==e.typeName}function eu(A,e){return HA(e)||!A.fieldWrapper?e:A.fieldWrapper.wrapField(e)}T.DOUBLE,T.FLOAT,T.INT64,T.UINT64,T.INT32,T.UINT32,T.BOOL,T.STRING,T.BYTES;const tu={ignoreUnknownFields:!1},Au={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function rB(A){return A?Object.assign(Object.assign({},tu),A):tu}function sB(A){return A?Object.assign(Object.assign({},Au),A):Au}const nr=Symbol(),ir=Symbol();function oB(){return{makeReadOptions:rB,makeWriteOptions:sB,readMessage(A,e,t,n){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(A.typeName," from JSON: ").concat(It(e)));n=n??new A;const i=new Map,r=t.typeRegistry;for(const[s,o]of Object.entries(e)){const a=A.fields.findJsonName(s);if(a){if(a.oneof){if(o===null&&a.kind=="scalar")continue;const c=i.get(a.oneof);if(c!==void 0)throw new Error("cannot decode message ".concat(A.typeName,' from JSON: multiple keys for oneof "').concat(a.oneof.name,'" present: "').concat(c,'", "').concat(s,'"'));i.set(a.oneof,s)}nu(n,o,a,t,A)}else{let c=!1;if(r?.findExtension&&s.startsWith("[")&&s.endsWith("]")){const l=r.findExtension(s.substring(1,s.length-1));if(l&&l.extendee.typeName==A.typeName){c=!0;const[u,d]=Jl(l);nu(u,o,l.field,t,l),iB(n,l,d(),t)}}if(!c&&!t.ignoreUnknownFields)throw new Error("cannot decode message ".concat(A.typeName,' from JSON: key "').concat(s,'" is unknown'))}}return n},writeMessage(A,e){const t=A.getType(),n={};let i;try{for(i of t.fields.byNumber()){if(!zl(i,A)){if(i.req)throw"required field not set";if(!e.emitDefaultValues||!cB(i))continue}const s=i.oneof?A[i.oneof.localName].value:A[i.localName],o=iu(i,s,e);o!==void 0&&(n[e.useProtoFieldName?i.name:i.jsonName]=o)}const r=e.typeRegistry;if(r?.findExtensionFor)for(const s of t.runtime.bin.listUnknownFields(A)){const o=r.findExtensionFor(t.typeName,s.no);if(o&&ql(A,o)){const a=nB(A,o,e),c=iu(o.field,a,e);c!==void 0&&(n[o.field.jsonName]=c)}}}catch(r){const s=i?"cannot encode field ".concat(t.typeName,".").concat(i.name," to JSON"):"cannot encode message ".concat(t.typeName," to JSON"),o=r instanceof Error?r.message:String(r);throw new Error(s+(o.length>0?": ".concat(o):""))}return n},readScalar(A,e,t){return Zn(A,e,t??iA.BIGINT,!0)},writeScalar(A,e,t){if(e!==void 0&&(t||Wl(A,e)))return rr(A,e)},debug:It}}function It(A){if(A===null)return"null";switch(typeof A){case"object":return Array.isArray(A)?"array":"object";case"string":return A.length>100?"string":'"'.concat(A.split('"').join('\\"'),'"');default:return String(A)}}function nu(A,e,t,n,i){let r=t.localName;if(t.repeated){if(he(t.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(e)));const s=A[r];for(const o of e){if(o===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(o)));switch(t.kind){case"message":s.push(t.T.fromJson(o,n));break;case"enum":const a=bo(t.T,o,n.ignoreUnknownFields,!0);a!==ir&&s.push(a);break;case"scalar":try{s.push(Zn(t.T,o,t.L,!0))}catch(c){let l="cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(o));throw c instanceof Error&&c.message.length>0&&(l+=": ".concat(c.message)),new Error(l)}break}}}else if(t.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(e)));const s=A[r];for(const[o,a]of Object.entries(e)){if(a===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: map value null"));let c;try{c=aB(t.K,o)}catch(l){let u="cannot decode map key for field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(e));throw l instanceof Error&&l.message.length>0&&(u+=": ".concat(l.message)),new Error(u)}switch(t.V.kind){case"message":s[c]=t.V.T.fromJson(a,n);break;case"enum":const l=bo(t.V.T,a,n.ignoreUnknownFields,!0);l!==ir&&(s[c]=l);break;case"scalar":try{s[c]=Zn(t.V.T,a,iA.BIGINT,!0)}catch(u){let d="cannot decode map value for field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(e));throw u instanceof Error&&u.message.length>0&&(d+=": ".concat(u.message)),new Error(d)}break}}}else switch(t.oneof&&(A=A[t.oneof.localName]={case:r},r="value"),t.kind){case"message":const s=t.T;if(e===null&&s.typeName!="google.protobuf.Value")return;let o=A[r];HA(o)?o.fromJson(e,n):(A[r]=o=s.fromJson(e,n),s.fieldWrapper&&!t.oneof&&(A[r]=s.fieldWrapper.unwrapField(o)));break;case"enum":const a=bo(t.T,e,n.ignoreUnknownFields,!1);switch(a){case nr:Zl(t,A);break;case ir:break;default:A[r]=a;break}break;case"scalar":try{const c=Zn(t.T,e,t.L,!1);switch(c){case nr:Zl(t,A);break;default:A[r]=c;break}}catch(c){let l="cannot decode field ".concat(i.typeName,".").concat(t.name," from JSON: ").concat(It(e));throw c instanceof Error&&c.message.length>0&&(l+=": ".concat(c.message)),new Error(l)}break}}function aB(A,e){if(A===T.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return Zn(A,e,iA.BIGINT,!0).toString()}function Zn(A,e,t,n){if(e===null)return n?hn(A,t):nr;switch(A){case T.DOUBLE:case T.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const i=Number(e);if(Number.isNaN(i)||!Number.isFinite(i))break;return A==T.FLOAT&&Dl(i),i;case T.INT32:case T.FIXED32:case T.SFIXED32:case T.SINT32:case T.UINT32:let r;if(typeof e=="number"?r=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(r=Number(e)),r===void 0)break;return A==T.UINT32||A==T.FIXED32?vo(r):er(r),r;case T.INT64:case T.SFIXED64:case T.SINT64:if(typeof e!="number"&&typeof e!="string")break;const s=ue.parse(e);return t?s.toString():s;case T.FIXED64:case T.UINT64:if(typeof e!="number"&&typeof e!="string")break;const o=ue.uParse(e);return t?o.toString():o;case T.BOOL:if(typeof e!="boolean")break;return e;case T.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case T.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return Xl.dec(e)}throw new Error}function bo(A,e,t,n){if(e===null)return A.typeName=="google.protobuf.NullValue"?0:n?A.values[0].no:nr;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const i=A.findName(e);if(i!==void 0)return i.no;if(t)return ir;break}throw new Error("cannot decode enum ".concat(A.typeName," from JSON: ").concat(It(e)))}function cB(A){return A.repeated||A.kind=="map"?!0:!(A.oneof||A.kind=="message"||A.opt||A.req)}function iu(A,e,t){if(A.kind=="map"){he(typeof e=="object"&&e!=null);const n={},i=Object.entries(e);switch(A.V.kind){case"scalar":for(const[s,o]of i)n[s.toString()]=rr(A.V.T,o);break;case"message":for(const[s,o]of i)n[s.toString()]=o.toJson(t);break;case"enum":const r=A.V.T;for(const[s,o]of i)n[s.toString()]=Eo(r,o,t.enumAsInteger);break}return t.emitDefaultValues||i.length>0?n:void 0}if(A.repeated){he(Array.isArray(e));const n=[];switch(A.kind){case"scalar":for(let i=0;i<e.length;i++)n.push(rr(A.T,e[i]));break;case"enum":for(let i=0;i<e.length;i++)n.push(Eo(A.T,e[i],t.enumAsInteger));break;case"message":for(let i=0;i<e.length;i++)n.push(e[i].toJson(t));break}return t.emitDefaultValues||n.length>0?n:void 0}switch(A.kind){case"scalar":return rr(A.T,e);case"enum":return Eo(A.T,e,t.enumAsInteger);case"message":return eu(A.T,e).toJson(t)}}function Eo(A,e,t){var n;if(he(typeof e=="number"),A.typeName=="google.protobuf.NullValue")return null;if(t)return e;const i=A.findNumber(e);return(n=i?.name)!==null&&n!==void 0?n:e}function rr(A,e){switch(A){case T.INT32:case T.SFIXED32:case T.SINT32:case T.FIXED32:case T.UINT32:return he(typeof e=="number"),e;case T.FLOAT:case T.DOUBLE:return he(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case T.STRING:return he(typeof e=="string"),e;case T.BOOL:return he(typeof e=="boolean"),e;case T.UINT64:case T.FIXED64:case T.INT64:case T.SFIXED64:case T.SINT64:return he(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case T.BYTES:return he(e instanceof Uint8Array),Xl.enc(e)}}const fn=Symbol("@bufbuild/protobuf/unknown-fields"),ru={readUnknownFields:!0,readerFactory:A=>new Zm(A)},su={writeUnknownFields:!0,writerFactory:()=>new zm};function lB(A){return A?Object.assign(Object.assign({},ru),A):ru}function uB(A){return A?Object.assign(Object.assign({},su),A):su}function dB(){return{makeReadOptions:lB,makeWriteOptions:uB,listUnknownFields(A){var e;return(e=A[fn])!==null&&e!==void 0?e:[]},discardUnknownFields(A){delete A[fn]},writeUnknownFields(A,e){const n=A[fn];if(n)for(const i of n)e.tag(i.no,i.wireType).raw(i.data)},onUnknownField(A,e,t,n){const i=A;Array.isArray(i[fn])||(i[fn]=[]),i[fn].push({no:e,wireType:t,data:n})},readMessage(A,e,t,n,i){const r=A.getType(),s=i?e.len:e.pos+t;let o,a;for(;e.pos<s&&([o,a]=e.tag(),!(i===!0&&a==me.EndGroup));){const c=r.fields.find(o);if(!c){const l=e.skip(a,o);n.readUnknownFields&&this.onUnknownField(A,o,a,l);continue}ou(A,e,c,a,n)}if(i&&(a!=me.EndGroup||o!==t))throw new Error("invalid end group tag")},readField:ou,writeMessage(A,e,t){const n=A.getType();for(const i of n.fields.byNumber()){if(!zl(i,A)){if(i.req)throw new Error("cannot encode field ".concat(n.typeName,".").concat(i.name," to binary: required field not set"));continue}const r=i.oneof?A[i.oneof.localName].value:A[i.localName];au(i,r,e,t)}return t.writeUnknownFields&&this.writeUnknownFields(A,e),e},writeField(A,e,t,n){e!==void 0&&au(A,e,t,n)}}}function ou(A,e,t,n,i){let{repeated:r,localName:s}=t;switch(t.oneof&&(A=A[t.oneof.localName],A.case!=s&&delete A.value,A.case=s,s="value"),t.kind){case"scalar":case"enum":const o=t.kind=="enum"?T.INT32:t.T;let a=or;if(t.kind=="scalar"&&t.L>0&&(a=fB),r){let d=A[s];if(n==me.LengthDelimited&&o!=T.STRING&&o!=T.BYTES){let f=e.uint32()+e.pos;for(;e.pos<f;)d.push(a(e,o))}else d.push(a(e,o))}else A[s]=a(e,o);break;case"message":const c=t.T;r?A[s].push(sr(e,new c,i,t)):HA(A[s])?sr(e,A[s],i,t):(A[s]=sr(e,new c,i,t),c.fieldWrapper&&!t.oneof&&!t.repeated&&(A[s]=c.fieldWrapper.unwrapField(A[s])));break;case"map":let[l,u]=hB(t,e,i);A[s][l]=u;break}}function sr(A,e,t,n){const i=e.getType().runtime.bin,r=n?.delimited;return i.readMessage(e,A,r?n.no:A.uint32(),t,r),e}function hB(A,e,t){const n=e.uint32(),i=e.pos+n;let r,s;for(;e.pos<i;){const[o]=e.tag();switch(o){case 1:r=or(e,A.K);break;case 2:switch(A.V.kind){case"scalar":s=or(e,A.V.T);break;case"enum":s=e.int32();break;case"message":s=sr(e,new A.V.T,t,void 0);break}break}}if(r===void 0&&(r=hn(A.K,iA.BIGINT)),typeof r!="string"&&typeof r!="number"&&(r=r.toString()),s===void 0)switch(A.V.kind){case"scalar":s=hn(A.V.T,iA.BIGINT);break;case"enum":s=A.V.T.values[0].no;break;case"message":s=new A.V.T;break}return[r,s]}function fB(A,e){const t=or(A,e);return typeof t=="bigint"?t.toString():t}function or(A,e){switch(e){case T.STRING:return A.string();case T.BOOL:return A.bool();case T.DOUBLE:return A.double();case T.FLOAT:return A.float();case T.INT32:return A.int32();case T.INT64:return A.int64();case T.UINT64:return A.uint64();case T.FIXED64:return A.fixed64();case T.BYTES:return A.bytes();case T.FIXED32:return A.fixed32();case T.SFIXED32:return A.sfixed32();case T.SFIXED64:return A.sfixed64();case T.SINT64:return A.sint64();case T.UINT32:return A.uint32();case T.SINT32:return A.sint32()}}function au(A,e,t,n){he(e!==void 0);const i=A.repeated;switch(A.kind){case"scalar":case"enum":let r=A.kind=="enum"?T.INT32:A.T;if(i)if(he(Array.isArray(e)),A.packed)pB(t,r,A.no,e);else for(const s of e)ei(t,r,A.no,s);else ei(t,r,A.no,e);break;case"message":if(i){he(Array.isArray(e));for(const s of e)cu(t,n,A,s)}else cu(t,n,A,e);break;case"map":he(typeof e=="object"&&e!=null);for(const[s,o]of Object.entries(e))gB(t,n,A,s,o);break}}function gB(A,e,t,n,i){A.tag(t.no,me.LengthDelimited),A.fork();let r=n;switch(t.K){case T.INT32:case T.FIXED32:case T.UINT32:case T.SFIXED32:case T.SINT32:r=Number.parseInt(n);break;case T.BOOL:he(n=="true"||n=="false"),r=n=="true";break}switch(ei(A,t.K,1,r),t.V.kind){case"scalar":ei(A,t.V.T,2,i);break;case"enum":ei(A,T.INT32,2,i);break;case"message":he(i!==void 0),A.tag(2,me.LengthDelimited).bytes(i.toBinary(e));break}A.join()}function cu(A,e,t,n){const i=eu(t.T,n);t.delimited?A.tag(t.no,me.StartGroup).raw(i.toBinary(e)).tag(t.no,me.EndGroup):A.tag(t.no,me.LengthDelimited).bytes(i.toBinary(e))}function ei(A,e,t,n){he(n!==void 0);let[i,r]=lu(e);A.tag(t,i)[r](n)}function pB(A,e,t,n){if(!n.length)return;A.tag(t,me.LengthDelimited).fork();let[,i]=lu(e);for(let r=0;r<n.length;r++)A[i](n[r]);A.join()}function lu(A){let e=me.Varint;switch(A){case T.BYTES:case T.STRING:e=me.LengthDelimited;break;case T.DOUBLE:case T.FIXED64:case T.SFIXED64:e=me.Bit64;break;case T.FIXED32:case T.SFIXED32:case T.FLOAT:e=me.Bit32;break}const t=T[A].toLowerCase();return[e,t]}function mB(){return{setEnumType:Hl,initPartial(A,e){if(A===void 0)return;const t=e.getType();for(const n of t.fields.byMember()){const i=n.localName,r=e,s=A;if(s[i]!=null)switch(n.kind){case"oneof":const o=s[i].case;if(o===void 0)continue;const a=n.findField(o);let c=s[i].value;a&&a.kind=="message"&&!HA(c,a.T)?c=new a.T(c):a&&a.kind==="scalar"&&a.T===T.BYTES&&(c=ti(c)),r[i]={case:o,value:c};break;case"scalar":case"enum":let l=s[i];n.T===T.BYTES&&(l=n.repeated?l.map(ti):ti(l)),r[i]=l;break;case"map":switch(n.V.kind){case"scalar":case"enum":if(n.V.T===T.BYTES)for(const[h,f]of Object.entries(s[i]))r[i][h]=ti(f);else Object.assign(r[i],s[i]);break;case"message":const d=n.V.T;for(const h of Object.keys(s[i])){let f=s[i][h];d.fieldWrapper||(f=new d(f)),r[i][h]=f}break}break;case"message":const u=n.T;if(n.repeated)r[i]=s[i].map(d=>HA(d,u)?d:new u(d));else{const d=s[i];u.fieldWrapper?u.typeName==="google.protobuf.BytesValue"?r[i]=ti(d):r[i]=d:r[i]=HA(d,u)?d:new u(d)}break}}},equals(A,e,t){return e===t?!0:!e||!t?!1:A.fields.byMember().every(n=>{const i=e[n.localName],r=t[n.localName];if(n.repeated){if(i.length!==r.length)return!1;switch(n.kind){case"message":return i.every((s,o)=>n.T.equals(s,r[o]));case"scalar":return i.every((s,o)=>rA(n.T,s,r[o]));case"enum":return i.every((s,o)=>rA(T.INT32,s,r[o]))}throw new Error("repeated cannot contain ".concat(n.kind))}switch(n.kind){case"message":return n.T.equals(i,r);case"enum":return rA(T.INT32,i,r);case"scalar":return rA(n.T,i,r);case"oneof":if(i.case!==r.case)return!1;const s=n.findField(i.case);if(s===void 0)return!0;switch(s.kind){case"message":return s.T.equals(i.value,r.value);case"enum":return rA(T.INT32,i.value,r.value);case"scalar":return rA(s.T,i.value,r.value)}throw new Error("oneof cannot contain ".concat(s.kind));case"map":const o=Object.keys(i).concat(Object.keys(r));switch(n.V.kind){case"message":const a=n.V.T;return o.every(l=>a.equals(i[l],r[l]));case"enum":return o.every(l=>rA(T.INT32,i[l],r[l]));case"scalar":const c=n.V.T;return o.every(l=>rA(c,i[l],r[l]))}break}})},clone(A){const e=A.getType(),t=new e,n=t;for(const i of e.fields.byMember()){const r=A[i.localName];let s;if(i.repeated)s=r.map(ar);else if(i.kind=="map"){s=n[i.localName];for(const[o,a]of Object.entries(r))s[o]=ar(a)}else i.kind=="oneof"?s=i.findField(r.case)?{case:r.case,value:ar(r.value)}:{case:void 0}:s=ar(r);n[i.localName]=s}for(const i of e.runtime.bin.listUnknownFields(A))e.runtime.bin.onUnknownField(n,i.no,i.wireType,i.data);return t}}}function ar(A){if(A===void 0)return A;if(HA(A))return A.clone();if(A instanceof Uint8Array){const e=new Uint8Array(A.byteLength);return e.set(A),e}return A}function ti(A){return A instanceof Uint8Array?A:new Uint8Array(A)}function BB(A,e,t){return{syntax:A,json:oB(),bin:dB(),util:Object.assign(Object.assign({},mB()),{newFieldList:e,initFields:t}),makeMessageType(n,i,r){return $m(this,n,i,r)},makeEnum:jm,makeEnumType:Ml,getEnumType:Gm,makeExtension(n,i,r){return eB(this,n,i,r)}}}class vB{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const t={};for(const n of this.list())t[n.jsonName]=t[n.name]=n;this.jsonNames=t}return this.jsonNames[e]}find(e){if(!this.numbers){const t={};for(const n of this.list())t[n.no]=n;this.numbers=t}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,t)=>e.no-t.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}}function uu(A,e){const t=du(A);return e?t:SB(EB(t))}function CB(A){return uu(A,!1)}const wB=du;function du(A){let e=!1;const t=[];for(let n=0;n<A.length;n++){let i=A.charAt(n);switch(i){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":t.push(i),e=!1;break;default:e&&(e=!1,i=i.toUpperCase()),t.push(i);break}}return t.join("")}const yB=new Set(["constructor","toString","toJSON","valueOf"]),bB=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),hu=A=>"".concat(A,"$"),EB=A=>bB.has(A)?hu(A):A,SB=A=>yB.has(A)?hu(A):A;class UB{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=CB(e)}addField(e){he(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let t=0;t<this.fields.length;t++)this._lookup[this.fields[t].localName]=this.fields[t]}return this._lookup[e]}}function TB(A,e){var t,n,i,r,s,o;const a=[];let c;for(const l of typeof A=="function"?A():A){const u=l;if(u.localName=uu(l.name,l.oneof!==void 0),u.jsonName=(t=l.jsonName)!==null&&t!==void 0?t:wB(l.name),u.repeated=(n=l.repeated)!==null&&n!==void 0?n:!1,l.kind=="scalar"&&(u.L=(i=l.L)!==null&&i!==void 0?i:iA.BIGINT),u.delimited=(r=l.delimited)!==null&&r!==void 0?r:!1,u.req=(s=l.req)!==null&&s!==void 0?s:!1,u.opt=(o=l.opt)!==null&&o!==void 0?o:!1,l.packed===void 0&&(u.packed=l.kind=="enum"||l.kind=="scalar"&&l.T!=T.BYTES&&l.T!=T.STRING),l.oneof!==void 0){const d=typeof l.oneof=="string"?l.oneof:l.oneof.name;(!c||c.name!=d)&&(c=new UB(d)),u.oneof=c,c.addField(u)}a.push(u)}return a}const E=BB("proto3",A=>new vB(A,e=>TB(e)),A=>{for(const e of A.getType().fields.byMember()){if(e.opt)continue;const t=e.localName,n=A;if(e.repeated){n[t]=[];continue}switch(e.kind){case"oneof":n[t]={case:void 0};break;case"enum":n[t]=0;break;case"map":n[t]={};break;case"scalar":n[t]=hn(e.T,e.L);break}}});class Je extends Co{constructor(e){super(),this.seconds=ue.zero,this.nanos=0,E.util.initPartial(e,this)}fromJson(e,t){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(E.json.debug(e)));const n=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const i=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(i))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(i<Date.parse("0001-01-01T00:00:00Z")||i>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=ue.parse(i/1e3),this.nanos=0,n[7]&&(this.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9),this}toJson(e){const t=Number(this.seconds)*1e3;if(t<Date.parse("0001-01-01T00:00:00Z")||t>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let n="Z";if(this.nanos>0){const i=(this.nanos+1e9).toString().substring(1);i.substring(3)==="000000"?n="."+i.substring(0,3)+"Z":i.substring(6)==="000"?n="."+i.substring(0,6)+"Z":n="."+i+"Z"}return new Date(t).toISOString().replace(".000Z",n)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return Je.fromDate(new Date)}static fromDate(e){const t=e.getTime();return new Je({seconds:ue.parse(Math.floor(t/1e3)),nanos:t%1e3*1e6})}static fromBinary(e,t){return new Je().fromBinary(e,t)}static fromJson(e,t){return new Je().fromJson(e,t)}static fromJsonString(e,t){return new Je().fromJsonString(e,t)}static equals(e,t){return E.util.equals(Je,e,t)}}Je.runtime=E,Je.typeName="google.protobuf.Timestamp",Je.fields=E.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const QB=E.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Je},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:FB,repeated:!0},{no:5,name:"events",kind:"message",T:IB,repeated:!0}]),FB=E.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:kB,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),kB=E.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Je},{no:3,name:"value",kind:"scalar",T:2}]),IB=E.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:Je},{no:7,name:"normalized_end_timestamp",kind:"message",T:Je,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),fu=E.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),pt=E.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),we=E.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),gn=E.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),Ai=E.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),ni=E.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),mt=E.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"}]),pn=E.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),_B=E.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),Bt=E.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),cr=E.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:lr,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:Tu}]),lr=E.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),xB=E.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:E.getEnumType(we),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}]),MA=E.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:E.getEnumType(mn)},{no:4,name:"tracks",kind:"message",T:Bn,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:xB},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:E.getEnumType(ur)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:E.getEnumType(mt)},{no:18,name:"kind_details",kind:"enum",T:E.getEnumType(RB),repeated:!0}]),mn=E.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),ur=E.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),RB=E.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),At=E.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),PB=E.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:NA,repeated:!0}]),Bn=E.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:E.getEnumType(pt)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:E.getEnumType(we)},{no:10,name:"layers",kind:"message",T:NA,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:PB,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:E.getEnumType(At)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:Tu},{no:19,name:"audio_features",kind:"enum",T:E.getEnumType(Bt),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:E.getEnumType(fu)}]),NA=E.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:E.getEnumType(gn)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13}]),Xe=E.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:E.getEnumType(Y)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:pu,oneof:"value"},{no:3,name:"speaker",kind:"message",T:LB,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:mu,oneof:"value"},{no:7,name:"transcription",kind:"message",T:DB,oneof:"value"},{no:8,name:"metrics",kind:"message",T:QB,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:So,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:Bu,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:vu,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:Cu,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:To,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Qo,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:Fo,oneof:"value"}]),Y=E.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),LB=E.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:gu,repeated:!0}]),gu=E.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),pu=E.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),mu=E.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),DB=E.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:OB,repeated:!0}]),OB=E.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),So=E.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),Bu=E.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}]),vu=E.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),Cu=E.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:wu,oneof:"value"}]),wu=E.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),yu=E.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),HB=E.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:E.getEnumType(bu)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),bu=E.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),MB=E.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:E.getEnumType(Eu)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9}]),Eu=E.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"}]),Su=E.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:Uu},{no:2,name:"screen",kind:"message",T:Uu},{no:3,name:"resume_connection",kind:"enum",T:E.getEnumType(ni)},{no:4,name:"disabled_codecs",kind:"message",T:NB},{no:5,name:"force_relay",kind:"enum",T:E.getEnumType(ni)}]),Uu=E.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:E.getEnumType(ni)}]),NB=E.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:lr,repeated:!0},{no:2,name:"publish",kind:"message",T:lr,repeated:!0}]),Tu=E.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),Uo=E.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),Qu=E.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:E.getEnumType(Uo)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),Fu=E.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),To=E.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:E.getEnumType(At)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:Qu,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:Fu,oneof:"content_header"}],{localName:"DataStream_Header"}),Qo=E.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),Fo=E.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),vt=E.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),ko=E.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),KB=E.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),VB=E.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:KA,oneof:"message"},{no:2,name:"answer",kind:"message",T:KA,oneof:"message"},{no:3,name:"trickle",kind:"message",T:xo,oneof:"message"},{no:4,name:"add_track",kind:"message",T:_o,oneof:"message"},{no:5,name:"mute",kind:"message",T:Ro,oneof:"message"},{no:6,name:"subscription",kind:"message",T:dr,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:Iu,oneof:"message"},{no:8,name:"leave",kind:"message",T:hr,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:xu,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:Du,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:Ou,oneof:"message"},{no:13,name:"simulate",kind:"message",T:_t,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:Ru,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:Mu,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:_u,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:JB,oneof:"message"}]),ku=E.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:GB,oneof:"message"},{no:2,name:"answer",kind:"message",T:KA,oneof:"message"},{no:3,name:"offer",kind:"message",T:KA,oneof:"message"},{no:4,name:"trickle",kind:"message",T:xo,oneof:"message"},{no:5,name:"update",kind:"message",T:WB,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Po,oneof:"message"},{no:8,name:"leave",kind:"message",T:hr,oneof:"message"},{no:9,name:"mute",kind:"message",T:Ro,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:XB,oneof:"message"},{no:11,name:"room_update",kind:"message",T:qB,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:zB,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:e0,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:A0,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:n0,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:$B,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:jB,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:r0,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:a0,oneof:"message"},{no:22,name:"request_response",kind:"message",T:c0,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:l0,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:i0,oneof:"message"}]),Io=E.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}]),_o=E.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:E.getEnumType(pt)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:E.getEnumType(we)},{no:9,name:"layers",kind:"message",T:NA,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:Io,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:E.getEnumType(At)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:E.getEnumType(fu)},{no:17,name:"audio_features",kind:"enum",T:E.getEnumType(Bt),repeated:!0}]),xo=E.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:E.getEnumType(vt)},{no:3,name:"final",kind:"scalar",T:8}]),Ro=E.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),GB=E.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:cr},{no:2,name:"participant",kind:"message",T:MA},{no:3,name:"other_participants",kind:"message",T:MA,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:Pu,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:Su},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:HB},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:lr,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),jB=E.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:Pu,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:Su}]),Po=E.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Bn}]),$B=E.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),KA=E.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9}]),WB=E.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:MA,repeated:!0}]),dr=E.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:yu,repeated:!0}]),Iu=E.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:E.getEnumType(gn)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),_u=E.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:E.getEnumType(Bt),repeated:!0}]),JB=E.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),hr=E.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:E.getEnumType(mt)},{no:3,name:"action",kind:"enum",T:E.getEnumType(vn)},{no:4,name:"regions",kind:"message",T:s0}]),vn=E.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),xu=E.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:NA,repeated:!0}]),Ru=E.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),Pu=E.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),XB=E.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:gu,repeated:!0}]),qB=E.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:cr}]),YB=E.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:E.getEnumType(Ai)},{no:3,name:"score",kind:"scalar",T:2}]),zB=E.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:YB,repeated:!0}]),ZB=E.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:E.getEnumType(ko)}]),e0=E.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:ZB,repeated:!0}]),Lo=E.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:E.getEnumType(gn)},{no:2,name:"enabled",kind:"scalar",T:8}]),t0=E.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:Lo,repeated:!0}]),A0=E.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:Lo,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:t0,repeated:!0}]),Lu=E.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),Du=E.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:Lu,repeated:!0}]),n0=E.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),i0=E.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:cr},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:MA},{no:4,name:"other_participants",kind:"message",T:MA,repeated:!0}]),Ou=E.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:KA},{no:2,name:"subscription",kind:"message",T:dr},{no:3,name:"publish_tracks",kind:"message",T:Po,repeated:!0},{no:4,name:"data_channels",kind:"message",T:Hu,repeated:!0},{no:5,name:"offer",kind:"message",T:KA},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0}]),Hu=E.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:E.getEnumType(vt)}]),_t=E.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:E.getEnumType(KB),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),Mu=E.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),r0=E.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),s0=E.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:o0,repeated:!0}]),o0=E.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),a0=E.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:E.getEnumType(_B)}]),c0=E.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:E.getEnumType(Do)},{no:3,name:"message",kind:"scalar",T:9}]),Do=E.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"}]),l0=E.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]);function u0(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var fr={exports:{}},d0=fr.exports,Nu;function h0(){return Nu||(Nu=1,function(A){(function(e,t){A.exports?A.exports=t():e.log=t()})(d0,function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},s=null;function o(g,p){var B=g[p];if(typeof B.bind=="function")return B.bind(g);try{return Function.prototype.bind.call(B,g)}catch{return function(){return Function.prototype.apply.apply(B,[g,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(g){return g==="debug"&&(g="log"),typeof console===t?!1:g==="trace"&&n?a:console[g]!==void 0?o(console,g):console.log!==void 0?o(console,"log"):e}function l(){for(var g=this.getLevel(),p=0;p<i.length;p++){var B=i[p];this[B]=p<g?e:this.methodFactory(B,g,this.name)}if(this.log=this.debug,typeof console===t&&g<this.levels.SILENT)return"No console available for logging"}function u(g){return function(){typeof console!==t&&(l.call(this),this[g].apply(this,arguments))}}function d(g,p,B){return c(g)||u.apply(this,arguments)}function h(g,p){var B=this,y,b,v,C="loglevel";typeof g=="string"?C+=":"+g:typeof g=="symbol"&&(C=void 0);function w(H){var M=(i[H]||"silent").toUpperCase();if(!(typeof window===t||!C)){try{window.localStorage[C]=M;return}catch{}try{window.document.cookie=encodeURIComponent(C)+"="+M+";"}catch{}}}function S(){var H;if(!(typeof window===t||!C)){try{H=window.localStorage[C]}catch{}if(typeof H===t)try{var M=window.document.cookie,K=encodeURIComponent(C),Le=M.indexOf(K+"=");Le!==-1&&(H=/^([^;]+)/.exec(M.slice(Le+K.length+1))[1])}catch{}return B.levels[H]===void 0&&(H=void 0),H}}function F(){if(!(typeof window===t||!C)){try{window.localStorage.removeItem(C)}catch{}try{window.document.cookie=encodeURIComponent(C)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function _(H){var M=H;if(typeof M=="string"&&B.levels[M.toUpperCase()]!==void 0&&(M=B.levels[M.toUpperCase()]),typeof M=="number"&&M>=0&&M<=B.levels.SILENT)return M;throw new TypeError("log.setLevel() called with invalid level: "+H)}B.name=g,B.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},B.methodFactory=p||d,B.getLevel=function(){return v??b??y},B.setLevel=function(H,M){return v=_(H),M!==!1&&w(v),l.call(B)},B.setDefaultLevel=function(H){b=_(H),S()||B.setLevel(H,!1)},B.resetLevel=function(){v=null,F(),l.call(B)},B.enableAll=function(H){B.setLevel(B.levels.TRACE,H)},B.disableAll=function(H){B.setLevel(B.levels.SILENT,H)},B.rebuild=function(){if(s!==B&&(y=_(s.getLevel())),l.call(B),s===B)for(var H in r)r[H].rebuild()},y=_(s?s.getLevel():"WARN");var D=S();D!=null&&(v=_(D)),l.call(B)}s=new h,s.getLogger=function(p){if(typeof p!="symbol"&&typeof p!="string"||p==="")throw new TypeError("You must supply a name when creating a logger.");var B=r[p];return B||(B=r[p]=new h(p,s.methodFactory)),B};var f=typeof window!==t?window.log:void 0;return s.noConflict=function(){return typeof window!==t&&window.log===s&&(window.log=f),s},s.getLoggers=function(){return r},s.default=s,s})}(fr)),fr.exports}var gr=h0(),Oo;(function(A){A[A.trace=0]="trace",A[A.debug=1]="debug",A[A.info=2]="info",A[A.warn=3]="warn",A[A.error=4]="error",A[A.silent=5]="silent"})(Oo||(Oo={}));var Ct;(function(A){A.Default="livekit",A.Room="livekit-room",A.Participant="livekit-participant",A.Track="livekit-track",A.Publication="livekit-track-publication",A.Engine="livekit-engine",A.Signal="livekit-signal",A.PCManager="livekit-pc-manager",A.PCTransport="livekit-pc-transport",A.E2EE="lk-e2ee"})(Ct||(Ct={}));let j=gr.getLogger("livekit");Object.values(Ct).map(A=>gr.getLogger(A)),j.setDefaultLevel(Oo.info);function jt(A){const e=gr.getLogger(A);return e.setDefaultLevel(j.getLevel()),e}const f0=gr.getLogger("lk-e2ee"),ii=7e3,g0=[0,300,2*2*300,3*3*300,4*4*300,ii,ii,ii,ii,ii];class p0{constructor(e){this._retryDelays=e!==void 0?[...e]:g0}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const t=this._retryDelays[e.retryCount];return e.retryCount<=1?t:t+Math.random()*1e3}}function m0(A,e){var t={};for(var n in A)Object.prototype.hasOwnProperty.call(A,n)&&e.indexOf(n)<0&&(t[n]=A[n]);if(A!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(A);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(A,n[i])&&(t[n[i]]=A[n[i]]);return t}function m(A,e,t,n){function i(r){return r instanceof t?r:new t(function(s){s(r)})}return new(t||(t=Promise))(function(r,s){function o(l){try{c(n.next(l))}catch(u){s(u)}}function a(l){try{c(n.throw(l))}catch(u){s(u)}}function c(l){l.done?r(l.value):i(l.value).then(o,a)}c((n=n.apply(A,e||[])).next())})}function Ku(A){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&A[e],n=0;if(t)return t.call(A);if(A&&typeof A.length=="number")return{next:function(){return A&&n>=A.length&&(A=void 0),{value:A&&A[n++],done:!A}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function sA(A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=A[Symbol.asyncIterator],t;return e?e.call(A):(A=typeof Ku=="function"?Ku(A):A[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=A[r]&&function(s){return new Promise(function(o,a){s=A[r](s),i(o,a,s.done,s.value)})}}function i(r,s,o,a){Promise.resolve(a).then(function(c){r({value:c,done:o})},s)}}typeof SuppressedError=="function"&&SuppressedError;var pr={exports:{}},Vu;function B0(){if(Vu)return pr.exports;Vu=1;var A=typeof Reflect=="object"?Reflect:null,e=A&&typeof A.apply=="function"?A.apply:function(C,w,S){return Function.prototype.apply.call(C,w,S)},t;A&&typeof A.ownKeys=="function"?t=A.ownKeys:Object.getOwnPropertySymbols?t=function(C){return Object.getOwnPropertyNames(C).concat(Object.getOwnPropertySymbols(C))}:t=function(C){return Object.getOwnPropertyNames(C)};function n(v){console&&console.warn&&console.warn(v)}var i=Number.isNaN||function(C){return C!==C};function r(){r.init.call(this)}pr.exports=r,pr.exports.once=B,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var s=10;function o(v){if(typeof v!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof v)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(v){if(typeof v!="number"||v<0||i(v))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+v+".");s=v}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(C){if(typeof C!="number"||C<0||i(C))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+C+".");return this._maxListeners=C,this};function a(v){return v._maxListeners===void 0?r.defaultMaxListeners:v._maxListeners}r.prototype.getMaxListeners=function(){return a(this)},r.prototype.emit=function(C){for(var w=[],S=1;S<arguments.length;S++)w.push(arguments[S]);var F=C==="error",_=this._events;if(_!==void 0)F=F&&_.error===void 0;else if(!F)return!1;if(F){var D;if(w.length>0&&(D=w[0]),D instanceof Error)throw D;var H=new Error("Unhandled error."+(D?" ("+D.message+")":""));throw H.context=D,H}var M=_[C];if(M===void 0)return!1;if(typeof M=="function")e(M,this,w);else for(var K=M.length,Le=f(M,K),S=0;S<K;++S)e(Le[S],this,w);return!0};function c(v,C,w,S){var F,_,D;if(o(w),_=v._events,_===void 0?(_=v._events=Object.create(null),v._eventsCount=0):(_.newListener!==void 0&&(v.emit("newListener",C,w.listener?w.listener:w),_=v._events),D=_[C]),D===void 0)D=_[C]=w,++v._eventsCount;else if(typeof D=="function"?D=_[C]=S?[w,D]:[D,w]:S?D.unshift(w):D.push(w),F=a(v),F>0&&D.length>F&&!D.warned){D.warned=!0;var H=new Error("Possible EventEmitter memory leak detected. "+D.length+" "+String(C)+" listeners added. Use emitter.setMaxListeners() to increase limit");H.name="MaxListenersExceededWarning",H.emitter=v,H.type=C,H.count=D.length,n(H)}return v}r.prototype.addListener=function(C,w){return c(this,C,w,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(C,w){return c(this,C,w,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(v,C,w){var S={fired:!1,wrapFn:void 0,target:v,type:C,listener:w},F=l.bind(S);return F.listener=w,S.wrapFn=F,F}r.prototype.once=function(C,w){return o(w),this.on(C,u(this,C,w)),this},r.prototype.prependOnceListener=function(C,w){return o(w),this.prependListener(C,u(this,C,w)),this},r.prototype.removeListener=function(C,w){var S,F,_,D,H;if(o(w),F=this._events,F===void 0)return this;if(S=F[C],S===void 0)return this;if(S===w||S.listener===w)--this._eventsCount===0?this._events=Object.create(null):(delete F[C],F.removeListener&&this.emit("removeListener",C,S.listener||w));else if(typeof S!="function"){for(_=-1,D=S.length-1;D>=0;D--)if(S[D]===w||S[D].listener===w){H=S[D].listener,_=D;break}if(_<0)return this;_===0?S.shift():g(S,_),S.length===1&&(F[C]=S[0]),F.removeListener!==void 0&&this.emit("removeListener",C,H||w)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(C){var w,S,F;if(S=this._events,S===void 0)return this;if(S.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):S[C]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete S[C]),this;if(arguments.length===0){var _=Object.keys(S),D;for(F=0;F<_.length;++F)D=_[F],D!=="removeListener"&&this.removeAllListeners(D);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(w=S[C],typeof w=="function")this.removeListener(C,w);else if(w!==void 0)for(F=w.length-1;F>=0;F--)this.removeListener(C,w[F]);return this};function d(v,C,w){var S=v._events;if(S===void 0)return[];var F=S[C];return F===void 0?[]:typeof F=="function"?w?[F.listener||F]:[F]:w?p(F):f(F,F.length)}r.prototype.listeners=function(C){return d(this,C,!0)},r.prototype.rawListeners=function(C){return d(this,C,!1)},r.listenerCount=function(v,C){return typeof v.listenerCount=="function"?v.listenerCount(C):h.call(v,C)},r.prototype.listenerCount=h;function h(v){var C=this._events;if(C!==void 0){var w=C[v];if(typeof w=="function")return 1;if(w!==void 0)return w.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function f(v,C){for(var w=new Array(C),S=0;S<C;++S)w[S]=v[S];return w}function g(v,C){for(;C+1<v.length;C++)v[C]=v[C+1];v.pop()}function p(v){for(var C=new Array(v.length),w=0;w<C.length;++w)C[w]=v[w].listener||v[w];return C}function B(v,C){return new Promise(function(w,S){function F(D){v.removeListener(C,_),S(D)}function _(){typeof v.removeListener=="function"&&v.removeListener("error",F),w([].slice.call(arguments))}b(v,C,_,{once:!0}),C!=="error"&&y(v,F,{once:!0})})}function y(v,C,w){typeof v.on=="function"&&b(v,"error",C,w)}function b(v,C,w,S){if(typeof v.on=="function")S.once?v.once(C,w):v.on(C,w);else if(typeof v.addEventListener=="function")v.addEventListener(C,function F(_){S.once&&v.removeEventListener(C,F),w(_)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof v)}return pr.exports}var xt=B0();let Gu=!0,ju=!0;function mr(A,e,t){const n=A.match(e);return n&&n.length>=t&&parseInt(n[t],10)}function VA(A,e,t){if(!A.RTCPeerConnection)return;const n=A.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(s,o){if(s!==e)return i.apply(this,arguments);const a=c=>{const l=t(c);l&&(o.handleEvent?o.handleEvent(l):o(l))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(o,a),i.apply(this,[s,a])};const r=n.removeEventListener;n.removeEventListener=function(s,o){if(s!==e||!this._eventMap||!this._eventMap[e])return r.apply(this,arguments);if(!this._eventMap[e].has(o))return r.apply(this,arguments);const a=this._eventMap[e].get(o);return this._eventMap[e].delete(o),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,r.apply(this,[s,a])},Object.defineProperty(n,"on"+e,{get(){return this["_on"+e]},set(s){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),s&&this.addEventListener(e,this["_on"+e]=s)},enumerable:!0,configurable:!0})}function v0(A){return typeof A!="boolean"?new Error("Argument type: "+typeof A+". Please use a boolean."):(Gu=A,A?"adapter.js logging disabled":"adapter.js logging enabled")}function C0(A){return typeof A!="boolean"?new Error("Argument type: "+typeof A+". Please use a boolean."):(ju=!A,"adapter.js deprecation warnings "+(A?"disabled":"enabled"))}function $u(){if(typeof window=="object"){if(Gu)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Ho(A,e){ju&&console.warn(A+" is deprecated, please use "+e+" instead.")}function w0(A){const e={browser:null,version:null};if(typeof A>"u"||!A.navigator||!A.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:t}=A;if(t.userAgentData&&t.userAgentData.brands){const n=t.userAgentData.brands.find(i=>i.brand==="Chromium");if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(t.mozGetUserMedia)e.browser="firefox",e.version=mr(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||A.isSecureContext===!1&&A.webkitRTCPeerConnection)e.browser="chrome",e.version=mr(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(A.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=mr(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=A.RTCRtpTransceiver&&"currentDirection"in A.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function Wu(A){return Object.prototype.toString.call(A)==="[object Object]"}function Ju(A){return Wu(A)?Object.keys(A).reduce(function(e,t){const n=Wu(A[t]),i=n?Ju(A[t]):A[t],r=n&&!Object.keys(i).length;return i===void 0||r?e:Object.assign(e,{[t]:i})},{}):A}function Mo(A,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(n=>{n.endsWith("Id")?Mo(A,A.get(e[n]),t):n.endsWith("Ids")&&e[n].forEach(i=>{Mo(A,A.get(i),t)})}))}function Xu(A,e,t){const n=t?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const r=[];return A.forEach(s=>{s.type==="track"&&s.trackIdentifier===e.id&&r.push(s)}),r.forEach(s=>{A.forEach(o=>{o.type===n&&o.trackId===s.id&&Mo(A,o,i)})}),i}const qu=$u;function Yu(A,e){const t=A&&A.navigator;if(!t.mediaDevices)return;const n=function(o){if(typeof o!="object"||o.mandatory||o.optional)return o;const a={};return Object.keys(o).forEach(c=>{if(c==="require"||c==="advanced"||c==="mediaSource")return;const l=typeof o[c]=="object"?o[c]:{ideal:o[c]};l.exact!==void 0&&typeof l.exact=="number"&&(l.min=l.max=l.exact);const u=function(d,h){return d?d+h.charAt(0).toUpperCase()+h.slice(1):h==="deviceId"?"sourceId":h};if(l.ideal!==void 0){a.optional=a.optional||[];let d={};typeof l.ideal=="number"?(d[u("min",c)]=l.ideal,a.optional.push(d),d={},d[u("max",c)]=l.ideal,a.optional.push(d)):(d[u("",c)]=l.ideal,a.optional.push(d))}l.exact!==void 0&&typeof l.exact!="number"?(a.mandatory=a.mandatory||{},a.mandatory[u("",c)]=l.exact):["min","max"].forEach(d=>{l[d]!==void 0&&(a.mandatory=a.mandatory||{},a.mandatory[u(d,c)]=l[d])})}),o.advanced&&(a.optional=(a.optional||[]).concat(o.advanced)),a},i=function(o,a){if(e.version>=61)return a(o);if(o=JSON.parse(JSON.stringify(o)),o&&typeof o.audio=="object"){const c=function(l,u,d){u in l&&!(d in l)&&(l[d]=l[u],delete l[u])};o=JSON.parse(JSON.stringify(o)),c(o.audio,"autoGainControl","googAutoGainControl"),c(o.audio,"noiseSuppression","googNoiseSuppression"),o.audio=n(o.audio)}if(o&&typeof o.video=="object"){let c=o.video.facingMode;c=c&&(typeof c=="object"?c:{ideal:c});const l=e.version<66;if(c&&(c.exact==="user"||c.exact==="environment"||c.ideal==="user"||c.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!l)){delete o.video.facingMode;let u;if(c.exact==="environment"||c.ideal==="environment"?u=["back","rear"]:(c.exact==="user"||c.ideal==="user")&&(u=["front"]),u)return t.mediaDevices.enumerateDevices().then(d=>{d=d.filter(f=>f.kind==="videoinput");let h=d.find(f=>u.some(g=>f.label.toLowerCase().includes(g)));return!h&&d.length&&u.includes("back")&&(h=d[d.length-1]),h&&(o.video.deviceId=c.exact?{exact:h.deviceId}:{ideal:h.deviceId}),o.video=n(o.video),qu("chrome: "+JSON.stringify(o)),a(o)})}o.video=n(o.video)}return qu("chrome: "+JSON.stringify(o)),a(o)},r=function(o){return e.version>=64?o:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[o.name]||o.name,message:o.message,constraint:o.constraint||o.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},s=function(o,a,c){i(o,l=>{t.webkitGetUserMedia(l,a,u=>{c&&c(r(u))})})};if(t.getUserMedia=s.bind(t),t.mediaDevices.getUserMedia){const o=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(a){return i(a,c=>o(c).then(l=>{if(c.audio&&!l.getAudioTracks().length||c.video&&!l.getVideoTracks().length)throw l.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return l},l=>Promise.reject(r(l))))}}}function zu(A){A.MediaStream=A.MediaStream||A.webkitMediaStream}function Zu(A){if(typeof A=="object"&&A.RTCPeerConnection&&!("ontrack"in A.RTCPeerConnection.prototype)){Object.defineProperty(A.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",i=>{let r;A.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.track.id):r={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=r,s.transceiver={receiver:r},s.streams=[n.stream],this.dispatchEvent(s)}),n.stream.getTracks().forEach(i=>{let r;A.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(o=>o.track&&o.track.id===i.id):r={track:i};const s=new Event("track");s.track=i,s.receiver=r,s.transceiver={receiver:r},s.streams=[n.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else VA(A,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ed(A){if(typeof A=="object"&&A.RTCPeerConnection&&!("getSenders"in A.RTCPeerConnection.prototype)&&"createDTMFSender"in A.RTCPeerConnection.prototype){const e=function(i,r){return{track:r,get dtmf(){return this._dtmf===void 0&&(r.kind==="audio"?this._dtmf=i.createDTMFSender(r):this._dtmf=null),this._dtmf},_pc:i}};if(!A.RTCPeerConnection.prototype.getSenders){A.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addTrack=function(o,a){let c=i.apply(this,arguments);return c||(c=e(this,o),this._senders.push(c)),c};const r=A.RTCPeerConnection.prototype.removeTrack;A.RTCPeerConnection.prototype.removeTrack=function(o){r.apply(this,arguments);const a=this._senders.indexOf(o);a!==-1&&this._senders.splice(a,1)}}const t=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(r){this._senders=this._senders||[],t.apply(this,[r]),r.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const n=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(r){this._senders=this._senders||[],n.apply(this,[r]),r.getTracks().forEach(s=>{const o=this._senders.find(a=>a.track===s);o&&this._senders.splice(this._senders.indexOf(o),1)})}}else if(typeof A=="object"&&A.RTCPeerConnection&&"getSenders"in A.RTCPeerConnection.prototype&&"createDTMFSender"in A.RTCPeerConnection.prototype&&A.RTCRtpSender&&!("dtmf"in A.RTCRtpSender.prototype)){const e=A.RTCPeerConnection.prototype.getSenders;A.RTCPeerConnection.prototype.getSenders=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n},Object.defineProperty(A.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function td(A){if(!(typeof A=="object"&&A.RTCPeerConnection&&A.RTCRtpSender&&A.RTCRtpReceiver))return;if(!("getStats"in A.RTCRtpSender.prototype)){const t=A.RTCPeerConnection.prototype.getSenders;t&&(A.RTCPeerConnection.prototype.getSenders=function(){const r=t.apply(this,[]);return r.forEach(s=>s._pc=this),r});const n=A.RTCPeerConnection.prototype.addTrack;n&&(A.RTCPeerConnection.prototype.addTrack=function(){const r=n.apply(this,arguments);return r._pc=this,r}),A.RTCRtpSender.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>Xu(s,r.track,!0))}}if(!("getStats"in A.RTCRtpReceiver.prototype)){const t=A.RTCPeerConnection.prototype.getReceivers;t&&(A.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(r=>r._pc=this),i}),VA(A,"track",n=>(n.receiver._pc=n.srcElement,n)),A.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(r=>Xu(r,i.track,!1))}}if(!("getStats"in A.RTCRtpSender.prototype&&"getStats"in A.RTCRtpReceiver.prototype))return;const e=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof A.MediaStreamTrack){const n=arguments[0];let i,r,s;return this.getSenders().forEach(o=>{o.track===n&&(i?s=!0:i=o)}),this.getReceivers().forEach(o=>(o.track===n&&(r?s=!0:r=o),o.track===n)),s||i&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function Ad(A){A.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addTrack=function(s,o){if(!o)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const a=e.apply(this,arguments);return this._shimmedLocalStreams[o.id]?this._shimmedLocalStreams[o.id].indexOf(a)===-1&&this._shimmedLocalStreams[o.id].push(a):this._shimmedLocalStreams[o.id]=[o,a],a};const t=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(c=>{if(this.getSenders().find(u=>u.track===c))throw new DOMException("Track already exists.","InvalidAccessError")});const o=this.getSenders();t.apply(this,arguments);const a=this.getSenders().filter(c=>o.indexOf(c)===-1);this._shimmedLocalStreams[s.id]=[s].concat(a)};const n=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],n.apply(this,arguments)};const i=A.RTCPeerConnection.prototype.removeTrack;A.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(o=>{const a=this._shimmedLocalStreams[o].indexOf(s);a!==-1&&this._shimmedLocalStreams[o].splice(a,1),this._shimmedLocalStreams[o].length===1&&delete this._shimmedLocalStreams[o]}),i.apply(this,arguments)}}function nd(A,e){if(!A.RTCPeerConnection)return;if(A.RTCPeerConnection.prototype.addTrack&&e.version>=65)return Ad(A);const t=A.RTCPeerConnection.prototype.getLocalStreams;A.RTCPeerConnection.prototype.getLocalStreams=function(){const l=t.apply(this);return this._reverseStreams=this._reverseStreams||{},l.map(u=>this._reverseStreams[u.id])};const n=A.RTCPeerConnection.prototype.addStream;A.RTCPeerConnection.prototype.addStream=function(l){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},l.getTracks().forEach(u=>{if(this.getSenders().find(h=>h.track===u))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[l.id]){const u=new A.MediaStream(l.getTracks());this._streams[l.id]=u,this._reverseStreams[u.id]=l,l=u}n.apply(this,[l])};const i=A.RTCPeerConnection.prototype.removeStream;A.RTCPeerConnection.prototype.removeStream=function(l){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[l.id]||l]),delete this._reverseStreams[this._streams[l.id]?this._streams[l.id].id:l.id],delete this._streams[l.id]},A.RTCPeerConnection.prototype.addTrack=function(l,u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const d=[].slice.call(arguments,1);if(d.length!==1||!d[0].getTracks().find(g=>g===l))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(g=>g.track===l))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const f=this._streams[u.id];if(f)f.addTrack(l),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const g=new A.MediaStream([l]);this._streams[u.id]=g,this._reverseStreams[g.id]=u,this.addStream(g)}return this.getSenders().find(g=>g.track===l)};function r(c,l){let u=l.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const h=c._reverseStreams[d],f=c._streams[h.id];u=u.replace(new RegExp(f.id,"g"),h.id)}),new RTCSessionDescription({type:l.type,sdp:u})}function s(c,l){let u=l.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const h=c._reverseStreams[d],f=c._streams[h.id];u=u.replace(new RegExp(h.id,"g"),f.id)}),new RTCSessionDescription({type:l.type,sdp:u})}["createOffer","createAnswer"].forEach(function(c){const l=A.RTCPeerConnection.prototype[c],u={[c](){const d=arguments;return arguments.length&&typeof arguments[0]=="function"?l.apply(this,[f=>{const g=r(this,f);d[0].apply(null,[g])},f=>{d[1]&&d[1].apply(null,f)},arguments[2]]):l.apply(this,arguments).then(f=>r(this,f))}};A.RTCPeerConnection.prototype[c]=u[c]});const o=A.RTCPeerConnection.prototype.setLocalDescription;A.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?o.apply(this,arguments):(arguments[0]=s(this,arguments[0]),o.apply(this,arguments))};const a=Object.getOwnPropertyDescriptor(A.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(A.RTCPeerConnection.prototype,"localDescription",{get(){const c=a.get.apply(this);return c.type===""?c:r(this,c)}}),A.RTCPeerConnection.prototype.removeTrack=function(l){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!l._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(l._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let d;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(g=>l.track===g)&&(d=this._streams[h])}),d&&(d.getTracks().length===1?this.removeStream(this._reverseStreams[d.id]):d.removeTrack(l.track),this.dispatchEvent(new Event("negotiationneeded")))}}function No(A,e){!A.RTCPeerConnection&&A.webkitRTCPeerConnection&&(A.RTCPeerConnection=A.webkitRTCPeerConnection),A.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const n=A.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new(t==="addIceCandidate"?A.RTCIceCandidate:A.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};A.RTCPeerConnection.prototype[t]=i[t]})}function id(A,e){VA(A,"negotiationneeded",t=>{const n=t.target;if(!((e.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics==="plan-b")&&n.signalingState!=="stable"))return t})}var rd=Object.freeze({__proto__:null,fixNegotiationNeeded:id,shimAddTrackRemoveTrack:nd,shimAddTrackRemoveTrackWithNative:Ad,shimGetSendersWithDtmf:ed,shimGetUserMedia:Yu,shimMediaStream:zu,shimOnTrack:Zu,shimPeerConnection:No,shimSenderReceiverGetStats:td});function sd(A,e){const t=A&&A.navigator,n=A&&A.MediaStreamTrack;if(t.getUserMedia=function(i,r,s){Ho("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),t.mediaDevices.getUserMedia(i).then(r,s)},!(e.version>55&&"autoGainControl"in t.mediaDevices.getSupportedConstraints())){const i=function(s,o,a){o in s&&!(a in s)&&(s[a]=s[o],delete s[o])},r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);if(t.mediaDevices.getUserMedia=function(s){return typeof s=="object"&&typeof s.audio=="object"&&(s=JSON.parse(JSON.stringify(s)),i(s.audio,"autoGainControl","mozAutoGainControl"),i(s.audio,"noiseSuppression","mozNoiseSuppression")),r(s)},n&&n.prototype.getSettings){const s=n.prototype.getSettings;n.prototype.getSettings=function(){const o=s.apply(this,arguments);return i(o,"mozAutoGainControl","autoGainControl"),i(o,"mozNoiseSuppression","noiseSuppression"),o}}if(n&&n.prototype.applyConstraints){const s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(o){return this.kind==="audio"&&typeof o=="object"&&(o=JSON.parse(JSON.stringify(o)),i(o,"autoGainControl","mozAutoGainControl"),i(o,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[o])}}}}function y0(A,e){A.navigator.mediaDevices&&"getDisplayMedia"in A.navigator.mediaDevices||A.navigator.mediaDevices&&(A.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){const i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return n.video===!0?n.video={mediaSource:e}:n.video.mediaSource=e,A.navigator.mediaDevices.getUserMedia(n)})}function od(A){typeof A=="object"&&A.RTCTrackEvent&&"receiver"in A.RTCTrackEvent.prototype&&!("transceiver"in A.RTCTrackEvent.prototype)&&Object.defineProperty(A.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Ko(A,e){if(typeof A!="object"||!(A.RTCPeerConnection||A.mozRTCPeerConnection))return;!A.RTCPeerConnection&&A.mozRTCPeerConnection&&(A.RTCPeerConnection=A.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const r=A.RTCPeerConnection.prototype[i],s={[i](){return arguments[0]=new(i==="addIceCandidate"?A.RTCIceCandidate:A.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};A.RTCPeerConnection.prototype[i]=s[i]});const t={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=A.RTCPeerConnection.prototype.getStats;A.RTCPeerConnection.prototype.getStats=function(){const[r,s,o]=arguments;return n.apply(this,[r||null]).then(a=>{if(e.version<53&&!s)try{a.forEach(c=>{c.type=t[c.type]||c.type})}catch(c){if(c.name!=="TypeError")throw c;a.forEach((l,u)=>{a.set(u,Object.assign({},l,{type:t[l.type]||l.type}))})}return a}).then(s,o)}}function ad(A){if(!(typeof A=="object"&&A.RTCPeerConnection&&A.RTCRtpSender)||A.RTCRtpSender&&"getStats"in A.RTCRtpSender.prototype)return;const e=A.RTCPeerConnection.prototype.getSenders;e&&(A.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(r=>r._pc=this),i});const t=A.RTCPeerConnection.prototype.addTrack;t&&(A.RTCPeerConnection.prototype.addTrack=function(){const i=t.apply(this,arguments);return i._pc=this,i}),A.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function cd(A){if(!(typeof A=="object"&&A.RTCPeerConnection&&A.RTCRtpSender)||A.RTCRtpSender&&"getStats"in A.RTCRtpReceiver.prototype)return;const e=A.RTCPeerConnection.prototype.getReceivers;e&&(A.RTCPeerConnection.prototype.getReceivers=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n}),VA(A,"track",t=>(t.receiver._pc=t.srcElement,t)),A.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function ld(A){!A.RTCPeerConnection||"removeStream"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.removeStream=function(t){Ho("removeStream","removeTrack"),this.getSenders().forEach(n=>{n.track&&t.getTracks().includes(n.track)&&this.removeTrack(n)})})}function ud(A){A.DataChannel&&!A.RTCDataChannel&&(A.RTCDataChannel=A.DataChannel)}function dd(A){if(!(typeof A=="object"&&A.RTCPeerConnection))return;const e=A.RTCPeerConnection.prototype.addTransceiver;e&&(A.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let n=arguments[1]&&arguments[1].sendEncodings;n===void 0&&(n=[]),n=[...n];const i=n.length>0;i&&n.forEach(s=>{if("rid"in s&&!/^[a-z0-9]{0,16}$/i.test(s.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in s&&!(parseFloat(s.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in s&&!(parseFloat(s.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const r=e.apply(this,arguments);if(i){const{sender:s}=r,o=s.getParameters();(!("encodings"in o)||o.encodings.length===1&&Object.keys(o.encodings[0]).length===0)&&(o.encodings=n,s.sendEncodings=n,this.setParametersPromises.push(s.setParameters(o).then(()=>{delete s.sendEncodings}).catch(()=>{delete s.sendEncodings})))}return r})}function hd(A){if(!(typeof A=="object"&&A.RTCRtpSender))return;const e=A.RTCRtpSender.prototype.getParameters;e&&(A.RTCRtpSender.prototype.getParameters=function(){const n=e.apply(this,arguments);return"encodings"in n||(n.encodings=[].concat(this.sendEncodings||[{}])),n})}function fd(A){if(!(typeof A=="object"&&A.RTCPeerConnection))return;const e=A.RTCPeerConnection.prototype.createOffer;A.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function gd(A){if(!(typeof A=="object"&&A.RTCPeerConnection))return;const e=A.RTCPeerConnection.prototype.createAnswer;A.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var pd=Object.freeze({__proto__:null,shimAddTransceiver:dd,shimCreateAnswer:gd,shimCreateOffer:fd,shimGetDisplayMedia:y0,shimGetParameters:hd,shimGetUserMedia:sd,shimOnTrack:od,shimPeerConnection:Ko,shimRTCDataChannel:ud,shimReceiverGetStats:cd,shimRemoveStream:ld,shimSenderGetStats:ad});function md(A){if(!(typeof A!="object"||!A.RTCPeerConnection)){if("getLocalStreams"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in A.RTCPeerConnection.prototype)){const e=A.RTCPeerConnection.prototype.addTrack;A.RTCPeerConnection.prototype.addStream=function(n){this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(i=>e.call(this,i,n)),n.getVideoTracks().forEach(i=>e.call(this,i,n))},A.RTCPeerConnection.prototype.addTrack=function(n){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return r&&r.forEach(o=>{this._localStreams?this._localStreams.includes(o)||this._localStreams.push(o):this._localStreams=[o]}),e.apply(this,arguments)}}"removeStream"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const n=this._localStreams.indexOf(t);if(n===-1)return;this._localStreams.splice(n,1);const i=t.getTracks();this.getSenders().forEach(r=>{i.includes(r.track)&&this.removeTrack(r)})})}}function Bd(A){if(!(typeof A!="object"||!A.RTCPeerConnection)&&("getRemoteStreams"in A.RTCPeerConnection.prototype||(A.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in A.RTCPeerConnection.prototype))){Object.defineProperty(A.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=n=>{n.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const r=new Event("addstream");r.stream=i,this.dispatchEvent(r)})})}});const e=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){const n=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(r=>{if(n._remoteStreams||(n._remoteStreams=[]),n._remoteStreams.indexOf(r)>=0)return;n._remoteStreams.push(r);const s=new Event("addstream");s.stream=r,n.dispatchEvent(s)})}),e.apply(n,arguments)}}}function vd(A){if(typeof A!="object"||!A.RTCPeerConnection)return;const e=A.RTCPeerConnection.prototype,t=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,r=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(c,l){const u=arguments.length>=2?arguments[2]:arguments[0],d=t.apply(this,[u]);return l?(d.then(c,l),Promise.resolve()):d},e.createAnswer=function(c,l){const u=arguments.length>=2?arguments[2]:arguments[0],d=n.apply(this,[u]);return l?(d.then(c,l),Promise.resolve()):d};let o=function(a,c,l){const u=i.apply(this,[a]);return l?(u.then(c,l),Promise.resolve()):u};e.setLocalDescription=o,o=function(a,c,l){const u=r.apply(this,[a]);return l?(u.then(c,l),Promise.resolve()):u},e.setRemoteDescription=o,o=function(a,c,l){const u=s.apply(this,[a]);return l?(u.then(c,l),Promise.resolve()):u},e.addIceCandidate=o}function Cd(A){const e=A&&A.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,n=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=i=>n(wd(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(n,i,r){e.mediaDevices.getUserMedia(n).then(i,r)}.bind(e))}function wd(A){return A&&A.video!==void 0?Object.assign({},A,{video:Ju(A.video)}):A}function yd(A){if(!A.RTCPeerConnection)return;const e=A.RTCPeerConnection;A.RTCPeerConnection=function(n,i){if(n&&n.iceServers){const r=[];for(let s=0;s<n.iceServers.length;s++){let o=n.iceServers[s];o.urls===void 0&&o.url?(Ho("RTCIceServer.url","RTCIceServer.urls"),o=JSON.parse(JSON.stringify(o)),o.urls=o.url,delete o.url,r.push(o)):r.push(n.iceServers[s])}n.iceServers=r}return new e(n,i)},A.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(A.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function bd(A){typeof A=="object"&&A.RTCTrackEvent&&"receiver"in A.RTCTrackEvent.prototype&&!("transceiver"in A.RTCTrackEvent.prototype)&&Object.defineProperty(A.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Ed(A){const e=A.RTCPeerConnection.prototype.createOffer;A.RTCPeerConnection.prototype.createOffer=function(n){if(n){typeof n.offerToReceiveAudio<"u"&&(n.offerToReceiveAudio=!!n.offerToReceiveAudio);const i=this.getTransceivers().find(s=>s.receiver.track.kind==="audio");n.offerToReceiveAudio===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):n.offerToReceiveAudio===!0&&!i&&this.addTransceiver("audio",{direction:"recvonly"}),typeof n.offerToReceiveVideo<"u"&&(n.offerToReceiveVideo=!!n.offerToReceiveVideo);const r=this.getTransceivers().find(s=>s.receiver.track.kind==="video");n.offerToReceiveVideo===!1&&r?r.direction==="sendrecv"?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":r.direction==="recvonly"&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):n.offerToReceiveVideo===!0&&!r&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function Sd(A){typeof A!="object"||A.AudioContext||(A.AudioContext=A.webkitAudioContext)}var Ud=Object.freeze({__proto__:null,shimAudioContext:Sd,shimCallbacksAPI:vd,shimConstraints:wd,shimCreateOfferLegacy:Ed,shimGetUserMedia:Cd,shimLocalStreamsAPI:md,shimRTCIceServerUrls:yd,shimRemoteStreamsAPI:Bd,shimTrackEventTransceiver:bd}),Vo={exports:{}},Td;function b0(){return Td||(Td=1,function(A){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
7
7
  `).map(n=>n.trim())},e.splitSections=function(t){return t.split(`
8
8
  m=`).map((i,r)=>(r>0?"m="+i:i).trim()+`\r
9
9
  `)},e.getDescription=function(t){const n=e.splitSections(t);return n&&n[0]},e.getMediaSections=function(t){const n=e.splitSections(t);return n.shift(),n},e.matchPrefix=function(t,n){return e.splitLines(t).filter(i=>i.indexOf(n)===0)},e.parseCandidate=function(t){let n;t.indexOf("a=candidate:")===0?n=t.substring(12).split(" "):n=t.substring(10).split(" ");const i={foundation:n[0],component:{1:"rtp",2:"rtcp"}[n[1]]||n[1],protocol:n[2].toLowerCase(),priority:parseInt(n[3],10),ip:n[4],address:n[4],port:parseInt(n[5],10),type:n[7]};for(let r=8;r<n.length;r+=2)switch(n[r]){case"raddr":i.relatedAddress=n[r+1];break;case"rport":i.relatedPort=parseInt(n[r+1],10);break;case"tcptype":i.tcpType=n[r+1];break;case"ufrag":i.ufrag=n[r+1],i.usernameFragment=n[r+1];break;default:i[n[r]]===void 0&&(i[n[r]]=n[r+1]);break}return i},e.writeCandidate=function(t){const n=[];n.push(t.foundation);const i=t.component;i==="rtp"?n.push(1):i==="rtcp"?n.push(2):n.push(i),n.push(t.protocol.toUpperCase()),n.push(t.priority),n.push(t.address||t.ip),n.push(t.port);const r=t.type;return n.push("typ"),n.push(r),r!=="host"&&t.relatedAddress&&t.relatedPort&&(n.push("raddr"),n.push(t.relatedAddress),n.push("rport"),n.push(t.relatedPort)),t.tcpType&&t.protocol.toLowerCase()==="tcp"&&(n.push("tcptype"),n.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(n.push("ufrag"),n.push(t.usernameFragment||t.ufrag)),"candidate:"+n.join(" ")},e.parseIceOptions=function(t){return t.substring(14).split(" ")},e.parseRtpMap=function(t){let n=t.substring(9).split(" ");const i={payloadType:parseInt(n.shift(),10)};return n=n[0].split("/"),i.name=n[0],i.clockRate=parseInt(n[1],10),i.channels=n.length===3?parseInt(n[2],10):1,i.numChannels=i.channels,i},e.writeRtpMap=function(t){let n=t.payloadType;t.preferredPayloadType!==void 0&&(n=t.preferredPayloadType);const i=t.channels||t.numChannels||1;return"a=rtpmap:"+n+" "+t.name+"/"+t.clockRate+(i!==1?"/"+i:"")+`\r
@@ -34,12 +34,12 @@ a=ice-pwd:`+t.password+`\r
34
34
  o=`+(i||"thisisadapterortc")+" "+r+" "+s+` IN IP4 127.0.0.1\r
35
35
  s=-\r
36
36
  t=0 0\r
37
- `},e.getDirection=function(t,n){const i=e.splitLines(t);for(let r=0;r<i.length;r++)switch(i[r]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[r].substring(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substring(2)},e.isRejected=function(t){return t.split(" ",2)[1]==="0"},e.parseMLine=function(t){const i=e.splitLines(t)[0].substring(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},e.parseOLine=function(t){const i=e.matchPrefix(t,"o=")[0].substring(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},e.isValidSDP=function(t){if(typeof t!="string"||t.length===0)return!1;const n=e.splitLines(t);for(let i=0;i<n.length;i++)if(n[i].length<2||n[i].charAt(1)!=="=")return!1;return!0},A.exports=e}(Go)),Go.exports}var Qd=b0(),Cn=u0(Qd),E0=Lm({__proto__:null,default:Cn},[Qd]);function Br(A){if(!A.RTCIceCandidate||A.RTCIceCandidate&&"foundation"in A.RTCIceCandidate.prototype)return;const e=A.RTCIceCandidate;A.RTCIceCandidate=function(n){if(typeof n=="object"&&n.candidate&&n.candidate.indexOf("a=")===0&&(n=JSON.parse(JSON.stringify(n)),n.candidate=n.candidate.substring(2)),n.candidate&&n.candidate.length){const i=new e(n),r=Cn.parseCandidate(n.candidate);for(const s in r)s in i||Object.defineProperty(i,s,{value:r[s]});return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(n)},A.RTCIceCandidate.prototype=e.prototype,KA(A,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new A.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Vo(A){!A.RTCIceCandidate||A.RTCIceCandidate&&"relayProtocol"in A.RTCIceCandidate.prototype||KA(A,"icecandidate",e=>{if(e.candidate){const t=Cn.parseCandidate(e.candidate.candidate);t.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e})}function vr(A,e){if(!A.RTCPeerConnection)return;"sctp"in A.RTCPeerConnection.prototype||Object.defineProperty(A.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const t=function(o){if(!o||!o.sdp)return!1;const a=Cn.splitSections(o.sdp);return a.shift(),a.some(c=>{const l=Cn.parseMLine(c);return l&&l.kind==="application"&&l.protocol.indexOf("SCTP")!==-1})},n=function(o){const a=o.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(a===null||a.length<2)return-1;const c=parseInt(a[1],10);return c!==c?-1:c},i=function(o){let a=65536;return e.browser==="firefox"&&(e.version<57?o===-1?a=16384:a=2147483637:e.version<60?a=e.version===57?65535:65536:a=2147483637),a},r=function(o,a){let c=65536;e.browser==="firefox"&&e.version===57&&(c=65535);const l=Cn.matchPrefix(o.sdp,"a=max-message-size:");return l.length>0?c=parseInt(l[0].substring(19),10):e.browser==="firefox"&&a!==-1&&(c=2147483637),c},s=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:a}=this.getConfiguration();a==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(t(arguments[0])){const a=n(arguments[0]),c=i(a),l=r(arguments[0],a);let u;c===0&&l===0?u=Number.POSITIVE_INFINITY:c===0||l===0?u=Math.max(c,l):u=Math.min(c,l);const d={};Object.defineProperty(d,"maxMessageSize",{get(){return u}}),this._sctp=d}return s.apply(this,arguments)}}function Cr(A){if(!(A.RTCPeerConnection&&"createDataChannel"in A.RTCPeerConnection.prototype))return;function e(n,i){const r=n.send;n.send=function(){const o=arguments[0],a=o.length||o.size||o.byteLength;if(n.readyState==="open"&&i.sctp&&a>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return r.apply(n,arguments)}}const t=A.RTCPeerConnection.prototype.createDataChannel;A.RTCPeerConnection.prototype.createDataChannel=function(){const i=t.apply(this,arguments);return e(i,this),i},KA(A,"datachannel",n=>(e(n.channel,n.target),n))}function jo(A){if(!A.RTCPeerConnection||"connectionState"in A.RTCPeerConnection.prototype)return;const e=A.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const n=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const r=i.target;if(r._lastConnectionState!==r.connectionState){r._lastConnectionState=r.connectionState;const s=new Event("connectionstatechange",i);r.dispatchEvent(s)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function $o(A,e){if(!A.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e.version>=605)return;const t=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(i){if(i&&i.sdp&&i.sdp.indexOf(`
37
+ `},e.getDirection=function(t,n){const i=e.splitLines(t);for(let r=0;r<i.length;r++)switch(i[r]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[r].substring(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substring(2)},e.isRejected=function(t){return t.split(" ",2)[1]==="0"},e.parseMLine=function(t){const i=e.splitLines(t)[0].substring(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},e.parseOLine=function(t){const i=e.matchPrefix(t,"o=")[0].substring(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},e.isValidSDP=function(t){if(typeof t!="string"||t.length===0)return!1;const n=e.splitLines(t);for(let i=0;i<n.length;i++)if(n[i].length<2||n[i].charAt(1)!=="=")return!1;return!0},A.exports=e}(Vo)),Vo.exports}var Qd=b0(),Cn=u0(Qd),E0=Lm({__proto__:null,default:Cn},[Qd]);function Br(A){if(!A.RTCIceCandidate||A.RTCIceCandidate&&"foundation"in A.RTCIceCandidate.prototype)return;const e=A.RTCIceCandidate;A.RTCIceCandidate=function(n){if(typeof n=="object"&&n.candidate&&n.candidate.indexOf("a=")===0&&(n=JSON.parse(JSON.stringify(n)),n.candidate=n.candidate.substring(2)),n.candidate&&n.candidate.length){const i=new e(n),r=Cn.parseCandidate(n.candidate);for(const s in r)s in i||Object.defineProperty(i,s,{value:r[s]});return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(n)},A.RTCIceCandidate.prototype=e.prototype,VA(A,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new A.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Go(A){!A.RTCIceCandidate||A.RTCIceCandidate&&"relayProtocol"in A.RTCIceCandidate.prototype||VA(A,"icecandidate",e=>{if(e.candidate){const t=Cn.parseCandidate(e.candidate.candidate);t.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e})}function vr(A,e){if(!A.RTCPeerConnection)return;"sctp"in A.RTCPeerConnection.prototype||Object.defineProperty(A.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const t=function(o){if(!o||!o.sdp)return!1;const a=Cn.splitSections(o.sdp);return a.shift(),a.some(c=>{const l=Cn.parseMLine(c);return l&&l.kind==="application"&&l.protocol.indexOf("SCTP")!==-1})},n=function(o){const a=o.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(a===null||a.length<2)return-1;const c=parseInt(a[1],10);return c!==c?-1:c},i=function(o){let a=65536;return e.browser==="firefox"&&(e.version<57?o===-1?a=16384:a=2147483637:e.version<60?a=e.version===57?65535:65536:a=2147483637),a},r=function(o,a){let c=65536;e.browser==="firefox"&&e.version===57&&(c=65535);const l=Cn.matchPrefix(o.sdp,"a=max-message-size:");return l.length>0?c=parseInt(l[0].substring(19),10):e.browser==="firefox"&&a!==-1&&(c=2147483637),c},s=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:a}=this.getConfiguration();a==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(t(arguments[0])){const a=n(arguments[0]),c=i(a),l=r(arguments[0],a);let u;c===0&&l===0?u=Number.POSITIVE_INFINITY:c===0||l===0?u=Math.max(c,l):u=Math.min(c,l);const d={};Object.defineProperty(d,"maxMessageSize",{get(){return u}}),this._sctp=d}return s.apply(this,arguments)}}function Cr(A){if(!(A.RTCPeerConnection&&"createDataChannel"in A.RTCPeerConnection.prototype))return;function e(n,i){const r=n.send;n.send=function(){const o=arguments[0],a=o.length||o.size||o.byteLength;if(n.readyState==="open"&&i.sctp&&a>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return r.apply(n,arguments)}}const t=A.RTCPeerConnection.prototype.createDataChannel;A.RTCPeerConnection.prototype.createDataChannel=function(){const i=t.apply(this,arguments);return e(i,this),i},VA(A,"datachannel",n=>(e(n.channel,n.target),n))}function jo(A){if(!A.RTCPeerConnection||"connectionState"in A.RTCPeerConnection.prototype)return;const e=A.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const n=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const r=i.target;if(r._lastConnectionState!==r.connectionState){r._lastConnectionState=r.connectionState;const s=new Event("connectionstatechange",i);r.dispatchEvent(s)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function $o(A,e){if(!A.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e.version>=605)return;const t=A.RTCPeerConnection.prototype.setRemoteDescription;A.RTCPeerConnection.prototype.setRemoteDescription=function(i){if(i&&i.sdp&&i.sdp.indexOf(`
38
38
  a=extmap-allow-mixed`)!==-1){const r=i.sdp.split(`
39
39
  `).filter(s=>s.trim()!=="a=extmap-allow-mixed").join(`
40
- `);A.RTCSessionDescription&&i instanceof A.RTCSessionDescription?arguments[0]=new A.RTCSessionDescription({type:i.type,sdp:r}):i.sdp=r}return t.apply(this,arguments)}}function wr(A,e){if(!(A.RTCPeerConnection&&A.RTCPeerConnection.prototype))return;const t=A.RTCPeerConnection.prototype.addIceCandidate;!t||t.length===0||(A.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function yr(A,e){if(!(A.RTCPeerConnection&&A.RTCPeerConnection.prototype))return;const t=A.RTCPeerConnection.prototype.setLocalDescription;!t||t.length===0||(A.RTCPeerConnection.prototype.setLocalDescription=function(){let i=arguments[0]||{};if(typeof i!="object"||i.type&&i.sdp)return t.apply(this,arguments);if(i={type:i.type,sdp:i.sdp},!i.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer";break}return i.sdp||i.type!=="offer"&&i.type!=="answer"?t.apply(this,[i]):(i.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(s=>t.apply(this,[s]))})}var S0=Object.freeze({__proto__:null,removeExtmapAllowMixed:$o,shimAddIceCandidateNullOrEmpty:wr,shimConnectionState:jo,shimMaxMessageSize:vr,shimParameterlessSetLocalDescription:yr,shimRTCIceCandidate:Br,shimRTCIceCandidateRelayProtocol:Vo,shimSendThrowTypeError:Cr});function U0(){let{window:A}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const t=$u,n=w0(A),i={browserDetails:n,commonShim:S0,extractVersion:mr,disableLog:v0,disableWarnings:C0,sdp:E0};switch(n.browser){case"chrome":if(!rd||!No||!e.shimChrome)return t("Chrome shim is not included in this adapter release."),i;if(n.version===null)return t("Chrome shim can not determine version, not shimming."),i;t("adapter.js shimming chrome."),i.browserShim=rd,wr(A,n),yr(A),Yu(A,n),zu(A),No(A,n),Zu(A),nd(A,n),ed(A),td(A),id(A,n),Br(A),Vo(A),jo(A),vr(A,n),Cr(A),$o(A,n);break;case"firefox":if(!pd||!Ko||!e.shimFirefox)return t("Firefox shim is not included in this adapter release."),i;t("adapter.js shimming firefox."),i.browserShim=pd,wr(A,n),yr(A),sd(A,n),Ko(A,n),od(A),ld(A),ad(A),cd(A),ud(A),dd(A),hd(A),fd(A),gd(A),Br(A),jo(A),vr(A,n),Cr(A);break;case"safari":if(!Ud||!e.shimSafari)return t("Safari shim is not included in this adapter release."),i;t("adapter.js shimming safari."),i.browserShim=Ud,wr(A,n),yr(A),yd(A),Ed(A),vd(A),md(A),Bd(A),bd(A),Cd(A),Sd(A),Br(A),Vo(A),vr(A,n),Cr(A),$o(A,n);break;default:t("Unsupported browser!");break}return i}U0({window:typeof window>"u"?void 0:window});const T0=10,br="lk_e2ee",Q0={sharedKey:!1,ratchetSalt:"LKFrameEncryptionKey",ratchetWindowSize:8,failureTolerance:T0,keyringSize:16};var oA;(function(A){A.SetKey="setKey",A.RatchetRequest="ratchetRequest",A.KeyRatcheted="keyRatcheted"})(oA||(oA={}));var Fd;(function(A){A.KeyRatcheted="keyRatcheted"})(Fd||(Fd={}));var aA;(function(A){A.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",A.EncryptionError="encryptionError"})(aA||(aA={}));var kd;(function(A){A.Error="cryptorError"})(kd||(kd={}));function F0(){return k0()||Wo()}function Wo(){return typeof window.RTCRtpScriptTransform<"u"}function k0(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}class k_ extends xt.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(t,n,i)=>{j.debug("key ratcheted event received",{ratchetResult:t,participantId:n,keyIndex:i})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Q0),e),this.on(oA.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,t,n){const i={key:e,participantIdentity:t,keyIndex:n};if(!this.options.sharedKey&&!t)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(t??"shared","-").concat(n??0),i),this.emit(oA.SetKey,i)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,t){this.emit(oA.RatchetRequest,e,t)}}class cA extends Error{constructor(e,t){super(t||"an error has occured"),this.name="LiveKitError",this.code=e}}var W;(function(A){A[A.NotAllowed=0]="NotAllowed",A[A.ServerUnreachable=1]="ServerUnreachable",A[A.InternalError=2]="InternalError",A[A.Cancelled=3]="Cancelled",A[A.LeaveRequest=4]="LeaveRequest"})(W||(W={}));class se extends cA{constructor(e,t,n,i){super(1,e),this.name="ConnectionError",this.status=n,this.reason=t,this.context=i,this.reasonName=W[t]}}class Jo extends cA{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class jt extends cA{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class I0 extends cA{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class Ee extends cA{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class Xo extends cA{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class qo extends cA{constructor(e,t){super(15,e),this.name="PublishTrackError",this.status=t}}class Id extends cA{constructor(e,t){super(15,e),this.reason=t,this.reasonName=typeof t=="string"?t:Do[t]}}var Er;(function(A){A.PermissionDenied="PermissionDenied",A.NotFound="NotFound",A.DeviceInUse="DeviceInUse",A.Other="Other"})(Er||(Er={})),function(A){function e(t){if(t&&"name"in t)return t.name==="NotFoundError"||t.name==="DevicesNotFoundError"?A.NotFound:t.name==="NotAllowedError"||t.name==="PermissionDeniedError"?A.PermissionDenied:t.name==="NotReadableError"||t.name==="TrackStartError"?A.DeviceInUse:A.Other}A.getFailure=e}(Er||(Er={}));var _d;(function(A){A[A.InvalidKey=0]="InvalidKey",A[A.MissingKey=1]="MissingKey",A[A.InternalError=2]="InternalError"})(_d||(_d={}));var Q;(function(A){A.Connected="connected",A.Reconnecting="reconnecting",A.SignalReconnecting="signalReconnecting",A.Reconnected="reconnected",A.Disconnected="disconnected",A.ConnectionStateChanged="connectionStateChanged",A.Moved="moved",A.MediaDevicesChanged="mediaDevicesChanged",A.ParticipantConnected="participantConnected",A.ParticipantDisconnected="participantDisconnected",A.TrackPublished="trackPublished",A.TrackSubscribed="trackSubscribed",A.TrackSubscriptionFailed="trackSubscriptionFailed",A.TrackUnpublished="trackUnpublished",A.TrackUnsubscribed="trackUnsubscribed",A.TrackMuted="trackMuted",A.TrackUnmuted="trackUnmuted",A.LocalTrackPublished="localTrackPublished",A.LocalTrackUnpublished="localTrackUnpublished",A.LocalAudioSilenceDetected="localAudioSilenceDetected",A.ActiveSpeakersChanged="activeSpeakersChanged",A.ParticipantMetadataChanged="participantMetadataChanged",A.ParticipantNameChanged="participantNameChanged",A.ParticipantAttributesChanged="participantAttributesChanged",A.ParticipantActive="participantActive",A.RoomMetadataChanged="roomMetadataChanged",A.DataReceived="dataReceived",A.SipDTMFReceived="sipDTMFReceived",A.TranscriptionReceived="transcriptionReceived",A.ConnectionQualityChanged="connectionQualityChanged",A.TrackStreamStateChanged="trackStreamStateChanged",A.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",A.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",A.AudioPlaybackStatusChanged="audioPlaybackChanged",A.VideoPlaybackStatusChanged="videoPlaybackChanged",A.MediaDevicesError="mediaDevicesError",A.ParticipantPermissionsChanged="participantPermissionsChanged",A.SignalConnected="signalConnected",A.RecordingStatusChanged="recordingStatusChanged",A.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",A.EncryptionError="encryptionError",A.DCBufferStatusChanged="dcBufferStatusChanged",A.ActiveDeviceChanged="activeDeviceChanged",A.ChatMessage="chatMessage",A.LocalTrackSubscribed="localTrackSubscribed",A.MetricsReceived="metricsReceived"})(Q||(Q={}));var x;(function(A){A.TrackPublished="trackPublished",A.TrackSubscribed="trackSubscribed",A.TrackSubscriptionFailed="trackSubscriptionFailed",A.TrackUnpublished="trackUnpublished",A.TrackUnsubscribed="trackUnsubscribed",A.TrackMuted="trackMuted",A.TrackUnmuted="trackUnmuted",A.LocalTrackPublished="localTrackPublished",A.LocalTrackUnpublished="localTrackUnpublished",A.ParticipantMetadataChanged="participantMetadataChanged",A.ParticipantNameChanged="participantNameChanged",A.DataReceived="dataReceived",A.SipDTMFReceived="sipDTMFReceived",A.TranscriptionReceived="transcriptionReceived",A.IsSpeakingChanged="isSpeakingChanged",A.ConnectionQualityChanged="connectionQualityChanged",A.TrackStreamStateChanged="trackStreamStateChanged",A.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",A.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",A.MediaDevicesError="mediaDevicesError",A.AudioStreamAcquired="audioStreamAcquired",A.ParticipantPermissionsChanged="participantPermissionsChanged",A.PCTrackAdded="pcTrackAdded",A.AttributesChanged="attributesChanged",A.LocalTrackSubscribed="localTrackSubscribed",A.ChatMessage="chatMessage",A.Active="active"})(x||(x={}));var I;(function(A){A.TransportsCreated="transportsCreated",A.Connected="connected",A.Disconnected="disconnected",A.Resuming="resuming",A.Resumed="resumed",A.Restarting="restarting",A.Restarted="restarted",A.SignalResumed="signalResumed",A.SignalRestarted="signalRestarted",A.Closing="closing",A.MediaTrackAdded="mediaTrackAdded",A.ActiveSpeakersUpdate="activeSpeakersUpdate",A.DataPacketReceived="dataPacketReceived",A.RTPVideoMapUpdate="rtpVideoMapUpdate",A.DCBufferStatusChanged="dcBufferStatusChanged",A.ParticipantUpdate="participantUpdate",A.RoomUpdate="roomUpdate",A.SpeakersChanged="speakersChanged",A.StreamStateChanged="streamStateChanged",A.ConnectionQualityUpdate="connectionQualityUpdate",A.SubscriptionError="subscriptionError",A.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",A.RemoteMute="remoteMute",A.SubscribedQualityUpdate="subscribedQualityUpdate",A.LocalTrackUnpublished="localTrackUnpublished",A.LocalTrackSubscribed="localTrackSubscribed",A.Offline="offline",A.SignalRequestResponse="signalRequestResponse",A.SignalConnected="signalConnected",A.RoomMoved="roomMoved"})(I||(I={}));var k;(function(A){A.Message="message",A.Muted="muted",A.Unmuted="unmuted",A.Restarted="restarted",A.Ended="ended",A.Subscribed="subscribed",A.Unsubscribed="unsubscribed",A.UpdateSettings="updateSettings",A.UpdateSubscription="updateSubscription",A.AudioPlaybackStarted="audioPlaybackStarted",A.AudioPlaybackFailed="audioPlaybackFailed",A.AudioSilenceDetected="audioSilenceDetected",A.VisibilityChanged="visibilityChanged",A.VideoDimensionsChanged="videoDimensionsChanged",A.VideoPlaybackStarted="videoPlaybackStarted",A.VideoPlaybackFailed="videoPlaybackFailed",A.ElementAttached="elementAttached",A.ElementDetached="elementDetached",A.UpstreamPaused="upstreamPaused",A.UpstreamResumed="upstreamResumed",A.SubscriptionPermissionChanged="subscriptionPermissionChanged",A.SubscriptionStatusChanged="subscriptionStatusChanged",A.SubscriptionFailed="subscriptionFailed",A.TrackProcessorUpdate="trackProcessorUpdate",A.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",A.TranscriptionReceived="transcriptionReceived",A.TimeSyncUpdate="timeSyncUpdate"})(k||(k={}));function _0(A){return typeof A>"u"?A:typeof structuredClone=="function"?structuredClone(A):JSON.parse(JSON.stringify(A))}const x0=/version\/(\d+(\.?_?\d+)+)/i;let Yo;function wt(A){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof A>"u"&&typeof navigator>"u")return;const t=(A??navigator.userAgent).toLowerCase();if(Yo===void 0||e){const n=R0.find(i=>{let{test:r}=i;return r.test(t)});Yo=n?.describe(t)}return Yo}const R0=[{test:/firefox|iceweasel|fxios/i,describe(A){return{name:"Firefox",version:Sr(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,A),os:A.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:zo(A)}}},{test:/chrom|crios|crmo/i,describe(A){return{name:"Chrome",version:Sr(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,A),os:A.toLowerCase().includes("crios")?"iOS":void 0,osVersion:zo(A)}}},{test:/safari|applewebkit/i,describe(A){return{name:"Safari",version:Sr(x0,A),os:A.includes("mobile/")?"iOS":"macOS",osVersion:zo(A)}}}];function Sr(A,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const n=e.match(A);return n&&n.length>=t&&n[t]||""}function zo(A){return A.includes("mac os")?Sr(/\(.+?(\d+_\d+(:?_\d+)?)/,A,1).replace(/_/g,"."):void 0}var P0="2.13.0";const L0=P0,D0=16;class Fe{}Fe.setTimeout=function(){return setTimeout(...arguments)},Fe.setInterval=function(){return setInterval(...arguments)},Fe.clearTimeout=function(){return clearTimeout(...arguments)},Fe.clearInterval=function(){return clearInterval(...arguments)};const O0=5e3,ri=[];var at;(function(A){A[A.LOW=0]="LOW",A[A.MEDIUM=1]="MEDIUM",A[A.HIGH=2]="HIGH"})(at||(at={}));class U extends xt.EventEmitter{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var i;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=U.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=j,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),O0):this.handleAppVisibilityChanged()},this.log=Vt((i=n.loggerName)!==null&&i!==void 0?i:Ct.Track),this.loggerContextCb=n.loggerContextCb,this.setMaxListeners(100),this.kind=t,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=U.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),Z(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let t="audio";this.kind===U.Kind.Video&&(t="video"),this.attachedElements.length===0&&this.kind===U.Kind.Video&&this.addAppVisibilityListener(),e||(t==="audio"&&(ri.forEach(r=>{r.parentElement===null&&!e&&(e=r)}),e&&ri.splice(ri.indexOf(e),1)),e||(e=document.createElement(t))),this.attachedElements.includes(e)||this.attachedElements.push(e),wn(this.mediaStreamTrack,e);const n=e.srcObject.getTracks(),i=n.some(r=>r.kind==="audio");return e.play().then(()=>{this.emit(i?k.AudioPlaybackStarted:k.VideoPlaybackStarted)}).catch(r=>{r.name==="NotAllowedError"?this.emit(i?k.AudioPlaybackFailed:k.VideoPlaybackFailed,r):r.name==="AbortError"?j.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):j.warn("could not playback ".concat(i?"audio":"video"),r),i&&e&&n.some(s=>s.kind==="video")&&r.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(k.ElementAttached,e),e}detach(e){try{if(e){yn(this.mediaStreamTrack,e);const n=this.attachedElements.indexOf(e);return n>=0&&(this.attachedElements.splice(n,1),this.recycleElement(e),this.emit(k.ElementDetached,e)),e}const t=[];return this.attachedElements.forEach(n=>{yn(this.mediaStreamTrack,n),t.push(n),this.recycleElement(n),this.emit(k.ElementDetached,n)}),this.attachedElements=[],t}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=Vt(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let t=!0;e.pause(),ri.forEach(n=>{n.parentElement||(t=!1)}),t&&ri.push(e)}}handleAppVisibilityChanged(){return m(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===U.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){Ye()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Ye()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function wn(A,e){let t;e.srcObject instanceof MediaStream?t=e.srcObject:t=new MediaStream;let n;A.kind==="audio"?n=t.getAudioTracks():n=t.getVideoTracks(),n.includes(A)||(n.forEach(i=>{t.removeTrack(i)}),t.addTrack(A)),(!lA()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=t.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==t&&(e.srcObject=t,(lA()||bn())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=t,e.play().catch(()=>{})},0))}function yn(A,e){if(e.srcObject instanceof MediaStream){const t=e.srcObject;t.removeTrack(A),t.getTracks().length>0?e.srcObject=t:e.srcObject=null}}(function(A){let e;(function(c){c.Audio="audio",c.Video="video",c.Unknown="unknown"})(e=A.Kind||(A.Kind={}));let t;(function(c){c.Camera="camera",c.Microphone="microphone",c.ScreenShare="screen_share",c.ScreenShareAudio="screen_share_audio",c.Unknown="unknown"})(t=A.Source||(A.Source={}));let n;(function(c){c.Active="active",c.Paused="paused",c.Unknown="unknown"})(n=A.StreamState||(A.StreamState={}));function i(c){switch(c){case e.Audio:return pt.AUDIO;case e.Video:return pt.VIDEO;default:return pt.DATA}}A.kindToProto=i;function r(c){switch(c){case pt.AUDIO:return e.Audio;case pt.VIDEO:return e.Video;default:return e.Unknown}}A.kindFromProto=r;function s(c){switch(c){case t.Camera:return we.CAMERA;case t.Microphone:return we.MICROPHONE;case t.ScreenShare:return we.SCREEN_SHARE;case t.ScreenShareAudio:return we.SCREEN_SHARE_AUDIO;default:return we.UNKNOWN}}A.sourceToProto=s;function o(c){switch(c){case we.CAMERA:return t.Camera;case we.MICROPHONE:return t.Microphone;case we.SCREEN_SHARE:return t.ScreenShare;case we.SCREEN_SHARE_AUDIO:return t.ScreenShareAudio;default:return t.Unknown}}A.sourceFromProto=o;function a(c){switch(c){case ko.ACTIVE:return n.Active;case ko.PAUSED:return n.Paused;default:return n.Unknown}}A.streamStateFromProto=a})(U||(U={}));class re{constructor(e,t,n,i,r){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(t!==void 0&&n!==void 0)this.width=e,this.height=t,this.aspectRatio=e/t,this.encoding={maxBitrate:n,maxFramerate:i,priority:r};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const H0=["vp8","h264"],M0=["vp8","h264","vp9","av1"];function N0(A){return!!H0.find(e=>e===A)}var xd;(function(A){A[A.PREFER_REGRESSION=0]="PREFER_REGRESSION",A[A.SIMULCAST=1]="SIMULCAST",A[A.REGRESSION=2]="REGRESSION"})(xd||(xd={}));var Zo;(function(A){A.telephone={maxBitrate:12e3},A.speech={maxBitrate:24e3},A.music={maxBitrate:48e3},A.musicStereo={maxBitrate:64e3},A.musicHighQuality={maxBitrate:96e3},A.musicHighQualityStereo={maxBitrate:128e3}})(Zo||(Zo={}));const si={h90:new re(160,90,9e4,20),h180:new re(320,180,16e4,20),h216:new re(384,216,18e4,20),h360:new re(640,360,45e4,20),h540:new re(960,540,8e5,25),h720:new re(1280,720,17e5,30),h1080:new re(1920,1080,3e6,30),h1440:new re(2560,1440,5e6,30),h2160:new re(3840,2160,8e6,30)},ea={h120:new re(160,120,7e4,20),h180:new re(240,180,125e3,20),h240:new re(320,240,14e4,20),h360:new re(480,360,33e4,20),h480:new re(640,480,5e5,20),h540:new re(720,540,6e5,25),h720:new re(960,720,13e5,30),h1080:new re(1440,1080,23e5,30),h1440:new re(1920,1440,38e5,30)},ta={h360fps3:new re(640,360,2e5,3,"medium"),h360fps15:new re(640,360,4e5,15,"medium"),h720fps5:new re(1280,720,8e5,5,"medium"),h720fps15:new re(1280,720,15e5,15,"medium"),h720fps30:new re(1280,720,2e6,30,"medium"),h1080fps15:new re(1920,1080,25e5,15,"medium"),h1080fps30:new re(1920,1080,5e6,30,"medium"),original:new re(0,0,7e6,30,"medium")},K0="|",Rd="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function G0(A){const e=A.split(K0);return e.length>1?[e[0],A.substr(e[0].length+1)]:[A,""]}function qe(A){return m(this,void 0,void 0,function*(){return new Promise(e=>Fe.setTimeout(e,A))})}function Aa(){return"addTransceiver"in RTCPeerConnection.prototype}function na(){return"addTrack"in RTCPeerConnection.prototype}function V0(){if(!("getCapabilities"in RTCRtpSender)||lA())return!1;const A=RTCRtpSender.getCapabilities("video");let e=!1;if(A){for(const t of A.codecs)if(t.mimeType==="video/AV1"){e=!0;break}}return e}function j0(){if(!("getCapabilities"in RTCRtpSender)||bn())return!1;if(lA()){const t=wt();if(t?.version&&GA(t.version,"16")<0)return!1}const A=RTCRtpSender.getCapabilities("video");let e=!1;if(A){for(const t of A.codecs)if(t.mimeType==="video/VP9"){e=!0;break}}return e}function oi(A){return A==="av1"||A==="vp9"}function ia(A){return document?(A||(A=document.createElement("audio")),"setSinkId"in A):!1}function $0(){return typeof RTCPeerConnection>"u"?!1:Aa()||na()}function bn(){var A;return((A=wt())===null||A===void 0?void 0:A.name)==="Firefox"}function lA(){var A;return((A=wt())===null||A===void 0?void 0:A.name)==="Safari"}function W0(){const A=wt();return A?.name==="Safari"&&A.version.startsWith("17.")}function Pd(){var A,e;return Ye()?(e=(A=navigator.userAgentData)===null||A===void 0?void 0:A.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function J0(){const A=wt(),e="17.2";if(A)return A.name!=="Safari"&&A.os!=="iOS"||A.os==="iOS"&&A.osVersion&&GA(e,A.osVersion)>=0?!0:A.name==="Safari"&&GA(e,A.version)>=0}function Ye(){return typeof document<"u"}function Rt(){return navigator.product=="ReactNative"}function ra(A){return A.hostname.endsWith(".livekit.cloud")||A.hostname.endsWith(".livekit.run")}function Ld(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function Dd(){if(!Rt())return;let A=Ld();if(A)return A.platform}function Od(){if(Ye())return window.devicePixelRatio;if(Rt()){let A=Ld();if(A)return A.devicePixelRatio}return 1}function GA(A,e){const t=A.split("."),n=e.split("."),i=Math.min(t.length,n.length);for(let r=0;r<i;++r){const s=parseInt(t[r],10),o=parseInt(n[r],10);if(s>o)return 1;if(s<o)return-1;if(r===i-1&&s===o)return 0}return A===""&&e!==""?-1:e===""?1:t.length==n.length?0:t.length<n.length?-1:1}function X0(A){for(const e of A)e.target.handleResize(e)}function q0(A){for(const e of A)e.target.handleVisibilityChanged(e)}let sa=null;const Hd=()=>(sa||(sa=new ResizeObserver(X0)),sa);let oa=null;const Md=()=>(oa||(oa=new IntersectionObserver(q0,{root:null,rootMargin:"0px"})),oa);function Y0(){var A;const e=new MB({sdk:Eu.JS,protocol:D0,version:L0});return Rt()&&(e.os=(A=Dd())!==null&&A!==void 0?A:""),e}function Nd(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const i=document.createElement("canvas");i.width=A,i.height=e;const r=i.getContext("2d");r?.fillRect(0,0,i.width,i.height),n&&r&&(r.beginPath(),r.arc(A/2,e/2,50,0,Math.PI*2,!0),r.closePath(),r.fillStyle="grey",r.fill());const s=i.captureStream(),[o]=s.getTracks();if(!o)throw Error("Could not get empty media stream video track");return o.enabled=t,o}let ai;function aa(){if(!ai){const A=new AudioContext,e=A.createOscillator(),t=A.createGain();t.gain.setValueAtTime(0,0);const n=A.createMediaStreamDestination();if(e.connect(t),t.connect(n),e.start(),[ai]=n.stream.getAudioTracks(),!ai)throw Error("Could not get empty media stream audio track");ai.enabled=!1}return ai.clone()}class ca{constructor(e,t){this.onFinally=t,this.promise=new Promise((n,i)=>m(this,void 0,void 0,function*(){this.resolve=n,this.reject=i,e&&(yield e(n,i))})).finally(()=>{var n;return(n=this.onFinally)===null||n===void 0?void 0:n.call(this)})}}function z0(A){return M0.includes(A)}function uA(A){if(typeof A=="string"||typeof A=="number")return A;if(Array.isArray(A))return A[0];if(A.exact)return Array.isArray(A.exact)?A.exact[0]:A.exact;if(A.ideal)return Array.isArray(A.ideal)?A.ideal[0]:A.ideal;throw Error("could not unwrap constraint")}function Z0(A){return A.startsWith("http")?A.replace(/^(http)/,"ws"):A}function la(A){return A.startsWith("ws")?A.replace(/^(ws)/,"http"):A}function ev(A,e){return A.segments.map(t=>{let{id:n,text:i,language:r,startTime:s,endTime:o,final:a}=t;var c;const l=(c=e.get(n))!==null&&c!==void 0?c:Date.now(),u=Date.now();return a?e.delete(n):e.set(n,l),{id:n,text:i,startTime:Number.parseInt(s.toString()),endTime:Number.parseInt(o.toString()),final:a,language:r,firstReceivedTime:l,lastReceivedTime:u}})}function tv(A){const{id:e,timestamp:t,message:n,editTimestamp:i}=A;return{id:e,timestamp:Number.parseInt(t.toString()),editTimestamp:i?Number.parseInt(i.toString()):void 0,message:n}}function Kd(A){switch(A.reason){case W.LeaveRequest:return A.context;case W.Cancelled:return mt.CLIENT_INITIATED;case W.NotAllowed:return mt.USER_REJECTED;case W.ServerUnreachable:return mt.JOIN_FAILURE;default:return mt.UNKNOWN_REASON}}function Ur(A){return A!==void 0?Number(A):void 0}function VA(A){return A!==void 0?BigInt(A):void 0}function En(A){return!!A&&!(A instanceof MediaStreamTrack)&&A.isLocal}function $t(A){return!!A&&A.kind==U.Kind.Audio}function Sn(A){return!!A&&A.kind==U.Kind.Video}function dA(A){return En(A)&&Sn(A)}function jA(A){return En(A)&&$t(A)}function ua(A){return!!A&&!A.isLocal}function Av(A){return!!A&&!A.isLocal}function da(A){return ua(A)&&Sn(A)}function nv(A){return A.isLocal}function iv(A,e){const t=[];let n=new TextEncoder().encode(A);for(;n.length>e;){let i=e;for(;i>0;){const r=n[i];if(r!==void 0&&(r&192)!==128)break;i--}t.push(n.slice(0,i)),n=n.slice(i)}return n.length>0&&t.push(n),t}function Gd(A,e,t){var n,i,r,s;const{optionsWithoutProcessor:o,audioProcessor:a,videoProcessor:c}=Wd(A??{}),l=e?.processor,u=t?.processor,d=o??{};return d.audio===!0&&(d.audio={}),d.video===!0&&(d.video={}),d.audio&&(ha(d.audio,e),(n=(r=d.audio).deviceId)!==null&&n!==void 0||(r.deviceId={ideal:"default"}),(a||l)&&(d.audio.processor=a??l)),d.video&&(ha(d.video,t),(i=(s=d.video).deviceId)!==null&&i!==void 0||(s.deviceId={ideal:"default"}),(c||u)&&(d.video.processor=c??u)),d}function ha(A,e){return Object.keys(e).forEach(t=>{A[t]===void 0&&(A[t]=e[t])}),A}function fa(A){var e,t,n,i;const r={};if(A.video)if(typeof A.video=="object"){const s={},o=s,a=A.video;Object.keys(a).forEach(c=>{switch(c){case"resolution":ha(o,a.resolution);break;default:o[c]=a[c]}}),r.video=s,(e=(n=r.video).deviceId)!==null&&e!==void 0||(n.deviceId={ideal:"default"})}else r.video=A.video?{deviceId:{ideal:"default"}}:!1;else r.video=!1;return A.audio?typeof A.audio=="object"?(r.audio=A.audio,(t=(i=r.audio).deviceId)!==null&&t!==void 0||(i.deviceId={ideal:"default"})):r.audio={deviceId:{ideal:"default"}}:r.audio=!1,r}function Vd(A){return m(this,arguments,void 0,function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const n=jd();if(n){const i=n.createAnalyser();i.fftSize=2048;const r=i.frequencyBinCount,s=new Uint8Array(r);n.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(i),yield qe(t),i.getByteTimeDomainData(s);const a=s.some(c=>c!==128&&c!==0);return n.close(),!a}return!1}()})}function jd(){var A;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const t=new e({latencyHint:"interactive"});if(t.state==="suspended"&&typeof window<"u"&&(!((A=window.document)===null||A===void 0)&&A.body)){const n=()=>m(this,void 0,void 0,function*(){var i;try{t.state==="suspended"&&(yield t.resume())}catch(r){console.warn("Error trying to auto-resume audio context",r)}(i=window.document.body)===null||i===void 0||i.removeEventListener("click",n)});window.document.body.addEventListener("click",n)}return t}}function rv(A){return A==="audioinput"?U.Source.Microphone:A==="videoinput"?U.Source.Camera:U.Source.Unknown}function $d(A){return A===U.Source.Microphone?"audioinput":A===U.Source.Camera?"videoinput":void 0}function sv(A){var e,t;let n=(e=A.video)!==null&&e!==void 0?e:!0;return A.resolution&&A.resolution.width>0&&A.resolution.height>0&&(n=typeof n=="boolean"?{}:n,lA()?n=Object.assign(Object.assign({},n),{width:{max:A.resolution.width},height:{max:A.resolution.height},frameRate:A.resolution.frameRate}):n=Object.assign(Object.assign({},n),{width:{ideal:A.resolution.width},height:{ideal:A.resolution.height},frameRate:A.resolution.frameRate})),{audio:(t=A.audio)!==null&&t!==void 0?t:!1,video:n,controller:A.controller,selfBrowserSurface:A.selfBrowserSurface,surfaceSwitching:A.surfaceSwitching,systemAudio:A.systemAudio,preferCurrentTab:A.preferCurrentTab}}function Tr(A){return A.split("/")[1].toLowerCase()}function ov(A){const e=[];return A.forEach(t=>{t.track!==void 0&&e.push(new Po({cid:t.track.mediaStreamID,track:t.trackInfo}))}),e}function Z(A){return"mediaStreamTrack"in A?{trackID:A.sid,source:A.source,muted:A.isMuted,enabled:A.mediaStreamTrack.enabled,kind:A.kind,streamID:A.mediaStreamID,streamTrackID:A.mediaStreamTrack.id}:{trackID:A.trackSid,enabled:A.isEnabled,muted:A.isMuted,trackInfo:Object.assign({mimeType:A.mimeType,name:A.trackName,encrypted:A.isEncrypted,kind:A.kind,source:A.source},A.track?Z(A.track):{})}}function av(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function cv(A,e){var t;A===void 0&&(A={}),e===void 0&&(e={});const n=[...Object.keys(e),...Object.keys(A)],i={};for(const r of n)A[r]!==e[r]&&(i[r]=(t=e[r])!==null&&t!==void 0?t:"");return i}function Wd(A){const e=Object.assign({},A);let t,n;return typeof e.audio=="object"&&e.audio.processor&&(t=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(n=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:t,videoProcessor:n,optionsWithoutProcessor:_0(e)}}function lv(A){switch(A){case we.CAMERA:return U.Source.Camera;case we.MICROPHONE:return U.Source.Microphone;case we.SCREEN_SHARE:return U.Source.ScreenShare;case we.SCREEN_SHARE_AUDIO:return U.Source.ScreenShareAudio;default:return U.Source.Unknown}}class uv extends xt.EventEmitter{constructor(e){super(),this.onWorkerMessage=t=>{var n,i;const{kind:r,data:s}=t.data;switch(r){case"error":j.error(s.error.message),this.emit(aA.EncryptionError,s.error);break;case"initAck":s.enabled&&this.keyProvider.getKeys().forEach(o=>{this.postKey(o)});break;case"enable":if(s.enabled&&this.keyProvider.getKeys().forEach(o=>{this.postKey(o)}),this.encryptionEnabled!==s.enabled&&s.participantIdentity===((n=this.room)===null||n===void 0?void 0:n.localParticipant.identity))this.emit(aA.ParticipantEncryptionStatusChanged,s.enabled,this.room.localParticipant),this.encryptionEnabled=s.enabled;else if(s.participantIdentity){const o=(i=this.room)===null||i===void 0?void 0:i.getParticipantByIdentity(s.participantIdentity);if(!o)throw TypeError("couldn't set encryption status, participant not found".concat(s.participantIdentity));this.emit(aA.ParticipantEncryptionStatusChanged,s.enabled,o)}break;case"ratchetKey":this.keyProvider.emit(oA.KeyRatcheted,s.ratchetResult,s.participantIdentity,s.keyIndex);break}},this.onWorkerError=t=>{j.error("e2ee worker encountered an error:",{error:t.error}),this.emit(aA.EncryptionError,t.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1}setup(e){if(!F0())throw new Jo("tried to setup end-to-end encryption on an unsupported browser");if(j.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const t={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:f0.getLevel()}};this.worker&&(j.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(t))}}setParticipantCryptorEnabled(e,t){j.debug("set e2ee to ".concat(e," for participant ").concat(t)),this.postEnable(e,t)}setSifTrailer(e){!e||e.length===0?j.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(I.RTPVideoMapUpdate,t=>{this.postRTPMap(t)})}setupEventListeners(e,t){e.on(Q.TrackPublished,(n,i)=>this.setParticipantCryptorEnabled(n.trackInfo.encryption!==At.NONE,i.identity)),e.on(Q.ConnectionStateChanged,n=>{n===z.Connected&&e.remoteParticipants.forEach(i=>{i.trackPublications.forEach(r=>{this.setParticipantCryptorEnabled(r.trackInfo.encryption!==At.NONE,i.identity)})})}).on(Q.TrackUnsubscribed,(n,i,r)=>{var s;const o={kind:"removeTransform",data:{participantIdentity:r.identity,trackId:n.mediaStreamID}};(s=this.worker)===null||s===void 0||s.postMessage(o)}).on(Q.TrackSubscribed,(n,i,r)=>{this.setupE2EEReceiver(n,r.identity,i.trackInfo)}).on(Q.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");t.getKeys().forEach(n=>{this.postKey(n)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(x.LocalTrackPublished,n=>m(this,void 0,void 0,function*(){this.setupE2EESender(n.track,n.track.sender)})),t.on(oA.SetKey,n=>this.postKey(n)).on(oA.RatchetRequest,(n,i)=>this.postRatchetRequest(n,i))}postRatchetRequest(e,t){if(!this.worker)throw Error("could not ratchet key, worker is missing");const n={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:t}};this.worker.postMessage(n)}postKey(e){let{key:t,participantIdentity:n,keyIndex:i}=e;var r;if(!this.worker)throw Error("could not set key, worker is missing");const s={kind:"setKey",data:{participantIdentity:n,isPublisher:n===((r=this.room)===null||r===void 0?void 0:r.localParticipant.identity),key:t,keyIndex:i}};this.worker.postMessage(s)}postEnable(e,t){if(this.worker){const n={kind:"enable",data:{enabled:e,participantIdentity:t}};this.worker.postMessage(n)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var t;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((t=this.room)===null||t===void 0)&&t.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const n={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(n)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const t={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(t)}setupE2EEReceiver(e,t,n){if(e.receiver){if(!n?.mimeType||n.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,t,e.kind==="video"?Tr(n.mimeType):void 0)}}setupE2EESender(e,t){if(!En(e)||!t){t||j.warn("early return because sender is not ready");return}this.handleSender(t,e.mediaStreamID,void 0)}handleReceiver(e,t,n,i){return m(this,void 0,void 0,function*(){if(this.worker){if(Wo()){const r={kind:"decode",participantIdentity:n,trackId:t,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,r)}else{if(br in e&&i){const a={kind:"updateCodec",data:{trackId:t,codec:i,participantIdentity:n}};this.worker.postMessage(a);return}let r=e.writableStream,s=e.readableStream;if(!r||!s){const a=e.createEncodedStreams();e.writableStream=a.writable,r=a.writable,e.readableStream=a.readable,s=a.readable}const o={kind:"decode",data:{readableStream:s,writableStream:r,trackId:t,codec:i,participantIdentity:n}};this.worker.postMessage(o,[s,r])}e[br]=!0}})}handleSender(e,t,n){var i;if(!(br in e||!this.worker)){if(!(!((i=this.room)===null||i===void 0)&&i.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(Wo()){j.info("initialize script transform");const r={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:t,codec:n};e.transform=new RTCRtpScriptTransform(this.worker,r)}else{j.info("initialize encoded streams");const r=e.createEncodedStreams(),s={kind:"encode",data:{readableStream:r.readable,writableStream:r.writable,codec:n,trackId:t,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(s,[r.readable,r.writable])}e[br]=!0}}}const ga="default";class Ue{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new Ue),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var r;if(((r=Ue.userMediaPromiseMap)===null||r===void 0?void 0:r.size)>0){j.debug("awaiting getUserMedia promise");try{t?yield Ue.userMediaPromiseMap.get(t):yield Promise.all(Ue.userMediaPromiseMap.values())}catch{j.warn("error waiting for media permissons")}}let s=yield navigator.mediaDevices.enumerateDevices();if(i&&!(lA()&&n.hasDeviceInUse(t))&&(s.filter(a=>a.kind===t).length===0||s.some(a=>{const c=a.label==="",l=t?a.kind===t:!0;return c&&l}))){const a={video:t!=="audioinput"&&t!=="audiooutput",audio:t!=="videoinput"&&{deviceId:{ideal:"default"}}},c=yield navigator.mediaDevices.getUserMedia(a);s=yield navigator.mediaDevices.enumerateDevices(),c.getTracks().forEach(l=>{l.stop()})}return n._previousDevices=s,t&&(s=s.filter(o=>o.kind===t)),s}()})}normalizeDeviceId(e,t,n){return m(this,void 0,void 0,function*(){if(t!==ga)return t;const i=yield this.getDevices(e),r=i.find(o=>o.deviceId===ga);if(!r){j.warn("could not reliably determine default device");return}const s=i.find(o=>o.deviceId!==ga&&o.groupId===(n??r.groupId));if(!s){j.warn("could not reliably determine default device");return}return s?.deviceId})}hasDeviceInUse(e){return e?Ue.userMediaPromiseMap.has(e):Ue.userMediaPromiseMap.size>0}}Ue.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],Ue.userMediaPromiseMap=new Map;var ci;(function(A){A[A.WAITING=0]="WAITING",A[A.RUNNING=1]="RUNNING",A[A.COMPLETED=2]="COMPLETED"})(ci||(ci={}));class dv{constructor(){this.pendingTasks=new Map,this.taskMutex=new We,this.nextTaskIndex=0}run(e){return m(this,void 0,void 0,function*(){const t={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:ci.WAITING};this.pendingTasks.set(t.id,t);const n=yield this.taskMutex.lock();try{return t.executedAt=Date.now(),t.status=ci.RUNNING,yield e()}finally{t.status=ci.COMPLETED,this.pendingTasks.delete(t.id),n()}})}flush(){return m(this,void 0,void 0,function*(){return this.run(()=>m(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function hv(A,e){const t=new URL(Z0(A));return e.forEach((n,i)=>{t.searchParams.set(i,n)}),Jd(t,"rtc")}function fv(A){const e=new URL(la(A));return Jd(e,"validate")}function gv(A){return A.endsWith("/")?A:"".concat(A,"/")}function Jd(A,e){return A.pathname="".concat(gv(A.pathname)).concat(e),A.toString()}const pv=["syncState","trickle","offer","answer","simulate","leave"];function mv(A){const e=pv.indexOf(A.case)>=0;return j.trace("request allowed to bypass queue:",{canPass:e,req:A}),e}var ae;(function(A){A[A.CONNECTING=0]="CONNECTING",A[A.CONNECTED=1]="CONNECTED",A[A.RECONNECTING=2]="RECONNECTING",A[A.DISCONNECTING=3]="DISCONNECTING",A[A.DISCONNECTED=4]="DISCONNECTED"})(ae||(ae={}));class pa{get currentState(){return this.state}get isDisconnected(){return this.state===ae.DISCONNECTING||this.state===ae.DISCONNECTED}get isEstablishingConnection(){return this.state===ae.CONNECTING||this.state===ae.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;this.rtt=0,this.state=ae.DISCONNECTED,this.log=j,this._requestId=0,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0},this.log=Vt((n=t.loggerName)!==null&&n!==void 0?n:Ct.Signal),this.loggerContextCb=t.loggerContextCb,this.useJSON=e,this.requestQueue=new dv,this.queuedRequests=[],this.closingLock=new We,this.connectionLock=new We,this.state=ae.DISCONNECTED}get logContext(){var e,t;return(t=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&t!==void 0?t:{}}join(e,t,n,i){return m(this,void 0,void 0,function*(){return this.state=ae.CONNECTING,this.options=n,yield this.connect(e,t,n,i)})}reconnect(e,t,n,i){return m(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=ae.RECONNECTING,this.clearPingInterval(),yield this.connect(e,t,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:n,reconnectReason:i}))})}connect(e,t,n,i){this.connectOptions=n;const r=Y0(),s=Bv(t,r,n),o=hv(e,s),a=fv(o);return new Promise((c,l)=>m(this,void 0,void 0,function*(){const u=yield this.connectionLock.lock();try{const d=()=>m(this,void 0,void 0,function*(){this.close(),clearTimeout(h),l(new se("room connection has been cancelled (signal)",W.Cancelled))}),h=setTimeout(()=>{this.close(),l(new se("room connection has timed out (signal)",W.ServerUnreachable))},n.websocketTimeout);i?.aborted&&d(),i?.addEventListener("abort",d);const f=new URL(o);f.searchParams.has("access_token")&&f.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(f),Object.assign({reconnect:n.reconnect,reconnectReason:n.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(o),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(h)},this.ws.onerror=g=>m(this,void 0,void 0,function*(){if(this.state!==ae.CONNECTED){this.state=ae.DISCONNECTED,clearTimeout(h);try{const p=yield fetch(a);if(p.status.toFixed(0).startsWith("4")){const B=yield p.text();l(new se(B,W.NotAllowed,p.status))}else l(new se("Encountered unknown websocket error during connection: ".concat(g.toString()),W.InternalError,p.status))}catch(p){l(new se(p instanceof Error?p.message:"server was not reachable",W.ServerUnreachable))}return}this.handleWSError(g)}),this.ws.onmessage=g=>m(this,void 0,void 0,function*(){var p,B,y;let b;if(typeof g.data=="string"){const v=JSON.parse(g.data);b=ku.fromJson(v,{ignoreUnknownFields:!0})}else if(g.data instanceof ArrayBuffer)b=ku.fromBinary(new Uint8Array(g.data));else{this.log.error("could not decode websocket message: ".concat(typeof g.data),this.logContext);return}if(this.state!==ae.CONNECTED){let v=!1;if(((p=b.message)===null||p===void 0?void 0:p.case)==="join"?(this.state=ae.CONNECTED,i?.removeEventListener("abort",d),this.pingTimeoutDuration=b.message.value.pingTimeout,this.pingIntervalDuration=b.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&(this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})),this.startPingInterval()),c(b.message.value)):this.state===ae.RECONNECTING&&b.message.case!=="leave"?(this.state=ae.CONNECTED,i?.removeEventListener("abort",d),this.startPingInterval(),((B=b.message)===null||B===void 0?void 0:B.case)==="reconnect"?c(b.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),c(void 0),v=!0)):this.isEstablishingConnection&&b.message.case==="leave"?l(new se("Received leave request while trying to (re)connect",W.LeaveRequest,void 0,b.message.value.reason)):n.reconnect||l(new se("did not receive join response, got ".concat((y=b.message)===null||y===void 0?void 0:y.case," instead"),W.InternalError)),!v)return}this.signalLatency&&(yield qe(this.signalLatency)),this.handleSignalResponse(b)}),this.ws.onclose=g=>{this.isEstablishingConnection&&l(new se("Websocket got closed during a (re)connection attempt",W.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:g.reason,code:g.code,wasClean:g.wasClean,state:this.state})),this.handleOnClose(g.reason)}}finally{u()}}))}close(){return m(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const n=yield e.closingLock.lock();try{if(e.clearPingInterval(),t&&(e.state=ae.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const i=new Promise(r=>{e.ws?e.ws.onclose=()=>{r()}:r()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([i,qe(250)])),e.ws=void 0}}finally{t&&(e.state=ae.DISCONNECTED),n()}}()})}sendOffer(e){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:Qr(e)})}sendAnswer(e){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:Qr(e)})}sendIceCandidate(e,t){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new xo({candidateInit:JSON.stringify(e),target:t})})}sendMuteTrack(e,t){return this.sendRequest({case:"mute",value:new Ro({sid:e,muted:t})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,t){return m(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const o=r.getNextRequestId();return yield r.sendRequest({case:"updateMetadata",value:new Ru({requestId:o,metadata:n,name:i,attributes:s})}),o}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,t){return this.sendRequest({case:"updateLayers",value:new xu({trackSid:e,layers:t})})}sendUpdateSubscriptionPermissions(e,t){return this.sendRequest({case:"subscriptionPermission",value:new Du({allParticipants:e,trackPermissions:t})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:ue.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new Mu({timestamp:ue.parse(Date.now()),rtt:ue.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,t){return this.sendRequest({case:"updateAudioTrack",value:new _u({trackSid:e,features:t})})}sendLeave(){return this.sendRequest({case:"leave",value:new hr({reason:mt.CLIENT_INITIATED,action:vn.DISCONNECT})})}sendRequest(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!i&&!mv(t)&&n.state===ae.RECONNECTING){n.queuedRequests.push(()=>m(n,void 0,void 0,function*(){yield this.sendRequest(t,!0)}));return}if(i||(yield n.requestQueue.flush()),n.signalLatency&&(yield qe(n.signalLatency)),!n.ws||n.ws.readyState!==n.ws.OPEN){n.log.error("cannot send signal request before connected, type: ".concat(t?.case),n.logContext);return}const s=new GB({message:t});try{n.useJSON?n.ws.send(s.toJsonString()):n.ws.send(s.toBinary())}catch(o){n.log.error("error sending signal message",Object.assign(Object.assign({},n.logContext),{error:o}))}}()})}handleSignalResponse(e){var t,n;const i=e.message;if(i==null){this.log.debug("received unsupported message",this.logContext);return}let r=!1;if(i.case==="answer"){const s=Xd(i.value);this.onAnswer&&this.onAnswer(s)}else if(i.case==="offer"){const s=Xd(i.value);this.onOffer&&this.onOffer(s)}else if(i.case==="trickle"){const s=JSON.parse(i.value.candidateInit);this.onTrickle&&this.onTrickle(s,i.value.target)}else i.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((t=i.value.participants)!==null&&t!==void 0?t:[]):i.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(i.value):i.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((n=i.value.speakers)!==null&&n!==void 0?n:[]):i.case==="leave"?this.onLeave&&this.onLeave(i.value):i.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(i.value.sid,i.value.muted):i.case==="roomUpdate"?this.onRoomUpdate&&i.value.room&&this.onRoomUpdate(i.value.room):i.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(i.value):i.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(i.value):i.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(i.value):i.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(i.value):i.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(i.value):i.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(i.value):i.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(i.value):i.case==="pong"||(i.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(i.value.lastPingTimestamp.toString()),this.resetPingTimeout(),r=!0):i.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(i.value):i.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(i.value.trackSid):i.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(i.value.token),this.onRoomMoved&&this.onRoomMoved(i.value)):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:i.case})));r||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return m(this,void 0,void 0,function*(){if(this.state===ae.DISCONNECTED)return;const t=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),t&&t(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=Fe.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&Fe.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=Fe.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Fe.clearInterval(this.pingInterval)}}function Xd(A){const e={type:"offer",sdp:A.sdp};switch(A.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=A.type;break}return e}function Qr(A){return new NA({sdp:A.sdp,type:A.type})}function Bv(A,e,t){var n;const i=new URLSearchParams;return i.set("access_token",A),t.reconnect&&(i.set("reconnect","1"),t.sid&&i.set("sid",t.sid)),i.set("auto_subscribe",t.autoSubscribe?"1":"0"),i.set("sdk",Rt()?"reactnative":"js"),i.set("version",e.version),i.set("protocol",e.protocol.toString()),e.deviceModel&&i.set("device_model",e.deviceModel),e.os&&i.set("os",e.os),e.osVersion&&i.set("os_version",e.osVersion),e.browser&&i.set("browser",e.browser),e.browserVersion&&i.set("browser_version",e.browserVersion),t.adaptiveStream&&i.set("adaptive_stream","1"),t.reconnectReason&&i.set("reconnect_reason",t.reconnectReason.toString()),!((n=navigator.connection)===null||n===void 0)&&n.type&&i.set("network",navigator.connection.type),i}var yt={},ma={},Ba={exports:{}},qd;function va(){if(qd)return Ba.exports;qd=1;var A=Ba.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=e.raddr!=null?" raddr %s rport %d":"%v%v",t+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(t+=" generation %d"),t+=e["network-id"]!=null?" network-id %d":"%v",t+=e["network-cost"]!=null?" network-cost %d":"%v",t}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return e.attribute!=null&&(t+=" %s",e.value!=null&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=e.id!=null?"id=%s %s":"%v%s",t+=e.mediaClockValue!=null?"=%s":"",t+=e.rateNumerator!=null?" rate=%s":"",t+=e.rateDenominator!=null?"/%s":"",t}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(A).forEach(function(e){var t=A[e];t.forEach(function(n){n.reg||(n.reg=/(.*)/),n.format||(n.format="%s")})}),Ba.exports}var Yd;function vv(){return Yd||(Yd=1,function(A){var e=function(o){return String(Number(o))===o?Number(o):o},t=function(o,a,c,l){if(l&&!c)a[l]=e(o[1]);else for(var u=0;u<c.length;u+=1)o[u+1]!=null&&(a[c[u]]=e(o[u+1]))},n=function(o,a,c){var l=o.name&&o.names;o.push&&!a[o.push]?a[o.push]=[]:l&&!a[o.name]&&(a[o.name]={});var u=o.push?{}:l?a[o.name]:a;t(c.match(o.reg),u,o.names,o.name),o.push&&a[o.push].push(u)},i=va(),r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);A.parse=function(o){var a={},c=[],l=a;return o.split(/(\r\n|\r|\n)/).filter(r).forEach(function(u){var d=u[0],h=u.slice(2);d==="m"&&(c.push({rtp:[],fmtp:[]}),l=c[c.length-1]);for(var f=0;f<(i[d]||[]).length;f+=1){var g=i[d][f];if(g.reg.test(h))return n(g,l,h)}}),a.media=c,a};var s=function(o,a){var c=a.split(/=(.+)/,2);return c.length===2?o[c[0]]=e(c[1]):c.length===1&&a.length>1&&(o[c[0]]=void 0),o};A.parseParams=function(o){return o.split(/;\s?/).reduce(s,{})},A.parseFmtpConfig=A.parseParams,A.parsePayloads=function(o){return o.toString().split(" ").map(Number)},A.parseRemoteCandidates=function(o){for(var a=[],c=o.split(" ").map(e),l=0;l<c.length;l+=3)a.push({component:c[l],ip:c[l+1],port:c[l+2]});return a},A.parseImageAttributes=function(o){return o.split(" ").map(function(a){return a.substring(1,a.length-1).split(",").reduce(s,{})})},A.parseSimulcastStreamList=function(o){return o.split(";").map(function(a){return a.split(",").map(function(c){var l,u=!1;return c[0]!=="~"?l=e(c):(l=e(c.substring(1,c.length)),u=!0),{scid:l,paused:u}})})}}(ma)),ma}var Ca,zd;function Cv(){if(zd)return Ca;zd=1;var A=va(),e=/%[sdv%]/g,t=function(s){var o=1,a=arguments,c=a.length;return s.replace(e,function(l){if(o>=c)return l;var u=a[o];switch(o+=1,l){case"%%":return"%";case"%s":return String(u);case"%d":return Number(u);case"%v":return""}})},n=function(s,o,a){var c=o.format instanceof Function?o.format(o.push?a:a[o.name]):o.format,l=[s+"="+c];if(o.names)for(var u=0;u<o.names.length;u+=1){var d=o.names[u];o.name?l.push(a[o.name][d]):l.push(a[o.names[u]])}else l.push(a[o.name]);return t.apply(null,l)},i=["v","o","s","i","u","e","p","c","b","t","r","z","a"],r=["i","c","b","a"];return Ca=function(s,o){o=o||{},s.version==null&&(s.version=0),s.name==null&&(s.name=" "),s.media.forEach(function(u){u.payloads==null&&(u.payloads="")});var a=o.outerOrder||i,c=o.innerOrder||r,l=[];return a.forEach(function(u){A[u].forEach(function(d){d.name in s&&s[d.name]!=null?l.push(n(u,d,s)):d.push in s&&s[d.push]!=null&&s[d.push].forEach(function(h){l.push(n(u,d,h))})})}),s.media.forEach(function(u){l.push(n("m",A.m[0],u)),c.forEach(function(d){A[d].forEach(function(h){h.name in u&&u[h.name]!=null?l.push(n(d,h,u)):h.push in u&&u[h.push]!=null&&u[h.push].forEach(function(f){l.push(n(d,h,f))})})})}),l.join(`\r
40
+ `);A.RTCSessionDescription&&i instanceof A.RTCSessionDescription?arguments[0]=new A.RTCSessionDescription({type:i.type,sdp:r}):i.sdp=r}return t.apply(this,arguments)}}function wr(A,e){if(!(A.RTCPeerConnection&&A.RTCPeerConnection.prototype))return;const t=A.RTCPeerConnection.prototype.addIceCandidate;!t||t.length===0||(A.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function yr(A,e){if(!(A.RTCPeerConnection&&A.RTCPeerConnection.prototype))return;const t=A.RTCPeerConnection.prototype.setLocalDescription;!t||t.length===0||(A.RTCPeerConnection.prototype.setLocalDescription=function(){let i=arguments[0]||{};if(typeof i!="object"||i.type&&i.sdp)return t.apply(this,arguments);if(i={type:i.type,sdp:i.sdp},!i.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer";break}return i.sdp||i.type!=="offer"&&i.type!=="answer"?t.apply(this,[i]):(i.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(s=>t.apply(this,[s]))})}var S0=Object.freeze({__proto__:null,removeExtmapAllowMixed:$o,shimAddIceCandidateNullOrEmpty:wr,shimConnectionState:jo,shimMaxMessageSize:vr,shimParameterlessSetLocalDescription:yr,shimRTCIceCandidate:Br,shimRTCIceCandidateRelayProtocol:Go,shimSendThrowTypeError:Cr});function U0(){let{window:A}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const t=$u,n=w0(A),i={browserDetails:n,commonShim:S0,extractVersion:mr,disableLog:v0,disableWarnings:C0,sdp:E0};switch(n.browser){case"chrome":if(!rd||!No||!e.shimChrome)return t("Chrome shim is not included in this adapter release."),i;if(n.version===null)return t("Chrome shim can not determine version, not shimming."),i;t("adapter.js shimming chrome."),i.browserShim=rd,wr(A,n),yr(A),Yu(A,n),zu(A),No(A,n),Zu(A),nd(A,n),ed(A),td(A),id(A,n),Br(A),Go(A),jo(A),vr(A,n),Cr(A),$o(A,n);break;case"firefox":if(!pd||!Ko||!e.shimFirefox)return t("Firefox shim is not included in this adapter release."),i;t("adapter.js shimming firefox."),i.browserShim=pd,wr(A,n),yr(A),sd(A,n),Ko(A,n),od(A),ld(A),ad(A),cd(A),ud(A),dd(A),hd(A),fd(A),gd(A),Br(A),jo(A),vr(A,n),Cr(A);break;case"safari":if(!Ud||!e.shimSafari)return t("Safari shim is not included in this adapter release."),i;t("adapter.js shimming safari."),i.browserShim=Ud,wr(A,n),yr(A),yd(A),Ed(A),vd(A),md(A),Bd(A),bd(A),Cd(A),Sd(A),Br(A),Go(A),vr(A,n),Cr(A),$o(A,n);break;default:t("Unsupported browser!");break}return i}U0({window:typeof window>"u"?void 0:window});const T0=10,br="lk_e2ee",Q0={sharedKey:!1,ratchetSalt:"LKFrameEncryptionKey",ratchetWindowSize:8,failureTolerance:T0,keyringSize:16};var oA;(function(A){A.SetKey="setKey",A.RatchetRequest="ratchetRequest",A.KeyRatcheted="keyRatcheted"})(oA||(oA={}));var Fd;(function(A){A.KeyRatcheted="keyRatcheted"})(Fd||(Fd={}));var aA;(function(A){A.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",A.EncryptionError="encryptionError"})(aA||(aA={}));var kd;(function(A){A.Error="cryptorError"})(kd||(kd={}));function F0(){return k0()||Wo()}function Wo(){return typeof window.RTCRtpScriptTransform<"u"}function k0(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}class k1 extends xt.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(t,n,i)=>{j.debug("key ratcheted event received",{ratchetResult:t,participantId:n,keyIndex:i})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Q0),e),this.on(oA.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,t,n){const i={key:e,participantIdentity:t,keyIndex:n};if(!this.options.sharedKey&&!t)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(t??"shared","-").concat(n??0),i),this.emit(oA.SetKey,i)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,t){this.emit(oA.RatchetRequest,e,t)}}class cA extends Error{constructor(e,t){super(t||"an error has occured"),this.name="LiveKitError",this.code=e}}var W;(function(A){A[A.NotAllowed=0]="NotAllowed",A[A.ServerUnreachable=1]="ServerUnreachable",A[A.InternalError=2]="InternalError",A[A.Cancelled=3]="Cancelled",A[A.LeaveRequest=4]="LeaveRequest"})(W||(W={}));class se extends cA{constructor(e,t,n,i){super(1,e),this.name="ConnectionError",this.status=n,this.reason=t,this.context=i,this.reasonName=W[t]}}class Jo extends cA{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class $t extends cA{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class I0 extends cA{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class Ee extends cA{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class Xo extends cA{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class qo extends cA{constructor(e,t){super(15,e),this.name="PublishTrackError",this.status=t}}class Id extends cA{constructor(e,t){super(15,e),this.reason=t,this.reasonName=typeof t=="string"?t:Do[t]}}var Er;(function(A){A.PermissionDenied="PermissionDenied",A.NotFound="NotFound",A.DeviceInUse="DeviceInUse",A.Other="Other"})(Er||(Er={})),function(A){function e(t){if(t&&"name"in t)return t.name==="NotFoundError"||t.name==="DevicesNotFoundError"?A.NotFound:t.name==="NotAllowedError"||t.name==="PermissionDeniedError"?A.PermissionDenied:t.name==="NotReadableError"||t.name==="TrackStartError"?A.DeviceInUse:A.Other}A.getFailure=e}(Er||(Er={}));var _d;(function(A){A[A.InvalidKey=0]="InvalidKey",A[A.MissingKey=1]="MissingKey",A[A.InternalError=2]="InternalError"})(_d||(_d={}));var Q;(function(A){A.Connected="connected",A.Reconnecting="reconnecting",A.SignalReconnecting="signalReconnecting",A.Reconnected="reconnected",A.Disconnected="disconnected",A.ConnectionStateChanged="connectionStateChanged",A.Moved="moved",A.MediaDevicesChanged="mediaDevicesChanged",A.ParticipantConnected="participantConnected",A.ParticipantDisconnected="participantDisconnected",A.TrackPublished="trackPublished",A.TrackSubscribed="trackSubscribed",A.TrackSubscriptionFailed="trackSubscriptionFailed",A.TrackUnpublished="trackUnpublished",A.TrackUnsubscribed="trackUnsubscribed",A.TrackMuted="trackMuted",A.TrackUnmuted="trackUnmuted",A.LocalTrackPublished="localTrackPublished",A.LocalTrackUnpublished="localTrackUnpublished",A.LocalAudioSilenceDetected="localAudioSilenceDetected",A.ActiveSpeakersChanged="activeSpeakersChanged",A.ParticipantMetadataChanged="participantMetadataChanged",A.ParticipantNameChanged="participantNameChanged",A.ParticipantAttributesChanged="participantAttributesChanged",A.ParticipantActive="participantActive",A.RoomMetadataChanged="roomMetadataChanged",A.DataReceived="dataReceived",A.SipDTMFReceived="sipDTMFReceived",A.TranscriptionReceived="transcriptionReceived",A.ConnectionQualityChanged="connectionQualityChanged",A.TrackStreamStateChanged="trackStreamStateChanged",A.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",A.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",A.AudioPlaybackStatusChanged="audioPlaybackChanged",A.VideoPlaybackStatusChanged="videoPlaybackChanged",A.MediaDevicesError="mediaDevicesError",A.ParticipantPermissionsChanged="participantPermissionsChanged",A.SignalConnected="signalConnected",A.RecordingStatusChanged="recordingStatusChanged",A.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",A.EncryptionError="encryptionError",A.DCBufferStatusChanged="dcBufferStatusChanged",A.ActiveDeviceChanged="activeDeviceChanged",A.ChatMessage="chatMessage",A.LocalTrackSubscribed="localTrackSubscribed",A.MetricsReceived="metricsReceived"})(Q||(Q={}));var x;(function(A){A.TrackPublished="trackPublished",A.TrackSubscribed="trackSubscribed",A.TrackSubscriptionFailed="trackSubscriptionFailed",A.TrackUnpublished="trackUnpublished",A.TrackUnsubscribed="trackUnsubscribed",A.TrackMuted="trackMuted",A.TrackUnmuted="trackUnmuted",A.LocalTrackPublished="localTrackPublished",A.LocalTrackUnpublished="localTrackUnpublished",A.ParticipantMetadataChanged="participantMetadataChanged",A.ParticipantNameChanged="participantNameChanged",A.DataReceived="dataReceived",A.SipDTMFReceived="sipDTMFReceived",A.TranscriptionReceived="transcriptionReceived",A.IsSpeakingChanged="isSpeakingChanged",A.ConnectionQualityChanged="connectionQualityChanged",A.TrackStreamStateChanged="trackStreamStateChanged",A.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",A.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",A.MediaDevicesError="mediaDevicesError",A.AudioStreamAcquired="audioStreamAcquired",A.ParticipantPermissionsChanged="participantPermissionsChanged",A.PCTrackAdded="pcTrackAdded",A.AttributesChanged="attributesChanged",A.LocalTrackSubscribed="localTrackSubscribed",A.ChatMessage="chatMessage",A.Active="active"})(x||(x={}));var I;(function(A){A.TransportsCreated="transportsCreated",A.Connected="connected",A.Disconnected="disconnected",A.Resuming="resuming",A.Resumed="resumed",A.Restarting="restarting",A.Restarted="restarted",A.SignalResumed="signalResumed",A.SignalRestarted="signalRestarted",A.Closing="closing",A.MediaTrackAdded="mediaTrackAdded",A.ActiveSpeakersUpdate="activeSpeakersUpdate",A.DataPacketReceived="dataPacketReceived",A.RTPVideoMapUpdate="rtpVideoMapUpdate",A.DCBufferStatusChanged="dcBufferStatusChanged",A.ParticipantUpdate="participantUpdate",A.RoomUpdate="roomUpdate",A.SpeakersChanged="speakersChanged",A.StreamStateChanged="streamStateChanged",A.ConnectionQualityUpdate="connectionQualityUpdate",A.SubscriptionError="subscriptionError",A.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",A.RemoteMute="remoteMute",A.SubscribedQualityUpdate="subscribedQualityUpdate",A.LocalTrackUnpublished="localTrackUnpublished",A.LocalTrackSubscribed="localTrackSubscribed",A.Offline="offline",A.SignalRequestResponse="signalRequestResponse",A.SignalConnected="signalConnected",A.RoomMoved="roomMoved"})(I||(I={}));var k;(function(A){A.Message="message",A.Muted="muted",A.Unmuted="unmuted",A.Restarted="restarted",A.Ended="ended",A.Subscribed="subscribed",A.Unsubscribed="unsubscribed",A.UpdateSettings="updateSettings",A.UpdateSubscription="updateSubscription",A.AudioPlaybackStarted="audioPlaybackStarted",A.AudioPlaybackFailed="audioPlaybackFailed",A.AudioSilenceDetected="audioSilenceDetected",A.VisibilityChanged="visibilityChanged",A.VideoDimensionsChanged="videoDimensionsChanged",A.VideoPlaybackStarted="videoPlaybackStarted",A.VideoPlaybackFailed="videoPlaybackFailed",A.ElementAttached="elementAttached",A.ElementDetached="elementDetached",A.UpstreamPaused="upstreamPaused",A.UpstreamResumed="upstreamResumed",A.SubscriptionPermissionChanged="subscriptionPermissionChanged",A.SubscriptionStatusChanged="subscriptionStatusChanged",A.SubscriptionFailed="subscriptionFailed",A.TrackProcessorUpdate="trackProcessorUpdate",A.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",A.TranscriptionReceived="transcriptionReceived",A.TimeSyncUpdate="timeSyncUpdate"})(k||(k={}));function _0(A){return typeof A>"u"?A:typeof structuredClone=="function"?structuredClone(A):JSON.parse(JSON.stringify(A))}const x0=/version\/(\d+(\.?_?\d+)+)/i;let Yo;function wt(A){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof A>"u"&&typeof navigator>"u")return;const t=(A??navigator.userAgent).toLowerCase();if(Yo===void 0||e){const n=R0.find(i=>{let{test:r}=i;return r.test(t)});Yo=n?.describe(t)}return Yo}const R0=[{test:/firefox|iceweasel|fxios/i,describe(A){return{name:"Firefox",version:Sr(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,A),os:A.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:zo(A)}}},{test:/chrom|crios|crmo/i,describe(A){return{name:"Chrome",version:Sr(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,A),os:A.toLowerCase().includes("crios")?"iOS":void 0,osVersion:zo(A)}}},{test:/safari|applewebkit/i,describe(A){return{name:"Safari",version:Sr(x0,A),os:A.includes("mobile/")?"iOS":"macOS",osVersion:zo(A)}}}];function Sr(A,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const n=e.match(A);return n&&n.length>=t&&n[t]||""}function zo(A){return A.includes("mac os")?Sr(/\(.+?(\d+_\d+(:?_\d+)?)/,A,1).replace(/_/g,"."):void 0}var P0="2.13.0";const L0=P0,D0=16;class Fe{}Fe.setTimeout=function(){return setTimeout(...arguments)},Fe.setInterval=function(){return setInterval(...arguments)},Fe.clearTimeout=function(){return clearTimeout(...arguments)},Fe.clearInterval=function(){return clearInterval(...arguments)};const O0=5e3,ri=[];var at;(function(A){A[A.LOW=0]="LOW",A[A.MEDIUM=1]="MEDIUM",A[A.HIGH=2]="HIGH"})(at||(at={}));class U extends xt.EventEmitter{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var i;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=U.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=j,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),O0):this.handleAppVisibilityChanged()},this.log=jt((i=n.loggerName)!==null&&i!==void 0?i:Ct.Track),this.loggerContextCb=n.loggerContextCb,this.setMaxListeners(100),this.kind=t,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=U.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),ee(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let t="audio";this.kind===U.Kind.Video&&(t="video"),this.attachedElements.length===0&&this.kind===U.Kind.Video&&this.addAppVisibilityListener(),e||(t==="audio"&&(ri.forEach(r=>{r.parentElement===null&&!e&&(e=r)}),e&&ri.splice(ri.indexOf(e),1)),e||(e=document.createElement(t))),this.attachedElements.includes(e)||this.attachedElements.push(e),wn(this.mediaStreamTrack,e);const n=e.srcObject.getTracks(),i=n.some(r=>r.kind==="audio");return e.play().then(()=>{this.emit(i?k.AudioPlaybackStarted:k.VideoPlaybackStarted)}).catch(r=>{r.name==="NotAllowedError"?this.emit(i?k.AudioPlaybackFailed:k.VideoPlaybackFailed,r):r.name==="AbortError"?j.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):j.warn("could not playback ".concat(i?"audio":"video"),r),i&&e&&n.some(s=>s.kind==="video")&&r.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(k.ElementAttached,e),e}detach(e){try{if(e){yn(this.mediaStreamTrack,e);const n=this.attachedElements.indexOf(e);return n>=0&&(this.attachedElements.splice(n,1),this.recycleElement(e),this.emit(k.ElementDetached,e)),e}const t=[];return this.attachedElements.forEach(n=>{yn(this.mediaStreamTrack,n),t.push(n),this.recycleElement(n),this.emit(k.ElementDetached,n)}),this.attachedElements=[],t}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=jt(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let t=!0;e.pause(),ri.forEach(n=>{n.parentElement||(t=!1)}),t&&ri.push(e)}}handleAppVisibilityChanged(){return m(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===U.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){Ye()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Ye()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function wn(A,e){let t;e.srcObject instanceof MediaStream?t=e.srcObject:t=new MediaStream;let n;A.kind==="audio"?n=t.getAudioTracks():n=t.getVideoTracks(),n.includes(A)||(n.forEach(i=>{t.removeTrack(i)}),t.addTrack(A)),(!lA()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=t.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==t&&(e.srcObject=t,(lA()||bn())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=t,e.play().catch(()=>{})},0))}function yn(A,e){if(e.srcObject instanceof MediaStream){const t=e.srcObject;t.removeTrack(A),t.getTracks().length>0?e.srcObject=t:e.srcObject=null}}(function(A){let e;(function(c){c.Audio="audio",c.Video="video",c.Unknown="unknown"})(e=A.Kind||(A.Kind={}));let t;(function(c){c.Camera="camera",c.Microphone="microphone",c.ScreenShare="screen_share",c.ScreenShareAudio="screen_share_audio",c.Unknown="unknown"})(t=A.Source||(A.Source={}));let n;(function(c){c.Active="active",c.Paused="paused",c.Unknown="unknown"})(n=A.StreamState||(A.StreamState={}));function i(c){switch(c){case e.Audio:return pt.AUDIO;case e.Video:return pt.VIDEO;default:return pt.DATA}}A.kindToProto=i;function r(c){switch(c){case pt.AUDIO:return e.Audio;case pt.VIDEO:return e.Video;default:return e.Unknown}}A.kindFromProto=r;function s(c){switch(c){case t.Camera:return we.CAMERA;case t.Microphone:return we.MICROPHONE;case t.ScreenShare:return we.SCREEN_SHARE;case t.ScreenShareAudio:return we.SCREEN_SHARE_AUDIO;default:return we.UNKNOWN}}A.sourceToProto=s;function o(c){switch(c){case we.CAMERA:return t.Camera;case we.MICROPHONE:return t.Microphone;case we.SCREEN_SHARE:return t.ScreenShare;case we.SCREEN_SHARE_AUDIO:return t.ScreenShareAudio;default:return t.Unknown}}A.sourceFromProto=o;function a(c){switch(c){case ko.ACTIVE:return n.Active;case ko.PAUSED:return n.Paused;default:return n.Unknown}}A.streamStateFromProto=a})(U||(U={}));class re{constructor(e,t,n,i,r){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(t!==void 0&&n!==void 0)this.width=e,this.height=t,this.aspectRatio=e/t,this.encoding={maxBitrate:n,maxFramerate:i,priority:r};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const H0=["vp8","h264"],M0=["vp8","h264","vp9","av1"];function N0(A){return!!H0.find(e=>e===A)}var xd;(function(A){A[A.PREFER_REGRESSION=0]="PREFER_REGRESSION",A[A.SIMULCAST=1]="SIMULCAST",A[A.REGRESSION=2]="REGRESSION"})(xd||(xd={}));var Zo;(function(A){A.telephone={maxBitrate:12e3},A.speech={maxBitrate:24e3},A.music={maxBitrate:48e3},A.musicStereo={maxBitrate:64e3},A.musicHighQuality={maxBitrate:96e3},A.musicHighQualityStereo={maxBitrate:128e3}})(Zo||(Zo={}));const si={h90:new re(160,90,9e4,20),h180:new re(320,180,16e4,20),h216:new re(384,216,18e4,20),h360:new re(640,360,45e4,20),h540:new re(960,540,8e5,25),h720:new re(1280,720,17e5,30),h1080:new re(1920,1080,3e6,30),h1440:new re(2560,1440,5e6,30),h2160:new re(3840,2160,8e6,30)},ea={h120:new re(160,120,7e4,20),h180:new re(240,180,125e3,20),h240:new re(320,240,14e4,20),h360:new re(480,360,33e4,20),h480:new re(640,480,5e5,20),h540:new re(720,540,6e5,25),h720:new re(960,720,13e5,30),h1080:new re(1440,1080,23e5,30),h1440:new re(1920,1440,38e5,30)},ta={h360fps3:new re(640,360,2e5,3,"medium"),h360fps15:new re(640,360,4e5,15,"medium"),h720fps5:new re(1280,720,8e5,5,"medium"),h720fps15:new re(1280,720,15e5,15,"medium"),h720fps30:new re(1280,720,2e6,30,"medium"),h1080fps15:new re(1920,1080,25e5,15,"medium"),h1080fps30:new re(1920,1080,5e6,30,"medium"),original:new re(0,0,7e6,30,"medium")},K0="|",Rd="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function V0(A){const e=A.split(K0);return e.length>1?[e[0],A.substr(e[0].length+1)]:[A,""]}function qe(A){return m(this,void 0,void 0,function*(){return new Promise(e=>Fe.setTimeout(e,A))})}function Aa(){return"addTransceiver"in RTCPeerConnection.prototype}function na(){return"addTrack"in RTCPeerConnection.prototype}function G0(){if(!("getCapabilities"in RTCRtpSender)||lA())return!1;const A=RTCRtpSender.getCapabilities("video");let e=!1;if(A){for(const t of A.codecs)if(t.mimeType==="video/AV1"){e=!0;break}}return e}function j0(){if(!("getCapabilities"in RTCRtpSender)||bn())return!1;if(lA()){const t=wt();if(t?.version&&GA(t.version,"16")<0)return!1}const A=RTCRtpSender.getCapabilities("video");let e=!1;if(A){for(const t of A.codecs)if(t.mimeType==="video/VP9"){e=!0;break}}return e}function oi(A){return A==="av1"||A==="vp9"}function ia(A){return document?(A||(A=document.createElement("audio")),"setSinkId"in A):!1}function $0(){return typeof RTCPeerConnection>"u"?!1:Aa()||na()}function bn(){var A;return((A=wt())===null||A===void 0?void 0:A.name)==="Firefox"}function lA(){var A;return((A=wt())===null||A===void 0?void 0:A.name)==="Safari"}function W0(){const A=wt();return A?.name==="Safari"&&A.version.startsWith("17.")}function Pd(){var A,e;return Ye()?(e=(A=navigator.userAgentData)===null||A===void 0?void 0:A.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function J0(){const A=wt(),e="17.2";if(A)return A.name!=="Safari"&&A.os!=="iOS"||A.os==="iOS"&&A.osVersion&&GA(e,A.osVersion)>=0?!0:A.name==="Safari"&&GA(e,A.version)>=0}function Ye(){return typeof document<"u"}function Rt(){return navigator.product=="ReactNative"}function ra(A){return A.hostname.endsWith(".livekit.cloud")||A.hostname.endsWith(".livekit.run")}function Ld(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function Dd(){if(!Rt())return;let A=Ld();if(A)return A.platform}function Od(){if(Ye())return window.devicePixelRatio;if(Rt()){let A=Ld();if(A)return A.devicePixelRatio}return 1}function GA(A,e){const t=A.split("."),n=e.split("."),i=Math.min(t.length,n.length);for(let r=0;r<i;++r){const s=parseInt(t[r],10),o=parseInt(n[r],10);if(s>o)return 1;if(s<o)return-1;if(r===i-1&&s===o)return 0}return A===""&&e!==""?-1:e===""?1:t.length==n.length?0:t.length<n.length?-1:1}function X0(A){for(const e of A)e.target.handleResize(e)}function q0(A){for(const e of A)e.target.handleVisibilityChanged(e)}let sa=null;const Hd=()=>(sa||(sa=new ResizeObserver(X0)),sa);let oa=null;const Md=()=>(oa||(oa=new IntersectionObserver(q0,{root:null,rootMargin:"0px"})),oa);function Y0(){var A;const e=new MB({sdk:Eu.JS,protocol:D0,version:L0});return Rt()&&(e.os=(A=Dd())!==null&&A!==void 0?A:""),e}function Nd(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const i=document.createElement("canvas");i.width=A,i.height=e;const r=i.getContext("2d");r?.fillRect(0,0,i.width,i.height),n&&r&&(r.beginPath(),r.arc(A/2,e/2,50,0,Math.PI*2,!0),r.closePath(),r.fillStyle="grey",r.fill());const s=i.captureStream(),[o]=s.getTracks();if(!o)throw Error("Could not get empty media stream video track");return o.enabled=t,o}let ai;function aa(){if(!ai){const A=new AudioContext,e=A.createOscillator(),t=A.createGain();t.gain.setValueAtTime(0,0);const n=A.createMediaStreamDestination();if(e.connect(t),t.connect(n),e.start(),[ai]=n.stream.getAudioTracks(),!ai)throw Error("Could not get empty media stream audio track");ai.enabled=!1}return ai.clone()}class ca{constructor(e,t){this.onFinally=t,this.promise=new Promise((n,i)=>m(this,void 0,void 0,function*(){this.resolve=n,this.reject=i,e&&(yield e(n,i))})).finally(()=>{var n;return(n=this.onFinally)===null||n===void 0?void 0:n.call(this)})}}function z0(A){return M0.includes(A)}function uA(A){if(typeof A=="string"||typeof A=="number")return A;if(Array.isArray(A))return A[0];if(A.exact)return Array.isArray(A.exact)?A.exact[0]:A.exact;if(A.ideal)return Array.isArray(A.ideal)?A.ideal[0]:A.ideal;throw Error("could not unwrap constraint")}function Z0(A){return A.startsWith("http")?A.replace(/^(http)/,"ws"):A}function la(A){return A.startsWith("ws")?A.replace(/^(ws)/,"http"):A}function ev(A,e){return A.segments.map(t=>{let{id:n,text:i,language:r,startTime:s,endTime:o,final:a}=t;var c;const l=(c=e.get(n))!==null&&c!==void 0?c:Date.now(),u=Date.now();return a?e.delete(n):e.set(n,l),{id:n,text:i,startTime:Number.parseInt(s.toString()),endTime:Number.parseInt(o.toString()),final:a,language:r,firstReceivedTime:l,lastReceivedTime:u}})}function tv(A){const{id:e,timestamp:t,message:n,editTimestamp:i}=A;return{id:e,timestamp:Number.parseInt(t.toString()),editTimestamp:i?Number.parseInt(i.toString()):void 0,message:n}}function Kd(A){switch(A.reason){case W.LeaveRequest:return A.context;case W.Cancelled:return mt.CLIENT_INITIATED;case W.NotAllowed:return mt.USER_REJECTED;case W.ServerUnreachable:return mt.JOIN_FAILURE;default:return mt.UNKNOWN_REASON}}function Ur(A){return A!==void 0?Number(A):void 0}function jA(A){return A!==void 0?BigInt(A):void 0}function En(A){return!!A&&!(A instanceof MediaStreamTrack)&&A.isLocal}function Wt(A){return!!A&&A.kind==U.Kind.Audio}function Sn(A){return!!A&&A.kind==U.Kind.Video}function dA(A){return En(A)&&Sn(A)}function $A(A){return En(A)&&Wt(A)}function ua(A){return!!A&&!A.isLocal}function Av(A){return!!A&&!A.isLocal}function da(A){return ua(A)&&Sn(A)}function nv(A){return A.isLocal}function iv(A,e){const t=[];let n=new TextEncoder().encode(A);for(;n.length>e;){let i=e;for(;i>0;){const r=n[i];if(r!==void 0&&(r&192)!==128)break;i--}t.push(n.slice(0,i)),n=n.slice(i)}return n.length>0&&t.push(n),t}function Vd(A,e,t){var n,i,r,s;const{optionsWithoutProcessor:o,audioProcessor:a,videoProcessor:c}=Wd(A??{}),l=e?.processor,u=t?.processor,d=o??{};return d.audio===!0&&(d.audio={}),d.video===!0&&(d.video={}),d.audio&&(ha(d.audio,e),(n=(r=d.audio).deviceId)!==null&&n!==void 0||(r.deviceId={ideal:"default"}),(a||l)&&(d.audio.processor=a??l)),d.video&&(ha(d.video,t),(i=(s=d.video).deviceId)!==null&&i!==void 0||(s.deviceId={ideal:"default"}),(c||u)&&(d.video.processor=c??u)),d}function ha(A,e){return Object.keys(e).forEach(t=>{A[t]===void 0&&(A[t]=e[t])}),A}function fa(A){var e,t,n,i;const r={};if(A.video)if(typeof A.video=="object"){const s={},o=s,a=A.video;Object.keys(a).forEach(c=>{switch(c){case"resolution":ha(o,a.resolution);break;default:o[c]=a[c]}}),r.video=s,(e=(n=r.video).deviceId)!==null&&e!==void 0||(n.deviceId={ideal:"default"})}else r.video=A.video?{deviceId:{ideal:"default"}}:!1;else r.video=!1;return A.audio?typeof A.audio=="object"?(r.audio=A.audio,(t=(i=r.audio).deviceId)!==null&&t!==void 0||(i.deviceId={ideal:"default"})):r.audio={deviceId:{ideal:"default"}}:r.audio=!1,r}function Gd(A){return m(this,arguments,void 0,function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const n=jd();if(n){const i=n.createAnalyser();i.fftSize=2048;const r=i.frequencyBinCount,s=new Uint8Array(r);n.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(i),yield qe(t),i.getByteTimeDomainData(s);const a=s.some(c=>c!==128&&c!==0);return n.close(),!a}return!1}()})}function jd(){var A;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const t=new e({latencyHint:"interactive"});if(t.state==="suspended"&&typeof window<"u"&&(!((A=window.document)===null||A===void 0)&&A.body)){const n=()=>m(this,void 0,void 0,function*(){var i;try{t.state==="suspended"&&(yield t.resume())}catch(r){console.warn("Error trying to auto-resume audio context",r)}(i=window.document.body)===null||i===void 0||i.removeEventListener("click",n)});window.document.body.addEventListener("click",n)}return t}}function rv(A){return A==="audioinput"?U.Source.Microphone:A==="videoinput"?U.Source.Camera:U.Source.Unknown}function $d(A){return A===U.Source.Microphone?"audioinput":A===U.Source.Camera?"videoinput":void 0}function sv(A){var e,t;let n=(e=A.video)!==null&&e!==void 0?e:!0;return A.resolution&&A.resolution.width>0&&A.resolution.height>0&&(n=typeof n=="boolean"?{}:n,lA()?n=Object.assign(Object.assign({},n),{width:{max:A.resolution.width},height:{max:A.resolution.height},frameRate:A.resolution.frameRate}):n=Object.assign(Object.assign({},n),{width:{ideal:A.resolution.width},height:{ideal:A.resolution.height},frameRate:A.resolution.frameRate})),{audio:(t=A.audio)!==null&&t!==void 0?t:!1,video:n,controller:A.controller,selfBrowserSurface:A.selfBrowserSurface,surfaceSwitching:A.surfaceSwitching,systemAudio:A.systemAudio,preferCurrentTab:A.preferCurrentTab}}function Tr(A){return A.split("/")[1].toLowerCase()}function ov(A){const e=[];return A.forEach(t=>{t.track!==void 0&&e.push(new Po({cid:t.track.mediaStreamID,track:t.trackInfo}))}),e}function ee(A){return"mediaStreamTrack"in A?{trackID:A.sid,source:A.source,muted:A.isMuted,enabled:A.mediaStreamTrack.enabled,kind:A.kind,streamID:A.mediaStreamID,streamTrackID:A.mediaStreamTrack.id}:{trackID:A.trackSid,enabled:A.isEnabled,muted:A.isMuted,trackInfo:Object.assign({mimeType:A.mimeType,name:A.trackName,encrypted:A.isEncrypted,kind:A.kind,source:A.source},A.track?ee(A.track):{})}}function av(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function cv(A,e){var t;A===void 0&&(A={}),e===void 0&&(e={});const n=[...Object.keys(e),...Object.keys(A)],i={};for(const r of n)A[r]!==e[r]&&(i[r]=(t=e[r])!==null&&t!==void 0?t:"");return i}function Wd(A){const e=Object.assign({},A);let t,n;return typeof e.audio=="object"&&e.audio.processor&&(t=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(n=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:t,videoProcessor:n,optionsWithoutProcessor:_0(e)}}function lv(A){switch(A){case we.CAMERA:return U.Source.Camera;case we.MICROPHONE:return U.Source.Microphone;case we.SCREEN_SHARE:return U.Source.ScreenShare;case we.SCREEN_SHARE_AUDIO:return U.Source.ScreenShareAudio;default:return U.Source.Unknown}}class uv extends xt.EventEmitter{constructor(e){super(),this.onWorkerMessage=t=>{var n,i;const{kind:r,data:s}=t.data;switch(r){case"error":j.error(s.error.message),this.emit(aA.EncryptionError,s.error);break;case"initAck":s.enabled&&this.keyProvider.getKeys().forEach(o=>{this.postKey(o)});break;case"enable":if(s.enabled&&this.keyProvider.getKeys().forEach(o=>{this.postKey(o)}),this.encryptionEnabled!==s.enabled&&s.participantIdentity===((n=this.room)===null||n===void 0?void 0:n.localParticipant.identity))this.emit(aA.ParticipantEncryptionStatusChanged,s.enabled,this.room.localParticipant),this.encryptionEnabled=s.enabled;else if(s.participantIdentity){const o=(i=this.room)===null||i===void 0?void 0:i.getParticipantByIdentity(s.participantIdentity);if(!o)throw TypeError("couldn't set encryption status, participant not found".concat(s.participantIdentity));this.emit(aA.ParticipantEncryptionStatusChanged,s.enabled,o)}break;case"ratchetKey":this.keyProvider.emit(oA.KeyRatcheted,s.ratchetResult,s.participantIdentity,s.keyIndex);break}},this.onWorkerError=t=>{j.error("e2ee worker encountered an error:",{error:t.error}),this.emit(aA.EncryptionError,t.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1}setup(e){if(!F0())throw new Jo("tried to setup end-to-end encryption on an unsupported browser");if(j.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const t={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:f0.getLevel()}};this.worker&&(j.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(t))}}setParticipantCryptorEnabled(e,t){j.debug("set e2ee to ".concat(e," for participant ").concat(t)),this.postEnable(e,t)}setSifTrailer(e){!e||e.length===0?j.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(I.RTPVideoMapUpdate,t=>{this.postRTPMap(t)})}setupEventListeners(e,t){e.on(Q.TrackPublished,(n,i)=>this.setParticipantCryptorEnabled(n.trackInfo.encryption!==At.NONE,i.identity)),e.on(Q.ConnectionStateChanged,n=>{n===z.Connected&&e.remoteParticipants.forEach(i=>{i.trackPublications.forEach(r=>{this.setParticipantCryptorEnabled(r.trackInfo.encryption!==At.NONE,i.identity)})})}).on(Q.TrackUnsubscribed,(n,i,r)=>{var s;const o={kind:"removeTransform",data:{participantIdentity:r.identity,trackId:n.mediaStreamID}};(s=this.worker)===null||s===void 0||s.postMessage(o)}).on(Q.TrackSubscribed,(n,i,r)=>{this.setupE2EEReceiver(n,r.identity,i.trackInfo)}).on(Q.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");t.getKeys().forEach(n=>{this.postKey(n)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(x.LocalTrackPublished,n=>m(this,void 0,void 0,function*(){this.setupE2EESender(n.track,n.track.sender)})),t.on(oA.SetKey,n=>this.postKey(n)).on(oA.RatchetRequest,(n,i)=>this.postRatchetRequest(n,i))}postRatchetRequest(e,t){if(!this.worker)throw Error("could not ratchet key, worker is missing");const n={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:t}};this.worker.postMessage(n)}postKey(e){let{key:t,participantIdentity:n,keyIndex:i}=e;var r;if(!this.worker)throw Error("could not set key, worker is missing");const s={kind:"setKey",data:{participantIdentity:n,isPublisher:n===((r=this.room)===null||r===void 0?void 0:r.localParticipant.identity),key:t,keyIndex:i}};this.worker.postMessage(s)}postEnable(e,t){if(this.worker){const n={kind:"enable",data:{enabled:e,participantIdentity:t}};this.worker.postMessage(n)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var t;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((t=this.room)===null||t===void 0)&&t.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const n={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(n)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const t={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(t)}setupE2EEReceiver(e,t,n){if(e.receiver){if(!n?.mimeType||n.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,t,e.kind==="video"?Tr(n.mimeType):void 0)}}setupE2EESender(e,t){if(!En(e)||!t){t||j.warn("early return because sender is not ready");return}this.handleSender(t,e.mediaStreamID,void 0)}handleReceiver(e,t,n,i){return m(this,void 0,void 0,function*(){if(this.worker){if(Wo()){const r={kind:"decode",participantIdentity:n,trackId:t,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,r)}else{if(br in e&&i){const a={kind:"updateCodec",data:{trackId:t,codec:i,participantIdentity:n}};this.worker.postMessage(a);return}let r=e.writableStream,s=e.readableStream;if(!r||!s){const a=e.createEncodedStreams();e.writableStream=a.writable,r=a.writable,e.readableStream=a.readable,s=a.readable}const o={kind:"decode",data:{readableStream:s,writableStream:r,trackId:t,codec:i,participantIdentity:n}};this.worker.postMessage(o,[s,r])}e[br]=!0}})}handleSender(e,t,n){var i;if(!(br in e||!this.worker)){if(!(!((i=this.room)===null||i===void 0)&&i.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(Wo()){j.info("initialize script transform");const r={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:t,codec:n};e.transform=new RTCRtpScriptTransform(this.worker,r)}else{j.info("initialize encoded streams");const r=e.createEncodedStreams(),s={kind:"encode",data:{readableStream:r.readable,writableStream:r.writable,codec:n,trackId:t,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(s,[r.readable,r.writable])}e[br]=!0}}}const ga="default";class Ue{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new Ue),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var r;if(((r=Ue.userMediaPromiseMap)===null||r===void 0?void 0:r.size)>0){j.debug("awaiting getUserMedia promise");try{t?yield Ue.userMediaPromiseMap.get(t):yield Promise.all(Ue.userMediaPromiseMap.values())}catch{j.warn("error waiting for media permissons")}}let s=yield navigator.mediaDevices.enumerateDevices();if(i&&!(lA()&&n.hasDeviceInUse(t))&&(s.filter(a=>a.kind===t).length===0||s.some(a=>{const c=a.label==="",l=t?a.kind===t:!0;return c&&l}))){const a={video:t!=="audioinput"&&t!=="audiooutput",audio:t!=="videoinput"&&{deviceId:{ideal:"default"}}},c=yield navigator.mediaDevices.getUserMedia(a);s=yield navigator.mediaDevices.enumerateDevices(),c.getTracks().forEach(l=>{l.stop()})}return n._previousDevices=s,t&&(s=s.filter(o=>o.kind===t)),s}()})}normalizeDeviceId(e,t,n){return m(this,void 0,void 0,function*(){if(t!==ga)return t;const i=yield this.getDevices(e),r=i.find(o=>o.deviceId===ga);if(!r){j.warn("could not reliably determine default device");return}const s=i.find(o=>o.deviceId!==ga&&o.groupId===(n??r.groupId));if(!s){j.warn("could not reliably determine default device");return}return s?.deviceId})}hasDeviceInUse(e){return e?Ue.userMediaPromiseMap.has(e):Ue.userMediaPromiseMap.size>0}}Ue.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],Ue.userMediaPromiseMap=new Map;var ci;(function(A){A[A.WAITING=0]="WAITING",A[A.RUNNING=1]="RUNNING",A[A.COMPLETED=2]="COMPLETED"})(ci||(ci={}));class dv{constructor(){this.pendingTasks=new Map,this.taskMutex=new We,this.nextTaskIndex=0}run(e){return m(this,void 0,void 0,function*(){const t={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:ci.WAITING};this.pendingTasks.set(t.id,t);const n=yield this.taskMutex.lock();try{return t.executedAt=Date.now(),t.status=ci.RUNNING,yield e()}finally{t.status=ci.COMPLETED,this.pendingTasks.delete(t.id),n()}})}flush(){return m(this,void 0,void 0,function*(){return this.run(()=>m(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function hv(A,e){const t=new URL(Z0(A));return e.forEach((n,i)=>{t.searchParams.set(i,n)}),Jd(t,"rtc")}function fv(A){const e=new URL(la(A));return Jd(e,"validate")}function gv(A){return A.endsWith("/")?A:"".concat(A,"/")}function Jd(A,e){return A.pathname="".concat(gv(A.pathname)).concat(e),A.toString()}const pv=["syncState","trickle","offer","answer","simulate","leave"];function mv(A){const e=pv.indexOf(A.case)>=0;return j.trace("request allowed to bypass queue:",{canPass:e,req:A}),e}var ae;(function(A){A[A.CONNECTING=0]="CONNECTING",A[A.CONNECTED=1]="CONNECTED",A[A.RECONNECTING=2]="RECONNECTING",A[A.DISCONNECTING=3]="DISCONNECTING",A[A.DISCONNECTED=4]="DISCONNECTED"})(ae||(ae={}));class pa{get currentState(){return this.state}get isDisconnected(){return this.state===ae.DISCONNECTING||this.state===ae.DISCONNECTED}get isEstablishingConnection(){return this.state===ae.CONNECTING||this.state===ae.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;this.rtt=0,this.state=ae.DISCONNECTED,this.log=j,this._requestId=0,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0},this.log=jt((n=t.loggerName)!==null&&n!==void 0?n:Ct.Signal),this.loggerContextCb=t.loggerContextCb,this.useJSON=e,this.requestQueue=new dv,this.queuedRequests=[],this.closingLock=new We,this.connectionLock=new We,this.state=ae.DISCONNECTED}get logContext(){var e,t;return(t=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&t!==void 0?t:{}}join(e,t,n,i){return m(this,void 0,void 0,function*(){return this.state=ae.CONNECTING,this.options=n,yield this.connect(e,t,n,i)})}reconnect(e,t,n,i){return m(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=ae.RECONNECTING,this.clearPingInterval(),yield this.connect(e,t,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:n,reconnectReason:i}))})}connect(e,t,n,i){this.connectOptions=n;const r=Y0(),s=Bv(t,r,n),o=hv(e,s),a=fv(o);return new Promise((c,l)=>m(this,void 0,void 0,function*(){const u=yield this.connectionLock.lock();try{const d=()=>m(this,void 0,void 0,function*(){this.close(),clearTimeout(h),l(new se("room connection has been cancelled (signal)",W.Cancelled))}),h=setTimeout(()=>{this.close(),l(new se("room connection has timed out (signal)",W.ServerUnreachable))},n.websocketTimeout);i?.aborted&&d(),i?.addEventListener("abort",d);const f=new URL(o);f.searchParams.has("access_token")&&f.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(f),Object.assign({reconnect:n.reconnect,reconnectReason:n.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(o),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(h)},this.ws.onerror=g=>m(this,void 0,void 0,function*(){if(this.state!==ae.CONNECTED){this.state=ae.DISCONNECTED,clearTimeout(h);try{const p=yield fetch(a);if(p.status.toFixed(0).startsWith("4")){const B=yield p.text();l(new se(B,W.NotAllowed,p.status))}else l(new se("Encountered unknown websocket error during connection: ".concat(g.toString()),W.InternalError,p.status))}catch(p){l(new se(p instanceof Error?p.message:"server was not reachable",W.ServerUnreachable))}return}this.handleWSError(g)}),this.ws.onmessage=g=>m(this,void 0,void 0,function*(){var p,B,y;let b;if(typeof g.data=="string"){const v=JSON.parse(g.data);b=ku.fromJson(v,{ignoreUnknownFields:!0})}else if(g.data instanceof ArrayBuffer)b=ku.fromBinary(new Uint8Array(g.data));else{this.log.error("could not decode websocket message: ".concat(typeof g.data),this.logContext);return}if(this.state!==ae.CONNECTED){let v=!1;if(((p=b.message)===null||p===void 0?void 0:p.case)==="join"?(this.state=ae.CONNECTED,i?.removeEventListener("abort",d),this.pingTimeoutDuration=b.message.value.pingTimeout,this.pingIntervalDuration=b.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&(this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})),this.startPingInterval()),c(b.message.value)):this.state===ae.RECONNECTING&&b.message.case!=="leave"?(this.state=ae.CONNECTED,i?.removeEventListener("abort",d),this.startPingInterval(),((B=b.message)===null||B===void 0?void 0:B.case)==="reconnect"?c(b.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),c(void 0),v=!0)):this.isEstablishingConnection&&b.message.case==="leave"?l(new se("Received leave request while trying to (re)connect",W.LeaveRequest,void 0,b.message.value.reason)):n.reconnect||l(new se("did not receive join response, got ".concat((y=b.message)===null||y===void 0?void 0:y.case," instead"),W.InternalError)),!v)return}this.signalLatency&&(yield qe(this.signalLatency)),this.handleSignalResponse(b)}),this.ws.onclose=g=>{this.isEstablishingConnection&&l(new se("Websocket got closed during a (re)connection attempt",W.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:g.reason,code:g.code,wasClean:g.wasClean,state:this.state})),this.handleOnClose(g.reason)}}finally{u()}}))}close(){return m(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const n=yield e.closingLock.lock();try{if(e.clearPingInterval(),t&&(e.state=ae.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const i=new Promise(r=>{e.ws?e.ws.onclose=()=>{r()}:r()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([i,qe(250)])),e.ws=void 0}}finally{t&&(e.state=ae.DISCONNECTED),n()}}()})}sendOffer(e){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:Qr(e)})}sendAnswer(e){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:Qr(e)})}sendIceCandidate(e,t){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new xo({candidateInit:JSON.stringify(e),target:t})})}sendMuteTrack(e,t){return this.sendRequest({case:"mute",value:new Ro({sid:e,muted:t})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,t){return m(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const o=r.getNextRequestId();return yield r.sendRequest({case:"updateMetadata",value:new Ru({requestId:o,metadata:n,name:i,attributes:s})}),o}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,t){return this.sendRequest({case:"updateLayers",value:new xu({trackSid:e,layers:t})})}sendUpdateSubscriptionPermissions(e,t){return this.sendRequest({case:"subscriptionPermission",value:new Du({allParticipants:e,trackPermissions:t})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:ue.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new Mu({timestamp:ue.parse(Date.now()),rtt:ue.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,t){return this.sendRequest({case:"updateAudioTrack",value:new _u({trackSid:e,features:t})})}sendLeave(){return this.sendRequest({case:"leave",value:new hr({reason:mt.CLIENT_INITIATED,action:vn.DISCONNECT})})}sendRequest(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!i&&!mv(t)&&n.state===ae.RECONNECTING){n.queuedRequests.push(()=>m(n,void 0,void 0,function*(){yield this.sendRequest(t,!0)}));return}if(i||(yield n.requestQueue.flush()),n.signalLatency&&(yield qe(n.signalLatency)),!n.ws||n.ws.readyState!==n.ws.OPEN){n.log.error("cannot send signal request before connected, type: ".concat(t?.case),n.logContext);return}const s=new VB({message:t});try{n.useJSON?n.ws.send(s.toJsonString()):n.ws.send(s.toBinary())}catch(o){n.log.error("error sending signal message",Object.assign(Object.assign({},n.logContext),{error:o}))}}()})}handleSignalResponse(e){var t,n;const i=e.message;if(i==null){this.log.debug("received unsupported message",this.logContext);return}let r=!1;if(i.case==="answer"){const s=Xd(i.value);this.onAnswer&&this.onAnswer(s)}else if(i.case==="offer"){const s=Xd(i.value);this.onOffer&&this.onOffer(s)}else if(i.case==="trickle"){const s=JSON.parse(i.value.candidateInit);this.onTrickle&&this.onTrickle(s,i.value.target)}else i.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((t=i.value.participants)!==null&&t!==void 0?t:[]):i.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(i.value):i.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((n=i.value.speakers)!==null&&n!==void 0?n:[]):i.case==="leave"?this.onLeave&&this.onLeave(i.value):i.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(i.value.sid,i.value.muted):i.case==="roomUpdate"?this.onRoomUpdate&&i.value.room&&this.onRoomUpdate(i.value.room):i.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(i.value):i.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(i.value):i.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(i.value):i.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(i.value):i.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(i.value):i.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(i.value):i.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(i.value):i.case==="pong"||(i.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(i.value.lastPingTimestamp.toString()),this.resetPingTimeout(),r=!0):i.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(i.value):i.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(i.value.trackSid):i.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(i.value.token),this.onRoomMoved&&this.onRoomMoved(i.value)):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:i.case})));r||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return m(this,void 0,void 0,function*(){if(this.state===ae.DISCONNECTED)return;const t=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),t&&t(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=Fe.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&Fe.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=Fe.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Fe.clearInterval(this.pingInterval)}}function Xd(A){const e={type:"offer",sdp:A.sdp};switch(A.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=A.type;break}return e}function Qr(A){return new KA({sdp:A.sdp,type:A.type})}function Bv(A,e,t){var n;const i=new URLSearchParams;return i.set("access_token",A),t.reconnect&&(i.set("reconnect","1"),t.sid&&i.set("sid",t.sid)),i.set("auto_subscribe",t.autoSubscribe?"1":"0"),i.set("sdk",Rt()?"reactnative":"js"),i.set("version",e.version),i.set("protocol",e.protocol.toString()),e.deviceModel&&i.set("device_model",e.deviceModel),e.os&&i.set("os",e.os),e.osVersion&&i.set("os_version",e.osVersion),e.browser&&i.set("browser",e.browser),e.browserVersion&&i.set("browser_version",e.browserVersion),t.adaptiveStream&&i.set("adaptive_stream","1"),t.reconnectReason&&i.set("reconnect_reason",t.reconnectReason.toString()),!((n=navigator.connection)===null||n===void 0)&&n.type&&i.set("network",navigator.connection.type),i}var yt={},ma={},Ba={exports:{}},qd;function va(){if(qd)return Ba.exports;qd=1;var A=Ba.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=e.raddr!=null?" raddr %s rport %d":"%v%v",t+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(t+=" generation %d"),t+=e["network-id"]!=null?" network-id %d":"%v",t+=e["network-cost"]!=null?" network-cost %d":"%v",t}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return e.attribute!=null&&(t+=" %s",e.value!=null&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=e.id!=null?"id=%s %s":"%v%s",t+=e.mediaClockValue!=null?"=%s":"",t+=e.rateNumerator!=null?" rate=%s":"",t+=e.rateDenominator!=null?"/%s":"",t}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(A).forEach(function(e){var t=A[e];t.forEach(function(n){n.reg||(n.reg=/(.*)/),n.format||(n.format="%s")})}),Ba.exports}var Yd;function vv(){return Yd||(Yd=1,function(A){var e=function(o){return String(Number(o))===o?Number(o):o},t=function(o,a,c,l){if(l&&!c)a[l]=e(o[1]);else for(var u=0;u<c.length;u+=1)o[u+1]!=null&&(a[c[u]]=e(o[u+1]))},n=function(o,a,c){var l=o.name&&o.names;o.push&&!a[o.push]?a[o.push]=[]:l&&!a[o.name]&&(a[o.name]={});var u=o.push?{}:l?a[o.name]:a;t(c.match(o.reg),u,o.names,o.name),o.push&&a[o.push].push(u)},i=va(),r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);A.parse=function(o){var a={},c=[],l=a;return o.split(/(\r\n|\r|\n)/).filter(r).forEach(function(u){var d=u[0],h=u.slice(2);d==="m"&&(c.push({rtp:[],fmtp:[]}),l=c[c.length-1]);for(var f=0;f<(i[d]||[]).length;f+=1){var g=i[d][f];if(g.reg.test(h))return n(g,l,h)}}),a.media=c,a};var s=function(o,a){var c=a.split(/=(.+)/,2);return c.length===2?o[c[0]]=e(c[1]):c.length===1&&a.length>1&&(o[c[0]]=void 0),o};A.parseParams=function(o){return o.split(/;\s?/).reduce(s,{})},A.parseFmtpConfig=A.parseParams,A.parsePayloads=function(o){return o.toString().split(" ").map(Number)},A.parseRemoteCandidates=function(o){for(var a=[],c=o.split(" ").map(e),l=0;l<c.length;l+=3)a.push({component:c[l],ip:c[l+1],port:c[l+2]});return a},A.parseImageAttributes=function(o){return o.split(" ").map(function(a){return a.substring(1,a.length-1).split(",").reduce(s,{})})},A.parseSimulcastStreamList=function(o){return o.split(";").map(function(a){return a.split(",").map(function(c){var l,u=!1;return c[0]!=="~"?l=e(c):(l=e(c.substring(1,c.length)),u=!0),{scid:l,paused:u}})})}}(ma)),ma}var Ca,zd;function Cv(){if(zd)return Ca;zd=1;var A=va(),e=/%[sdv%]/g,t=function(s){var o=1,a=arguments,c=a.length;return s.replace(e,function(l){if(o>=c)return l;var u=a[o];switch(o+=1,l){case"%%":return"%";case"%s":return String(u);case"%d":return Number(u);case"%v":return""}})},n=function(s,o,a){var c=o.format instanceof Function?o.format(o.push?a:a[o.name]):o.format,l=[s+"="+c];if(o.names)for(var u=0;u<o.names.length;u+=1){var d=o.names[u];o.name?l.push(a[o.name][d]):l.push(a[o.names[u]])}else l.push(a[o.name]);return t.apply(null,l)},i=["v","o","s","i","u","e","p","c","b","t","r","z","a"],r=["i","c","b","a"];return Ca=function(s,o){o=o||{},s.version==null&&(s.version=0),s.name==null&&(s.name=" "),s.media.forEach(function(u){u.payloads==null&&(u.payloads="")});var a=o.outerOrder||i,c=o.innerOrder||r,l=[];return a.forEach(function(u){A[u].forEach(function(d){d.name in s&&s[d.name]!=null?l.push(n(u,d,s)):d.push in s&&s[d.push]!=null&&s[d.push].forEach(function(h){l.push(n(u,d,h))})})}),s.media.forEach(function(u){l.push(n("m",A.m[0],u)),c.forEach(function(d){A[d].forEach(function(h){h.name in u&&u[h.name]!=null?l.push(n(d,h,u)):h.push in u&&u[h.push]!=null&&u[h.push].forEach(function(f){l.push(n(d,h,f))})})})}),l.join(`\r
41
41
  `)+`\r
42
- `},Ca}var Zd;function wv(){if(Zd)return yt;Zd=1;var A=vv(),e=Cv(),t=va();return yt.grammar=t,yt.write=e,yt.parse=A.parse,yt.parseParams=A.parseParams,yt.parseFmtpConfig=A.parseFmtpConfig,yt.parsePayloads=A.parsePayloads,yt.parseRemoteCandidates=A.parseRemoteCandidates,yt.parseImageAttributes=A.parseImageAttributes,yt.parseSimulcastStreamList=A.parseSimulcastStreamList,yt}var hA=wv();function wa(A,e,t){var n,i,r;e===void 0&&(e=50),t===void 0&&(t={});var s=(n=t.isImmediate)!=null&&n,o=(i=t.callback)!=null&&i,a=t.maxWait,c=Date.now(),l=[];function u(){if(a!==void 0){var h=Date.now()-c;if(h+e>=a)return a-h}return e}var d=function(){var h=[].slice.call(arguments),f=this;return new Promise(function(g,p){var B=s&&r===void 0;if(r!==void 0&&clearTimeout(r),r=setTimeout(function(){if(r=void 0,c=Date.now(),!s){var b=A.apply(f,h);o&&o(b),l.forEach(function(v){return(0,v.resolve)(b)}),l=[]}},u()),B){var y=A.apply(f,h);return o&&o(y),g(y)}l.push({resolve:g,reject:p})})};return d.cancel=function(h){r!==void 0&&clearTimeout(r),l.forEach(function(f){return(0,f.reject)(h)}),l=[]},d}const yv=.7,bv=20,Un={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class eh extends xt.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;super(),this.log=j,this.ddExtID=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=wa(i=>m(this,void 0,void 0,function*(){this.emit(Un.NegotiationStarted);try{yield this.createAndSendOffer()}catch(r){if(i)i(r);else throw r}}),bv),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=Vt((n=t.loggerName)!==null&&n!==void 0?n:Ct.PCTransport),this.loggerOptions=t,this.config=e,this._pc=this.createPC()}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=t=>{var n;t.candidate&&((n=this.onIceCandidate)===null||n===void 0||n.call(this,t.candidate))},e.onicecandidateerror=t=>{var n;(n=this.onIceCandidateError)===null||n===void 0||n.call(this,t)},e.oniceconnectionstatechange=()=>{var t;(t=this.onIceConnectionStateChange)===null||t===void 0||t.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var t;(t=this.onSignalingStatechange)===null||t===void 0||t.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var t;(t=this.onConnectionStateChange)===null||t===void 0||t.call(this,e.connectionState)},e.ondatachannel=t=>{var n;(n=this.onDataChannel)===null||n===void 0||n.call(this,t)},e.ontrack=t=>{var n;(n=this.onTrack)===null||n===void 0||n.call(this,t)},e}get logContext(){var e,t;return Object.assign({},(t=(e=this.loggerOptions).loggerContextCb)===null||t===void 0?void 0:t.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return m(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e){return m(this,void 0,void 0,function*(){var t;let n;if(e.type==="offer"){let{stereoMids:i,nackMids:r}=Ev(e);this.remoteStereoMids=i,this.remoteNackMids=r}else if(e.type==="answer"){const i=hA.parse((t=e.sdp)!==null&&t!==void 0?t:"");i.media.forEach(r=>{r.type==="audio"&&this.trackBitrates.some(s=>{if(!s.transceiver||r.mid!=s.transceiver.mid)return!1;let o=0;if(r.rtp.some(c=>c.codec.toUpperCase()===s.codec.toUpperCase()?(o=c.payload,!0):!1),o===0)return!0;let a=!1;for(const c of r.fmtp)if(c.payload===o){c.config=c.config.split(";").filter(l=>!l.includes("maxaveragebitrate")).join(";"),s.maxbr>0&&(c.config+=";maxaveragebitrate=".concat(s.maxbr*1e3)),a=!0;break}return a||s.maxbr>0&&r.fmtp.push({payload:o,config:"maxaveragebitrate=".concat(s.maxbr*1e3)}),!0})}),n=hA.write(i)}yield this.setMungedSDP(e,n,!0),this.pendingCandidates.forEach(i=>{this.pc.addIceCandidate(i)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(Un.NegotiationComplete),e.sdp&&hA.parse(e.sdp).media.forEach(r=>{r.type==="video"&&this.emit(Un.RTPVideoPayloadTypes,r.rtp)}))})}createAndSendOffer(e){return m(this,void 0,void 0,function*(){var t;if(this.onOffer===void 0)return;if(e?.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const r=this._pc.remoteDescription;if(e?.iceRestart&&r)yield this._pc.setRemoteDescription(r);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const n=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:n.sdp},this.logContext));const i=hA.parse((t=n.sdp)!==null&&t!==void 0?t:"");i.media.forEach(r=>{Ah(r),r.type==="audio"?th(r,[],[]):r.type==="video"&&this.trackBitrates.some(s=>{if(!r.msid||!s.cid||!r.msid.includes(s.cid))return!1;let o=0;if(r.rtp.some(c=>c.codec.toUpperCase()===s.codec.toUpperCase()?(o=c.payload,!0):!1),o===0||(oi(s.codec)&&this.ensureVideoDDExtensionForSVC(r,i),s.codec!=="av1"))return!0;const a=Math.round(s.maxbr*yv);for(const c of r.fmtp)if(c.payload===o){c.config.includes("x-google-start-bitrate")||(c.config+=";x-google-start-bitrate=".concat(a));break}return!0})}),yield this.setMungedSDP(n,hA.write(i)),this.onOffer(n)})}createAndSetAnswer(){return m(this,void 0,void 0,function*(){var e;const t=yield this.pc.createAnswer(),n=hA.parse((e=t.sdp)!==null&&e!==void 0?e:"");return n.media.forEach(i=>{Ah(i),i.type==="audio"&&th(i,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(t,hA.write(n)),t})}createDataChannel(e,t){return this.pc.createDataChannel(e,t)}addTransceiver(e,t){return this.pc.addTransceiver(e,t)}addTrack(e){if(!this._pc)throw new Ee("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var t;if(!this._pc)throw new Ee("PC closed, cannot configure");return(t=this._pc)===null||t===void 0?void 0:t.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var t;return(t=this._pc)===null||t===void 0?void 0:t.removeTrack(e)}getConnectionState(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&t!==void 0?t:"closed"}getICEConnectionState(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&t!==void 0?t:"closed"}getSignallingState(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&t!==void 0?t:"closed"}getTransceivers(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&t!==void 0?t:[]}getSenders(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&t!==void 0?t:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return m(this,void 0,void 0,function*(){var e;if(!this._pc)return;let t="";const n=new Map,i=new Map;if((yield this._pc.getStats()).forEach(o=>{switch(o.type){case"transport":t=o.selectedCandidatePairId;break;case"candidate-pair":t===""&&o.selected&&(t=o.id),n.set(o.id,o);break;case"remote-candidate":i.set(o.id,"".concat(o.address,":").concat(o.port));break}}),t==="")return;const s=(e=n.get(t))===null||e===void 0?void 0:e.remoteCandidateId;if(s!==void 0)return i.get(s)})}setMungedSDP(e,t,n){return m(this,void 0,void 0,function*(){if(t){const i=e.sdp;e.sdp=t;try{this.log.debug("setting munged ".concat(n?"remote":"local"," description"),this.logContext),n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(r){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:r,sdp:t})),e.sdp=i}}try{n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(i){let r="unknown error";i instanceof Error?r=i.message:typeof i=="string"&&(r=i);const s={error:r,sdp:e.sdp};throw!n&&this.pc.remoteDescription&&(s.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:s})),new Xo(r)}})}ensureVideoDDExtensionForSVC(e,t){var n,i;if(!((n=e.ext)===null||n===void 0?void 0:n.some(s=>s.uri===Rd))){if(this.ddExtID===0){let s=0;t.media.forEach(o=>{var a;o.type==="video"&&((a=o.ext)===null||a===void 0||a.forEach(c=>{c.value>s&&(s=c.value)}))}),this.ddExtID=s+1}(i=e.ext)===null||i===void 0||i.push({value:this.ddExtID,uri:Rd})}}}function th(A,e,t){let n=0;A.rtp.some(i=>i.codec==="opus"?(n=i.payload,!0):!1),n>0&&(A.rtcpFb||(A.rtcpFb=[]),t.includes(A.mid)&&!A.rtcpFb.some(i=>i.payload===n&&i.type==="nack")&&A.rtcpFb.push({payload:n,type:"nack"}),e.includes(A.mid)&&A.fmtp.some(i=>i.payload===n?(i.config.includes("stereo=1")||(i.config+=";stereo=1"),!0):!1))}function Ev(A){var e;const t=[],n=[],i=hA.parse((e=A.sdp)!==null&&e!==void 0?e:"");let r=0;return i.media.forEach(s=>{var o;s.type==="audio"&&(s.rtp.some(a=>a.codec==="opus"?(r=a.payload,!0):!1),!((o=s.rtcpFb)===null||o===void 0)&&o.some(a=>a.payload===r&&a.type==="nack")&&n.push(s.mid),s.fmtp.some(a=>a.payload===r?(a.config.includes("sprop-stereo=1")&&t.push(s.mid),!0):!1))}),{stereoMids:t,nackMids:n}}function Ah(A){if(A.connection){const e=A.connection.ip.indexOf(":")>=0;(A.connection.version===4&&e||A.connection.version===6&&!e)&&(A.connection.ip="0.0.0.0",A.connection.version=4)}}const ya="vp8",Sv={audioPreset:Zo.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:ta.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:ya,backupCodec:!0},nh={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},ih={deviceId:{ideal:"default"},resolution:si.h720.resolution},Uv={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new p0,disconnectOnPageLeave:!0,webAudioMix:!1},ba={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var fe;(function(A){A[A.NEW=0]="NEW",A[A.CONNECTING=1]="CONNECTING",A[A.CONNECTED=2]="CONNECTED",A[A.FAILED=3]="FAILED",A[A.CLOSING=4]="CLOSING",A[A.CLOSED=5]="CLOSED"})(fe||(fe={}));class Tv{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,t,n){var i;this.peerConnectionTimeout=ba.peerConnectionTimeout,this.log=j,this.updateState=()=>{var r;const s=this.state,o=this.requiredTransports.map(a=>a.getConnectionState());o.every(a=>a==="connected")?this.state=fe.CONNECTED:o.some(a=>a==="failed")?this.state=fe.FAILED:o.some(a=>a==="connecting")?this.state=fe.CONNECTING:o.every(a=>a==="closed")?this.state=fe.CLOSED:o.some(a=>a==="closed")?this.state=fe.CLOSING:o.every(a=>a==="new")&&(this.state=fe.NEW),s!==this.state&&(this.log.debug("pc state change: from ".concat(fe[s]," to ").concat(fe[this.state]),this.logContext),(r=this.onStateChange)===null||r===void 0||r.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=Vt((i=n.loggerName)!==null&&i!==void 0?i:Ct.PCManager),this.loggerOptions=n,this.isPublisherConnectionRequired=!t,this.isSubscriberConnectionRequired=t,this.publisher=new eh(e,n),this.subscriber=new eh(e,n),this.publisher.onConnectionStateChange=this.updateState,this.subscriber.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=r=>{var s;(s=this.onIceCandidate)===null||s===void 0||s.call(this,r,vt.PUBLISHER)},this.subscriber.onIceCandidate=r=>{var s;(s=this.onIceCandidate)===null||s===void 0||s.call(this,r,vt.SUBSCRIBER)},this.subscriber.onDataChannel=r=>{var s;(s=this.onDataChannel)===null||s===void 0||s.call(this,r)},this.subscriber.onTrack=r=>{var s;(s=this.onTrack)===null||s===void 0||s.call(this,r)},this.publisher.onOffer=r=>{var s;(s=this.onPublisherOffer)===null||s===void 0||s.call(this,r)},this.state=fe.NEW,this.connectionLock=new We,this.remoteOfferLock=new We}get logContext(){var e,t;return Object.assign({},(t=(e=this.loggerOptions).loggerContextCb)===null||t===void 0?void 0:t.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e){return this.publisher.setRemoteDescription(e)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return m(this,void 0,void 0,function*(){if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const e=this.publisher;for(const t of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(t)}catch(n){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:n}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return m(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,t){return m(this,void 0,void 0,function*(){t===vt.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e){return m(this,void 0,void 0,function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const t=yield this.remoteOfferLock.lock();try{return yield this.subscriber.setRemoteDescription(e),yield this.subscriber.createAndSetAnswer()}finally{t()}})}updateConfiguration(e,t){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),t&&this.triggerIceRestart()}ensurePCTransportConnection(e,t){return m(this,void 0,void 0,function*(){var n;const i=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((n=this.requiredTransports)===null||n===void 0?void 0:n.map(r=>this.ensureTransportConnected(r,e,t)))}finally{i()}})}negotiate(e){return m(this,void 0,void 0,function*(){return new Promise((t,n)=>m(this,void 0,void 0,function*(){const i=setTimeout(()=>{n("negotiation timed out")},this.peerConnectionTimeout),r=()=>{clearTimeout(i),n("negotiation aborted")};e.signal.addEventListener("abort",r),this.publisher.once(Un.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(Un.NegotiationComplete,()=>{clearTimeout(i),t()})}),yield this.publisher.negotiate(s=>{clearTimeout(i),n(s)})}))})}addPublisherTransceiver(e,t){return this.publisher.addTransceiver(e,t)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,t){return this.publisher.createDataChannel(e,t)}getConnectedAddress(e){return e===vt.PUBLISHER?this.publisher.getConnectedAddress():e===vt.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&e.push(this.subscriber),e}ensureTransportConnected(e,t){return m(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(n.getConnectionState()!=="connected")return new Promise((a,c)=>m(r,void 0,void 0,function*(){const l=()=>{this.log.warn("abort transport connection",this.logContext),Fe.clearTimeout(u),c(new se("room connection has been cancelled",W.Cancelled))};i?.signal.aborted&&l(),i?.signal.addEventListener("abort",l);const u=Fe.setTimeout(()=>{i?.signal.removeEventListener("abort",l),c(new se("could not establish pc connection",W.InternalError))},s);for(;this.state!==fe.CONNECTED;)if(yield qe(50),i?.signal.aborted){c(new se("room connection has been cancelled",W.Cancelled));return}Fe.clearTimeout(u),i?.signal.removeEventListener("abort",l),a()}))}()})}}class ge extends Error{constructor(e,t,n){super(t),this.code=e,this.message=sh(t,ge.MAX_MESSAGE_BYTES),this.data=n?sh(n,ge.MAX_DATA_BYTES):void 0}static fromProto(e){return new ge(e.code,e.message,e.data)}toProto(){return new wu({code:this.code,message:this.message,data:this.data})}static builtIn(e,t){return new ge(ge.ErrorCode[e],ge.ErrorMessage[e],t)}}ge.MAX_MESSAGE_BYTES=256,ge.MAX_DATA_BYTES=15360,ge.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404},ge.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const rh=15360;function Ea(A){return new TextEncoder().encode(A).length}function sh(A,e){if(Ea(A)<=e)return A;let t=0,n=A.length;const i=new TextEncoder;for(;t<n;){const r=Math.floor((t+n+1)/2);i.encode(A.slice(0,r)).length<=e?t=r:n=r-1}return A.slice(0,t)}const Sa=2e3;function Fr(A,e){if(!e)return 0;let t,n;return"bytesReceived"in A?(t=A.bytesReceived,n=e.bytesReceived):"bytesSent"in A&&(t=A.bytesSent,n=e.bytesSent),t===void 0||n===void 0||A.timestamp===void 0||e.timestamp===void 0?0:(t-n)*8*1e3/(A.timestamp-e.timestamp)}const Qv=1e3;class oh extends U{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}constructor(e,t,n){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=arguments.length>4?arguments[4]:void 0;super(e,t,r),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=wa(()=>m(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>m(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(k.Ended,this)},this.reacquireTrack=!1,this.providedByUser=i,this.muteLock=new We,this.pauseUpstreamLock=new We,this.processorLock=new We,this.restartLock=new We,this.setMediaStreamTrack(e,!0),this._constraints=e.getConstraints(),n&&(this._constraints=n)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==U.Kind.Video)return;const{width:e,height:t}=this._mediaStreamTrack.getSettings();if(e&&t)return{width:e,height:t}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,t;return(t=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&t!==void 0?t:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,t){return m(this,void 0,void 0,function*(){var n;if(e===this._mediaStreamTrack&&!t)return;this._mediaStreamTrack&&(this.attachedElements.forEach(r=>{yn(this._mediaStreamTrack,r)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let i;if(this.processor&&e){const r=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(wn(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),i=this.processor.processedTrack}finally{r()}}this.sender&&((n=this.sender.transport)===null||n===void 0?void 0:n.state)!=="closed"&&(yield this.sender.replaceTrack(i??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(r=>{wn(i??e,r)}))})}waitForDimensions(){return m(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qv;return function*(){var n;if(e.kind===U.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((n=wt())===null||n===void 0?void 0:n.os)==="iOS"&&(yield qe(10));const i=Date.now();for(;Date.now()-i<t;){const r=e.dimensions;if(r)return r;yield qe(50)}throw new jt("unable to get track dimensions after timeout")}()})}setDeviceId(e){return m(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===uA(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),uA(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return m(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===U.Source.ScreenShare)return;const{deviceId:n,groupId:i}=e._mediaStreamTrack.getSettings(),r=e.kind===U.Kind.Audio?"audioinput":"videoinput";return t?Ue.getInstance().normalizeDeviceId(r,n,i):n}()})}mute(){return m(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return m(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,t){return m(this,void 0,void 0,function*(){if(!this.sender)throw new jt("unable to replace an unpublished track");let n,i;return typeof t=="boolean"?n=t:t!==void 0&&(n=t.userProvidedTrack,i=t.stopProcessor),this.providedByUser=n??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),i&&this.processor&&(yield this.stopProcessor()),this})}restart(e){return m(this,void 0,void 0,function*(){this.manuallyStopped=!1;const t=yield this.restartLock.lock();try{e||(e=this._constraints);const{deviceId:n,facingMode:i}=e,r=m0(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const s={audio:!1,video:!1};this.kind===U.Kind.Video?s.video=n||i?{deviceId:n,facingMode:i}:!0:s.audio=n?{deviceId:n}:!0,this.attachedElements.forEach(c=>{yn(this.mediaStreamTrack,c)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const a=(yield navigator.mediaDevices.getUserMedia(s)).getTracks()[0];return yield a.applyConstraints(r),a.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(a),this._constraints=e,this.emit(k.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{t()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?k.Muted:k.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return m(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),Pd()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return m(this,void 0,void 0,function*(){var e;const t=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(k.UpstreamPaused,this);const n=wt();if(n?.name==="Safari"&&GA(n.version,"12.0")<0)throw new Jo("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{t()}})}resumeUpstream(){return m(this,void 0,void 0,function*(){var e;const t=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(k.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{t()}})}getRTCStatsReport(){return m(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var r;const s=yield n.processorLock.lock();try{n.log.debug("setting up processor",n.logContext);const o=document.createElement(n.kind),a={kind:n.kind,track:n._mediaStreamTrack,element:o,audioContext:n.audioContext};if(yield t.init(a),n.log.debug("processor initialized",n.logContext),n.processor&&(yield n.stopProcessor()),n.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(wn(n._mediaStreamTrack,o),o.muted=!0,o.play().catch(c=>n.log.error("failed to play processor element",Object.assign(Object.assign({},n.logContext),{error:c}))),n.processor=t,n.processorElement=o,n.processor.processedTrack){for(const c of n.attachedElements)c!==n.processorElement&&i&&(yn(n._mediaStreamTrack,c),wn(n.processor.processedTrack,c));yield(r=n.sender)===null||r===void 0?void 0:r.replaceTrack(n.processor.processedTrack)}n.emit(k.TrackProcessorUpdate,n.processor)}finally{s()}}()})}getProcessor(){return this.processor}stopProcessor(){return m(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var n,i;e.processor&&(e.log.debug("stopping processor",e.logContext),(n=e.processor.processedTrack)===null||n===void 0||n.stop(),yield e.processor.destroy(),e.processor=void 0,t||((i=e.processorElement)===null||i===void 0||i.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(k.TrackProcessorUpdate))}()})}}class kr extends oh{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;super(e,U.Kind.Audio,t,n,r),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>m(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(o){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:o}));return}s&&this.prevStats&&(this._currentBitrate=Fr(s,this.prevStats)),this.prevStats=s}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(k.AudioTrackFeatureUpdate,this,Bt.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(k.AudioTrackFeatureUpdate,this,Bt.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=i,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return m(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===U.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return m(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const n=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==uA(this._constraints.deviceId);return this.source===U.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||n)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{t()}})}restartTrack(e){return m(this,void 0,void 0,function*(){let t;if(e){const n=fa({audio:e});typeof n.audio!="boolean"&&(t=n.audio)}yield this.restart(t)})}restart(e){const t=Object.create(null,{restart:{get:()=>super.restart}});return m(this,void 0,void 0,function*(){const n=yield t.restart.call(this,e);return this.checkForSilence(),n})}startMonitor(){Ye()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},Sa)))}setProcessor(e){return m(this,void 0,void 0,function*(){var t;const n=yield this.processorLock.lock();try{if(!Rt()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const i={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(i),this.processor=e,this.processor.processedTrack&&(yield(t=this.sender)===null||t===void 0?void 0:t.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(k.TrackProcessorUpdate,this.processor)}finally{n()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return m(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const t=yield this.sender.getStats();let n;return t.forEach(i=>{i.type==="outbound-rtp"&&(n={type:"audio",streamId:i.id,packetsSent:i.packetsSent,packetsLost:i.packetsLost,bytesSent:i.bytesSent,timestamp:i.timestamp,roundTripTime:i.roundTripTime,jitter:i.jitter})}),n})}checkForSilence(){return m(this,void 0,void 0,function*(){const e=yield Vd(this);return e&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(k.AudioSilenceDetected)),e})}}function Fv(A,e,t){switch(A.kind){case"audio":return new kr(A,e,!1,void 0,t);case"video":return new _r(A,e,!1,t);default:throw new jt("unsupported track type: ".concat(A.kind))}}const kv=Object.values(si),Iv=Object.values(ea),_v=Object.values(ta),xv=[si.h180,si.h360],Rv=[ea.h180,ea.h360],Pv=A=>[{scaleResolutionDownBy:2,fps:A.encoding.maxFramerate}].map(t=>{var n,i;return new re(Math.floor(A.width/t.scaleResolutionDownBy),Math.floor(A.height/t.scaleResolutionDownBy),Math.max(15e4,Math.floor(A.encoding.maxBitrate/(Math.pow(t.scaleResolutionDownBy,2)*(((n=A.encoding.maxFramerate)!==null&&n!==void 0?n:30)/((i=t.fps)!==null&&i!==void 0?i:30))))),t.fps,A.encoding.priority)}),Ua=["q","h","f"];function Ta(A,e,t,n){var i,r;let s=n?.videoEncoding;A&&(s=n?.screenShareEncoding);const o=n?.simulcast,a=n?.scalabilityMode,c=n?.videoCodec;if(!s&&!o&&!a||!e||!t)return[{}];s||(s=Dv(A,e,t,c),j.debug("using video encoding",s));const l=s.maxFramerate,u=new re(e,t,s.maxBitrate,s.maxFramerate,s.priority);if(a&&oi(c)){const f=new Ir(a),g=[];if(f.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(a));const p=wt();if(lA()||Rt()||p?.name==="Chrome"&&GA(p?.version,"113")<0){const B=f.suffix=="h"?2:3;for(let y=0;y<f.spatial;y+=1)g.push({rid:Ua[2-y],maxBitrate:s.maxBitrate/Math.pow(B,y),maxFramerate:u.encoding.maxFramerate});g[0].scalabilityMode=a}else g.push({maxBitrate:s.maxBitrate,maxFramerate:u.encoding.maxFramerate,scalabilityMode:a});return u.encoding.priority&&(g[0].priority=u.encoding.priority,g[0].networkPriority=u.encoding.priority),j.debug("using svc encoding",{encodings:g}),g}if(!o)return[s];let d=[];A?d=(i=ch(n?.screenShareSimulcastLayers))!==null&&i!==void 0?i:ah(A,u):d=(r=ch(n?.videoSimulcastLayers))!==null&&r!==void 0?r:ah(A,u);let h;if(d.length>0){const f=d[0];d.length>1&&([,h]=d);const g=Math.max(e,t);if(g>=960&&h)return Qa(e,t,[f,h,u],l);if(g>=480)return Qa(e,t,[f,u],l)}return Qa(e,t,[u])}function Lv(A,e,t){var n,i,r,s;if(!t.backupCodec||t.backupCodec===!0||t.backupCodec.codec===t.videoCodec)return;e!==t.backupCodec.codec&&j.warn("requested a different codec than specified as backup",{serverRequested:e,backup:t.backupCodec.codec}),t.videoCodec=e,t.videoEncoding=t.backupCodec.encoding;const o=A.mediaStreamTrack.getSettings(),a=(n=o.width)!==null&&n!==void 0?n:(i=A.dimensions)===null||i===void 0?void 0:i.width,c=(r=o.height)!==null&&r!==void 0?r:(s=A.dimensions)===null||s===void 0?void 0:s.height;return A.source===U.Source.ScreenShare&&t.simulcast&&(t.simulcast=!1),Ta(A.source===U.Source.ScreenShare,a,c,t)}function Dv(A,e,t,n){const i=Ov(A,e,t);let{encoding:r}=i[0];const s=Math.max(e,t);for(let o=0;o<i.length;o+=1){const a=i[o];if(r=a.encoding,a.width>=s)break}if(n)switch(n){case"av1":r=Object.assign({},r),r.maxBitrate=r.maxBitrate*.7;break;case"vp9":r=Object.assign({},r),r.maxBitrate=r.maxBitrate*.85;break}return r}function Ov(A,e,t){if(A)return _v;const n=e>t?e/t:t/e;return Math.abs(n-16/9)<Math.abs(n-4/3)?kv:Iv}function ah(A,e){if(A)return Pv(e);const{width:t,height:n}=e,i=t>n?t/n:n/t;return Math.abs(i-16/9)<Math.abs(i-4/3)?xv:Rv}function Qa(A,e,t,n){const i=[];if(t.forEach((r,s)=>{if(s>=Ua.length)return;const o=Math.min(A,e),c={rid:Ua[s],scaleResolutionDownBy:Math.max(1,o/Math.min(r.width,r.height)),maxBitrate:r.encoding.maxBitrate},l=n&&r.encoding.maxFramerate?Math.min(n,r.encoding.maxFramerate):r.encoding.maxFramerate;l&&(c.maxFramerate=l);const u=bn()||s===0;r.encoding.priority&&u&&(c.priority=r.encoding.priority,c.networkPriority=r.encoding.priority),i.push(c)}),Rt()&&Dd()==="ios"){let r;i.forEach(o=>{r?o.maxFramerate&&o.maxFramerate>r&&(r=o.maxFramerate):r=o.maxFramerate});let s=!0;i.forEach(o=>{var a;o.maxFramerate!=r&&(s&&(s=!1,j.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),j.info('Setting framerate of encoding "'.concat((a=o.rid)!==null&&a!==void 0?a:"",'" to ').concat(r)),o.maxFramerate=r)})}return i}function ch(A){if(A)return A.sort((e,t)=>{const{encoding:n}=e,{encoding:i}=t;return n.maxBitrate>i.maxBitrate?1:n.maxBitrate<i.maxBitrate?-1:n.maxBitrate===i.maxBitrate&&n.maxFramerate&&i.maxFramerate?n.maxFramerate>i.maxFramerate?1:-1:0})}class Ir{constructor(e){const t=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!t)throw new Error("invalid scalability mode");if(this.spatial=parseInt(t[1]),this.temporal=parseInt(t[2]),t.length>3)switch(t[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=t[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function Hv(A){return A.source===U.Source.ScreenShare||A.constraints.height&&uA(A.constraints.height)>=1080?"maintain-resolution":"balanced"}const Mv=5e3;class _r extends oh{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0;super(e,U.Kind.Video,t,n,i),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>m(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let r;try{r=yield this.getSenderStats()}catch(o){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:o}));return}const s=new Map(r.map(o=>[o.rid,o]));if(this.prevStats){let o=0;s.forEach((a,c)=>{var l;const u=(l=this.prevStats)===null||l===void 0?void 0:l.get(c);o+=Fr(a,u)}),this._currentBitrate=o}this.prevStats=s}),this.senderLock=new We}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var t;if(this.signalClient=e,!Ye())return;const n=(t=this.sender)===null||t===void 0?void 0:t.getParameters();n&&(this.encodings=n.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},Sa))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return m(this,void 0,void 0,function*(){var t,n,i,r,s;yield e.pauseUpstream.call(this);try{for(var o=!0,a=sA(this.simulcastCodecs.values()),c;c=yield a.next(),t=c.done,!t;o=!0)r=c.value,o=!1,yield(s=r.sender)===null||s===void 0?void 0:s.replaceTrack(null)}catch(l){n={error:l}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(n)throw n.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return m(this,void 0,void 0,function*(){var t,n,i,r,s;yield e.resumeUpstream.call(this);try{for(var o=!0,a=sA(this.simulcastCodecs.values()),c;c=yield a.next(),t=c.done,!t;o=!0){r=c.value,o=!1;const l=r;yield(s=l.sender)===null||s===void 0?void 0:s.replaceTrack(l.mediaStreamTrack)}}catch(l){n={error:l}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(n)throw n.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return m(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===U.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return m(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.source===U.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{t()}})}setTrackMuted(e){super.setTrackMuted(e);for(const t of this.simulcastCodecs.values())t.mediaStreamTrack.enabled=!e}getSenderStats(){return m(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const t=[],n=yield this.sender.getStats();return n.forEach(i=>{var r;if(i.type==="outbound-rtp"){const s={type:"video",streamId:i.id,frameHeight:i.frameHeight,frameWidth:i.frameWidth,framesPerSecond:i.framesPerSecond,framesSent:i.framesSent,firCount:i.firCount,pliCount:i.pliCount,nackCount:i.nackCount,packetsSent:i.packetsSent,bytesSent:i.bytesSent,qualityLimitationReason:i.qualityLimitationReason,qualityLimitationDurations:i.qualityLimitationDurations,qualityLimitationResolutionChanges:i.qualityLimitationResolutionChanges,rid:(r=i.rid)!==null&&r!==void 0?r:i.id,retransmittedPacketsSent:i.retransmittedPacketsSent,targetBitrate:i.targetBitrate,timestamp:i.timestamp},o=n.get(i.remoteId);o&&(s.jitter=o.jitter,s.packetsLost=o.packetsLost,s.roundTripTime=o.roundTripTime),t.push(s)}}),t.sort((i,r)=>{var s,o;return((s=r.frameWidth)!==null&&s!==void 0?s:0)-((o=i.frameWidth)!==null&&o!==void 0?o:0)}),t})}setPublishingQuality(e){const t=[];for(let n=at.LOW;n<=at.HIGH;n+=1)t.push(new Lo({quality:n,enabled:n<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(t)}restartTrack(e){return m(this,void 0,void 0,function*(){var t,n,i,r,s;let o;if(e){const u=fa({video:e});typeof u.video!="boolean"&&(o=u.video)}yield this.restart(o);try{for(var a=!0,c=sA(this.simulcastCodecs.values()),l;l=yield c.next(),t=l.done,!t;a=!0){r=l.value,a=!1;const u=r;u.sender&&((s=u.sender.transport)===null||s===void 0?void 0:s.state)!=="closed"&&(u.mediaStreamTrack=this.mediaStreamTrack.clone(),yield u.sender.replaceTrack(u.mediaStreamTrack))}}catch(u){n={error:u}}finally{try{!a&&!t&&(i=c.return)&&(yield i.call(c))}finally{if(n)throw n.error}}})}setProcessor(e){const t=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return m(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s,o,a,c,l,u;if(yield t.setProcessor.call(i,n,r),!((l=i.processor)===null||l===void 0)&&l.processedTrack)try{for(var d=!0,h=sA(i.simulcastCodecs.values()),f;f=yield h.next(),s=f.done,!s;d=!0)c=f.value,d=!1,yield(u=c.sender)===null||u===void 0?void 0:u.replaceTrack(i.processor.processedTrack)}catch(g){o={error:g}}finally{try{!d&&!s&&(a=h.return)&&(yield a.call(h))}finally{if(o)throw o.error}}}()})}setDegradationPreference(e){return m(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const t=this.sender.getParameters();t.degradationPreference=e,this.sender.setParameters(t)}catch(t){this.log.warn("failed to set degradationPreference",Object.assign({error:t},this.logContext))}})}addSimulcastTrack(e,t){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const n={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:t};return this.simulcastCodecs.set(e,n),n}setSimulcastTrackSender(e,t){const n=this.simulcastCodecs.get(e);n&&(n.sender=t,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},Mv))}setPublishingCodecs(e){return m(this,void 0,void 0,function*(){var t,n,i,r,s,o,a;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(e[0].qualities),[];this.subscribedCodecs=e;const c=[];try{for(t=!0,n=sA(e);i=yield n.next(),r=i.done,!r;t=!0){a=i.value,t=!1;const l=a;if(!this.codec||this.codec===l.codec)yield this.setPublishingLayers(l.qualities);else{const u=this.simulcastCodecs.get(l.codec);if(this.log.debug("try setPublishingCodec for ".concat(l.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:u})),!u||!u.sender){for(const d of l.qualities)if(d.enabled){c.push(l.codec);break}}else u.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(l.codec),this.logContext),yield lh(u.sender,u.encodings,l.qualities,this.senderLock,this.log,this.logContext))}}}catch(l){s={error:l}}finally{try{!t&&!r&&(o=n.return)&&(yield o.call(n))}finally{if(s)throw s.error}}return c})}setPublishingLayers(e){return m(this,void 0,void 0,function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:e})),!(!this.sender||!this.encodings)&&(yield lh(this.sender,this.encodings,e,this.senderLock,this.log,this.logContext))})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return m(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),Pd()&&this.isInBackground&&this.source===U.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function lh(A,e,t,n,i,r){return m(this,void 0,void 0,function*(){const s=yield n.lock();i.debug("setPublishingLayersForSender",Object.assign(Object.assign({},r),{sender:A,qualities:t,senderEncodings:e}));try{const o=A.getParameters(),{encodings:a}=o;if(!a)return;if(a.length!==e.length){i.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},r),{encodings:a,senderEncodings:e}));return}let c=!1;const l=wt();if(l?.name==="Chrome"&&GA(l?.version,"133")>0&&a[0].scalabilityMode){const d=a[0],h=new Ir(d.scalabilityMode);let f=gn.OFF;if(t.forEach(g=>{g.enabled&&(f===gn.OFF||g.quality>f)&&(f=g.quality)}),f===gn.OFF)d.active&&(d.active=!1,c=!0);else if(!d.active||h.spatial!==f+1){c=!0,d.active=!0;const g=new Ir(e[0].scalabilityMode);h.spatial=f+1,h.suffix=g.suffix,h.spatial===1&&(h.suffix=void 0),d.scalabilityMode=h.toString(),d.scaleResolutionDownBy=Math.pow(2,2-f),e[0].maxBitrate&&(d.maxBitrate=e[0].maxBitrate/(d.scaleResolutionDownBy*d.scaleResolutionDownBy))}}else a.forEach((d,h)=>{var f;let g=(f=d.rid)!==null&&f!==void 0?f:"";g===""&&(g="q");const p=uh(g),B=t.find(y=>y.quality===p);B&&d.active!==B.enabled&&(c=!0,d.active=B.enabled,i.debug("setting layer ".concat(B.quality," to ").concat(d.active?"enabled":"disabled"),r),bn()&&(B.enabled?(d.scaleResolutionDownBy=e[h].scaleResolutionDownBy,d.maxBitrate=e[h].maxBitrate,d.maxFrameRate=e[h].maxFrameRate):(d.scaleResolutionDownBy=4,d.maxBitrate=10,d.maxFrameRate=2)))});c&&(o.encodings=a,i.debug("setting encodings",Object.assign(Object.assign({},r),{encodings:o.encodings})),yield A.setParameters(o))}finally{s()}})}function uh(A){switch(A){case"f":return at.HIGH;case"h":return at.MEDIUM;case"q":return at.LOW;default:return at.HIGH}}function dh(A,e,t,n){if(!t)return[new MA({quality:at.HIGH,width:A,height:e,bitrate:0,ssrc:0})];if(n){const i=t[0].scalabilityMode,r=new Ir(i),s=[],o=r.suffix=="h"?1.5:2,a=r.suffix=="h"?2:3;for(let c=0;c<r.spatial;c+=1)s.push(new MA({quality:Math.min(at.HIGH,r.spatial-1)-c,width:Math.ceil(A/Math.pow(o,c)),height:Math.ceil(e/Math.pow(o,c)),bitrate:t[0].maxBitrate?Math.ceil(t[0].maxBitrate/Math.pow(a,c)):0,ssrc:0}));return s}return t.map(i=>{var r,s,o;const a=(r=i.scaleResolutionDownBy)!==null&&r!==void 0?r:1;let c=uh((s=i.rid)!==null&&s!==void 0?s:"");return new MA({quality:c,width:Math.ceil(A/a),height:Math.ceil(e/a),bitrate:(o=i.maxBitrate)!==null&&o!==void 0?o:0,ssrc:0})})}const hh="_lossy",fh="_reliable",Nv=2*1e3,Fa="leave-reconnect";var bt;(function(A){A[A.New=0]="New",A[A.Connected=1]="Connected",A[A.Disconnected=2]="Disconnected",A[A.Reconnecting=3]="Reconnecting",A[A.Closed=4]="Closed"})(bt||(bt={}));class Kv extends xt.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var t;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=ba.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.subscriberPrimary=!1,this.pcState=bt.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=j,this.handleDataChannel=n=>m(this,[n],void 0,function(i){var r=this;let{channel:s}=i;return function*(){if(s){if(s.label===fh)r.reliableDCSub=s;else if(s.label===hh)r.lossyDCSub=s;else return;r.log.debug("on data channel ".concat(s.id,", ").concat(s.label),r.logContext),s.onmessage=r.handleDataMessage}}()}),this.handleDataMessage=n=>m(this,void 0,void 0,function*(){var i,r;const s=yield this.dataProcessLock.lock();try{let o;if(n.data instanceof ArrayBuffer)o=n.data;else if(n.data instanceof Blob)o=yield n.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:n.data}));return}const a=Xe.fromBinary(new Uint8Array(o));((i=a.value)===null||i===void 0?void 0:i.case)==="speaker"?this.emit(I.ActiveSpeakersUpdate,a.value.value.speakers):(((r=a.value)===null||r===void 0?void 0:r.case)==="user"&&Vv(a,a.value.value),this.emit(I.DataPacketReceived,a))}finally{s()}}),this.handleDataError=n=>{const r=n.currentTarget.maxRetransmits===0?"lossy":"reliable";if(n instanceof ErrorEvent&&n.error){const{error:s}=n.error;this.log.error("DataChannel error on ".concat(r,": ").concat(n.message),Object.assign(Object.assign({},this.logContext),{error:s}))}else this.log.error("Unknown DataChannel error on ".concat(r),Object.assign(Object.assign({},this.logContext),{event:n}))},this.handleBufferedAmountLow=n=>{const r=n.currentTarget.maxRetransmits===0?Y.LOSSY:Y.RELIABLE;this.updateAndEmitDCBufferStatus(r)},this.handleDisconnect=(n,i)=>{if(this._isClosed)return;this.log.warn("".concat(n," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const r=a=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(a,"ms. giving up"),this.logContext),this.emit(I.Disconnected),this.close()},s=Date.now()-this.reconnectStart;let o=this.getNextRetryDelay({elapsedMs:s,retryCount:this.reconnectAttempts});if(o===null){r(s);return}n===Fa&&(o=0),this.log.debug("reconnecting in ".concat(o,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Fe.setTimeout(()=>this.attemptReconnect(i).finally(()=>this.reconnectTimeout=void 0),o)},this.waitForRestarted=()=>new Promise((n,i)=>{this.pcState===bt.Connected&&n();const r=()=>{this.off(I.Disconnected,s),n()},s=()=>{this.off(I.Restarted,r),i()};this.once(I.Restarted,r),this.once(I.Disconnected,s)}),this.updateAndEmitDCBufferStatus=n=>{const i=this.isBufferStatusLow(n);typeof i<"u"&&i!==this.dcBufferStatus.get(n)&&(this.dcBufferStatus.set(n,i),this.emit(I.DCBufferStatusChanged,i,n))},this.isBufferStatusLow=n=>{const i=this.dataChannelForKind(n);if(i)return i.bufferedAmount<=i.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===ae.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(pn.RR_SIGNAL_DISCONNECTED))},this.log=Vt((t=e.loggerName)!==null&&t!==void 0?t:Ct.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new pa(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new We,this.dataProcessLock=new We,this.dcBufferStatus=new Map([[Y.LOSSY,!0],[Y.RELIABLE,!0]]),this.client.onParticipantUpdate=n=>this.emit(I.ParticipantUpdate,n),this.client.onConnectionQuality=n=>this.emit(I.ConnectionQualityUpdate,n),this.client.onRoomUpdate=n=>this.emit(I.RoomUpdate,n),this.client.onSubscriptionError=n=>this.emit(I.SubscriptionError,n),this.client.onSubscriptionPermissionUpdate=n=>this.emit(I.SubscriptionPermissionUpdate,n),this.client.onSpeakersChanged=n=>this.emit(I.SpeakersChanged,n),this.client.onStreamStateUpdate=n=>this.emit(I.StreamStateChanged,n),this.client.onRequestResponse=n=>this.emit(I.SignalRequestResponse,n)}get logContext(){var e,t,n,i,r,s,o,a;return{room:(t=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||t===void 0?void 0:t.name,roomID:(i=(n=this.latestJoinResponse)===null||n===void 0?void 0:n.room)===null||i===void 0?void 0:i.sid,participant:(s=(r=this.latestJoinResponse)===null||r===void 0?void 0:r.participant)===null||s===void 0?void 0:s.identity,pID:(a=(o=this.latestJoinResponse)===null||o===void 0?void 0:o.participant)===null||a===void 0?void 0:a.sid}}join(e,t,n,i){return m(this,void 0,void 0,function*(){this.url=e,this.token=t,this.signalOpts=n,this.maxJoinAttempts=n.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const r=yield this.client.join(e,t,n,i);return this._isClosed=!1,this.latestJoinResponse=r,this.subscriberPrimary=r.subscriberPrimary,this.pcManager||(yield this.configure(r)),(!this.subscriberPrimary||r.fastPublish)&&this.negotiate(),this.clientConfiguration=r.clientConfiguration,setTimeout(()=>{this.emit(I.SignalConnected)},10),r}catch(r){if(r instanceof se&&r.reason===W.ServerUnreachable&&(this.log.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts," of ").concat(this.maxJoinAttempts),this.logContext),this.joinAttempts<this.maxJoinAttempts))return this.join(e,t,n,i);throw r}})}close(){return m(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(I.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return m(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const t=n=>{n&&(n.close(),n.onbufferedamountlow=null,n.onclose=null,n.onclosing=null,n.onerror=null,n.onmessage=null,n.onopen=null)};t(this.lossyDC),t(this.lossyDCSub),t(this.reliableDC),t(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0})}cleanupClient(){return m(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new jt("a track with the same ID has already been published");return new Promise((t,n)=>{const i=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],n(new se("publication of local track timed out, no response from server",W.InternalError))},1e4);this.pendingTrackResolvers[e.cid]={resolve:r=>{clearTimeout(i),t(r)},reject:()=>{clearTimeout(i),n(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:t}=this.pendingTrackResolvers[e.track.id];t&&t(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(t){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:t}))}return!1}updateMuteStatus(e,t){this.client.sendMuteTrack(e,t)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return m(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return m(this,void 0,void 0,function*(){var t,n;if(this.pcManager&&this.pcManager.currentState!==fe.NEW)return;this.participantSid=(t=e.participant)===null||t===void 0?void 0:t.sid;const i=this.makeRTCConfiguration(e);this.pcManager=new Tv(i,e.subscriberPrimary,this.loggerOptions),this.emit(I.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(r,s)=>{this.client.sendIceCandidate(r,s)},this.pcManager.onPublisherOffer=r=>{this.client.sendOffer(r)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(r,s,o)=>m(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(r),this.logContext),["closed","disconnected","failed"].includes(s)&&(this.publisherConnectionPromise=void 0),r===fe.CONNECTED){const l=this.pcState===bt.New;this.pcState=bt.Connected,l&&this.emit(I.Connected,e)}else r===fe.FAILED&&this.pcState===bt.Connected&&(this.pcState=bt.Disconnected,this.handleDisconnect("peerconnection failed",o==="failed"?pn.RR_SUBSCRIBER_FAILED:pn.RR_PUBLISHER_FAILED));const a=this.client.isDisconnected||this.client.currentState===ae.RECONNECTING,c=[fe.FAILED,fe.CLOSING,fe.CLOSED].includes(r);a&&c&&!this._isClosed&&this.emit(I.Offline)}),this.pcManager.onTrack=r=>{this.emit(I.MediaTrackAdded,r.track,r.streams[0],r.receiver)},Gv((n=e.serverInfo)===null||n===void 0?void 0:n.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=e=>m(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type})),yield this.pcManager.setPublisherAnswer(e))}),this.client.onTrickle=(e,t)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:t})),this.pcManager.addIceCandidate(e,t))},this.client.onOffer=e=>m(this,void 0,void 0,function*(){if(!this.pcManager)return;const t=yield this.pcManager.createSubscriberAnswerFromOffer(e);this.client.sendAnswer(t)}),this.client.onLocalTrackPublished=e=>{var t;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(t=e.track)===null||t===void 0?void 0:t.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:n}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],n(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(I.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(I.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,t)=>{this.emit(I.RemoteMute,e,t)},this.client.onSubscribedQualityUpdate=e=>{this.emit(I.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var t;this.participantSid=(t=e.participant)===null||t===void 0?void 0:t.sid,this.emit(I.RoomMoved,e)},this.client.onClose=()=>{this.handleDisconnect("signal",pn.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e?.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case vn.DISCONNECT:this.emit(I.Disconnected,e?.reason),this.close();break;case vn.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Fa);break;case vn.RESUME:this.handleDisconnect(Fa)}}}makeRTCConfiguration(e){var t;const n=Object.assign({},this.rtcConfig);if(!((t=this.signalOpts)===null||t===void 0)&&t.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),n.encodedInsertableStreams=!0),e.iceServers&&!n.iceServers){const i=[];e.iceServers.forEach(r=>{const s={urls:r.urls};r.username&&(s.username=r.username),r.credential&&(s.credential=r.credential),i.push(s)}),n.iceServers=i}return e.clientConfiguration&&e.clientConfiguration.forceRelay===ni.ENABLED&&(n.iceTransportPolicy="relay"),n.sdpSemantics="unified-plan",n.continualGatheringPolicy="gather_continually",n}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(hh,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(fh,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow)}createSender(e,t,n){return m(this,void 0,void 0,function*(){if(Aa())return yield this.createTransceiverRTCRtpSender(e,t,n);if(na())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new Ee("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,t,n,i){return m(this,void 0,void 0,function*(){if(Aa())return this.createSimulcastTransceiverSender(e,t,n,i);if(na())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new Ee("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,t,n){return m(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ee("publisher is closed");const i=[];e.mediaStream&&i.push(e.mediaStream),Sn(e)&&(e.codec=t.videoCodec);const r={direction:"sendonly",streams:i};return n&&(r.sendEncodings=n),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,r)).sender})}createSimulcastTransceiverSender(e,t,n,i){return m(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ee("publisher is closed");const r={direction:"sendonly"};i&&(r.sendEncodings=i);const s=yield this.pcManager.addPublisherTransceiver(t.mediaStreamTrack,r);if(n.videoCodec)return e.setSimulcastTrackSender(n.videoCodec,s.sender),s.sender})}createRTCRtpSender(e){return m(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ee("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return m(this,void 0,void 0,function*(){var t,n,i;if(!this._isClosed){if(this.attemptingReconnect){j.warn("already attempting reconnect, returning early",this.logContext);return}(((t=this.clientConfiguration)===null||t===void 0?void 0:t.resumeConnection)===ni.DISABLED||((i=(n=this.pcManager)===null||n===void 0?void 0:n.currentState)!==null&&i!==void 0?i:fe.NEW)===fe.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(r){this.reconnectAttempts+=1;let s=!0;r instanceof Ee?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:r})),s=!1):r instanceof Tn||(this.fullReconnectOnNext=!0),s?this.handleDisconnect("reconnect",pn.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(I.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(t){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:t}))}return null}restartConnection(e){return m(this,void 0,void 0,function*(){var t,n,i;try{if(!this.url||!this.token)throw new Ee("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(I.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let r;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new Tn;r=yield this.join(e??this.url,this.token,this.signalOpts)}catch(s){throw s instanceof se&&s.reason===W.NotAllowed?new Ee("could not reconnect, token might be expired"):new Tn}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(I.SignalRestarted,r),yield this.waitForPCReconnected(),this.client.currentState!==ae.CONNECTED)throw new Tn("Signal connection got severed during reconnect");(t=this.regionUrlProvider)===null||t===void 0||t.resetAttempts(),this.emit(I.Restarted)}catch(r){const s=yield(n=this.regionUrlProvider)===null||n===void 0?void 0:n.getNextBestRegionUrl();if(s){yield this.restartConnection(s);return}else throw(i=this.regionUrlProvider)===null||i===void 0||i.resetAttempts(),r}})}resumeConnection(e){return m(this,void 0,void 0,function*(){var t;if(!this.url||!this.token)throw new Ee("could not reconnect, url or token not saved");if(!this.pcManager)throw new Ee("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(I.Resuming);let n;try{this.setupSignalClientCallbacks(),n=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(i){let r="";throw i instanceof Error&&(r=i.message,this.log.error(i.message,Object.assign(Object.assign({},this.logContext),{error:i}))),i instanceof se&&i.reason===W.NotAllowed?new Ee("could not reconnect, token might be expired"):i instanceof se&&i.reason===W.LeaveRequest?i:new Tn(r)}if(this.emit(I.SignalResumed),n){const i=this.makeRTCConfiguration(n);this.pcManager.updateConfiguration(i)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==ae.CONNECTED)throw new Tn("Signal connection got severed during reconnect");this.client.setReconnected(),((t=this.reliableDC)===null||t===void 0?void 0:t.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),this.emit(I.Resumed)})}waitForPCInitialConnection(e,t){return m(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ee("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(t,e)})}waitForPCReconnected(){return m(this,void 0,void 0,function*(){this.pcState=bt.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield qe(Nv),!this.pcManager)throw new Ee("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=bt.Connected}catch(e){throw this.pcState=bt.Disconnected,new se("could not establish PC connection, ".concat(e.message),W.InternalError)}})}publishRpcResponse(e,t,n,i){return m(this,void 0,void 0,function*(){const r=new Xe({destinationIdentities:[e],kind:Y.RELIABLE,value:{case:"rpcResponse",value:new Cu({requestId:t,value:i?{case:"error",value:i.toProto()}:{case:"payload",value:n??""}})}});yield this.sendDataPacket(r,Y.RELIABLE)})}publishRpcAck(e,t){return m(this,void 0,void 0,function*(){const n=new Xe({destinationIdentities:[e],kind:Y.RELIABLE,value:{case:"rpcAck",value:new vu({requestId:t})}});yield this.sendDataPacket(n,Y.RELIABLE)})}sendDataPacket(e,t){return m(this,void 0,void 0,function*(){const n=e.toBinary();yield this.ensurePublisherConnected(t);const i=this.dataChannelForKind(t);i&&i.send(n),this.updateAndEmitDCBufferStatus(t)})}waitForBufferStatusLow(e){return new Promise((t,n)=>m(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))t();else{const i=()=>n("Engine closed");for(this.once(I.Closing,i);!this.dcBufferStatus.get(e);)yield qe(10);this.off(I.Closing,i),t()}}))}ensureDataTransportConnected(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var r;if(!n.pcManager)throw new Ee("PC manager is closed");const s=i?n.pcManager.subscriber:n.pcManager.publisher,o=i?"Subscriber":"Publisher";if(!s)throw new se("".concat(o," connection not set"),W.InternalError);let a=!1;!i&&!n.dataChannelForKind(t,i)&&(n.createDataChannels(),a=!0),!a&&!i&&!n.pcManager.publisher.isICEConnected&&n.pcManager.publisher.getICEConnectionState()!=="checking"&&(a=!0),a&&n.negotiate();const c=n.dataChannelForKind(t,i);if(c?.readyState==="open")return;const l=new Date().getTime()+n.peerConnectionTimeout;for(;new Date().getTime()<l;){if(s.isICEConnected&&((r=n.dataChannelForKind(t,i))===null||r===void 0?void 0:r.readyState)==="open")return;yield qe(50)}throw new se("could not establish ".concat(o," connection, state: ").concat(s.getICEConnectionState()),W.InternalError)}()})}ensurePublisherConnected(e){return m(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==fe.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return m(this,void 0,void 0,function*(){return new Promise((e,t)=>m(this,void 0,void 0,function*(){if(!this.pcManager){t(new Xo("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const n=new AbortController,i=()=>{n.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&t("cannot negotiate on closed engine"),this.on(I.Closing,i),this.pcManager.publisher.once(Un.RTPVideoPayloadTypes,r=>{const s=new Map;r.forEach(o=>{const a=o.codec.toLowerCase();z0(a)&&s.set(o.payload,a)}),this.emit(I.RTPVideoMapUpdate,s)});try{yield this.pcManager.negotiate(n),e()}catch(r){r instanceof Xo&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",pn.RR_UNKNOWN),t(r)}finally{this.off(I.Closing,i)}}))})}dataChannelForKind(e,t){if(t){if(e===Y.LOSSY)return this.lossyDCSub;if(e===Y.RELIABLE)return this.reliableDCSub}else{if(e===Y.LOSSY)return this.lossyDC;if(e===Y.RELIABLE)return this.reliableDC}}sendSyncState(e,t){var n,i;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const r=this.pcManager.subscriber.getLocalDescription(),s=this.pcManager.subscriber.getRemoteDescription(),o=(i=(n=this.signalOpts)===null||n===void 0?void 0:n.autoSubscribe)!==null&&i!==void 0?i:!0,a=new Array,c=new Array;e.forEach(l=>{l.isDesired!==o&&a.push(l.trackSid),l.isEnabled||c.push(l.trackSid)}),this.client.sendSyncState(new Ou({answer:r?Qr({sdp:r.sdp,type:r.type}):void 0,offer:s?Qr({sdp:s.sdp,type:s.type}):void 0,subscription:new dr({trackSids:a,subscribe:!o,participantTracks:[]}),publishTracks:ov(t),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:c}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],t=(n,i)=>{n?.id!==void 0&&n.id!==null&&e.push(new Hu({label:n.label,id:n.id,target:i}))};return t(this.dataChannelForKind(Y.LOSSY),vt.PUBLISHER),t(this.dataChannelForKind(Y.RELIABLE),vt.PUBLISHER),t(this.dataChannelForKind(Y.LOSSY,!0),vt.SUBSCRIBER),t(this.dataChannelForKind(Y.RELIABLE,!0),vt.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Fe.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Ye()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){Ye()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class Tn extends Error{}function Gv(A){return A!==void 0&&A>13}function Vv(A,e){const t=A.participantIdentity?A.participantIdentity:e.participantIdentity;A.participantIdentity=t,e.participantIdentity=t;const n=A.destinationIdentities.length!==0?A.destinationIdentities:e.destinationIdentities;A.destinationIdentities=n,e.destinationIdentities=n}class ka{constructor(e,t){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=t}updateToken(e){this.token=e}isCloud(){return ra(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return m(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");(!this.regionSettings||Date.now()-this.lastUpdateAt>this.settingsCacheTime)&&(this.regionSettings=yield this.fetchRegionSettings(e));const t=this.regionSettings.regions.filter(n=>!this.attemptedRegions.find(i=>i.url===n.url));if(t.length>0){const n=t[0];return this.attemptedRegions.push(n),j.debug("next region: ".concat(n.region)),n.url}else return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return m(this,void 0,void 0,function*(){const t=yield fetch("".concat(jv(this.serverUrl),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});if(t.ok){const n=yield t.json();return this.lastUpdateAt=Date.now(),n}else throw new se("Could not fetch region settings: ".concat(t.statusText),t.status===401?W.NotAllowed:W.InternalError,t.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}function jv(A){return"".concat(A.protocol.replace("ws","http"),"//").concat(A.host,"/settings")}class gh{get info(){return this._info}constructor(e,t,n){this.reader=t,this.totalByteSize=n,this._info=e,this.bytesReceived=0}}class $v extends gh{handleChunkReceived(e){var t;this.bytesReceived+=e.content.byteLength;const n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(t=this.onProgress)===null||t===void 0||t.call(this,n)}[Symbol.asyncIterator](){const e=this.reader.getReader();return{next:()=>m(this,void 0,void 0,function*(){try{const{done:t,value:n}=yield e.read();return t?{done:!0,value:void 0}:(this.handleChunkReceived(n),{done:!1,value:n.content})}catch{return{done:!0,value:void 0}}}),return(){return m(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return m(this,void 0,void 0,function*(){var e,t,n,i;let r=new Set;try{for(var s=!0,o=sA(this),a;a=yield o.next(),e=a.done,!e;s=!0){i=a.value,s=!1;const c=i;r.add(c)}}catch(c){t={error:c}}finally{try{!s&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return Array.from(r)})}}class Wv extends gh{constructor(e,t,n){super(e,t,n),this.receivedChunks=new Map}handleChunkReceived(e){var t;const n=Ur(e.chunkIndex),i=this.receivedChunks.get(n);if(i&&i.version>e.version)return;this.receivedChunks.set(n,e),this.bytesReceived+=e.content.byteLength;const r=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(t=this.onProgress)===null||t===void 0||t.call(this,r)}[Symbol.asyncIterator](){const e=this.reader.getReader(),t=new TextDecoder;return{next:()=>m(this,void 0,void 0,function*(){try{const{done:n,value:i}=yield e.read();return n?{done:!0,value:void 0}:(this.handleChunkReceived(i),{done:!1,value:t.decode(i.content)})}catch{return{done:!0,value:void 0}}}),return(){return m(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return m(this,void 0,void 0,function*(){var e,t,n,i;let r="";try{for(var s=!0,o=sA(this),a;a=yield o.next(),e=a.done,!e;s=!0)i=a.value,s=!1,r+=i}catch(c){t={error:c}}finally{try{!s&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return r})}}class ph{constructor(e,t,n){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=n,this.info=t}write(e){return this.defaultWriter.write(e)}close(){return m(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class Jv extends ph{}class Xv extends ph{}class mh extends U{constructor(e,t,n,i,r){super(e,n,r),this.sid=t,this.receiver=i}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?k.Muted:k.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const t=n=>{n.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",t),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(k.Ended,this))};e.addEventListener("removetrack",t)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return m(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),Sa)),av()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var t;this.timeSyncHandle=requestAnimationFrame(()=>e());const n=(t=this.receiver)===null||t===void 0?void 0:t.getSynchronizationSources()[0];if(n){const{timestamp:i,rtpTimestamp:r}=n;r&&this.rtpTimestamp!==r&&(this.emit(k.TimeSyncUpdate,{timestamp:i,rtpTimestamp:r}),this.rtpTimestamp=r)}};e()}}class qv extends mh{constructor(e,t,n,i,r,s){super(e,t,U.Kind.Audio,n,s),this.monitorReceiver=()=>m(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const o=yield this.getReceiverStats();o&&this.prevStats&&this.receiver&&(this._currentBitrate=Fr(o,this.prevStats)),this.prevStats=o}),this.audioContext=i,this.webAudioPluginNodes=[],r&&(this.sinkId=r.deviceId)}setVolume(e){var t;for(const n of this.attachedElements)this.audioContext?(t=this.gainNode)===null||t===void 0||t.gain.setTargetAtTime(e,0,.1):n.volume=e;Rt()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(Rt())return 1;let e=0;return this.attachedElements.forEach(t=>{t.volume>e&&(e=t.volume)}),e}setSinkId(e){return m(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(t=>{if(ia(t))return t.setSinkId(e)}))})}attach(e){const t=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&ia(e)&&e.setSinkId(this.sinkId).catch(n=>{this.log.error("Failed to set sink id on remote audio track",n,this.logContext)}),this.audioContext&&t&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let t;return e?(t=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(t=super.detach(),this.disconnectWebAudio()),t}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,t){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(t.srcObject);let n=this.sourceNode;this.webAudioPluginNodes.forEach(i=>{n.connect(i),n=i}),this.gainNode=e.createGain(),n.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(k.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(i=>{this.emit(k.AudioPlaybackFailed,i)})}disconnectWebAudio(){var e,t;(e=this.gainNode)===null||e===void 0||e.disconnect(),(t=this.sourceNode)===null||t===void 0||t.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return m(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let t;return e.forEach(n=>{n.type==="inbound-rtp"&&(t={type:"audio",streamId:n.id,timestamp:n.timestamp,jitter:n.jitter,bytesReceived:n.bytesReceived,concealedSamples:n.concealedSamples,concealmentEvents:n.concealmentEvents,silentConcealedSamples:n.silentConcealedSamples,silentConcealmentEvents:n.silentConcealmentEvents,totalAudioEnergy:n.totalAudioEnergy,totalSamplesDuration:n.totalSamplesDuration})}),t})}}const Ia=100;class Yv extends mh{constructor(e,t,n,i,r){super(e,t,U.Kind.Video,n,r),this.elementInfos=[],this.monitorReceiver=()=>m(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const s=yield this.getReceiverStats();s&&this.prevStats&&this.receiver&&(this._currentBitrate=Fr(s,this.prevStats)),this.prevStats=s}),this.debouncedHandleResize=wa(()=>{this.updateDimensions()},Ia),this.adaptiveStreamSettings=i}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(t=>{e?yn(this._mediaStreamTrack,t):wn(this._mediaStreamTrack,t)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(t=>t.element===e)===void 0){const t=new zv(e);this.observeElementInfo(t)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(t=>t===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const t=this.elementInfos.filter(n=>n===e);for(const n of t)n.stopObserving();this.elementInfos=this.elementInfos.filter(n=>n!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let t=[];if(e)return this.stopObservingElement(e),super.detach(e);t=super.detach();for(const n of t)this.stopObservingElement(n);return t}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return m(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let t,n="",i=new Map;return e.forEach(r=>{r.type==="inbound-rtp"?(n=r.codecId,t={type:"video",streamId:r.id,framesDecoded:r.framesDecoded,framesDropped:r.framesDropped,framesReceived:r.framesReceived,packetsReceived:r.packetsReceived,packetsLost:r.packetsLost,frameWidth:r.frameWidth,frameHeight:r.frameHeight,pliCount:r.pliCount,firCount:r.firCount,nackCount:r.nackCount,jitter:r.jitter,timestamp:r.timestamp,bytesReceived:r.bytesReceived,decoderImplementation:r.decoderImplementation}):r.type==="codec"&&i.set(r.id,r)}),t&&n!==""&&i.get(n)&&(t.mimeType=i.get(n).mimeType),t})}stopObservingElement(e){const t=this.elementInfos.filter(n=>n.element===e);for(const n of t)this.stopObservingElementInfo(n)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return m(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(){var e,t;const n=this.elementInfos.reduce((o,a)=>Math.max(o,a.visibilityChangedAt||0),0),i=!((t=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pauseVideoInBackground)!==null&&t!==void 0)||t?this.isInBackground:!1,r=this.elementInfos.some(o=>o.pictureInPicture),s=this.elementInfos.some(o=>o.visible)&&!i||r;if(this.lastVisible!==s){if(!s&&Date.now()-n<Ia){Fe.setTimeout(()=>{this.updateVisibility()},Ia);return}this.lastVisible=s,this.emit(k.VisibilityChanged,s,this)}}updateDimensions(){var e,t;let n=0,i=0;const r=this.getPixelDensity();for(const s of this.elementInfos){const o=s.width()*r,a=s.height()*r;o+a>n+i&&(n=o,i=a)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===n&&((t=this.lastDimensions)===null||t===void 0?void 0:t.height)===i||(this.lastDimensions={width:n,height:i},this.emit(k.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const t=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return t==="screen"?Od():t||(Od()>2?2:1)}}class zv{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,t){this.onVisibilityChanged=n=>{var i;const{target:r,isIntersecting:s}=n;r===this.element&&(this.isIntersecting=s,this.isPiP=li(this.element),this.visibilityChangedAt=Date.now(),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this))},this.onEnterPiP=()=>{var n,i,r;(i=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP),this.isPiP=li(this.element),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this)},this.onLeavePiP=()=>{var n;this.isPiP=li(this.element),(n=this.handleVisibilityChanged)===null||n===void 0||n.call(this)},this.element=e,this.isIntersecting=t??_a(e),this.isPiP=Ye()&&li(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,t,n;this.isIntersecting=_a(this.element),this.isPiP=li(this.element),this.element.handleResize=()=>{var i;(i=this.handleResize)===null||i===void 0||i.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,Md().observe(this.element),Hd().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(n=(t=window.documentPictureInPicture)===null||t===void 0?void 0:t.window)===null||n===void 0||n.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,t,n,i,r;(e=Md())===null||e===void 0||e.unobserve(this.element),(t=Hd())===null||t===void 0||t.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(n=window.documentPictureInPicture)===null||n===void 0||n.removeEventListener("enter",this.onEnterPiP),(r=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||r===void 0||r.removeEventListener("pagehide",this.onLeavePiP)}}function li(A){var e,t;return document.pictureInPictureElement===A?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?_a(A,(t=window.documentPictureInPicture)===null||t===void 0?void 0:t.window):!1}function _a(A,e){const t=e||window;let n=A.offsetTop,i=A.offsetLeft;const r=A.offsetWidth,s=A.offsetHeight,{hidden:o}=A,{display:a}=getComputedStyle(A);for(;A.offsetParent;)A=A.offsetParent,n+=A.offsetTop,i+=A.offsetLeft;return n<t.pageYOffset+t.innerHeight&&i<t.pageXOffset+t.innerWidth&&n+s>t.pageYOffset&&i+r>t.pageXOffset&&!o&&a!=="none"}class Wt extends xt.EventEmitter{constructor(e,t,n,i){var r;super(),this.metadataMuted=!1,this.encryption=At.NONE,this.log=j,this.handleMuted=()=>{this.emit(k.Muted)},this.handleUnmuted=()=>{this.emit(k.Unmuted)},this.log=Vt((r=i?.loggerName)!==null&&r!==void 0?r:Ct.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=t,this.trackName=n,this.source=U.Source.Unknown}setTrack(e){this.track&&(this.track.off(k.Muted,this.handleMuted),this.track.off(k.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(k.Muted,this.handleMuted),e.on(k.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),Z(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==At.NONE}get audioTrack(){if($t(this.track))return this.track}get videoTrack(){if(Sn(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=U.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===U.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(A){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(A.SubscriptionStatus||(A.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(A.PermissionStatus||(A.PermissionStatus={}))})(Wt||(Wt={}));class xa extends Wt{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,t,n,i){super(e,t.sid,t.name,i),this.track=void 0,this.handleTrackEnded=()=>{this.emit(k.Ended)},this.updateInfo(t),this.setTrack(n)}setTrack(e){this.track&&this.track.off(k.Ended,this.handleTrackEnded),super.setTrack(e),e&&e.on(k.Ended,this.handleTrackEnded)}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return m(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return m(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return m(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return m(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if($t(this.track)){const t=this.track.getSourceTrackSettings(),n=new Set;return t.autoGainControl&&n.add(Bt.TF_AUTO_GAIN_CONTROL),t.echoCancellation&&n.add(Bt.TF_ECHO_CANCELLATION),t.noiseSuppression&&n.add(Bt.TF_NOISE_SUPPRESSION),t.channelCount&&t.channelCount>1&&n.add(Bt.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||n.add(Bt.TF_NO_DTX),this.track.enhancedNoiseCancellation&&n.add(Bt.TF_ENHANCED_NOISE_CANCELLATION),Array.from(n.values())}else return[]}}function xr(A,e){return m(this,void 0,void 0,function*(){A??(A={});let t=!1;const{audioProcessor:n,videoProcessor:i,optionsWithoutProcessor:r}=Wd(A);let s=r.audio,o=r.video;if(n&&typeof r.audio=="object"&&(r.audio.processor=n),i&&typeof r.video=="object"&&(r.video.processor=i),A.audio&&typeof r.audio=="object"&&typeof r.audio.deviceId=="string"){const u=r.audio.deviceId;r.audio.deviceId={exact:u},t=!0,s=Object.assign(Object.assign({},r.audio),{deviceId:{ideal:u}})}if(r.video&&typeof r.video=="object"&&typeof r.video.deviceId=="string"){const u=r.video.deviceId;r.video.deviceId={exact:u},t=!0,o=Object.assign(Object.assign({},r.video),{deviceId:{ideal:u}})}(r.audio===!0||typeof r.audio=="object"&&!r.audio.deviceId)&&(r.audio={deviceId:"default"}),r.video===!0?r.video={deviceId:"default"}:typeof r.video=="object"&&!r.video.deviceId&&(r.video.deviceId="default");const a=Gd(r,nh,ih),c=fa(a),l=navigator.mediaDevices.getUserMedia(c);r.audio&&(Ue.userMediaPromiseMap.set("audioinput",l),l.catch(()=>Ue.userMediaPromiseMap.delete("audioinput"))),r.video&&(Ue.userMediaPromiseMap.set("videoinput",l),l.catch(()=>Ue.userMediaPromiseMap.delete("videoinput")));try{const u=yield l;return yield Promise.all(u.getTracks().map(d=>m(this,void 0,void 0,function*(){const h=d.kind==="audio";let f=h?a.audio:a.video;(typeof f=="boolean"||!f)&&(f={});let g;const p=h?c.audio:c.video;typeof p!="boolean"&&(g=p);const B=d.getSettings().deviceId;g?.deviceId&&uA(g.deviceId)!==B?g.deviceId=B:g||(g={deviceId:B});const y=Fv(d,g,e);return y.kind===U.Kind.Video?y.source=U.Source.Camera:y.kind===U.Kind.Audio&&(y.source=U.Source.Microphone),y.mediaStream=u,$t(y)&&n?yield y.setProcessor(n):Sn(y)&&i&&(yield y.setProcessor(i)),y})))}catch(u){if(!t)throw u;return xr(Object.assign(Object.assign({},A),{audio:s,video:o}),e)}})}function Zv(A){return m(this,void 0,void 0,function*(){return(yield xr({audio:!1,video:A??!0}))[0]})}function eC(A){return m(this,void 0,void 0,function*(){return(yield xr({audio:A??!0,video:!1}))[0]})}var fA;(function(A){A.Excellent="excellent",A.Good="good",A.Poor="poor",A.Lost="lost",A.Unknown="unknown"})(fA||(fA={}));function tC(A){switch(A){case Ai.EXCELLENT:return fA.Excellent;case Ai.GOOD:return fA.Good;case Ai.POOR:return fA.Poor;case Ai.LOST:return fA.Lost;default:return fA.Unknown}}class Bh extends xt.EventEmitter{get logContext(){var e,t;return Object.assign({},(t=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||t===void 0?void 0:t.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===ur.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===mn.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,t,n,i,r,s){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:ur.STANDARD;var a;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=fA.Unknown,this.log=j,this.log=Vt((a=s?.loggerName)!==null&&a!==void 0?a:Ct.Participant),this.loggerOptions=s,this.setMaxListeners(100),this.sid=e,this.identity=t,this.name=n,this.metadata=i,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=o,this._attributes=r??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,t]of this.trackPublications)if(t.source===e)return t}getTrackPublicationByName(e){for(const[,t]of this.trackPublications)if(t.trackName===e)return t}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new ca,this.once(x.Active,()=>{var e,t;(t=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||t===void 0||t.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const t=this.getTrackPublication(U.Source.Camera);return!(!((e=t?.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const t=this.getTrackPublication(U.Source.Microphone);return!(!((e=t?.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(U.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var t;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===mn.ACTIVE&&((t=this.participantInfo)===null||t===void 0?void 0:t.state)!==mn.ACTIVE&&this.emit(x.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const t=this.metadata!==e,n=this.metadata;this.metadata=e,t&&this.emit(x.ParticipantMetadataChanged,n)}_setName(e){const t=this.name!==e;this.name=e,t&&this.emit(x.ParticipantNameChanged,e)}_setAttributes(e){const t=cv(this.attributes,e);this._attributes=e,Object.keys(t).length>0&&this.emit(x.AttributesChanged,t)}setPermissions(e){var t,n,i,r,s,o;const a=this.permissions,c=e.canPublish!==((t=this.permissions)===null||t===void 0?void 0:t.canPublish)||e.canSubscribe!==((n=this.permissions)===null||n===void 0?void 0:n.canSubscribe)||e.canPublishData!==((i=this.permissions)===null||i===void 0?void 0:i.canPublishData)||e.hidden!==((r=this.permissions)===null||r===void 0?void 0:r.hidden)||e.recorder!==((s=this.permissions)===null||s===void 0?void 0:s.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((l,u)=>{var d;return l!==((d=this.permissions)===null||d===void 0?void 0:d.canPublishSources[u])})||e.canSubscribeMetrics!==((o=this.permissions)===null||o===void 0?void 0:o.canSubscribeMetrics);return this.permissions=e,c&&this.emit(x.ParticipantPermissionsChanged,a),c}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(x.IsSpeakingChanged,e))}setConnectionQuality(e){const t=this._connectionQuality;this._connectionQuality=tC(e),t!==this._connectionQuality&&this.emit(x.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,t;this.activeFuture&&((t=(e=this.activeFuture).reject)===null||t===void 0||t.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(t=>$t(t.track)&&t.track.setAudioContext(e))}addTrackPublication(e){e.on(k.Muted,()=>{this.emit(x.TrackMuted,e)}),e.on(k.Unmuted,()=>{this.emit(x.TrackUnmuted,e)});const t=e;switch(t.track&&(t.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case U.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case U.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function AC(A){var e,t,n;if(!A.participantSid&&!A.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new Lu({participantIdentity:(e=A.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(t=A.participantSid)!==null&&t!==void 0?t:"",allTracks:(n=A.allowAll)!==null&&n!==void 0?n:!1,trackSids:A.allowedTrackSids||[]})}const vh=15e3;class nC extends Bh{constructor(e,t,n,i,r){super(e,t,void 0,void 0,void 0,{loggerName:i.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=At.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new ca)},this.handleReconnected=()=>{var s,o;(o=(s=this.reconnectFuture)===null||s===void 0?void 0:s.resolve)===null||o===void 0||o.call(s),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var s,o;this.reconnectFuture&&(this.reconnectFuture.promise.catch(a=>this.log.warn(a.message,this.logContext)),(o=(s=this.reconnectFuture)===null||s===void 0?void 0:s.reject)===null||o===void 0||o.call(s,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0)},this.handleSignalRequestResponse=s=>{const{requestId:o,reason:a,message:c}=s,l=this.pendingSignalRequests.get(o);l&&(a!==Do.OK&&l.reject(new Id(c,a)),this.pendingSignalRequests.delete(o))},this.handleDataPacket=s=>{switch(s.value.case){case"rpcResponse":let o=s.value.value,a=null,c=null;o.value.case==="payload"?a=o.value.value:o.value.case==="error"&&(c=ge.fromProto(o.value.value)),this.handleIncomingRpcResponse(o.requestId,a,c);break;case"rpcAck":let l=s.value.value;this.handleIncomingRpcAck(l.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(s=>AC(s)))},this.onTrackUnmuted=s=>{this.onTrackMuted(s,s.isUpstreamPaused)},this.onTrackMuted=(s,o)=>{if(o===void 0&&(o=!0),!s.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),Z(s)));return}this.engine.updateMuteStatus(s.sid,o)},this.onTrackUpstreamPaused=s=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),Z(s))),this.onTrackMuted(s,!0)},this.onTrackUpstreamResumed=s=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),Z(s))),this.onTrackMuted(s,s.isMuted)},this.onTrackFeatureUpdate=s=>{const o=this.audioTrackPublications.get(s.sid);if(!o){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(s.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(o.trackSid,o.getTrackFeatures())},this.handleSubscribedQualityUpdate=s=>m(this,void 0,void 0,function*(){var o,a,c,l,u,d;if(!(!((u=this.roomOptions)===null||u===void 0)&&u.dynacast))return;const h=this.videoTrackPublications.get(s.trackSid);if(!h){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:s.trackSid}));return}if(s.subscribedCodecs.length>0){if(!h.videoTrack)return;const B=yield h.videoTrack.setPublishingCodecs(s.subscribedCodecs);try{for(var f=!0,g=sA(B),p;p=yield g.next(),o=p.done,!o;f=!0){l=p.value,f=!1;const y=l;N0(y)&&(this.log.debug("publish ".concat(y," for ").concat(h.videoTrack.sid),Object.assign(Object.assign({},this.logContext),Z(h))),yield this.publishAdditionalCodecForTrack(h.videoTrack,y,h.options))}}catch(y){a={error:y}}finally{try{!f&&!o&&(c=g.return)&&(yield c.call(g))}finally{if(a)throw a.error}}}else s.subscribedQualities.length>0&&(yield(d=h.videoTrack)===null||d===void 0?void 0:d.setPublishingLayers(s.subscribedQualities))}),this.handleLocalTrackUnpublished=s=>{const o=this.trackPublications.get(s.trackSid);if(!o){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:s.trackSid}));return}this.unpublishTrack(o.track)},this.handleTrackEnded=s=>m(this,void 0,void 0,function*(){if(s.source===U.Source.ScreenShare||s.source===U.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),Z(s))),this.unpublishTrack(s);else if(s.isUserProvided)yield s.mute();else if(jA(s)||dA(s))try{if(Ye())try{const o=yield navigator?.permissions.query({name:s.source===U.Source.Camera?"camera":"microphone"});if(o&&o.state==="denied")throw this.log.warn("user has revoked access to ".concat(s.source),Object.assign(Object.assign({},this.logContext),Z(s))),o.onchange=()=>{o.state!=="denied"&&(s.isMuted||s.restartTrack(),o.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}s.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),Z(s))),jA(s)?yield s.restartTrack({deviceId:"default"}):yield s.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),Z(s))),yield s.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=n,this.roomOptions=i,this.setupEngine(n),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=r}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==At.NONE}getTrackPublication(e){const t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){const t=super.getTrackPublicationByName(e);if(t)return t}setupEngine(e){this.engine=e,this.engine.on(I.RemoteMute,(t,n)=>{const i=this.trackPublications.get(t);!i||!i.track||(n?i.mute():i.unmute())}),this.engine.on(I.Connected,this.handleReconnected).on(I.SignalRestarted,this.handleReconnected).on(I.SignalResumed,this.handleReconnected).on(I.Restarting,this.handleReconnecting).on(I.Resuming,this.handleReconnecting).on(I.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(I.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(I.Disconnected,this.handleDisconnected).on(I.SignalRequestResponse,this.handleSignalRequestResponse).on(I.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return m(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return m(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return m(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return m(this,arguments,void 0,function(t){var n=this;let{metadata:i,name:r,attributes:s}=t;return function*(){return new Promise((o,a)=>m(n,void 0,void 0,function*(){var c,l;try{let u=!1;const d=yield this.engine.client.sendUpdateLocalMetadata((c=i??this.metadata)!==null&&c!==void 0?c:"",(l=r??this.name)!==null&&l!==void 0?l:"",s),h=performance.now();for(this.pendingSignalRequests.set(d,{resolve:o,reject:f=>{a(f),u=!0},values:{name:r,metadata:i,attributes:s}});performance.now()-h<5e3&&!u;){if((!r||this.name===r)&&(!i||this.metadata===i)&&(!s||Object.entries(s).every(f=>{let[g,p]=f;return this.attributes[g]===p||p===""&&!this.attributes[g]}))){this.pendingSignalRequests.delete(d),o();return}yield qe(50)}a(new Id("Request to update local metadata timed out","TimeoutError"))}catch(u){u instanceof Error&&a(u)}}))}()})}setCameraEnabled(e,t,n){return this.setTrackEnabled(U.Source.Camera,e,t,n)}setMicrophoneEnabled(e,t,n){return this.setTrackEnabled(U.Source.Microphone,e,t,n)}setScreenShareEnabled(e,t,n){return this.setTrackEnabled(U.Source.ScreenShare,e,t,n)}setPermissions(e){const t=this.permissions,n=super.setPermissions(e);return n&&t&&this.emit(x.ParticipantPermissionsChanged,t),n}setE2EEEnabled(e){return m(this,void 0,void 0,function*(){this.encryptionType=e?At.GCM:At.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,t,n,i){return m(this,void 0,void 0,function*(){var r,s;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:t})),this.republishPromise&&(yield this.republishPromise);let o=this.getTrackPublication(e);if(t)if(o)yield o.unmute();else{let a;if(this.pendingPublishing.has(e)){const c=yield this.waitForPendingPublicationOfSource(e);return c||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield c?.unmute(),c}this.pendingPublishing.add(e);try{switch(e){case U.Source.Camera:a=yield this.createTracks({video:(r=n)!==null&&r!==void 0?r:!0});break;case U.Source.Microphone:a=yield this.createTracks({audio:(s=n)!==null&&s!==void 0?s:!0});break;case U.Source.ScreenShare:a=yield this.createScreenTracks(Object.assign({},n));break;default:throw new jt(e)}}catch(c){throw a?.forEach(l=>{l.stop()}),c instanceof Error&&this.emit(x.MediaDevicesError,c),this.pendingPublishing.delete(e),c}try{const c=[];for(const u of a)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),Z(u))),c.push(this.publishTrack(u,i));[o]=yield Promise.all(c)}catch(c){throw a?.forEach(l=>{l.stop()}),c}finally{this.pendingPublishing.delete(e)}}else if(!o?.track&&this.pendingPublishing.has(e)&&(o=yield this.waitForPendingPublicationOfSource(e),o||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),o&&o.track)if(e===U.Source.ScreenShare){o=yield this.unpublishTrack(o.track);const a=this.getTrackPublication(U.Source.ScreenShareAudio);a&&a.track&&this.unpublishTrack(a.track)}else yield o.mute();return o})}enableCameraAndMicrophone(){return m(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(U.Source.Camera)||this.pendingPublishing.has(U.Source.Microphone))){this.pendingPublishing.add(U.Source.Camera),this.pendingPublishing.add(U.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(t=>this.publishTrack(t)))}finally{this.pendingPublishing.delete(U.Source.Camera),this.pendingPublishing.delete(U.Source.Microphone)}}})}createTracks(e){return m(this,void 0,void 0,function*(){var t,n;e??(e={});const i=Gd(e,(t=this.roomOptions)===null||t===void 0?void 0:t.audioCaptureDefaults,(n=this.roomOptions)===null||n===void 0?void 0:n.videoCaptureDefaults);try{return(yield xr(i,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(o=>($t(o)&&(this.microphoneError=void 0,o.setAudioContext(this.audioContext),o.source=U.Source.Microphone,this.emit(x.AudioStreamAcquired)),Sn(o)&&(this.cameraError=void 0,o.source=U.Source.Camera),o))}catch(r){throw r instanceof Error&&(e.audio&&(this.microphoneError=r),e.video&&(this.cameraError=r)),r}})}createScreenTracks(e){return m(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new Jo("getDisplayMedia not supported");e.resolution===void 0&&!W0()&&(e.resolution=ta.h1080fps30.resolution);const t=sv(e),n=yield navigator.mediaDevices.getDisplayMedia(t),i=n.getVideoTracks();if(i.length===0)throw new jt("no video track found");const r=new _r(i[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});r.source=U.Source.ScreenShare,e.contentHint&&(r.mediaStreamTrack.contentHint=e.contentHint);const s=[r];if(n.getAudioTracks().length>0){this.emit(x.AudioStreamAcquired);const o=new kr(n.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});o.source=U.Source.ScreenShareAudio,s.push(o)}return s})}publishTrack(e,t){return m(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,t)})}publishOrRepublishTrack(e,t){return m(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var o,a,c,l;jA(n)&&n.setAudioContext(r.audioContext),yield(o=r.reconnectFuture)===null||o===void 0?void 0:o.promise,r.republishPromise&&!s&&(yield r.republishPromise),En(n)&&r.pendingPublishPromises.has(n)&&(yield r.pendingPublishPromises.get(n));let u;if(n instanceof MediaStreamTrack)u=n.getConstraints();else{u=n.constraints;let B;switch(n.source){case U.Source.Microphone:B="audioinput";break;case U.Source.Camera:B="videoinput"}B&&r.activeDeviceMap.has(B)&&(u=Object.assign(Object.assign({},u),{deviceId:r.activeDeviceMap.get(B)}))}if(n instanceof MediaStreamTrack)switch(n.kind){case"audio":n=new kr(n,u,!0,r.audioContext,{loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});break;case"video":n=new _r(n,u,!0,{loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});break;default:throw new jt("unsupported MediaStreamTrack kind ".concat(n.kind))}else n.updateLoggerOptions({loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});let d;if(r.trackPublications.forEach(B=>{B.track&&B.track===n&&(d=B)}),d)return r.log.warn("track has already been published, skipping",Object.assign(Object.assign({},r.logContext),Z(d))),d;const h="channelCount"in n.mediaStreamTrack.getSettings()&&n.mediaStreamTrack.getSettings().channelCount===2||n.mediaStreamTrack.getConstraints().channelCount===2,f=(a=i?.forceStereo)!==null&&a!==void 0?a:h;f&&(i||(i={}),i.dtx===void 0&&r.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},r.logContext),Z(n))),i.red===void 0&&r.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(c=i.dtx)!==null&&c!==void 0||(i.dtx=!1),(l=i.red)!==null&&l!==void 0||(i.red=!1));const g=Object.assign(Object.assign({},r.roomOptions.publishDefaults),i);!J0()&&r.roomOptions.e2ee&&(r.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},r.logContext)),g.simulcast=!1),g.source&&(n.source=g.source);const p=new Promise((B,y)=>m(r,void 0,void 0,function*(){try{if(this.engine.client.currentState!==ae.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:Z(n)}));const b=()=>m(this,void 0,void 0,function*(){try{const v=yield this.publish(n,g,f);B(v)}catch(v){y(v)}});setTimeout(()=>{this.engine.off(I.SignalConnected,b),y(new qo("publishing rejected as engine not connected within timeout",408))},15e3),this.engine.once(I.SignalConnected,b),this.engine.on(I.Closing,()=>{this.engine.off(I.SignalConnected,b),y(new qo("publishing rejected as engine closed",499))})}else try{const b=yield this.publish(n,g,f);B(b)}catch(b){y(b)}}catch(b){y(b)}}));r.pendingPublishPromises.set(n,p);try{return yield p}catch(B){throw B}finally{r.pendingPublishPromises.delete(n)}}()})}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),Z(e))),!1;const{canPublish:t,canPublishSources:n}=this.permissions;return t&&(n.length===0||n.map(i=>lv(i)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),Z(e))),!1)}publish(e,t,n){return m(this,void 0,void 0,function*(){var i,r,s,o,a,c,l,u,d,h;if(!this.hasPermissionsToPublish(e))throw new qo("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(C=>En(e)&&C.source===e.source)&&e.source!==U.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),Z(e))),t.stopMicTrackOnMute&&$t(e)&&(e.stopOnMute=!0),e.source===U.Source.ScreenShare&&bn()&&(t.simulcast=!1),t.videoCodec==="av1"&&!V0()&&(t.videoCodec=void 0),t.videoCodec==="vp9"&&!j0()&&(t.videoCodec=void 0),t.videoCodec===void 0&&(t.videoCodec=ya),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(C=>t.videoCodec===Tr(C.mime))||(t.videoCodec=Tr(this.enabledPublishVideoCodecs[0].mime)));const g=t.videoCodec;e.on(k.Muted,this.onTrackMuted),e.on(k.Unmuted,this.onTrackUnmuted),e.on(k.Ended,this.handleTrackEnded),e.on(k.UpstreamPaused,this.onTrackUpstreamPaused),e.on(k.UpstreamResumed,this.onTrackUpstreamResumed),e.on(k.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const p=new _o({cid:e.mediaStreamTrack.id,name:t.name,type:U.kindToProto(e.kind),muted:e.isMuted,source:U.sourceToProto(e.source),disableDtx:!(!((i=t.dtx)!==null&&i!==void 0)||i),encryption:this.encryptionType,stereo:n,disableRed:this.isE2EEEnabled||!(!((r=t.red)!==null&&r!==void 0)||r),stream:t?.stream,backupCodecPolicy:t?.backupCodecPolicy});let B;if(e.kind===U.Kind.Video){let C={width:0,height:0};try{C=yield e.waitForDimensions()}catch{const S=(o=(s=this.roomOptions.videoCaptureDefaults)===null||s===void 0?void 0:s.resolution)!==null&&o!==void 0?o:si.h720.resolution;C={width:S.width,height:S.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),Z(e)),{dims:C}))}p.width=C.width,p.height=C.height,dA(e)&&(oi(g)&&(e.source===U.Source.ScreenShare&&(t.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),Z(e))))),t.scalabilityMode=(a=t.scalabilityMode)!==null&&a!==void 0?a:"L3T3_KEY"),p.simulcastCodecs=[new Io({codec:g,cid:e.mediaStreamTrack.id})],t.backupCodec===!0&&(t.backupCodec={codec:ya}),t.backupCodec&&g!==t.backupCodec.codec&&p.encryption===At.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),p.simulcastCodecs.push(new Io({codec:t.backupCodec.codec,cid:""})))),B=Ta(e.source===U.Source.ScreenShare,p.width,p.height,t),p.layers=dh(p.width,p.height,B,oi(t.videoCodec))}else e.kind===U.Kind.Audio&&(B=[{maxBitrate:(c=t.audioPreset)===null||c===void 0?void 0:c.maxBitrate,priority:(u=(l=t.audioPreset)===null||l===void 0?void 0:l.priority)!==null&&u!==void 0?u:"high",networkPriority:(h=(d=t.audioPreset)===null||d===void 0?void 0:d.priority)!==null&&h!==void 0?h:"high"}]);if(!this.engine||this.engine.isClosed)throw new Ee("cannot publish track when not connected");const y=()=>m(this,void 0,void 0,function*(){var C,w,S;if(!this.engine.pcManager)throw new Ee("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,t,B),dA(e)&&((C=t.degradationPreference)!==null&&C!==void 0||(t.degradationPreference=Hv(e)),e.setDegradationPreference(t.degradationPreference)),B)if(bn()&&e.kind===U.Kind.Audio){let F;for(const _ of this.engine.pcManager.publisher.getTransceivers())if(_.sender===e.sender){F=_;break}F&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:F,codec:"opus",maxbr:!((w=B[0])===null||w===void 0)&&w.maxBitrate?B[0].maxBitrate/1e3:0})}else e.codec&&oi(e.codec)&&(!((S=B[0])===null||S===void 0)&&S.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:p.cid,codec:e.codec,maxbr:B[0].maxBitrate/1e3});yield this.engine.negotiate()});let b;if(this.enabledPublishVideoCodecs.length>0)b=(yield Promise.all([this.engine.addTrack(p),y()]))[0];else{b=yield this.engine.addTrack(p);let C;if(b.codecs.forEach(w=>{C===void 0&&(C=w.mimeType)}),C&&e.kind===U.Kind.Video){const w=Tr(C);w!==g&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),Z(e)),{codec:w})),t.videoCodec=w,B=Ta(e.source===U.Source.ScreenShare,p.width,p.height,t))}yield y()}const v=new xa(e.kind,b,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});return v.options=t,e.sid=b.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:B,trackInfo:b})),dA(e)?e.startMonitor(this.engine.client):jA(e)&&e.startMonitor(),this.addTrackPublication(v),this.emit(x.LocalTrackPublished,v),v})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,t,n){return m(this,void 0,void 0,function*(){var i;if(this.encryptionType!==At.NONE)return;let r;if(this.trackPublications.forEach(h=>{h.track&&h.track===e&&(r=h)}),!r)throw new jt("track is not published");if(!dA(e))throw new jt("track is not a video track");const s=Object.assign(Object.assign({},(i=this.roomOptions)===null||i===void 0?void 0:i.publishDefaults),n),o=Lv(e,t,s);if(!o){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),Z(e)));return}const a=e.addSimulcastTrack(t,o);if(!a)return;const c=new _o({cid:a.mediaStreamTrack.id,type:U.kindToProto(e.kind),muted:e.isMuted,source:U.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:s.videoCodec,cid:a.mediaStreamTrack.id}]});if(c.layers=dh(c.width,c.height,o),!this.engine||this.engine.isClosed)throw new Ee("cannot publish track when not connected");const l=()=>m(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,a,s,o),yield this.engine.negotiate()}),d=(yield Promise.all([this.engine.addTrack(c),l()]))[0];this.log.debug("published ".concat(t," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:o,trackInfo:d}))})}unpublishTrack(e,t){return m(this,void 0,void 0,function*(){var n,i;if(En(e)){const c=this.pendingPublishPromises.get(e);c&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),Z(e))),yield c)}const r=this.getPublicationForTrack(e),s=r?Z(r):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),s)),!r||!r.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),s));return}e=r.track,e.off(k.Muted,this.onTrackMuted),e.off(k.Unmuted,this.onTrackUnmuted),e.off(k.Ended,this.handleTrackEnded),e.off(k.UpstreamPaused,this.onTrackUpstreamPaused),e.off(k.UpstreamResumed,this.onTrackUpstreamResumed),e.off(k.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),t===void 0&&(t=(i=(n=this.roomOptions)===null||n===void 0?void 0:n.stopLocalTrackOnUnpublish)!==null&&i!==void 0?i:!0),t?e.stop():e.stopMonitor();let o=!1;const a=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<fe.FAILED&&a)try{for(const c of this.engine.pcManager.publisher.getTransceivers())c.sender===a&&(c.direction="inactive",o=!0);if(this.engine.removeTrack(a)&&(o=!0),dA(e)){for(const[,c]of e.simulcastCodecs)c.sender&&(this.engine.removeTrack(c.sender)&&(o=!0),c.sender=void 0);e.simulcastCodecs.clear()}}catch(c){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),s),{error:c}))}switch(this.trackPublications.delete(r.trackSid),r.kind){case U.Kind.Audio:this.audioTrackPublications.delete(r.trackSid);break;case U.Kind.Video:this.videoTrackPublications.delete(r.trackSid);break}return this.emit(x.LocalTrackUnpublished,r),r.setTrack(void 0),o&&(yield this.engine.negotiate()),r})}unpublishTracks(e){return m(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>this.unpublishTrack(n)))).filter(n=>!!n)})}republishAllTracks(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){n.republishPromise&&(yield n.republishPromise),n.republishPromise=new Promise((r,s)=>m(n,void 0,void 0,function*(){try{const o=[];this.trackPublications.forEach(a=>{a.track&&(t&&(a.options=Object.assign(Object.assign({},a.options),t)),o.push(a))}),yield Promise.all(o.map(a=>m(this,void 0,void 0,function*(){const c=a.track;yield this.unpublishTrack(c,!1),i&&!c.isMuted&&c.source!==U.Source.ScreenShare&&c.source!==U.Source.ScreenShareAudio&&(jA(c)||dA(c))&&!c.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:a.trackSid})),yield c.restartTrack()),yield this.publishOrRepublishTrack(c,a.options,!0)}))),r()}catch(o){s(o)}finally{this.republishPromise=void 0}})),yield n.republishPromise}()})}publishData(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const r=i.reliable?Y.RELIABLE:Y.LOSSY,s=i.destinationIdentities,o=i.topic,a=new Xe({kind:r,value:{case:"user",value:new pu({participantIdentity:n.identity,payload:t,destinationIdentities:s,topic:o})}});yield n.engine.sendDataPacket(a,r)}()})}publishDtmf(e,t){return m(this,void 0,void 0,function*(){const n=new Xe({kind:Y.RELIABLE,value:{case:"sipDtmf",value:new mu({code:e,digit:t})}});yield this.engine.sendDataPacket(n,Y.RELIABLE)})}sendChatMessage(e,t){return m(this,void 0,void 0,function*(){const n={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:t?.attachments},i=new Xe({value:{case:"chatMessage",value:new So(Object.assign(Object.assign({},n),{timestamp:ue.parse(n.timestamp)}))}});return yield this.engine.sendDataPacket(i,Y.RELIABLE),this.emit(x.ChatMessage,n),n})}editChatMessage(e,t){return m(this,void 0,void 0,function*(){const n=Object.assign(Object.assign({},t),{message:e,editTimestamp:Date.now()}),i=new Xe({value:{case:"chatMessage",value:new So(Object.assign(Object.assign({},n),{timestamp:ue.parse(n.timestamp),editTimestamp:ue.parse(n.editTimestamp)}))}});return yield this.engine.sendDataPacket(i,Y.RELIABLE),this.emit(x.ChatMessage,n),n})}sendText(e,t){return m(this,void 0,void 0,function*(){var n;const i=crypto.randomUUID(),s=new TextEncoder().encode(e).byteLength,o=(n=t?.attachments)===null||n===void 0?void 0:n.map(()=>crypto.randomUUID()),a=new Array(o?o.length+1:1).fill(0),c=(u,d)=>{var h;a[d]=u;const f=a.reduce((g,p)=>g+p,0);(h=t?.onProgress)===null||h===void 0||h.call(t,f)},l=yield this.streamText({streamId:i,totalSize:s,destinationIdentities:t?.destinationIdentities,topic:t?.topic,attachedStreamIds:o,attributes:t?.attributes});return yield l.write(e),c(1,0),yield l.close(),t?.attachments&&o&&(yield Promise.all(t.attachments.map((u,d)=>m(this,void 0,void 0,function*(){return this._sendFile(o[d],u,{topic:t.topic,mimeType:u.type,onProgress:h=>{c(h,d+1)}})})))),l.info})}streamText(e){return m(this,void 0,void 0,function*(){var t,n;const i=(t=e?.streamId)!==null&&t!==void 0?t:crypto.randomUUID(),r={id:i,mimeType:"text/plain",timestamp:Date.now(),topic:(n=e?.topic)!==null&&n!==void 0?n:"",size:e?.totalSize,attributes:e?.attributes},s=new To({streamId:i,mimeType:r.mimeType,topic:r.topic,timestamp:VA(r.timestamp),totalLength:VA(e?.totalSize),attributes:r.attributes,contentHeader:{case:"textHeader",value:new Qu({version:e?.version,attachedStreamIds:e?.attachedStreamIds,replyToStreamId:e?.replyToStreamId,operationType:e?.type==="update"?Uo.UPDATE:Uo.CREATE})}}),o=e?.destinationIdentities,a=new Xe({destinationIdentities:o,value:{case:"streamHeader",value:s}});yield this.engine.sendDataPacket(a,Y.RELIABLE);let c=0;const l=this,u=new WritableStream({write(f){return m(this,void 0,void 0,function*(){for(const g of iv(f,vh)){yield l.engine.waitForBufferStatusLow(Y.RELIABLE);const p=new Qo({content:g,streamId:i,chunkIndex:VA(c)}),B=new Xe({destinationIdentities:o,value:{case:"streamChunk",value:p}});yield l.engine.sendDataPacket(B,Y.RELIABLE),c+=1}})},close(){return m(this,void 0,void 0,function*(){const f=new Fo({streamId:i}),g=new Xe({destinationIdentities:o,value:{case:"streamTrailer",value:f}});yield l.engine.sendDataPacket(g,Y.RELIABLE)})},abort(f){console.log("Sink error:",f)}});let d=()=>m(this,void 0,void 0,function*(){yield h.close()});l.engine.once(I.Closing,d);const h=new Jv(u,r,()=>this.engine.off(I.Closing,d));return h})}sendFile(e,t){return m(this,void 0,void 0,function*(){const n=crypto.randomUUID();return yield this._sendFile(n,e,t),{id:n}})}_sendFile(e,t,n){return m(this,void 0,void 0,function*(){var i;const r=yield this.streamBytes({streamId:e,totalSize:t.size,name:t.name,mimeType:(i=n?.mimeType)!==null&&i!==void 0?i:t.type,topic:n?.topic,destinationIdentities:n?.destinationIdentities}),s=t.stream().getReader();for(;;){const{done:o,value:a}=yield s.read();if(o)break;yield r.write(a)}return yield r.close(),r.info})}streamBytes(e){return m(this,void 0,void 0,function*(){var t,n,i,r,s;const o=(t=e?.streamId)!==null&&t!==void 0?t:crypto.randomUUID(),a=e?.destinationIdentities,c={id:o,mimeType:(n=e?.mimeType)!==null&&n!==void 0?n:"application/octet-stream",topic:(i=e?.topic)!==null&&i!==void 0?i:"",timestamp:Date.now(),attributes:e?.attributes,size:e?.totalSize,name:(r=e?.name)!==null&&r!==void 0?r:"unknown"},l=new To({totalLength:VA((s=c.size)!==null&&s!==void 0?s:0),mimeType:c.mimeType,streamId:o,topic:c.topic,timestamp:VA(Date.now()),attributes:c.attributes,contentHeader:{case:"byteHeader",value:new Fu({name:c.name})}}),u=new Xe({destinationIdentities:a,value:{case:"streamHeader",value:l}});yield this.engine.sendDataPacket(u,Y.RELIABLE);let d=0;const h=new We,f=this.engine,g=this.log,p=new WritableStream({write(y){return m(this,void 0,void 0,function*(){const b=yield h.lock();let v=0;try{for(;v<y.byteLength;){const C=y.slice(v,v+vh);yield f.waitForBufferStatusLow(Y.RELIABLE);const w=new Xe({destinationIdentities:a,value:{case:"streamChunk",value:new Qo({content:C,streamId:o,chunkIndex:VA(d)})}});yield f.sendDataPacket(w,Y.RELIABLE),d+=1,v+=C.byteLength}}finally{b()}})},close(){return m(this,void 0,void 0,function*(){const y=new Fo({streamId:o}),b=new Xe({destinationIdentities:a,value:{case:"streamTrailer",value:y}});yield f.sendDataPacket(b,Y.RELIABLE)})},abort(y){g.error("Sink error:",y)}});return new Xv(p,c)})}performRpc(e){return m(this,arguments,void 0,function(t){var n=this;let{destinationIdentity:i,method:r,payload:s,responseTimeout:o=1e4}=t;return function*(){return new Promise((c,l)=>m(n,void 0,void 0,function*(){var u,d,h,f;if(Ea(s)>rh){l(ge.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((d=(u=this.engine.latestJoinResponse)===null||u===void 0?void 0:u.serverInfo)===null||d===void 0)&&d.version&&GA((f=(h=this.engine.latestJoinResponse)===null||h===void 0?void 0:h.serverInfo)===null||f===void 0?void 0:f.version,"1.8.0")<0){l(ge.builtIn("UNSUPPORTED_SERVER"));return}const g=crypto.randomUUID();yield this.publishRpcRequest(i,g,r,s,o-2e3);const p=setTimeout(()=>{this.pendingAcks.delete(g),l(ge.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(g),clearTimeout(B)},2e3);this.pendingAcks.set(g,{resolve:()=>{clearTimeout(p)},participantIdentity:i});const B=setTimeout(()=>{this.pendingResponses.delete(g),l(ge.builtIn("RESPONSE_TIMEOUT"))},o);this.pendingResponses.set(g,{resolve:(y,b)=>{clearTimeout(B),this.pendingAcks.has(g)&&(console.warn("RPC response received before ack",g),this.pendingAcks.delete(g),clearTimeout(p)),b?l(b):c(y??"")},participantIdentity:i})}))}()})}registerRpcMethod(e,t){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=t,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const t=this.pendingAcks.get(e);t?(t.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,t,n){const i=this.pendingResponses.get(e);i?(i.resolve(t,n),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,t,n,i,r){return m(this,void 0,void 0,function*(){const s=new Xe({destinationIdentities:[e],kind:Y.RELIABLE,value:{case:"rpcRequest",value:new Bu({id:t,method:n,payload:i,responseTimeoutMs:r,version:1})}});yield this.engine.sendDataPacket(s,Y.RELIABLE)})}handleParticipantDisconnected(e){for(const[t,{participantIdentity:n}]of this.pendingAcks)n===e&&this.pendingAcks.delete(t);for(const[t,{participantIdentity:n,resolve:i}]of this.pendingResponses)n===e&&(i(null,ge.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(t))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(t=>t.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(t=>{var n,i;const r=this.trackPublications.get(t.sid);if(r){const s=r.isMuted||((i=(n=r.track)===null||n===void 0?void 0:n.isUpstreamPaused)!==null&&i!==void 0?i:!1);s!==t.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),Z(r)),{mutedOnServer:s})),this.engine.client.sendMuteTrack(t.sid,s))}}),!0):!1}getPublicationForTrack(e){let t;return this.trackPublications.forEach(n=>{const i=n.track;i&&(e instanceof MediaStreamTrack?(jA(i)||dA(i))&&i.mediaStreamTrack===e&&(t=n):e===i&&(t=n))}),t}waitForPendingPublicationOfSource(e){return m(this,void 0,void 0,function*(){const n=Date.now();for(;Date.now()<n+1e4;){const i=Array.from(this.pendingPublishPromises.entries()).find(r=>{let[s]=r;return s.source===e});if(i)return i[1];yield qe(20)}})}}class iC extends Wt{constructor(e,t,n,i){super(e,t.sid,t.name,i),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=at.HIGH,this.handleEnded=r=>{this.setTrack(void 0),this.emit(k.Ended,r)},this.handleVisibilityChange=r=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(r),this.logContext),this.disabled=!r,this.emitTrackUpdate()},this.handleVideoDimensionsChange=r=>{this.log.debug("adaptivestream video dimensions ".concat(r.width,"x").concat(r.height),this.logContext),this.videoDimensions=r,this.emitTrackUpdate()},this.subscribed=n,this.updateInfo(t)}setSubscribed(e){const t=this.subscriptionStatus,n=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const i=new dr({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new yu({participantSid:"",trackSids:[this.trackSid]})]});this.emit(k.UpdateSubscription,i),this.emitSubscriptionUpdateIfChanged(t),this.emitPermissionUpdateIfChanged(n)}get subscriptionStatus(){return this.subscribed===!1?Wt.SubscriptionStatus.Unsubscribed:super.isSubscribed?Wt.SubscriptionStatus.Subscribed:Wt.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Wt.PermissionStatus.Allowed:Wt.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.disabled===!e||(this.disabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.currentVideoQuality===e||(this.currentVideoQuality=e,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var t,n;this.isManualOperationAllowed()&&(((t=this.videoDimensions)===null||t===void 0?void 0:t.width)===e.width&&((n=this.videoDimensions)===null||n===void 0?void 0:n.height)===e.height||(da(this.track)&&(this.videoDimensions=e),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&da(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(e){const t=this.subscriptionStatus,n=this.permissionStatus,i=this.track;i!==e&&(i&&(i.off(k.VideoDimensionsChanged,this.handleVideoDimensionsChange),i.off(k.VisibilityChanged,this.handleVisibilityChange),i.off(k.Ended,this.handleEnded),i.detach(),i.stopMonitor(),this.emit(k.Unsubscribed,i)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(k.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(k.VisibilityChanged,this.handleVisibilityChange),e.on(k.Ended,this.handleEnded),this.emit(k.Subscribed,e)),this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(t))}setAllowed(e){const t=this.subscriptionStatus,n=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(t)}setSubscriptionError(e){this.emit(k.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const t=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):t!==e.muted&&this.emit(e.muted?k.Muted:k.Unmuted)}emitSubscriptionUpdateIfChanged(e){const t=this.subscriptionStatus;e!==t&&this.emit(k.SubscriptionStatusChanged,t,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(k.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.kind===U.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return da(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new Iu({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(e.width=Math.ceil(this.videoDimensions.width),e.height=Math.ceil(this.videoDimensions.height)):this.currentVideoQuality!==void 0?e.quality=this.currentVideoQuality:e.quality=at.HIGH,this.emit(k.UpdateSettings,e)}}class Rr extends Bh{static fromParticipantInfo(e,t,n){return new Rr(e,t.sid,t.identity,t.name,t.metadata,t.attributes,n,t.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,t,n,i,r,s,o){let a=arguments.length>7&&arguments[7]!==void 0?arguments[7]:ur.STANDARD;super(t,n||"",i,r,s,o,a),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(k.UpdateSettings,t=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),Z(e))),this.signalClient.sendUpdateTrackSettings(t)}),e.on(k.UpdateSubscription,t=>{t.participantTracks.forEach(n=>{n.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(t)}),e.on(k.SubscriptionPermissionChanged,t=>{this.emit(x.TrackSubscriptionPermissionChanged,e,t)}),e.on(k.SubscriptionStatusChanged,t=>{this.emit(x.TrackSubscriptionStatusChanged,e,t)}),e.on(k.Subscribed,t=>{this.emit(x.TrackSubscribed,t,e)}),e.on(k.Unsubscribed,t=>{this.emit(x.TrackUnsubscribed,t,e)}),e.on(k.SubscriptionFailed,t=>{this.emit(x.TrackSubscriptionFailed,e.trackSid,t)})}getTrackPublication(e){const t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){const t=super.getTrackPublicationByName(e);if(t)return t}setVolume(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:U.Source.Microphone;this.volumeMap.set(t,e);const n=this.getTrackPublication(t);n&&n.track&&n.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:U.Source.Microphone;const t=this.getTrackPublication(e);return t&&t.track?t.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,t,n,i,r,s){let o=this.getTrackPublicationBySid(t);if(o||t.startsWith("TR")||this.trackPublications.forEach(l=>{!o&&e.kind===l.kind.toString()&&(o=l)}),!o){if(s===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:t})),this.emit(x.TrackSubscriptionFailed,t);return}s===void 0&&(s=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,t,n,i,r,s-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),Z(o))),this.emit(x.TrackSubscriptionFailed,t);return}const a=e.kind==="video";let c;return a?c=new Yv(e,t,i,r):c=new qv(e,t,i,this.audioContext,this.audioOutput),c.source=o.source,c.isMuted=o.isMuted,c.setMediaStream(n),c.start(),o.setTrack(c),this.volumeMap.has(o.source)&&ua(c)&&$t(c)&&c.setVolume(this.volumeMap.get(o.source)),o}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const t=new Map,n=new Map;return e.tracks.forEach(i=>{var r,s;let o=this.getTrackPublicationBySid(i.sid);if(o)o.updateInfo(i);else{const a=U.kindFromProto(i.type);if(!a)return;o=new iC(a,i,(r=this.signalClient.connectOptions)===null||r===void 0?void 0:r.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(s=this.loggerOptions)===null||s===void 0?void 0:s.loggerName}),o.updateInfo(i),n.set(i.sid,o);const c=Array.from(this.trackPublications.values()).find(l=>l.source===o?.source);c&&o.source!==U.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(o.source),Object.assign(Object.assign({},this.logContext),{oldTrack:Z(c),newTrack:Z(o)})),this.addTrackPublication(o)}t.set(i.sid,o)}),this.trackPublications.forEach(i=>{t.has(i.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),Z(i))),this.unpublishTrack(i.trackSid,!0))}),n.forEach(i=>{this.emit(x.TrackPublished,i)}),!0}unpublishTrack(e,t){const n=this.trackPublications.get(e);if(!n)return;const{track:i}=n;switch(i&&(i.stop(),n.setTrack(void 0)),this.trackPublications.delete(e),n.kind){case U.Kind.Audio:this.audioTrackPublications.delete(e);break;case U.Kind.Video:this.videoTrackPublications.delete(e);break}t&&this.emit(x.TrackUnpublished,n)}setAudioOutput(e){return m(this,void 0,void 0,function*(){this.audioOutput=e;const t=[];this.audioTrackPublications.forEach(n=>{var i;$t(n.track)&&ua(n.track)&&t.push(n.track.setSinkId((i=e.deviceId)!==null&&i!==void 0?i:"default"))}),yield Promise.all(t)})}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:n})),super.emit(e,...n)}}var z;(function(A){A.Disconnected="disconnected",A.Connecting="connecting",A.Connected="connected",A.Reconnecting="reconnecting",A.SignalReconnecting="signalReconnecting"})(z||(z={}));const rC=4*1e3;class $A extends xt.EventEmitter{constructor(e){var t,n,i,r;if(super(),t=this,this.state=z.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=j,this.bufferedEvents=[],this.isResuming=!1,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.rpcHandlers=new Map,this.connect=(s,o,a)=>m(this,void 0,void 0,function*(){var c;if(!$0())throw Rt()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const l=yield this.disconnectLock.lock();if(this.state===z.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),l(),Promise.resolve();if(this.connectFuture)return l(),this.connectFuture.promise;this.setAndEmitConnectionState(z.Connecting),((c=this.regionUrlProvider)===null||c===void 0?void 0:c.getServerUrl().toString())!==s&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),ra(new URL(s))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new ka(s,o):this.regionUrlProvider.updateToken(o),this.regionUrlProvider.fetchRegionSettings().then(h=>{var f;(f=this.regionUrlProvider)===null||f===void 0||f.setServerReportedRegions(h)}).catch(h=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:h}))}));const u=(h,f,g)=>m(this,void 0,void 0,function*(){var p,B;this.abortController&&this.abortController.abort();const y=new AbortController;this.abortController=y,l?.();try{yield this.attemptConnection(g??s,o,a,y),this.abortController=void 0,h()}catch(b){if(this.regionUrlProvider&&b instanceof se&&b.reason!==W.Cancelled&&b.reason!==W.NotAllowed){let v=null;try{v=yield this.regionUrlProvider.getNextBestRegionUrl((p=this.abortController)===null||p===void 0?void 0:p.signal)}catch(C){if(C instanceof se&&(C.status===401||C.reason===W.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),f(C);return}}v&&!(!((B=this.abortController)===null||B===void 0)&&B.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(b.message,". Retrying with another region: ").concat(v),this.logContext),this.recreateEngine(),yield u(h,f,v)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Kd(b)),f(b))}else{let v=mt.UNKNOWN_REASON;b instanceof se&&(v=Kd(b)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,v),f(b)}}}),d=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new ca((h,f)=>{u(h,f,d)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(s,o,a,c,l,u)=>m(this,void 0,void 0,function*(){var d,h,f;const g=yield a.join(s,o,{autoSubscribe:c.autoSubscribe,adaptiveStream:typeof l.adaptiveStream=="object"?!0:l.adaptiveStream,maxRetries:c.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:c.websocketTimeout},u.signal);let p=g.serverInfo;if(p||(p={version:g.serverVersion,region:g.serverRegion}),this.serverInfo=p,this.log.debug("connected to Livekit Server ".concat(Object.entries(p).map(B=>{let[y,b]=B;return"".concat(y,": ").concat(b)}).join(", ")),{room:(d=g.room)===null||d===void 0?void 0:d.name,roomSid:(h=g.room)===null||h===void 0?void 0:h.sid,identity:(f=g.participant)===null||f===void 0?void 0:f.identity}),!p.version)throw new I0("unknown server version");return p.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),l.dynacast=!1),g}),this.applyJoinResponse=s=>{const o=s.participant;if(this.localParticipant.sid=o.sid,this.localParticipant.identity=o.identity,this.localParticipant.setEnabledPublishCodecs(s.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(s.sifTrailer)}catch(a){this.log.error(a instanceof Error?a.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:a}))}this.handleParticipantUpdates([o,...s.otherParticipants]),s.room&&this.handleRoomUpdate(s.room)},this.attemptConnection=(s,o,a,c)=>m(this,void 0,void 0,function*(){var l,u;this.state===z.Reconnecting||this.isResuming||!((l=this.engine)===null||l===void 0)&&l.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((u=this.regionUrlProvider)===null||u===void 0)&&u.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},ba),a),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const d=yield this.connectSignal(s,o,this.engine,this.connOptions,this.options,c);this.applyJoinResponse(d),this.setupLocalParticipantEvents(),this.emit(Q.SignalConnected)}catch(d){yield this.engine.close(),this.recreateEngine();const h=new se("could not establish signal connection",W.ServerUnreachable);throw d instanceof Error&&(h.message="".concat(h.message,": ").concat(d.message)),d instanceof se&&(h.reason=d.reason,h.status=d.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:d})),h}if(c.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new se("Connection attempt aborted",W.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,c)}catch(d){throw yield this.engine.close(),this.recreateEngine(),d}Ye()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Ye()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(z.Connected),this.emit(Q.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];return m(t,[...o],void 0,function(){var c=this;let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var u,d,h,f;const g=yield c.disconnectLock.lock();try{if(c.state===z.Disconnected){c.log.debug("already disconnected",c.logContext);return}c.log.info("disconnect from room",Object.assign({},c.logContext)),(c.state===z.Connecting||c.state===z.Reconnecting||c.isResuming)&&(c.log.warn("abort connection attempt",c.logContext),(u=c.abortController)===null||u===void 0||u.abort(),(h=(d=c.connectFuture)===null||d===void 0?void 0:d.reject)===null||h===void 0||h.call(d,new se("Client initiated disconnect",W.Cancelled)),c.connectFuture=void 0),!((f=c.engine)===null||f===void 0)&&f.client.isDisconnected||(yield c.engine.client.sendLeave()),c.engine&&(yield c.engine.close()),c.handleDisconnect(l,mt.CLIENT_INITIATED),c.engine=void 0}finally{g()}}()})},this.onPageLeave=()=>m(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>m(this,void 0,void 0,function*(){const s=[],o=wt();if(o&&o.os==="iOS"){const a="livekit-dummy-audio-el";let c=document.getElementById(a);if(!c){c=document.createElement("audio"),c.id=a,c.autoplay=!0,c.hidden=!0;const l=aa();l.enabled=!0;const u=new MediaStream([l]);c.srcObject=u,document.addEventListener("visibilitychange",()=>{c&&(c.srcObject=document.hidden?null:u,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(c),this.once(Q.Disconnected,()=>{c?.remove(),c=null})}s.push(c)}this.remoteParticipants.forEach(a=>{a.audioTrackPublications.forEach(c=>{c.track&&c.track.attachedElements.forEach(l=>{s.push(l)})})});try{yield Promise.all([this.acquireAudioContext(),...s.map(a=>(a.muted=!1,a.play()))]),this.handleAudioPlaybackStarted()}catch(a){throw this.handleAudioPlaybackFailed(a),a}}),this.startVideo=()=>m(this,void 0,void 0,function*(){const s=[];for(const o of this.remoteParticipants.values())o.videoTrackPublications.forEach(a=>{var c;(c=a.track)===null||c===void 0||c.attachedElements.forEach(l=>{s.includes(l)||s.push(l)})});yield Promise.all(s.map(o=>o.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(o=>{o.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const s of this.remoteParticipants.values())this.handleParticipantDisconnected(s.identity,s);this.setAndEmitConnectionState(z.Reconnecting)&&this.emit(Q.Reconnecting)},this.handleSignalRestarted=s=>m(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(s.serverRegion),Object.assign(Object.assign({},this.logContext),{region:s.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(s);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(o){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:o}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:s.serverRegion}))}catch{return}this.setAndEmitConnectionState(z.Connected),this.emit(Q.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=s=>{s.forEach(o=>{var a;if(o.identity===this.localParticipant.identity){this.localParticipant.updateInfo(o);return}o.identity===""&&(o.identity=(a=this.sidToIdentity.get(o.sid))!==null&&a!==void 0?a:"");let c=this.remoteParticipants.get(o.identity);o.state===mn.DISCONNECTED?this.handleParticipantDisconnected(o.identity,c):c=this.getOrCreateParticipant(o.identity,o)})},this.handleActiveSpeakersUpdate=s=>{const o=[],a={};s.forEach(c=>{if(a[c.sid]=!0,c.sid===this.localParticipant.sid)this.localParticipant.audioLevel=c.level,this.localParticipant.setIsSpeaking(!0),o.push(this.localParticipant);else{const l=this.getRemoteParticipantBySid(c.sid);l&&(l.audioLevel=c.level,l.setIsSpeaking(!0),o.push(l))}}),a[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(c=>{a[c.sid]||(c.audioLevel=0,c.setIsSpeaking(!1))}),this.activeSpeakers=o,this.emitWhenConnected(Q.ActiveSpeakersChanged,o)},this.handleSpeakersChanged=s=>{const o=new Map;this.activeSpeakers.forEach(c=>{const l=this.remoteParticipants.get(c.identity);l&&l.sid!==c.sid||o.set(c.sid,c)}),s.forEach(c=>{let l=this.getRemoteParticipantBySid(c.sid);c.sid===this.localParticipant.sid&&(l=this.localParticipant),l&&(l.audioLevel=c.level,l.setIsSpeaking(c.active),c.active?o.set(c.sid,l):o.delete(c.sid))});const a=Array.from(o.values());a.sort((c,l)=>l.audioLevel-c.audioLevel),this.activeSpeakers=a,this.emitWhenConnected(Q.ActiveSpeakersChanged,a)},this.handleStreamStateUpdate=s=>{s.streamStates.forEach(o=>{const a=this.getRemoteParticipantBySid(o.participantSid);if(!a)return;const c=a.getTrackPublicationBySid(o.trackSid);if(!c||!c.track)return;const l=U.streamStateFromProto(o.state);l!==c.track.streamState&&(c.track.streamState=l,a.emit(x.TrackStreamStateChanged,c,c.track.streamState),this.emitWhenConnected(Q.TrackStreamStateChanged,c,c.track.streamState,a))})},this.handleSubscriptionPermissionUpdate=s=>{const o=this.getRemoteParticipantBySid(s.participantSid);if(!o)return;const a=o.getTrackPublicationBySid(s.trackSid);a&&a.setAllowed(s.allowed)},this.handleSubscriptionError=s=>{const o=Array.from(this.remoteParticipants.values()).find(c=>c.trackPublications.has(s.trackSid));if(!o)return;const a=o.getTrackPublicationBySid(s.trackSid);a&&a.setSubscriptionError(s.err)},this.handleDataPacket=s=>{const o=this.remoteParticipants.get(s.participantIdentity);if(s.value.case==="user")this.handleUserPacket(o,s.value.value,s.kind);else if(s.value.case==="transcription")this.handleTranscription(o,s.value.value);else if(s.value.case==="sipDtmf")this.handleSipDtmf(o,s.value.value);else if(s.value.case==="chatMessage")this.handleChatMessage(o,s.value.value);else if(s.value.case==="metrics")this.handleMetrics(s.value.value,o);else if(s.value.case==="streamHeader")this.handleStreamHeader(s.value.value,s.participantIdentity);else if(s.value.case==="streamChunk")this.handleStreamChunk(s.value.value);else if(s.value.case==="streamTrailer")this.handleStreamTrailer(s.value.value);else if(s.value.case==="rpcRequest"){const a=s.value.value;this.handleIncomingRpcRequest(s.participantIdentity,a.id,a.method,a.payload,a.responseTimeoutMs,a.version)}},this.handleUserPacket=(s,o,a)=>{this.emit(Q.DataReceived,o.payload,s,a,o.topic),s?.emit(x.DataReceived,o.payload,a)},this.handleSipDtmf=(s,o)=>{this.emit(Q.SipDTMFReceived,o,s),s?.emit(x.SipDTMFReceived,o)},this.bufferedSegments=new Map,this.handleTranscription=(s,o)=>{const a=o.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(o.transcribedParticipantIdentity),c=a?.trackPublications.get(o.trackId),l=ev(o,this.transcriptionReceivedTimes);c?.emit(k.TranscriptionReceived,l),a?.emit(x.TranscriptionReceived,l,c),this.emit(Q.TranscriptionReceived,l,a,c)},this.handleChatMessage=(s,o)=>{const a=tv(o);this.emit(Q.ChatMessage,a,s)},this.handleMetrics=(s,o)=>{this.emit(Q.MetricsReceived,s,o)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(Q.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=s=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:s})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(Q.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(Q.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(Q.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>m(this,void 0,void 0,function*(){var s,o,a;const c=Ue.getInstance().previousDevices,l=yield Ue.getInstance().getDevices(void 0,!1),u=wt();if(u?.name==="Chrome"&&u.os!=="iOS")for(let h of l){const f=c.find(g=>g.deviceId===h.deviceId);f&&f.label!==""&&f.kind===h.kind&&f.label!==h.label&&this.getActiveDevice(h.kind)==="default"&&this.emit(Q.ActiveDeviceChanged,h.kind,h.deviceId)}const d=["audiooutput","audioinput","videoinput"];for(let h of d){const f=rv(h),g=this.localParticipant.getTrackPublication(f);if(g&&(!((s=g.track)===null||s===void 0)&&s.isUserProvided))continue;const p=l.filter(y=>y.kind===h),B=this.getActiveDevice(h);if(B===((o=c.filter(y=>y.kind===h)[0])===null||o===void 0?void 0:o.deviceId)&&p.length>0&&((a=p[0])===null||a===void 0?void 0:a.deviceId)!==B){yield this.switchActiveDevice(h,p[0].deviceId);continue}h==="audioinput"&&!lA()||h==="videoinput"||p.length>0&&!p.find(y=>y.deviceId===this.getActiveDevice(h))&&(yield this.switchActiveDevice(h,p[0].deviceId))}this.emit(Q.MediaDevicesChanged)}),this.handleRoomUpdate=s=>{const o=this.roomInfo;this.roomInfo=s,o&&o.metadata!==s.metadata&&this.emitWhenConnected(Q.RoomMetadataChanged,s.metadata),o?.activeRecording!==s.activeRecording&&this.emitWhenConnected(Q.RecordingStatusChanged,s.activeRecording)},this.handleConnectionQualityUpdate=s=>{s.updates.forEach(o=>{if(o.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(o.quality);return}const a=this.getRemoteParticipantBySid(o.participantSid);a&&a.setConnectionQuality(o.quality)})},this.onLocalParticipantMetadataChanged=s=>{this.emit(Q.ParticipantMetadataChanged,s,this.localParticipant)},this.onLocalParticipantNameChanged=s=>{this.emit(Q.ParticipantNameChanged,s,this.localParticipant)},this.onLocalAttributesChanged=s=>{this.emit(Q.ParticipantAttributesChanged,s,this.localParticipant)},this.onLocalTrackMuted=s=>{this.emit(Q.TrackMuted,s,this.localParticipant)},this.onLocalTrackUnmuted=s=>{this.emit(Q.TrackUnmuted,s,this.localParticipant)},this.onTrackProcessorUpdate=s=>{var o;(o=s?.onPublish)===null||o===void 0||o.call(s,this)},this.onLocalTrackPublished=s=>m(this,void 0,void 0,function*(){var o,a,c,l,u,d;(o=s.track)===null||o===void 0||o.on(k.TrackProcessorUpdate,this.onTrackProcessorUpdate),(a=s.track)===null||a===void 0||a.on(k.Restarted,this.onLocalTrackRestarted),(u=(l=(c=s.track)===null||c===void 0?void 0:c.getProcessor())===null||l===void 0?void 0:l.onPublish)===null||u===void 0||u.call(l,this),this.emit(Q.LocalTrackPublished,s,this.localParticipant),jA(s.track)&&(yield s.track.checkForSilence())&&this.emit(Q.LocalAudioSilenceDetected,s);const h=yield(d=s.track)===null||d===void 0?void 0:d.getDeviceId(!1),f=$d(s.source);f&&h&&h!==this.localParticipant.activeDeviceMap.get(f)&&(this.localParticipant.activeDeviceMap.set(f,h),this.emit(Q.ActiveDeviceChanged,f,h))}),this.onLocalTrackUnpublished=s=>{var o,a;(o=s.track)===null||o===void 0||o.off(k.TrackProcessorUpdate,this.onTrackProcessorUpdate),(a=s.track)===null||a===void 0||a.off(k.Restarted,this.onLocalTrackRestarted),this.emit(Q.LocalTrackUnpublished,s,this.localParticipant)},this.onLocalTrackRestarted=s=>m(this,void 0,void 0,function*(){const o=yield s.getDeviceId(!1),a=$d(s.source);a&&o&&o!==this.localParticipant.activeDeviceMap.get(a)&&(this.log.debug("local track restarted, setting ".concat(a," ").concat(o," active"),this.logContext),this.localParticipant.activeDeviceMap.set(a,o),this.emit(Q.ActiveDeviceChanged,a,o))}),this.onLocalConnectionQualityChanged=s=>{this.emit(Q.ConnectionQualityChanged,s,this.localParticipant)},this.onMediaDevicesError=s=>{this.emit(Q.MediaDevicesError,s)},this.onLocalParticipantPermissionsChanged=s=>{this.emit(Q.ParticipantPermissionsChanged,s,this.localParticipant)},this.onLocalChatMessageSent=s=>{this.emit(Q.ChatMessage,s,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},Uv),e),this.log=Vt((n=this.options.loggerName)!==null&&n!==void 0?n:Ct.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},nh),e?.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},ih),e?.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},Sv),e?.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new We,this.localParticipant=new nC("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",uA(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",uA(this.options.audioCaptureDefaults.deviceId)),!((i=this.options.audioOutput)===null||i===void 0)&&i.deviceId&&this.switchActiveDevice("audiooutput",uA(this.options.audioOutput.deviceId)).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message),this.logContext)),this.options.e2ee&&this.setupE2EE(),Ye()){const s=new AbortController;(r=navigator.mediaDevices)===null||r===void 0||r.addEventListener("devicechange",this.handleDeviceChange,{signal:s.signal}),$A.cleanupRegistry&&$A.cleanupRegistry.register(this,()=>{s.abort()})}}registerTextStreamHandler(e,t){if(this.textStreamHandlers.has(e))throw new TypeError('A text stream handler for topic "'.concat(e,'" has already been set.'));this.textStreamHandlers.set(e,t)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,t){if(this.byteStreamHandlers.has(e))throw new TypeError('A byte stream handler for topic "'.concat(e,'" has already been set.'));this.byteStreamHandlers.set(e,t)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}registerRpcMethod(e,t){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}handleIncomingRpcRequest(e,t,n,i,r,s){return m(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,t),s!==1){yield this.engine.publishRpcResponse(e,t,null,ge.builtIn("UNSUPPORTED_VERSION"));return}const o=this.rpcHandlers.get(n);if(!o){yield this.engine.publishRpcResponse(e,t,null,ge.builtIn("UNSUPPORTED_METHOD"));return}let a=null,c=null;try{const l=yield o({requestId:t,callerIdentity:e,payload:i,responseTimeout:r});Ea(l)>rh?(a=ge.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(n))):c=l}catch(l){l instanceof ge?a=l:(console.warn("Uncaught error returned by RPC handler for ".concat(n,". Returning APPLICATION_ERROR instead."),l),a=ge.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,t,c,a)})}setE2EEEnabled(e){return m(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new uv(this.options.e2ee),this.e2eeManager.on(aA.ParticipantEncryptionStatusChanged,(t,n)=>{nv(n)&&(this.isE2EEEnabled=t),this.emit(Q.ParticipantEncryptionStatusChanged,t,n)}),this.e2eeManager.on(aA.EncryptionError,t=>this.emit(Q.EncryptionError,t)),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&t!==void 0?t:!1}getSid(){return m(this,void 0,void 0,function*(){return this.state===z.Disconnected?"":this.roomInfo&&this.roomInfo.sid!==""?this.roomInfo.sid:new Promise((e,t)=>{const n=i=>{i.sid!==""&&(this.engine.off(I.RoomUpdate,n),e(i.sid))};this.engine.on(I.RoomUpdate,n),this.once(Q.Disconnected,()=>{this.engine.off(I.RoomUpdate,n),t("Room disconnected before room server id was available")})})})}get name(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&t!==void 0?t:0}get numPublishers(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&t!==void 0?t:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new Kv(this.options),this.engine.on(I.ParticipantUpdate,this.handleParticipantUpdates).on(I.RoomUpdate,this.handleRoomUpdate).on(I.SpeakersChanged,this.handleSpeakersChanged).on(I.StreamStateChanged,this.handleStreamStateUpdate).on(I.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(I.SubscriptionError,this.handleSubscriptionError).on(I.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(I.MediaTrackAdded,(e,t,n)=>{this.onTrackAdded(e,t,n)}).on(I.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(I.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(I.DataPacketReceived,this.handleDataPacket).on(I.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(z.SignalReconnecting)&&this.emit(Q.SignalReconnecting)}).on(I.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(z.Connected)&&this.emit(Q.Reconnected)}).on(I.SignalResumed,()=>{this.bufferedEvents=[],(this.state===z.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(I.Restarting,this.handleRestarting).on(I.SignalRestarted,this.handleSignalRestarted).on(I.Offline,()=>{this.setAndEmitConnectionState(z.Reconnecting)&&this.emit(Q.Reconnecting)}).on(I.DCBufferStatusChanged,(e,t)=>{this.emit(Q.DCBufferStatusChanged,e,t)}).on(I.LocalTrackSubscribed,e=>{const t=this.localParticipant.getTrackPublications().find(n=>{let{trackSid:i}=n;return i===e});if(!t){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(x.LocalTrackSubscribed,t),this.emitWhenConnected(Q.LocalTrackSubscribed,t,this.localParticipant)}).on(I.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((t,n)=>{this.handleParticipantDisconnected(n,t)}),this.emit(Q.Moved,e.room.name,e.token),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ue.getInstance().getDevices(e,t)}prepareConnection(e,t){return m(this,void 0,void 0,function*(){if(this.state===z.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(ra(new URL(e))&&t){this.regionUrlProvider=new ka(e,t);const n=yield this.regionUrlProvider.getNextBestRegionUrl();n&&this.state===z.Disconnected&&(this.regionUrl=n,yield fetch(la(n),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(n),this.logContext))}else yield fetch(la(e),{method:"HEAD"})}catch(n){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:n}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,t){return m(this,void 0,void 0,function*(){let n=()=>{},i;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":i=new _t({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":i=new _t({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":i=new _t({scenario:{case:"serverLeave",value:!0}});break;case"migration":i=new _t({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":n=()=>m(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new _t({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":n=()=>m(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new _t({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":i=new _t({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),n=()=>m(this,void 0,void 0,function*(){const r=this.engine.client.onLeave;r&&r(new hr({reason:mt.CLIENT_INITIATED,action:vn.RECONNECT}))});break;case"subscriber-bandwidth":if(t===void 0||typeof t!="number")throw new Error("subscriber-bandwidth requires a number as argument");i=new _t({scenario:{case:"subscriberBandwidth",value:VA(t)}});break;case"leave-full-reconnect":i=new _t({scenario:{case:"leaveRequestFullReconnect",value:!0}})}i&&(yield this.engine.client.sendSimulateScenario(i),yield n())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,t){return m(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var o,a,c,l,u,d,h,f;let g=!0,p=!1;const B=s?{exact:i}:i;if(n==="audioinput"){p=r.localParticipant.audioTrackPublications.size===0;const y=(o=r.getActiveDevice(n))!==null&&o!==void 0?o:r.options.audioCaptureDefaults.deviceId;r.options.audioCaptureDefaults.deviceId=B;const b=Array.from(r.localParticipant.audioTrackPublications.values()).filter(v=>v.source===U.Source.Microphone);try{g=(yield Promise.all(b.map(v=>{var C;return(C=v.audioTrack)===null||C===void 0?void 0:C.setDeviceId(B)}))).every(v=>v===!0)}catch(v){throw r.options.audioCaptureDefaults.deviceId=y,v}}else if(n==="videoinput"){p=r.localParticipant.videoTrackPublications.size===0;const y=(a=r.getActiveDevice(n))!==null&&a!==void 0?a:r.options.videoCaptureDefaults.deviceId;r.options.videoCaptureDefaults.deviceId=B;const b=Array.from(r.localParticipant.videoTrackPublications.values()).filter(v=>v.source===U.Source.Camera);try{g=(yield Promise.all(b.map(v=>{var C;return(C=v.videoTrack)===null||C===void 0?void 0:C.setDeviceId(B)}))).every(v=>v===!0)}catch(v){throw r.options.videoCaptureDefaults.deviceId=y,v}}else if(n==="audiooutput"){if(!ia()&&!r.options.webAudioMix||r.options.webAudioMix&&r.audioContext&&!("setSinkId"in r.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");r.options.webAudioMix&&(i=(c=yield Ue.getInstance().normalizeDeviceId("audiooutput",i))!==null&&c!==void 0?c:""),(l=(f=r.options).audioOutput)!==null&&l!==void 0||(f.audioOutput={});const y=(u=r.getActiveDevice(n))!==null&&u!==void 0?u:r.options.audioOutput.deviceId;r.options.audioOutput.deviceId=i;try{r.options.webAudioMix&&((d=r.audioContext)===null||d===void 0||d.setSinkId(i)),yield Promise.all(Array.from(r.remoteParticipants.values()).map(b=>b.setAudioOutput({deviceId:i})))}catch(b){throw r.options.audioOutput.deviceId=y,b}}return(p||n==="audiooutput")&&(r.localParticipant.activeDeviceMap.set(n,n==="audiooutput"&&((h=r.options.audioOutput)===null||h===void 0?void 0:h.deviceId)||i),r.emit(Q.ActiveDeviceChanged,n,i)),g}()})}setupLocalParticipantEvents(){this.localParticipant.on(x.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(x.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(x.AttributesChanged,this.onLocalAttributesChanged).on(x.TrackMuted,this.onLocalTrackMuted).on(x.TrackUnmuted,this.onLocalTrackUnmuted).on(x.LocalTrackPublished,this.onLocalTrackPublished).on(x.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(x.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(x.MediaDevicesError,this.onMediaDevicesError).on(x.AudioStreamAcquired,this.startAudio).on(x.ChatMessage,this.onLocalChatMessageSent).on(x.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,t,n){if(this.state===z.Connecting||this.state===z.Reconnecting){const l=()=>{this.onTrackAdded(e,t,n),u()},u=()=>{this.off(Q.Reconnected,l),this.off(Q.Connected,l),this.off(Q.Disconnected,u)};this.once(Q.Reconnected,l),this.once(Q.Connected,l),this.once(Q.Disconnected,u);return}if(this.state===z.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const i=G0(t.id),r=i[0];let s=i[1],o=e.id;if(s&&s.startsWith("TR")&&(o=s),r===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const a=Array.from(this.remoteParticipants.values()).find(l=>l.sid===r);if(!a){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(r),this.logContext);return}let c;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?c=this.options.adaptiveStream:c={}),a.addSubscribedMediaTrack(e,o,t,n,c)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1?arguments[1]:void 0;var n;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==z.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(i=>{i.trackPublications.forEach(r=>{i.unpublishTrack(r.trackSid)})}),this.localParticipant.trackPublications.forEach(i=>{var r,s,o;i.track&&this.localParticipant.unpublishTrack(i.track,e),e?((r=i.track)===null||r===void 0||r.detach(),(s=i.track)===null||s===void 0||s.stop()):(o=i.track)===null||o===void 0||o.stopMonitor()}),this.localParticipant.off(x.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(x.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(x.AttributesChanged,this.onLocalAttributesChanged).off(x.TrackMuted,this.onLocalTrackMuted).off(x.TrackUnmuted,this.onLocalTrackUnmuted).off(x.LocalTrackPublished,this.onLocalTrackPublished).off(x.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(x.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(x.MediaDevicesError,this.onMediaDevicesError).off(x.AudioStreamAcquired,this.startAudio).off(x.ChatMessage,this.onLocalChatMessageSent).off(x.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),Ye()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(n=navigator.mediaDevices)===null||n===void 0||n.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(z.Disconnected),this.emit(Q.Disconnected,t)}}}handleParticipantDisconnected(e,t){var n;this.remoteParticipants.delete(e),t&&(t.trackPublications.forEach(i=>{t.unpublishTrack(i.trackSid,!0)}),this.emit(Q.ParticipantDisconnected,t),t.setDisconnected(),(n=this.localParticipant)===null||n===void 0||n.handleParticipantDisconnected(t.identity))}handleStreamHeader(e,t){return m(this,void 0,void 0,function*(){var n;if(e.contentHeader.case==="byteHeader"){const i=this.byteStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let r;const s={id:e.streamId,name:(n=e.contentHeader.value.name)!==null&&n!==void 0?n:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Ur(e.timestamp),attributes:e.attributes},o=new ReadableStream({start:a=>{r=a,this.byteStreamControllers.set(e.streamId,{info:s,controller:r,startTime:Date.now()})}});i(new $v(s,o,Ur(e.totalLength)),{identity:t})}else if(e.contentHeader.case==="textHeader"){const i=this.textStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let r;const s={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes},o=new ReadableStream({start:a=>{r=a,this.textStreamControllers.set(e.streamId,{info:s,controller:r,startTime:Date.now()})}});i(new Wv(s,o,Ur(e.totalLength)),{identity:t})}})}handleStreamChunk(e){const t=this.byteStreamControllers.get(e.streamId);t&&e.content.length>0&&t.controller.enqueue(e);const n=this.textStreamControllers.get(e.streamId);n&&e.content.length>0&&n.controller.enqueue(e)}handleStreamTrailer(e){const t=this.textStreamControllers.get(e.streamId);t&&(t.info.attributes=Object.assign(Object.assign({},t.info.attributes),e.attributes),t.controller.close(),this.textStreamControllers.delete(e.streamId));const n=this.byteStreamControllers.get(e.streamId);n&&(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.byteStreamControllers.delete(e.streamId))}acquireAudioContext(){return m(this,void 0,void 0,function*(){var e,t;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=jd())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(i=>i.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),qe(200)])}catch(i){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:i}))}const n=((t=this.audioContext)===null||t===void 0?void 0:t.state)==="running";n!==this.canPlaybackAudio&&(this.audioEnabled=n,this.emit(Q.AudioPlaybackStatusChanged,n))})}createParticipant(e,t){var n;let i;return t?i=Rr.fromParticipantInfo(this.engine.client,t,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):i=new Rr(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&i.setAudioContext(this.audioContext),!((n=this.options.audioOutput)===null||n===void 0)&&n.deviceId&&i.setAudioOutput(this.options.audioOutput).catch(r=>this.log.warn("Could not set audio output: ".concat(r.message),this.logContext)),i}getOrCreateParticipant(e,t){if(this.remoteParticipants.has(e)){const i=this.remoteParticipants.get(e);return t&&i.updateInfo(t)&&this.sidToIdentity.set(t.sid,t.identity),i}const n=this.createParticipant(e,t);return this.remoteParticipants.set(e,n),this.sidToIdentity.set(t.sid,t.identity),this.emitWhenConnected(Q.ParticipantConnected,n),n.on(x.TrackPublished,i=>{this.emitWhenConnected(Q.TrackPublished,i,n)}).on(x.TrackSubscribed,(i,r)=>{i.kind===U.Kind.Audio?(i.on(k.AudioPlaybackStarted,this.handleAudioPlaybackStarted),i.on(k.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):i.kind===U.Kind.Video&&(i.on(k.VideoPlaybackFailed,this.handleVideoPlaybackFailed),i.on(k.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(Q.TrackSubscribed,i,r,n)}).on(x.TrackUnpublished,i=>{this.emit(Q.TrackUnpublished,i,n)}).on(x.TrackUnsubscribed,(i,r)=>{this.emit(Q.TrackUnsubscribed,i,r,n)}).on(x.TrackMuted,i=>{this.emitWhenConnected(Q.TrackMuted,i,n)}).on(x.TrackUnmuted,i=>{this.emitWhenConnected(Q.TrackUnmuted,i,n)}).on(x.ParticipantMetadataChanged,i=>{this.emitWhenConnected(Q.ParticipantMetadataChanged,i,n)}).on(x.ParticipantNameChanged,i=>{this.emitWhenConnected(Q.ParticipantNameChanged,i,n)}).on(x.AttributesChanged,i=>{this.emitWhenConnected(Q.ParticipantAttributesChanged,i,n)}).on(x.ConnectionQualityChanged,i=>{this.emitWhenConnected(Q.ConnectionQualityChanged,i,n)}).on(x.ParticipantPermissionsChanged,i=>{this.emitWhenConnected(Q.ParticipantPermissionsChanged,i,n)}).on(x.TrackSubscriptionStatusChanged,(i,r)=>{this.emitWhenConnected(Q.TrackSubscriptionStatusChanged,i,r,n)}).on(x.TrackSubscriptionFailed,(i,r)=>{this.emit(Q.TrackSubscriptionFailed,i,n,r)}).on(x.TrackSubscriptionPermissionChanged,(i,r)=>{this.emitWhenConnected(Q.TrackSubscriptionPermissionChanged,i,r,n)}).on(x.Active,()=>{this.emitWhenConnected(Q.ParticipantActive,n)}),t&&n.updateInfo(t),n}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((n,i)=>(n.push(...i.getTrackPublications()),n),[]),t=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,t)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const t of e.videoTrackPublications.values())t.isSubscribed&&Av(t)&&t.emitTrackUpdate()}getRemoteParticipantBySid(e){const t=this.sidToIdentity.get(e);if(t)return this.remoteParticipants.get(t)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Fe.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,mt.STATE_MISMATCH))):e=0},rC)}clearConnectionReconcile(){this.connectionReconcileInterval&&Fe.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(Q.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[t,n]=e;this.emit(t,...n)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(this.state===z.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,n]);else if(this.state===z.Connected)return this.emit(e,...n);return!1}simulateParticipants(e){return m(this,void 0,void 0,function*(){var t,n;const i=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),r=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new cr({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:ue.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new HA({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(Q.SignalConnected),this.emit(Q.Connected),this.setAndEmitConnectionState(z.Connected),i.video){const s=new xa(U.Kind.Video,new Bn({source:we.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:pt.AUDIO,name:"video-dummy"}),new _r(i.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:Nd(160*((t=r.aspectRatios[0])!==null&&t!==void 0?t:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(s),this.localParticipant.emit(x.LocalTrackPublished,s)}if(i.audio){const s=new xa(U.Kind.Audio,new Bn({source:we.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:pt.AUDIO}),new kr(i.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:aa(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(s),this.localParticipant.emit(x.LocalTrackPublished,s)}for(let s=0;s<r.count-1;s+=1){let o=new HA({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(s),state:mn.ACTIVE,tracks:[],joinedAt:ue.parse(Date.now())});const a=this.getOrCreateParticipant(o.identity,o);if(r.video){const c=Nd(160*((n=r.aspectRatios[s%r.aspectRatios.length])!==null&&n!==void 0?n:1),160,!1,!0),l=new Bn({source:we.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:pt.AUDIO});a.addSubscribedMediaTrack(c,l.sid,new MediaStream([c]),new RTCRtpReceiver),o.tracks=[...o.tracks,l]}if(r.audio){const c=aa(),l=new Bn({source:we.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:pt.AUDIO});a.addSubscribedMediaTrack(c,l.sid,new MediaStream([c]),new RTCRtpReceiver),o.tracks=[...o.tracks,l]}a.updateInfo(o)}})}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(e!==Q.ActiveSpeakersChanged&&e!==Q.TranscriptionReceived){const r=Ch(n).filter(s=>s!==void 0);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:r}))}return super.emit(e,...n)}}$A.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(A=>{A()});function Ch(A){return A.map(e=>{if(e)return Array.isArray(e)?Ch(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var Et;(function(A){A[A.IDLE=0]="IDLE",A[A.RUNNING=1]="RUNNING",A[A.SKIPPED=2]="SKIPPED",A[A.SUCCESS=3]="SUCCESS",A[A.FAILED=4]="FAILED"})(Et||(Et={}));class gA extends xt.EventEmitter{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=Et.IDLE,this.logs=[],this.options={},this.url=e,this.token=t,this.name=this.constructor.name,this.room=new $A(n.roomOptions),this.connectOptions=n.connectOptions,this.options=n}run(e){return m(this,void 0,void 0,function*(){if(this.status!==Et.IDLE)throw Error("check is running already");this.setStatus(Et.RUNNING);try{yield this.perform()}catch(t){t instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(t.message):this.appendError(t.message))}return yield this.disconnect(),yield new Promise(t=>setTimeout(t,500)),this.status!==Et.SKIPPED&&this.setStatus(this.isSuccess()?Et.SUCCESS:Et.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return m(this,void 0,void 0,function*(){return this.room.state===z.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return m(this,void 0,void 0,function*(){this.room&&this.room.state!==z.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(Et.SKIPPED)}switchProtocol(e){return m(this,void 0,void 0,function*(){let t=!1,n=!1;if(this.room.on(Q.Reconnecting,()=>{t=!0}),this.room.once(Q.Reconnected,()=>{n=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(r=>setTimeout(r,1e3)),!t)return;const i=Date.now()+1e4;for(;Date.now()<i;){if(n)return;yield qe(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class sC extends gA{get description(){return"Cloud regions"}perform(){return m(this,void 0,void 0,function*(){const e=new ka(this.url,this.token);if(!e.isCloud()){this.skip();return}const t=[],n=new Set;for(let r=0;r<3;r++){const s=yield e.getNextBestRegionUrl();if(!s)break;if(n.has(s))continue;n.add(s);const o=yield this.checkCloudRegion(s);this.appendMessage("".concat(o.region," RTT: ").concat(o.rtt,"ms, duration: ").concat(o.duration,"ms")),t.push(o)}t.sort((r,s)=>(r.duration-s.duration)*.5+(r.rtt-s.rtt)*.5);const i=t[0];this.bestStats=i,this.appendMessage("best Cloud region: ".concat(i.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return m(this,void 0,void 0,function*(){var t,n;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const i=(t=this.room.serverInfo)===null||t===void 0?void 0:t.region;if(!i)throw new Error("Region not found");const r=yield this.room.localParticipant.streamText({topic:"test"}),s=1e3,a=1e6/s,c="A".repeat(s),l=Date.now();for(let f=0;f<a;f++)yield r.write(c);yield r.close();const u=Date.now(),d=yield(n=this.room.engine.pcManager)===null||n===void 0?void 0:n.publisher.getStats(),h={region:i,rtt:1e4,duration:u-l};return d?.forEach(f=>{f.type==="candidate-pair"&&f.nominated&&(h.rtt=f.currentRoundTripTime*1e3)}),yield this.disconnect(),h})}}const Ra=1e4;class oC extends gA{get description(){return"Connection via UDP vs TCP"}perform(){return m(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),t=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-t.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-t.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=t):this.appendMessage("best connection quality via udp");const n=this.bestStats;this.appendMessage("upstream bitrate: ".concat((n.bitrateTotal/n.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((n.rttTotal/n.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((n.jitterTotal/n.count*1e3).toFixed(2)," ms")),n.packetsLost>0&&this.appendWarning("packets lost: ".concat((n.packetsLost/n.packetsSent*100).toFixed(2),"%")),n.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((n.qualityLimitationDurations.bandwidth/(Ra/1e3)*100).toFixed(2),"%")),n.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((n.qualityLimitationDurations.cpu/(Ra/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return m(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const t=document.createElement("canvas");t.width=1280,t.height=720;const n=t.getContext("2d");if(!n)throw new Error("Could not get canvas context");let i=0;const r=()=>{i=(i+1)%360,n.fillStyle="hsl(".concat(i,", 100%, 50%)"),n.fillRect(0,0,t.width,t.height),requestAnimationFrame(r)};r();const o=t.captureStream(30).getVideoTracks()[0],c=(yield this.room.localParticipant.publishTrack(o,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,l={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},u=setInterval(()=>m(this,void 0,void 0,function*(){const d=yield c.getRTCStatsReport();d?.forEach(h=>{h.type==="outbound-rtp"?(l.packetsSent=h.packetsSent,l.qualityLimitationDurations=h.qualityLimitationDurations,l.bitrateTotal+=h.targetBitrate,l.count++):h.type==="remote-inbound-rtp"&&(l.packetsLost=h.packetsLost,l.rttTotal+=h.roundTripTime,l.jitterTotal+=h.jitter)})}),1e3);return yield new Promise(d=>setTimeout(d,Ra)),clearInterval(u),o.stop(),t.remove(),yield this.disconnect(),l})}}class aC extends gA{get description(){return"Can publish audio"}perform(){return m(this,void 0,void 0,function*(){var e;const t=yield this.connect(),n=yield eC();if(yield Vd(n,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),t.localParticipant.publishTrack(n),yield new Promise(o=>setTimeout(o,3e3));const r=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!r)throw new Error("Could not get RTCStats");let s=0;if(r.forEach(o=>{o.type==="outbound-rtp"&&(o.kind==="audio"||!o.kind&&o.mediaType==="audio")&&(s=o.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," audio packets"))})}}class cC extends gA{get description(){return"Can publish video"}perform(){return m(this,void 0,void 0,function*(){var e;const t=yield this.connect(),n=yield Zv();yield this.checkForVideo(n.mediaStreamTrack),t.localParticipant.publishTrack(n),yield new Promise(s=>setTimeout(s,5e3));const i=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!i)throw new Error("Could not get RTCStats");let r=0;if(i.forEach(s=>{s.type==="outbound-rtp"&&(s.kind==="video"||!s.kind&&s.mediaType==="video")&&(r+=s.packetsSent)}),r===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(r," video packets"))})}checkForVideo(e){return m(this,void 0,void 0,function*(){const t=new MediaStream;t.addTrack(e.clone());const n=document.createElement("video");n.srcObject=t,n.muted=!0,yield new Promise(i=>{n.onplay=()=>{setTimeout(()=>{var r,s,o,a;const c=document.createElement("canvas"),l=e.getSettings(),u=(s=(r=l.width)!==null&&r!==void 0?r:n.videoWidth)!==null&&s!==void 0?s:1280,d=(a=(o=l.height)!==null&&o!==void 0?o:n.videoHeight)!==null&&a!==void 0?a:720;c.width=u,c.height=d;const h=c.getContext("2d");h.drawImage(n,0,0);const g=h.getImageData(0,0,c.width,c.height).data;let p=!0;for(let B=0;B<g.length;B+=4)if(g[B]!==0||g[B+1]!==0||g[B+2]!==0){p=!1;break}p?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),i()},1e3)},n.play()}),n.remove()})}}class lC extends gA{get description(){return"Resuming connection after interruption"}perform(){return m(this,void 0,void 0,function*(){var e;const t=yield this.connect();let n=!1,i=!1,r;const s=new Promise(c=>{setTimeout(c,5e3),r=c}),o=()=>{n=!0};t.on(Q.SignalReconnecting,o).on(Q.Reconnecting,o).on(Q.Reconnected,()=>{i=!0,r(!0)}),(e=t.engine.client.ws)===null||e===void 0||e.close();const a=t.engine.client.onClose;if(a&&a(""),yield s,n){if(!i||t.state!==z.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class uC extends gA{get description(){return"Can connect via TURN"}perform(){return m(this,void 0,void 0,function*(){var e,t;const n=new pa,i=yield n.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});let r=!1,s=!1,o=!1;for(let a of i.iceServers)for(let c of a.urls)c.startsWith("turn:")?(s=!0,o=!0):c.startsWith("turns:")&&(s=!0,o=!0,r=!0),c.startsWith("stun:")&&(o=!0);o?s&&!r&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield n.close(),!((t=(e=this.connectOptions)===null||e===void 0?void 0:e.rtcConfig)===null||t===void 0)&&t.iceServers||s?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(a=>setTimeout(a,0)))})}}class dC extends gA{get description(){return"Establishing WebRTC connection"}perform(){return m(this,void 0,void 0,function*(){let e=!1,t=!1;this.room.on(Q.SignalConnected,()=>{const n=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(i,r)=>{if(i.candidate){const s=new RTCIceCandidate(i);let o="".concat(s.protocol," ").concat(s.address,":").concat(s.port," ").concat(s.type);s.address&&(hC(s.address)?o+=" (private)":s.protocol==="tcp"&&s.tcpType==="passive"?(e=!0,o+=" (passive)"):s.protocol==="udp"&&(t=!0)),this.appendMessage(o)}n&&n(i,r)},this.room.engine.pcManager&&(this.room.engine.pcManager.subscriber.onIceCandidateError=i=>{i instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(i.errorCode," ").concat(i.errorText," ").concat(i.url))})});try{yield this.connect(),j.info("now the room is connected")}catch(n){throw this.appendWarning("ports need to be open on firewall in order to connect."),n}e||this.appendWarning("Server is not configured for ICE/TCP"),t||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function hC(A){const e=A.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const t=parseInt(e[1],10);if(t>=16&&t<=31)return!0}}return!1}class fC extends gA{get description(){return"Connecting to signal connection via WebSocket"}perform(){return m(this,void 0,void 0,function*(){var e,t,n;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let i=new pa;const r=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});this.appendMessage("Connected to server, version ".concat(r.serverVersion,".")),((e=r.serverInfo)===null||e===void 0?void 0:e.edition)===bu.Cloud&&(!((t=r.serverInfo)===null||t===void 0)&&t.region)&&this.appendMessage("LiveKit Cloud: ".concat((n=r.serverInfo)===null||n===void 0?void 0:n.region)),yield i.close()})}}class I_ extends xt.EventEmitter{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=t,this.options=n}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:Et.IDLE,name:"",description:""}),e}updateCheck(e,t){this.checkResults.set(e,t),this.emit("checkUpdate",e,t)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==Et.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return m(this,void 0,void 0,function*(){const t=this.getNextCheckId(),n=new e(this.url,this.token,this.options),i=s=>{this.updateCheck(t,s)};n.on("update",i);const r=yield n.run();return n.off("update",i),r})}checkWebsocket(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(fC)})}checkWebRTC(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(dC)})}checkTURN(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(uC)})}checkReconnect(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(lC)})}checkPublishAudio(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(aC)})}checkPublishVideo(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(cC)})}checkConnectionProtocol(){return m(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(oC);if(e.data&&"protocol"in e.data){const t=e.data;this.options.protocol=t.protocol}return e})}checkCloudRegion(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(sC)})}}const ze=Symbol.for("@ts-pattern/matcher"),wh=Symbol.for("@ts-pattern/isVariadic"),Pr="@ts-pattern/anonymous-select-key",Pa=A=>!!(A&&typeof A=="object"),Lr=A=>A&&!!A[ze],ke=(A,e,t)=>{if(Lr(A)){const n=A[ze](),{matched:i,selections:r}=n.match(e);return i&&r&&Object.keys(r).forEach(s=>t(s,r[s])),i}if(Pa(A)){if(!Pa(e))return!1;if(Array.isArray(A)){if(!Array.isArray(e))return!1;let n=[],i=[],r=[];for(const s of A.keys()){const o=A[s];Lr(o)&&o[wh]?r.push(o):r.length?i.push(o):n.push(o)}if(r.length){if(r.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(e.length<n.length+i.length)return!1;const s=e.slice(0,n.length),o=i.length===0?[]:e.slice(-i.length),a=e.slice(n.length,i.length===0?1/0:-i.length);return n.every((c,l)=>ke(c,s[l],t))&&i.every((c,l)=>ke(c,o[l],t))&&(r.length===0||ke(r[0],a,t))}return A.length===e.length&&A.every((s,o)=>ke(s,e[o],t))}return Reflect.ownKeys(A).every(n=>{const i=A[n];return(n in e||Lr(r=i)&&r[ze]().matcherType==="optional")&&ke(i,e[n],t);var r})}return Object.is(e,A)},nt=A=>{var e,t,n;return Pa(A)?Lr(A)?(e=(t=(n=A[ze]()).getSelectionKeys)==null?void 0:t.call(n))!=null?e:[]:Array.isArray(A)?ui(A,nt):ui(Object.values(A),nt):[]},ui=(A,e)=>A.reduce((t,n)=>t.concat(e(n)),[]);function gC(...A){if(A.length===1){const[e]=A;return t=>ke(e,t,()=>{})}if(A.length===2){const[e,t]=A;return ke(e,t,()=>{})}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${A.length}.`)}function Ie(A){return Object.assign(A,{optional:()=>Da(A),and:e=>ce(A,e),or:e=>yh(A,e),select:e=>e===void 0?di(A):di(e,A)})}function La(A){return Object.assign((e=>Object.assign(e,{[Symbol.iterator](){let t=0;const n=[{value:Object.assign(e,{[wh]:!0}),done:!1},{done:!0,value:void 0}];return{next:()=>{var i;return(i=n[t++])!=null?i:n.at(-1)}}}}))(A),{optional:()=>La(Da(A)),select:e=>La(e===void 0?di(A):di(e,A))})}function Da(A){return Ie({[ze]:()=>({match:e=>{let t={};const n=(i,r)=>{t[i]=r};return e===void 0?(nt(A).forEach(i=>n(i,void 0)),{matched:!0,selections:t}):{matched:ke(A,e,n),selections:t}},getSelectionKeys:()=>nt(A),matcherType:"optional"})})}const pC=(A,e)=>{for(const t of A)if(!e(t))return!1;return!0},mC=(A,e)=>{for(const[t,n]of A.entries())if(!e(n,t))return!1;return!0};function ce(...A){return Ie({[ze]:()=>({match:e=>{let t={};const n=(i,r)=>{t[i]=r};return{matched:A.every(i=>ke(i,e,n)),selections:t}},getSelectionKeys:()=>ui(A,nt),matcherType:"and"})})}function yh(...A){return Ie({[ze]:()=>({match:e=>{let t={};const n=(i,r)=>{t[i]=r};return ui(A,nt).forEach(i=>n(i,void 0)),{matched:A.some(i=>ke(i,e,n)),selections:t}},getSelectionKeys:()=>ui(A,nt),matcherType:"or"})})}function J(A){return{[ze]:()=>({match:e=>({matched:!!A(e)})})}}function di(...A){const e=typeof A[0]=="string"?A[0]:void 0,t=A.length===2?A[1]:typeof A[0]=="string"?void 0:A[0];return Ie({[ze]:()=>({match:n=>{let i={[e??Pr]:n};return{matched:t===void 0||ke(t,n,(r,s)=>{i[r]=s}),selections:i}},getSelectionKeys:()=>[e??Pr].concat(t===void 0?[]:nt(t))})})}function Pt(A){return typeof A=="number"}function pA(A){return typeof A=="string"}function mA(A){return typeof A=="bigint"}const bh=Ie(J(function(A){return!0})),BC=bh,BA=A=>Object.assign(Ie(A),{startsWith:e=>{return BA(ce(A,(t=e,J(n=>pA(n)&&n.startsWith(t)))));var t},endsWith:e=>{return BA(ce(A,(t=e,J(n=>pA(n)&&n.endsWith(t)))));var t},minLength:e=>BA(ce(A,(t=>J(n=>pA(n)&&n.length>=t))(e))),length:e=>BA(ce(A,(t=>J(n=>pA(n)&&n.length===t))(e))),maxLength:e=>BA(ce(A,(t=>J(n=>pA(n)&&n.length<=t))(e))),includes:e=>{return BA(ce(A,(t=e,J(n=>pA(n)&&n.includes(t)))));var t},regex:e=>{return BA(ce(A,(t=e,J(n=>pA(n)&&!!n.match(t)))));var t}}),vC=BA(J(pA)),Lt=A=>Object.assign(Ie(A),{between:(e,t)=>Lt(ce(A,((n,i)=>J(r=>Pt(r)&&n<=r&&i>=r))(e,t))),lt:e=>Lt(ce(A,(t=>J(n=>Pt(n)&&n<t))(e))),gt:e=>Lt(ce(A,(t=>J(n=>Pt(n)&&n>t))(e))),lte:e=>Lt(ce(A,(t=>J(n=>Pt(n)&&n<=t))(e))),gte:e=>Lt(ce(A,(t=>J(n=>Pt(n)&&n>=t))(e))),int:()=>Lt(ce(A,J(e=>Pt(e)&&Number.isInteger(e)))),finite:()=>Lt(ce(A,J(e=>Pt(e)&&Number.isFinite(e)))),positive:()=>Lt(ce(A,J(e=>Pt(e)&&e>0))),negative:()=>Lt(ce(A,J(e=>Pt(e)&&e<0)))}),CC=Lt(J(Pt)),vA=A=>Object.assign(Ie(A),{between:(e,t)=>vA(ce(A,((n,i)=>J(r=>mA(r)&&n<=r&&i>=r))(e,t))),lt:e=>vA(ce(A,(t=>J(n=>mA(n)&&n<t))(e))),gt:e=>vA(ce(A,(t=>J(n=>mA(n)&&n>t))(e))),lte:e=>vA(ce(A,(t=>J(n=>mA(n)&&n<=t))(e))),gte:e=>vA(ce(A,(t=>J(n=>mA(n)&&n>=t))(e))),positive:()=>vA(ce(A,J(e=>mA(e)&&e>0))),negative:()=>vA(ce(A,J(e=>mA(e)&&e<0)))}),wC=vA(J(mA)),yC=Ie(J(function(A){return typeof A=="boolean"})),bC=Ie(J(function(A){return typeof A=="symbol"})),EC=Ie(J(function(A){return A==null})),SC=Ie(J(function(A){return A!=null}));var UC={__proto__:null,matcher:ze,optional:Da,array:function(...A){return La({[ze]:()=>({match:e=>{if(!Array.isArray(e))return{matched:!1};if(A.length===0)return{matched:!0};const t=A[0];let n={};if(e.length===0)return nt(t).forEach(r=>{n[r]=[]}),{matched:!0,selections:n};const i=(r,s)=>{n[r]=(n[r]||[]).concat([s])};return{matched:e.every(r=>ke(t,r,i)),selections:n}},getSelectionKeys:()=>A.length===0?[]:nt(A[0])})})},set:function(...A){return Ie({[ze]:()=>({match:e=>{if(!(e instanceof Set))return{matched:!1};let t={};if(e.size===0)return{matched:!0,selections:t};if(A.length===0)return{matched:!0};const n=(r,s)=>{t[r]=(t[r]||[]).concat([s])},i=A[0];return{matched:pC(e,r=>ke(i,r,n)),selections:t}},getSelectionKeys:()=>A.length===0?[]:nt(A[0])})})},map:function(...A){return Ie({[ze]:()=>({match:e=>{if(!(e instanceof Map))return{matched:!1};let t={};if(e.size===0)return{matched:!0,selections:t};const n=(o,a)=>{t[o]=(t[o]||[]).concat([a])};if(A.length===0)return{matched:!0};var i;if(A.length===1)throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(i=A[0])==null?void 0:i.toString()}`);const[r,s]=A;return{matched:mC(e,(o,a)=>{const c=ke(r,a,n),l=ke(s,o,n);return c&&l}),selections:t}},getSelectionKeys:()=>A.length===0?[]:[...nt(A[0]),...nt(A[1])]})})},intersection:ce,union:yh,not:function(A){return Ie({[ze]:()=>({match:e=>({matched:!ke(A,e,()=>{})}),getSelectionKeys:()=>[],matcherType:"not"})})},when:J,select:di,any:bh,_:BC,string:vC,number:CC,bigint:wC,boolean:yC,symbol:bC,nullish:EC,nonNullable:SC,instanceOf:function(A){return Ie(J(function(e){return t=>t instanceof e}(A)))},shape:function(A){return Ie(J(gC(A)))}};class TC extends Error{constructor(e){let t;try{t=JSON.stringify(e)}catch{t=e}super(`Pattern matching error: no pattern matches value ${t}`),this.input=void 0,this.input=e}}const Oa={matched:!1,value:void 0};function hi(A){return new QC(A,Oa)}let QC=class _l{constructor(e,t){this.input=void 0,this.state=void 0,this.input=e,this.state=t}with(...e){if(this.state.matched)return this;const t=e[e.length-1],n=[e[0]];let i;e.length===3&&typeof e[1]=="function"?i=e[1]:e.length>2&&n.push(...e.slice(1,e.length-1));let r=!1,s={};const o=(c,l)=>{r=!0,s[c]=l},a=!n.some(c=>ke(c,this.input,o))||i&&!i(this.input)?Oa:{matched:!0,value:t(r?Pr in s?s[Pr]:s:this.input,this.input)};return new _l(this.input,a)}when(e,t){if(this.state.matched)return this;const n=!!e(this.input);return new _l(this.input,n?{matched:!0,value:t(this.input,this.input)}:Oa)}otherwise(e){return this.state.matched?this.state.value:e(this.input)}exhaustive(e=FC){return this.state.matched?this.state.value:e(this.input)}run(){return this.exhaustive()}returnType(){return this}};function FC(A){throw new TC(A)}const kC=/\{[^{}]+\}/g;function IC(){return Math.random().toString(36).slice(2,11)}function _C(A){let{baseUrl:e="",Request:t=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:i,bodySerializer:r,headers:s,...o}={...A};e=Th(e);const a=[];async function c(l,u){const{baseUrl:d,fetch:h=n,Request:f=t,headers:g,params:p={},parseAs:B="json",querySerializer:y,bodySerializer:b=r??RC,body:v,...C}=u||{};d&&(e=Th(d));let w=typeof i=="function"?i:Uh(i);y&&(w=typeof y=="function"?y:Uh({...typeof i=="object"?i:{},...y}));const S=v===void 0?void 0:b(v),F=S===void 0||S instanceof FormData?{}:{"Content-Type":"application/json"},_={redirect:"follow",...o,...C,body:S,headers:LC(F,s,g,p.header)};let D,H,M=new t(PC(l,{baseUrl:e,params:p,querySerializer:w}),_);for(const G in C)G in M||(M[G]=C[G]);if(a.length){D=IC(),H=Object.freeze({baseUrl:e,fetch:h,parseAs:B,querySerializer:w,bodySerializer:b});for(const G of a)if(G&&typeof G=="object"&&typeof G.onRequest=="function"){const q=await G.onRequest({request:M,schemaPath:l,params:p,options:H,id:D});if(q){if(!(q instanceof t))throw new Error("onRequest: must return new Request() when modifying the request");M=q}}}let K=await h(M);if(a.length)for(let G=a.length-1;G>=0;G--){const q=a[G];if(q&&typeof q=="object"&&typeof q.onResponse=="function"){const tt=await q.onResponse({request:M,response:K,schemaPath:l,params:p,options:H,id:D});if(tt){if(!(tt instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");K=tt}}}if(K.status===204||K.headers.get("Content-Length")==="0")return K.ok?{data:{},response:K}:{error:{},response:K};if(K.ok)return B==="stream"?{data:K.body,response:K}:{data:await K[B](),response:K};let Le=await K.text();try{Le=JSON.parse(Le)}catch{}return{error:Le,response:K}}return{GET(l,u){return c(l,{...u,method:"GET"})},PUT(l,u){return c(l,{...u,method:"PUT"})},POST(l,u){return c(l,{...u,method:"POST"})},DELETE(l,u){return c(l,{...u,method:"DELETE"})},OPTIONS(l,u){return c(l,{...u,method:"OPTIONS"})},HEAD(l,u){return c(l,{...u,method:"HEAD"})},PATCH(l,u){return c(l,{...u,method:"PATCH"})},TRACE(l,u){return c(l,{...u,method:"TRACE"})},use(...l){for(const u of l)if(u){if(typeof u!="object"||!("onRequest"in u||"onResponse"in u))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");a.push(u)}},eject(...l){for(const u of l){const d=a.indexOf(u);d!==-1&&a.splice(d,1)}}}}function Dr(A,e,t){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${A}=${t?.allowReserved===!0?e:encodeURIComponent(e)}`}function Eh(A,e,t){if(!e||typeof e!="object")return"";const n=[],i={simple:",",label:".",matrix:";"}[t.style]||"&";if(t.style!=="deepObject"&&t.explode===!1){for(const o in e)n.push(o,t.allowReserved===!0?e[o]:encodeURIComponent(e[o]));const s=n.join(",");switch(t.style){case"form":return`${A}=${s}`;case"label":return`.${s}`;case"matrix":return`;${A}=${s}`;default:return s}}for(const s in e){const o=t.style==="deepObject"?`${A}[${s}]`:s;n.push(Dr(o,e[s],t))}const r=n.join(i);return t.style==="label"||t.style==="matrix"?`${i}${r}`:r}function Sh(A,e,t){if(!Array.isArray(e))return"";if(t.explode===!1){const r={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[t.style]||",",s=(t.allowReserved===!0?e:e.map(o=>encodeURIComponent(o))).join(r);switch(t.style){case"simple":return s;case"label":return`.${s}`;case"matrix":return`;${A}=${s}`;default:return`${A}=${s}`}}const n={simple:",",label:".",matrix:";"}[t.style]||"&",i=[];for(const r of e)t.style==="simple"||t.style==="label"?i.push(t.allowReserved===!0?r:encodeURIComponent(r)):i.push(Dr(A,r,t));return t.style==="label"||t.style==="matrix"?`${n}${i.join(n)}`:i.join(n)}function Uh(A){return function(t){const n=[];if(t&&typeof t=="object")for(const i in t){const r=t[i];if(r!=null){if(Array.isArray(r)){if(r.length===0)continue;n.push(Sh(i,r,{style:"form",explode:!0,...A?.array,allowReserved:A?.allowReserved||!1}));continue}if(typeof r=="object"){n.push(Eh(i,r,{style:"deepObject",explode:!0,...A?.object,allowReserved:A?.allowReserved||!1}));continue}n.push(Dr(i,r,A))}}return n.join("&")}}function xC(A,e){let t=A;for(const n of A.match(kC)??[]){let i=n.substring(1,n.length-1),r=!1,s="simple";if(i.endsWith("*")&&(r=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(s="label",i=i.substring(1)):i.startsWith(";")&&(s="matrix",i=i.substring(1)),!e||e[i]===void 0||e[i]===null)continue;const o=e[i];if(Array.isArray(o)){t=t.replace(n,Sh(i,o,{style:s,explode:r}));continue}if(typeof o=="object"){t=t.replace(n,Eh(i,o,{style:s,explode:r}));continue}if(s==="matrix"){t=t.replace(n,`;${Dr(i,o)}`);continue}t=t.replace(n,s==="label"?`.${encodeURIComponent(o)}`:encodeURIComponent(o))}return t}function RC(A){return A instanceof FormData?A:JSON.stringify(A)}function PC(A,e){let t=`${e.baseUrl}${A}`;e.params?.path&&(t=xC(t,e.params.path));let n=e.querySerializer(e.params.query??{});return n.startsWith("?")&&(n=n.substring(1)),n&&(t+=`?${n}`),t}function LC(...A){const e=new Headers;for(const t of A){if(!t||typeof t!="object")continue;const n=t instanceof Headers?t.entries():Object.entries(t);for(const[i,r]of n)if(r===null)e.delete(i);else if(Array.isArray(r))for(const s of r)e.append(i,s);else r!==void 0&&e.set(i,r)}return e}function Th(A){return A.endsWith("/")?A.substring(0,A.length-1):A}class Qh{constructor(e){this.client=_C({baseUrl:e.baseUrl,headers:e.headers,fetch:e.fetch})}setAuthToken(e){this.client.use({onRequest({request:t}){return t.headers.set("Authorization",`Bearer ${e}`),t}})}setApiToken(e){this.client.use({onRequest({request:t}){return t.headers.set("Authorization",`Token ${e}`),t}})}async getAuthUrl(e){return await this.client.GET("/auth/{type}",{params:{path:{type:e}}})}async getConnectUrl(e){return await this.client.GET("/connect/{type}",{params:{path:{type:e}}})}async logout(){return await this.client.POST("/logout")}async getCurrentUser(){return await this.client.GET("/me")}async createPresignedUploadUrl(e){return await this.client.POST("/files",{body:e})}async createKnowledgeBlock(e){return await this.client.POST("/knowledge",{body:e})}async listOnboardees(){return await this.client.GET("/onboardees")}async getOnboardee(e){return await this.client.GET("/onboardees/{id}",{params:{path:{id:e}}})}async getOnboardeeWhitelistedDomains(e){return await this.client.GET("/onboardees/{id}/whitelisted-domains",{params:{path:{id:e}}})}async getOnboardeeWidgetConfig(e,t){return await this.client.GET("/onboardees/{id}/config",{params:{path:{id:e}},signal:t})}async listPlans(){return await this.client.GET("/plans")}async listProducts(){return await this.client.GET("/products")}async createProduct(e){return await this.client.POST("/products",{body:e})}async updateProduct(e,t){return await this.client.PATCH("/products/{id}",{params:{path:{id:e}},body:t})}async createPlan(e){return await this.client.POST("/plans",{body:e})}async getPlan(e){return await this.client.GET("/plans/{id}",{params:{path:{id:e}}})}async replacePlan(e,t){return await this.client.PUT("/plans/{id}",{params:{path:{id:e}},body:t})}async updatePlan(e,t){return await this.client.PATCH("/plans/{id}",{params:{path:{id:e}},body:t})}async getPlanVideoUrl(e){return await this.client.GET("/plans/{id}/video-url",{params:{path:{id:e}}})}async deletePlan(e){return await this.client.DELETE("/admin/plans/{id}",{params:{path:{id:e}}})}async publishPlanRevision(e,t){return await this.client.POST("/plans/{id}/publish",{params:{path:{id:e}},body:t})}async listPlanRevisions(e){return await this.client.GET("/plans/{id}/revisions",{params:{path:{id:e}}})}async getRevisionNavigationIndex(e){return await this.client.GET("/revisions/{id}/navigation-index",{params:{path:{id:e}}})}async replaceRevisionNavigationIndex(e,t){return await this.client.PUT("/revisions/{id}/navigation-index",{params:{path:{id:e}},body:t})}async getRevisionFAQ(e){return await this.client.GET("/revisions/{id}/faq",{params:{path:{id:e}}})}async replaceRevisionFAQ(e,t){return await this.client.PUT("/revisions/{id}/faq",{params:{path:{id:e}},body:t})}async listRevisionKnowledgeBlocks(e){return await this.client.GET("/revisions/{id}/knowledge-blocks",{params:{path:{id:e}}})}async replaceRevisionKnowledgeBlocks(e,t){return await this.client.PUT("/revisions/{id}/knowledge-blocks",{params:{path:{id:e}},body:t})}async createRevisionKnowledgeBlock(e,t){return await this.client.POST("/revisions/{id}/knowledge-blocks",{params:{path:{id:e}},body:t})}async updateRevisionKnowledgeBlock(e,t,n){return await this.client.PUT("/revisions/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:t}},body:n})}async deleteRevisionKnowledgeBlock(e,t){return await this.client.DELETE("/revisions/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:t}}})}async listSessions(e){return await this.client.GET("/sessions",{params:{query:e?{token:e}:{}}})}async createSession(e){return await this.client.POST("/sessions",{body:e})}async getSession(e){return await this.client.GET("/sessions/{id}",{params:{path:{id:e}}})}async startSession(e,t){return await this.client.GET("/sessions/{id}/start-session",{params:{path:{id:e},query:t?{token:t}:{}}})}async getSessionRecording(e){return await this.client.GET("/sessions/{id}/recording",{params:{path:{id:e}}})}async getSessionProductUrl(e){return await this.client.GET("/sessions/{id}/product-url",{params:{path:{id:e}}})}async getJoinToken(e,{skipIntro:t,user:n}={}){return await this.client.GET("/join-token",{params:{query:{token:e,...t&&{skip_intro:"true"},...n&&{user:encodeURIComponent(n)}}}})}getClient(){return this.client}}const DC="https://app.coragents.ai/api";var O;(function(A){A.READY="ready",A.ERROR="error",A.PAUSED="paused",A.LOADING="loading",A.THINKING="thinking",A.RESEARCHING="researching",A.AGENT_SPEAKING="agent_speaking",A.USER_SPEAKING="user_speaking",A.AWAITING_USER_INPUT="awaiting_user_input"})(O||(O={}));class OC{constructor({sessionId:e,apiBaseUrl:t}){this.currentState=O.READY,this.livekitState="speaking",this.assistantAudioContext=null,this.userAudioContext=null,this._assistantAudioTimer=null,this._userAudioTimer=null,this.sessionId=e,this.apiBaseUrl=t||DC,this.client=new Qh({baseUrl:this.apiBaseUrl}),this.emitter=new Pm}emit(e,t){this.emitter.emit(e,t)}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}setupRoomEventListeners(){this.room&&(this.room.on(Q.LocalTrackUnpublished,e=>{e.source===U.Source.ScreenShare&&(this.screenStream=void 0)}),this.room.on(Q.Disconnected,()=>{this.disconnect()}),this.room.on(Q.ParticipantDisconnected,()=>{this.disconnect()}),this.room.on(Q.TrackSubscribed,(e,t,n)=>{if(e.kind==="audio"&&e.attach(),e.source===U.Source.Microphone&&n.identity.includes("agent-")){const i=e.mediaStream;if(!i){console.error("No media stream available for assistant track");return}const r=new AudioContext,s=r.createAnalyser();r.createMediaStreamSource(i).connect(s),s.fftSize=2048;const a=new Uint8Array(s.frequencyBinCount);this.analyzeAudio(s,a,"ASSISTANT"),this.assistantAudioContext=r}}),this.room.on(Q.ParticipantAttributesChanged,e=>{if(!e["lk.agent.state"]||this.currentState===O.RESEARCHING||this.currentState===O.PAUSED)return;const t=e["lk.agent.state"],n=hi(t).with("listening",()=>O.USER_SPEAKING).with("speaking",()=>O.AGENT_SPEAKING).with("thinking",()=>O.THINKING).otherwise(()=>{});n&&(this.setState(n),this.livekitState=t)}),this.room.on(Q.DataReceived,async e=>{try{const t=JSON.parse(new TextDecoder().decode(e)),n=t.status||t.request;hi(n).with("using_tool",()=>{this.currentState=O.RESEARCHING,this.emitter.emit("stateChanged",O.RESEARCHING)}).with("using_tool_ended",()=>{this.currentState=O.AGENT_SPEAKING,this.emitter.emit("stateChanged",O.AGENT_SPEAKING)}).with("share_screen",()=>{this.shareScreen()}).with("prompt_user",()=>{this.promptContinue()}).with("capture_page_html",()=>{this.emitter.emit("capturePageHTML")}).with("fill",()=>{this.emitter.emit("fill",t.value)}).otherwise(()=>{console.warn("Unknown data received:",t)})}catch(t){console.error("Error parsing data:",t)}}),this.room.localParticipant.registerRpcMethod("screen_capture",async e=>(this.emitter.emit("screenCaptureRequested"),new Promise(t=>{this.emitter.once("screenCaptureComplete",async n=>{if(n==="error"){t("error");return}try{await this.room.localParticipant.sendFile(new File([n],"screen_capture.png",{type:"image/png"}),{mimeType:"image/png",topic:"screen_capture"}),t("ok")}catch{t("error")}})}))))}async connect(){if(!this.sessionId){console.error("No session ID found"),this.emitter.emit("error",new Error("No session ID provided"));return}try{await this.requestMicrophone(),this.room=new $A({adaptiveStream:!0,dynacast:!0}),this.setupRoomEventListeners();const e=await this.client.getJoinToken(this.sessionId,{skipIntro:!0});if(await this.room.connect(e.data.url,e.data.token),this.microphoneStream){const t=this.microphoneStream.getAudioTracks()[0];await this.room.localParticipant.publishTrack(t,{name:"microphone",source:U.Source.Microphone})}return{url:e.data.url,token:e.data.token}}catch(e){throw console.error("Failed to connect to LiveKit:",e),this.disconnect(),this.emitter.emit("error",e instanceof Error?e:new Error(String(e))),e}}async disconnect(){this.room&&(this.room.disconnect(!0),this.room.removeAllListeners(),this.room=void 0),this.screenStream?.track&&this.screenStream.track.stop(),this.microphoneStream&&this.microphoneStream.getTracks().forEach(e=>e.stop()),this._userAudioTimer&&(window.clearTimeout(this._userAudioTimer),this._userAudioTimer=null),this._assistantAudioTimer&&(window.clearTimeout(this._assistantAudioTimer),this._assistantAudioTimer=null),await this.userAudioContext?.close().catch(()=>{}),this.userAudioContext=null,await this.assistantAudioContext?.close().catch(()=>{}),this.assistantAudioContext=null,this.setState(O.READY),this.emitter.emit("disconnected")}setState(e){e!==this.currentState&&(this.currentState=e,this.emitter.emit("stateChanged",e))}getCurrentState(){return this.currentState}async requestMicrophone(){try{const e=await navigator.mediaDevices.getUserMedia({audio:!0});this.microphoneStream=e;const t=new AudioContext;this.userAudioContext=t;const n=t.createAnalyser(),i=t.createMediaStreamSource(e),r=t.createGain();r.gain.value=1.5,i.connect(r),r.connect(n),n.fftSize=2048;const s=new Uint8Array(n.frequencyBinCount);this.analyzeAudio(n,s,"USER")}catch(e){throw console.error("Microphone permission denied:",e),new Error("Microphone permission denied")}}async shareScreen(){if(!this.room){console.warn("[obi] shareScreen called while not connected");return}this.emitter.emit("preScreenShare");try{if(this.screenStream=await this.room.localParticipant.setScreenShareEnabled(!0,{video:{displaySurface:"window"}}),!this.screenStream){console.warn("Failed to share screen");return}await this.room.localParticipant.publishData(new TextEncoder().encode(JSON.stringify({request:"share_screen",success:!0})),{reliable:!0})}catch(e){console.error("Error sharing screen:",e),this.emitter.emit("error",e instanceof Error?e:new Error(String(e)))}}pauseRecording(){this.room&&(this.setState(O.PAUSED),this.room.localParticipant.getTrackPublications().forEach(e=>{e.handleMuted(),e.track?.mediaStream?.getTracks().forEach(t=>t.enabled=!1)}),this.microphoneStream?.getTracks().forEach(e=>e.enabled=!1),this.screenStream?.track?.mute())}resumeRecording(){if(!this.room)return;const e=hi(this.livekitState).with("listening",()=>O.USER_SPEAKING).with("speaking",()=>O.AGENT_SPEAKING).otherwise(()=>O.THINKING);this.setState(e),this.room.localParticipant.getTrackPublications().forEach(t=>{t.handleUnmuted(),t.track?.mediaStream?.getTracks().forEach(n=>n.enabled=!0)}),this.microphoneStream?.getTracks().forEach(t=>t.enabled=!0),this.screenStream?.track?.unmute()}async promptContinue(){await this.room.localParticipant.publishData(new TextEncoder().encode(JSON.stringify({request:"prompt_user",success:!0})),{reliable:!0})}async analyzeAudio(e,t,n){if(n==="USER"&&this.currentState===O.USER_SPEAKING||n==="ASSISTANT"&&this.currentState===O.AGENT_SPEAKING){e.getByteFrequencyData(t);const i=t.reduce((o,a)=>o+a,0)/t.length,r=Math.max(.01,Math.min(1,i/128));let s;n==="USER"&&this.currentState===O.USER_SPEAKING?s="USER":n==="ASSISTANT"&&this.currentState===O.AGENT_SPEAKING&&(s="ASSISTANT"),s&&this.emitter.emit("volume",{speaker:s,spectrum:Array.from(t),volume:r})}n==="USER"?this._userAudioTimer=window.setTimeout(()=>this.analyzeAudio(e,t,n),200):this._assistantAudioTimer=window.setTimeout(()=>this.analyzeAudio(e,t,n),200)}async sendHTML(e){if(!this.room){console.log("Cannot send HTML: Not connected to room");return}try{const t={type:"page_content",html:e,timestamp:new Date().toISOString()},n=JSON.stringify(t),r=new TextEncoder().encode(n);await this.room.localParticipant.publishData(r,{reliable:!0})}catch(t){console.error("Error sending HTML to LiveKit:",t),this.emitter.emit("error",t instanceof Error?t:new Error(String(t)))}}async reconnect(e,t,n){try{if(!e||!t)return console.error("Missing room URL or token for reconnection"),this.emitter.emit("error",new Error("Missing room URL or token for reconnection")),!1;if(await this.requestMicrophone(),this.room=new $A({adaptiveStream:!0,dynacast:!0}),this.setupRoomEventListeners(),await this.room.connect(e,t),this.microphoneStream){const i=this.microphoneStream.getAudioTracks()[0];await this.room.localParticipant.publishTrack(i,{name:"microphone",source:U.Source.Microphone})}return this.setState(n),n===O.PAUSED&&this.pauseRecording(),!0}catch(i){return console.error("Failed to reconnect to room:",i),this.disconnect(),this.emitter.emit("error",i instanceof Error?i:new Error(String(i))),!1}}}/**
42
+ `},Ca}var Zd;function wv(){if(Zd)return yt;Zd=1;var A=vv(),e=Cv(),t=va();return yt.grammar=t,yt.write=e,yt.parse=A.parse,yt.parseParams=A.parseParams,yt.parseFmtpConfig=A.parseFmtpConfig,yt.parsePayloads=A.parsePayloads,yt.parseRemoteCandidates=A.parseRemoteCandidates,yt.parseImageAttributes=A.parseImageAttributes,yt.parseSimulcastStreamList=A.parseSimulcastStreamList,yt}var hA=wv();function wa(A,e,t){var n,i,r;e===void 0&&(e=50),t===void 0&&(t={});var s=(n=t.isImmediate)!=null&&n,o=(i=t.callback)!=null&&i,a=t.maxWait,c=Date.now(),l=[];function u(){if(a!==void 0){var h=Date.now()-c;if(h+e>=a)return a-h}return e}var d=function(){var h=[].slice.call(arguments),f=this;return new Promise(function(g,p){var B=s&&r===void 0;if(r!==void 0&&clearTimeout(r),r=setTimeout(function(){if(r=void 0,c=Date.now(),!s){var b=A.apply(f,h);o&&o(b),l.forEach(function(v){return(0,v.resolve)(b)}),l=[]}},u()),B){var y=A.apply(f,h);return o&&o(y),g(y)}l.push({resolve:g,reject:p})})};return d.cancel=function(h){r!==void 0&&clearTimeout(r),l.forEach(function(f){return(0,f.reject)(h)}),l=[]},d}const yv=.7,bv=20,Un={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class eh extends xt.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;super(),this.log=j,this.ddExtID=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=wa(i=>m(this,void 0,void 0,function*(){this.emit(Un.NegotiationStarted);try{yield this.createAndSendOffer()}catch(r){if(i)i(r);else throw r}}),bv),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=jt((n=t.loggerName)!==null&&n!==void 0?n:Ct.PCTransport),this.loggerOptions=t,this.config=e,this._pc=this.createPC()}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=t=>{var n;t.candidate&&((n=this.onIceCandidate)===null||n===void 0||n.call(this,t.candidate))},e.onicecandidateerror=t=>{var n;(n=this.onIceCandidateError)===null||n===void 0||n.call(this,t)},e.oniceconnectionstatechange=()=>{var t;(t=this.onIceConnectionStateChange)===null||t===void 0||t.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var t;(t=this.onSignalingStatechange)===null||t===void 0||t.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var t;(t=this.onConnectionStateChange)===null||t===void 0||t.call(this,e.connectionState)},e.ondatachannel=t=>{var n;(n=this.onDataChannel)===null||n===void 0||n.call(this,t)},e.ontrack=t=>{var n;(n=this.onTrack)===null||n===void 0||n.call(this,t)},e}get logContext(){var e,t;return Object.assign({},(t=(e=this.loggerOptions).loggerContextCb)===null||t===void 0?void 0:t.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return m(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e){return m(this,void 0,void 0,function*(){var t;let n;if(e.type==="offer"){let{stereoMids:i,nackMids:r}=Ev(e);this.remoteStereoMids=i,this.remoteNackMids=r}else if(e.type==="answer"){const i=hA.parse((t=e.sdp)!==null&&t!==void 0?t:"");i.media.forEach(r=>{r.type==="audio"&&this.trackBitrates.some(s=>{if(!s.transceiver||r.mid!=s.transceiver.mid)return!1;let o=0;if(r.rtp.some(c=>c.codec.toUpperCase()===s.codec.toUpperCase()?(o=c.payload,!0):!1),o===0)return!0;let a=!1;for(const c of r.fmtp)if(c.payload===o){c.config=c.config.split(";").filter(l=>!l.includes("maxaveragebitrate")).join(";"),s.maxbr>0&&(c.config+=";maxaveragebitrate=".concat(s.maxbr*1e3)),a=!0;break}return a||s.maxbr>0&&r.fmtp.push({payload:o,config:"maxaveragebitrate=".concat(s.maxbr*1e3)}),!0})}),n=hA.write(i)}yield this.setMungedSDP(e,n,!0),this.pendingCandidates.forEach(i=>{this.pc.addIceCandidate(i)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(Un.NegotiationComplete),e.sdp&&hA.parse(e.sdp).media.forEach(r=>{r.type==="video"&&this.emit(Un.RTPVideoPayloadTypes,r.rtp)}))})}createAndSendOffer(e){return m(this,void 0,void 0,function*(){var t;if(this.onOffer===void 0)return;if(e?.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const r=this._pc.remoteDescription;if(e?.iceRestart&&r)yield this._pc.setRemoteDescription(r);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const n=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:n.sdp},this.logContext));const i=hA.parse((t=n.sdp)!==null&&t!==void 0?t:"");i.media.forEach(r=>{Ah(r),r.type==="audio"?th(r,[],[]):r.type==="video"&&this.trackBitrates.some(s=>{if(!r.msid||!s.cid||!r.msid.includes(s.cid))return!1;let o=0;if(r.rtp.some(c=>c.codec.toUpperCase()===s.codec.toUpperCase()?(o=c.payload,!0):!1),o===0||(oi(s.codec)&&this.ensureVideoDDExtensionForSVC(r,i),s.codec!=="av1"))return!0;const a=Math.round(s.maxbr*yv);for(const c of r.fmtp)if(c.payload===o){c.config.includes("x-google-start-bitrate")||(c.config+=";x-google-start-bitrate=".concat(a));break}return!0})}),yield this.setMungedSDP(n,hA.write(i)),this.onOffer(n)})}createAndSetAnswer(){return m(this,void 0,void 0,function*(){var e;const t=yield this.pc.createAnswer(),n=hA.parse((e=t.sdp)!==null&&e!==void 0?e:"");return n.media.forEach(i=>{Ah(i),i.type==="audio"&&th(i,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(t,hA.write(n)),t})}createDataChannel(e,t){return this.pc.createDataChannel(e,t)}addTransceiver(e,t){return this.pc.addTransceiver(e,t)}addTrack(e){if(!this._pc)throw new Ee("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var t;if(!this._pc)throw new Ee("PC closed, cannot configure");return(t=this._pc)===null||t===void 0?void 0:t.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var t;return(t=this._pc)===null||t===void 0?void 0:t.removeTrack(e)}getConnectionState(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&t!==void 0?t:"closed"}getICEConnectionState(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&t!==void 0?t:"closed"}getSignallingState(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&t!==void 0?t:"closed"}getTransceivers(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&t!==void 0?t:[]}getSenders(){var e,t;return(t=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&t!==void 0?t:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return m(this,void 0,void 0,function*(){var e;if(!this._pc)return;let t="";const n=new Map,i=new Map;if((yield this._pc.getStats()).forEach(o=>{switch(o.type){case"transport":t=o.selectedCandidatePairId;break;case"candidate-pair":t===""&&o.selected&&(t=o.id),n.set(o.id,o);break;case"remote-candidate":i.set(o.id,"".concat(o.address,":").concat(o.port));break}}),t==="")return;const s=(e=n.get(t))===null||e===void 0?void 0:e.remoteCandidateId;if(s!==void 0)return i.get(s)})}setMungedSDP(e,t,n){return m(this,void 0,void 0,function*(){if(t){const i=e.sdp;e.sdp=t;try{this.log.debug("setting munged ".concat(n?"remote":"local"," description"),this.logContext),n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(r){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:r,sdp:t})),e.sdp=i}}try{n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(i){let r="unknown error";i instanceof Error?r=i.message:typeof i=="string"&&(r=i);const s={error:r,sdp:e.sdp};throw!n&&this.pc.remoteDescription&&(s.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:s})),new Xo(r)}})}ensureVideoDDExtensionForSVC(e,t){var n,i;if(!((n=e.ext)===null||n===void 0?void 0:n.some(s=>s.uri===Rd))){if(this.ddExtID===0){let s=0;t.media.forEach(o=>{var a;o.type==="video"&&((a=o.ext)===null||a===void 0||a.forEach(c=>{c.value>s&&(s=c.value)}))}),this.ddExtID=s+1}(i=e.ext)===null||i===void 0||i.push({value:this.ddExtID,uri:Rd})}}}function th(A,e,t){let n=0;A.rtp.some(i=>i.codec==="opus"?(n=i.payload,!0):!1),n>0&&(A.rtcpFb||(A.rtcpFb=[]),t.includes(A.mid)&&!A.rtcpFb.some(i=>i.payload===n&&i.type==="nack")&&A.rtcpFb.push({payload:n,type:"nack"}),e.includes(A.mid)&&A.fmtp.some(i=>i.payload===n?(i.config.includes("stereo=1")||(i.config+=";stereo=1"),!0):!1))}function Ev(A){var e;const t=[],n=[],i=hA.parse((e=A.sdp)!==null&&e!==void 0?e:"");let r=0;return i.media.forEach(s=>{var o;s.type==="audio"&&(s.rtp.some(a=>a.codec==="opus"?(r=a.payload,!0):!1),!((o=s.rtcpFb)===null||o===void 0)&&o.some(a=>a.payload===r&&a.type==="nack")&&n.push(s.mid),s.fmtp.some(a=>a.payload===r?(a.config.includes("sprop-stereo=1")&&t.push(s.mid),!0):!1))}),{stereoMids:t,nackMids:n}}function Ah(A){if(A.connection){const e=A.connection.ip.indexOf(":")>=0;(A.connection.version===4&&e||A.connection.version===6&&!e)&&(A.connection.ip="0.0.0.0",A.connection.version=4)}}const ya="vp8",Sv={audioPreset:Zo.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:ta.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:ya,backupCodec:!0},nh={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},ih={deviceId:{ideal:"default"},resolution:si.h720.resolution},Uv={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new p0,disconnectOnPageLeave:!0,webAudioMix:!1},ba={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var fe;(function(A){A[A.NEW=0]="NEW",A[A.CONNECTING=1]="CONNECTING",A[A.CONNECTED=2]="CONNECTED",A[A.FAILED=3]="FAILED",A[A.CLOSING=4]="CLOSING",A[A.CLOSED=5]="CLOSED"})(fe||(fe={}));class Tv{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,t,n){var i;this.peerConnectionTimeout=ba.peerConnectionTimeout,this.log=j,this.updateState=()=>{var r;const s=this.state,o=this.requiredTransports.map(a=>a.getConnectionState());o.every(a=>a==="connected")?this.state=fe.CONNECTED:o.some(a=>a==="failed")?this.state=fe.FAILED:o.some(a=>a==="connecting")?this.state=fe.CONNECTING:o.every(a=>a==="closed")?this.state=fe.CLOSED:o.some(a=>a==="closed")?this.state=fe.CLOSING:o.every(a=>a==="new")&&(this.state=fe.NEW),s!==this.state&&(this.log.debug("pc state change: from ".concat(fe[s]," to ").concat(fe[this.state]),this.logContext),(r=this.onStateChange)===null||r===void 0||r.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=jt((i=n.loggerName)!==null&&i!==void 0?i:Ct.PCManager),this.loggerOptions=n,this.isPublisherConnectionRequired=!t,this.isSubscriberConnectionRequired=t,this.publisher=new eh(e,n),this.subscriber=new eh(e,n),this.publisher.onConnectionStateChange=this.updateState,this.subscriber.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=r=>{var s;(s=this.onIceCandidate)===null||s===void 0||s.call(this,r,vt.PUBLISHER)},this.subscriber.onIceCandidate=r=>{var s;(s=this.onIceCandidate)===null||s===void 0||s.call(this,r,vt.SUBSCRIBER)},this.subscriber.onDataChannel=r=>{var s;(s=this.onDataChannel)===null||s===void 0||s.call(this,r)},this.subscriber.onTrack=r=>{var s;(s=this.onTrack)===null||s===void 0||s.call(this,r)},this.publisher.onOffer=r=>{var s;(s=this.onPublisherOffer)===null||s===void 0||s.call(this,r)},this.state=fe.NEW,this.connectionLock=new We,this.remoteOfferLock=new We}get logContext(){var e,t;return Object.assign({},(t=(e=this.loggerOptions).loggerContextCb)===null||t===void 0?void 0:t.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e){return this.publisher.setRemoteDescription(e)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return m(this,void 0,void 0,function*(){if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const e=this.publisher;for(const t of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(t)}catch(n){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:n}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return m(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,t){return m(this,void 0,void 0,function*(){t===vt.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e){return m(this,void 0,void 0,function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const t=yield this.remoteOfferLock.lock();try{return yield this.subscriber.setRemoteDescription(e),yield this.subscriber.createAndSetAnswer()}finally{t()}})}updateConfiguration(e,t){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),t&&this.triggerIceRestart()}ensurePCTransportConnection(e,t){return m(this,void 0,void 0,function*(){var n;const i=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((n=this.requiredTransports)===null||n===void 0?void 0:n.map(r=>this.ensureTransportConnected(r,e,t)))}finally{i()}})}negotiate(e){return m(this,void 0,void 0,function*(){return new Promise((t,n)=>m(this,void 0,void 0,function*(){const i=setTimeout(()=>{n("negotiation timed out")},this.peerConnectionTimeout),r=()=>{clearTimeout(i),n("negotiation aborted")};e.signal.addEventListener("abort",r),this.publisher.once(Un.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(Un.NegotiationComplete,()=>{clearTimeout(i),t()})}),yield this.publisher.negotiate(s=>{clearTimeout(i),n(s)})}))})}addPublisherTransceiver(e,t){return this.publisher.addTransceiver(e,t)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,t){return this.publisher.createDataChannel(e,t)}getConnectedAddress(e){return e===vt.PUBLISHER?this.publisher.getConnectedAddress():e===vt.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&e.push(this.subscriber),e}ensureTransportConnected(e,t){return m(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(n.getConnectionState()!=="connected")return new Promise((a,c)=>m(r,void 0,void 0,function*(){const l=()=>{this.log.warn("abort transport connection",this.logContext),Fe.clearTimeout(u),c(new se("room connection has been cancelled",W.Cancelled))};i?.signal.aborted&&l(),i?.signal.addEventListener("abort",l);const u=Fe.setTimeout(()=>{i?.signal.removeEventListener("abort",l),c(new se("could not establish pc connection",W.InternalError))},s);for(;this.state!==fe.CONNECTED;)if(yield qe(50),i?.signal.aborted){c(new se("room connection has been cancelled",W.Cancelled));return}Fe.clearTimeout(u),i?.signal.removeEventListener("abort",l),a()}))}()})}}class ge extends Error{constructor(e,t,n){super(t),this.code=e,this.message=sh(t,ge.MAX_MESSAGE_BYTES),this.data=n?sh(n,ge.MAX_DATA_BYTES):void 0}static fromProto(e){return new ge(e.code,e.message,e.data)}toProto(){return new wu({code:this.code,message:this.message,data:this.data})}static builtIn(e,t){return new ge(ge.ErrorCode[e],ge.ErrorMessage[e],t)}}ge.MAX_MESSAGE_BYTES=256,ge.MAX_DATA_BYTES=15360,ge.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404},ge.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const rh=15360;function Ea(A){return new TextEncoder().encode(A).length}function sh(A,e){if(Ea(A)<=e)return A;let t=0,n=A.length;const i=new TextEncoder;for(;t<n;){const r=Math.floor((t+n+1)/2);i.encode(A.slice(0,r)).length<=e?t=r:n=r-1}return A.slice(0,t)}const Sa=2e3;function Fr(A,e){if(!e)return 0;let t,n;return"bytesReceived"in A?(t=A.bytesReceived,n=e.bytesReceived):"bytesSent"in A&&(t=A.bytesSent,n=e.bytesSent),t===void 0||n===void 0||A.timestamp===void 0||e.timestamp===void 0?0:(t-n)*8*1e3/(A.timestamp-e.timestamp)}const Qv=1e3;class oh extends U{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}constructor(e,t,n){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=arguments.length>4?arguments[4]:void 0;super(e,t,r),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=wa(()=>m(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>m(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(k.Ended,this)},this.reacquireTrack=!1,this.providedByUser=i,this.muteLock=new We,this.pauseUpstreamLock=new We,this.processorLock=new We,this.restartLock=new We,this.setMediaStreamTrack(e,!0),this._constraints=e.getConstraints(),n&&(this._constraints=n)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==U.Kind.Video)return;const{width:e,height:t}=this._mediaStreamTrack.getSettings();if(e&&t)return{width:e,height:t}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,t;return(t=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&t!==void 0?t:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,t){return m(this,void 0,void 0,function*(){var n;if(e===this._mediaStreamTrack&&!t)return;this._mediaStreamTrack&&(this.attachedElements.forEach(r=>{yn(this._mediaStreamTrack,r)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let i;if(this.processor&&e){const r=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(wn(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),i=this.processor.processedTrack}finally{r()}}this.sender&&((n=this.sender.transport)===null||n===void 0?void 0:n.state)!=="closed"&&(yield this.sender.replaceTrack(i??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(r=>{wn(i??e,r)}))})}waitForDimensions(){return m(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qv;return function*(){var n;if(e.kind===U.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((n=wt())===null||n===void 0?void 0:n.os)==="iOS"&&(yield qe(10));const i=Date.now();for(;Date.now()-i<t;){const r=e.dimensions;if(r)return r;yield qe(50)}throw new $t("unable to get track dimensions after timeout")}()})}setDeviceId(e){return m(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===uA(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),uA(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return m(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===U.Source.ScreenShare)return;const{deviceId:n,groupId:i}=e._mediaStreamTrack.getSettings(),r=e.kind===U.Kind.Audio?"audioinput":"videoinput";return t?Ue.getInstance().normalizeDeviceId(r,n,i):n}()})}mute(){return m(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return m(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,t){return m(this,void 0,void 0,function*(){if(!this.sender)throw new $t("unable to replace an unpublished track");let n,i;return typeof t=="boolean"?n=t:t!==void 0&&(n=t.userProvidedTrack,i=t.stopProcessor),this.providedByUser=n??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),i&&this.processor&&(yield this.stopProcessor()),this})}restart(e){return m(this,void 0,void 0,function*(){this.manuallyStopped=!1;const t=yield this.restartLock.lock();try{e||(e=this._constraints);const{deviceId:n,facingMode:i}=e,r=m0(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const s={audio:!1,video:!1};this.kind===U.Kind.Video?s.video=n||i?{deviceId:n,facingMode:i}:!0:s.audio=n?{deviceId:n}:!0,this.attachedElements.forEach(c=>{yn(this.mediaStreamTrack,c)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const a=(yield navigator.mediaDevices.getUserMedia(s)).getTracks()[0];return yield a.applyConstraints(r),a.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(a),this._constraints=e,this.emit(k.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{t()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?k.Muted:k.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return m(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),Pd()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return m(this,void 0,void 0,function*(){var e;const t=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(k.UpstreamPaused,this);const n=wt();if(n?.name==="Safari"&&GA(n.version,"12.0")<0)throw new Jo("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{t()}})}resumeUpstream(){return m(this,void 0,void 0,function*(){var e;const t=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(k.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{t()}})}getRTCStatsReport(){return m(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var r;const s=yield n.processorLock.lock();try{n.log.debug("setting up processor",n.logContext);const o=document.createElement(n.kind),a={kind:n.kind,track:n._mediaStreamTrack,element:o,audioContext:n.audioContext};if(yield t.init(a),n.log.debug("processor initialized",n.logContext),n.processor&&(yield n.stopProcessor()),n.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(wn(n._mediaStreamTrack,o),o.muted=!0,o.play().catch(c=>n.log.error("failed to play processor element",Object.assign(Object.assign({},n.logContext),{error:c}))),n.processor=t,n.processorElement=o,n.processor.processedTrack){for(const c of n.attachedElements)c!==n.processorElement&&i&&(yn(n._mediaStreamTrack,c),wn(n.processor.processedTrack,c));yield(r=n.sender)===null||r===void 0?void 0:r.replaceTrack(n.processor.processedTrack)}n.emit(k.TrackProcessorUpdate,n.processor)}finally{s()}}()})}getProcessor(){return this.processor}stopProcessor(){return m(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var n,i;e.processor&&(e.log.debug("stopping processor",e.logContext),(n=e.processor.processedTrack)===null||n===void 0||n.stop(),yield e.processor.destroy(),e.processor=void 0,t||((i=e.processorElement)===null||i===void 0||i.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(k.TrackProcessorUpdate))}()})}}class kr extends oh{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;super(e,U.Kind.Audio,t,n,r),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>m(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(o){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:o}));return}s&&this.prevStats&&(this._currentBitrate=Fr(s,this.prevStats)),this.prevStats=s}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(k.AudioTrackFeatureUpdate,this,Bt.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(k.AudioTrackFeatureUpdate,this,Bt.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=i,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return m(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===U.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return m(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const n=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==uA(this._constraints.deviceId);return this.source===U.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||n)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{t()}})}restartTrack(e){return m(this,void 0,void 0,function*(){let t;if(e){const n=fa({audio:e});typeof n.audio!="boolean"&&(t=n.audio)}yield this.restart(t)})}restart(e){const t=Object.create(null,{restart:{get:()=>super.restart}});return m(this,void 0,void 0,function*(){const n=yield t.restart.call(this,e);return this.checkForSilence(),n})}startMonitor(){Ye()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},Sa)))}setProcessor(e){return m(this,void 0,void 0,function*(){var t;const n=yield this.processorLock.lock();try{if(!Rt()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const i={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(i),this.processor=e,this.processor.processedTrack&&(yield(t=this.sender)===null||t===void 0?void 0:t.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(k.TrackProcessorUpdate,this.processor)}finally{n()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return m(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const t=yield this.sender.getStats();let n;return t.forEach(i=>{i.type==="outbound-rtp"&&(n={type:"audio",streamId:i.id,packetsSent:i.packetsSent,packetsLost:i.packetsLost,bytesSent:i.bytesSent,timestamp:i.timestamp,roundTripTime:i.roundTripTime,jitter:i.jitter})}),n})}checkForSilence(){return m(this,void 0,void 0,function*(){const e=yield Gd(this);return e&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(k.AudioSilenceDetected)),e})}}function Fv(A,e,t){switch(A.kind){case"audio":return new kr(A,e,!1,void 0,t);case"video":return new _r(A,e,!1,t);default:throw new $t("unsupported track type: ".concat(A.kind))}}const kv=Object.values(si),Iv=Object.values(ea),_v=Object.values(ta),xv=[si.h180,si.h360],Rv=[ea.h180,ea.h360],Pv=A=>[{scaleResolutionDownBy:2,fps:A.encoding.maxFramerate}].map(t=>{var n,i;return new re(Math.floor(A.width/t.scaleResolutionDownBy),Math.floor(A.height/t.scaleResolutionDownBy),Math.max(15e4,Math.floor(A.encoding.maxBitrate/(Math.pow(t.scaleResolutionDownBy,2)*(((n=A.encoding.maxFramerate)!==null&&n!==void 0?n:30)/((i=t.fps)!==null&&i!==void 0?i:30))))),t.fps,A.encoding.priority)}),Ua=["q","h","f"];function Ta(A,e,t,n){var i,r;let s=n?.videoEncoding;A&&(s=n?.screenShareEncoding);const o=n?.simulcast,a=n?.scalabilityMode,c=n?.videoCodec;if(!s&&!o&&!a||!e||!t)return[{}];s||(s=Dv(A,e,t,c),j.debug("using video encoding",s));const l=s.maxFramerate,u=new re(e,t,s.maxBitrate,s.maxFramerate,s.priority);if(a&&oi(c)){const f=new Ir(a),g=[];if(f.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(a));const p=wt();if(lA()||Rt()||p?.name==="Chrome"&&GA(p?.version,"113")<0){const B=f.suffix=="h"?2:3;for(let y=0;y<f.spatial;y+=1)g.push({rid:Ua[2-y],maxBitrate:s.maxBitrate/Math.pow(B,y),maxFramerate:u.encoding.maxFramerate});g[0].scalabilityMode=a}else g.push({maxBitrate:s.maxBitrate,maxFramerate:u.encoding.maxFramerate,scalabilityMode:a});return u.encoding.priority&&(g[0].priority=u.encoding.priority,g[0].networkPriority=u.encoding.priority),j.debug("using svc encoding",{encodings:g}),g}if(!o)return[s];let d=[];A?d=(i=ch(n?.screenShareSimulcastLayers))!==null&&i!==void 0?i:ah(A,u):d=(r=ch(n?.videoSimulcastLayers))!==null&&r!==void 0?r:ah(A,u);let h;if(d.length>0){const f=d[0];d.length>1&&([,h]=d);const g=Math.max(e,t);if(g>=960&&h)return Qa(e,t,[f,h,u],l);if(g>=480)return Qa(e,t,[f,u],l)}return Qa(e,t,[u])}function Lv(A,e,t){var n,i,r,s;if(!t.backupCodec||t.backupCodec===!0||t.backupCodec.codec===t.videoCodec)return;e!==t.backupCodec.codec&&j.warn("requested a different codec than specified as backup",{serverRequested:e,backup:t.backupCodec.codec}),t.videoCodec=e,t.videoEncoding=t.backupCodec.encoding;const o=A.mediaStreamTrack.getSettings(),a=(n=o.width)!==null&&n!==void 0?n:(i=A.dimensions)===null||i===void 0?void 0:i.width,c=(r=o.height)!==null&&r!==void 0?r:(s=A.dimensions)===null||s===void 0?void 0:s.height;return A.source===U.Source.ScreenShare&&t.simulcast&&(t.simulcast=!1),Ta(A.source===U.Source.ScreenShare,a,c,t)}function Dv(A,e,t,n){const i=Ov(A,e,t);let{encoding:r}=i[0];const s=Math.max(e,t);for(let o=0;o<i.length;o+=1){const a=i[o];if(r=a.encoding,a.width>=s)break}if(n)switch(n){case"av1":r=Object.assign({},r),r.maxBitrate=r.maxBitrate*.7;break;case"vp9":r=Object.assign({},r),r.maxBitrate=r.maxBitrate*.85;break}return r}function Ov(A,e,t){if(A)return _v;const n=e>t?e/t:t/e;return Math.abs(n-16/9)<Math.abs(n-4/3)?kv:Iv}function ah(A,e){if(A)return Pv(e);const{width:t,height:n}=e,i=t>n?t/n:n/t;return Math.abs(i-16/9)<Math.abs(i-4/3)?xv:Rv}function Qa(A,e,t,n){const i=[];if(t.forEach((r,s)=>{if(s>=Ua.length)return;const o=Math.min(A,e),c={rid:Ua[s],scaleResolutionDownBy:Math.max(1,o/Math.min(r.width,r.height)),maxBitrate:r.encoding.maxBitrate},l=n&&r.encoding.maxFramerate?Math.min(n,r.encoding.maxFramerate):r.encoding.maxFramerate;l&&(c.maxFramerate=l);const u=bn()||s===0;r.encoding.priority&&u&&(c.priority=r.encoding.priority,c.networkPriority=r.encoding.priority),i.push(c)}),Rt()&&Dd()==="ios"){let r;i.forEach(o=>{r?o.maxFramerate&&o.maxFramerate>r&&(r=o.maxFramerate):r=o.maxFramerate});let s=!0;i.forEach(o=>{var a;o.maxFramerate!=r&&(s&&(s=!1,j.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),j.info('Setting framerate of encoding "'.concat((a=o.rid)!==null&&a!==void 0?a:"",'" to ').concat(r)),o.maxFramerate=r)})}return i}function ch(A){if(A)return A.sort((e,t)=>{const{encoding:n}=e,{encoding:i}=t;return n.maxBitrate>i.maxBitrate?1:n.maxBitrate<i.maxBitrate?-1:n.maxBitrate===i.maxBitrate&&n.maxFramerate&&i.maxFramerate?n.maxFramerate>i.maxFramerate?1:-1:0})}class Ir{constructor(e){const t=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!t)throw new Error("invalid scalability mode");if(this.spatial=parseInt(t[1]),this.temporal=parseInt(t[2]),t.length>3)switch(t[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=t[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function Hv(A){return A.source===U.Source.ScreenShare||A.constraints.height&&uA(A.constraints.height)>=1080?"maintain-resolution":"balanced"}const Mv=5e3;class _r extends oh{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0;super(e,U.Kind.Video,t,n,i),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>m(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let r;try{r=yield this.getSenderStats()}catch(o){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:o}));return}const s=new Map(r.map(o=>[o.rid,o]));if(this.prevStats){let o=0;s.forEach((a,c)=>{var l;const u=(l=this.prevStats)===null||l===void 0?void 0:l.get(c);o+=Fr(a,u)}),this._currentBitrate=o}this.prevStats=s}),this.senderLock=new We}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var t;if(this.signalClient=e,!Ye())return;const n=(t=this.sender)===null||t===void 0?void 0:t.getParameters();n&&(this.encodings=n.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},Sa))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return m(this,void 0,void 0,function*(){var t,n,i,r,s;yield e.pauseUpstream.call(this);try{for(var o=!0,a=sA(this.simulcastCodecs.values()),c;c=yield a.next(),t=c.done,!t;o=!0)r=c.value,o=!1,yield(s=r.sender)===null||s===void 0?void 0:s.replaceTrack(null)}catch(l){n={error:l}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(n)throw n.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return m(this,void 0,void 0,function*(){var t,n,i,r,s;yield e.resumeUpstream.call(this);try{for(var o=!0,a=sA(this.simulcastCodecs.values()),c;c=yield a.next(),t=c.done,!t;o=!0){r=c.value,o=!1;const l=r;yield(s=l.sender)===null||s===void 0?void 0:s.replaceTrack(l.mediaStreamTrack)}}catch(l){n={error:l}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(n)throw n.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return m(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===U.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return m(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.source===U.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{t()}})}setTrackMuted(e){super.setTrackMuted(e);for(const t of this.simulcastCodecs.values())t.mediaStreamTrack.enabled=!e}getSenderStats(){return m(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const t=[],n=yield this.sender.getStats();return n.forEach(i=>{var r;if(i.type==="outbound-rtp"){const s={type:"video",streamId:i.id,frameHeight:i.frameHeight,frameWidth:i.frameWidth,framesPerSecond:i.framesPerSecond,framesSent:i.framesSent,firCount:i.firCount,pliCount:i.pliCount,nackCount:i.nackCount,packetsSent:i.packetsSent,bytesSent:i.bytesSent,qualityLimitationReason:i.qualityLimitationReason,qualityLimitationDurations:i.qualityLimitationDurations,qualityLimitationResolutionChanges:i.qualityLimitationResolutionChanges,rid:(r=i.rid)!==null&&r!==void 0?r:i.id,retransmittedPacketsSent:i.retransmittedPacketsSent,targetBitrate:i.targetBitrate,timestamp:i.timestamp},o=n.get(i.remoteId);o&&(s.jitter=o.jitter,s.packetsLost=o.packetsLost,s.roundTripTime=o.roundTripTime),t.push(s)}}),t.sort((i,r)=>{var s,o;return((s=r.frameWidth)!==null&&s!==void 0?s:0)-((o=i.frameWidth)!==null&&o!==void 0?o:0)}),t})}setPublishingQuality(e){const t=[];for(let n=at.LOW;n<=at.HIGH;n+=1)t.push(new Lo({quality:n,enabled:n<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(t)}restartTrack(e){return m(this,void 0,void 0,function*(){var t,n,i,r,s;let o;if(e){const u=fa({video:e});typeof u.video!="boolean"&&(o=u.video)}yield this.restart(o);try{for(var a=!0,c=sA(this.simulcastCodecs.values()),l;l=yield c.next(),t=l.done,!t;a=!0){r=l.value,a=!1;const u=r;u.sender&&((s=u.sender.transport)===null||s===void 0?void 0:s.state)!=="closed"&&(u.mediaStreamTrack=this.mediaStreamTrack.clone(),yield u.sender.replaceTrack(u.mediaStreamTrack))}}catch(u){n={error:u}}finally{try{!a&&!t&&(i=c.return)&&(yield i.call(c))}finally{if(n)throw n.error}}})}setProcessor(e){const t=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return m(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s,o,a,c,l,u;if(yield t.setProcessor.call(i,n,r),!((l=i.processor)===null||l===void 0)&&l.processedTrack)try{for(var d=!0,h=sA(i.simulcastCodecs.values()),f;f=yield h.next(),s=f.done,!s;d=!0)c=f.value,d=!1,yield(u=c.sender)===null||u===void 0?void 0:u.replaceTrack(i.processor.processedTrack)}catch(g){o={error:g}}finally{try{!d&&!s&&(a=h.return)&&(yield a.call(h))}finally{if(o)throw o.error}}}()})}setDegradationPreference(e){return m(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const t=this.sender.getParameters();t.degradationPreference=e,this.sender.setParameters(t)}catch(t){this.log.warn("failed to set degradationPreference",Object.assign({error:t},this.logContext))}})}addSimulcastTrack(e,t){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const n={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:t};return this.simulcastCodecs.set(e,n),n}setSimulcastTrackSender(e,t){const n=this.simulcastCodecs.get(e);n&&(n.sender=t,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},Mv))}setPublishingCodecs(e){return m(this,void 0,void 0,function*(){var t,n,i,r,s,o,a;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(e[0].qualities),[];this.subscribedCodecs=e;const c=[];try{for(t=!0,n=sA(e);i=yield n.next(),r=i.done,!r;t=!0){a=i.value,t=!1;const l=a;if(!this.codec||this.codec===l.codec)yield this.setPublishingLayers(l.qualities);else{const u=this.simulcastCodecs.get(l.codec);if(this.log.debug("try setPublishingCodec for ".concat(l.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:u})),!u||!u.sender){for(const d of l.qualities)if(d.enabled){c.push(l.codec);break}}else u.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(l.codec),this.logContext),yield lh(u.sender,u.encodings,l.qualities,this.senderLock,this.log,this.logContext))}}}catch(l){s={error:l}}finally{try{!t&&!r&&(o=n.return)&&(yield o.call(n))}finally{if(s)throw s.error}}return c})}setPublishingLayers(e){return m(this,void 0,void 0,function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:e})),!(!this.sender||!this.encodings)&&(yield lh(this.sender,this.encodings,e,this.senderLock,this.log,this.logContext))})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return m(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),Pd()&&this.isInBackground&&this.source===U.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function lh(A,e,t,n,i,r){return m(this,void 0,void 0,function*(){const s=yield n.lock();i.debug("setPublishingLayersForSender",Object.assign(Object.assign({},r),{sender:A,qualities:t,senderEncodings:e}));try{const o=A.getParameters(),{encodings:a}=o;if(!a)return;if(a.length!==e.length){i.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},r),{encodings:a,senderEncodings:e}));return}let c=!1;const l=wt();if(l?.name==="Chrome"&&GA(l?.version,"133")>0&&a[0].scalabilityMode){const d=a[0],h=new Ir(d.scalabilityMode);let f=gn.OFF;if(t.forEach(g=>{g.enabled&&(f===gn.OFF||g.quality>f)&&(f=g.quality)}),f===gn.OFF)d.active&&(d.active=!1,c=!0);else if(!d.active||h.spatial!==f+1){c=!0,d.active=!0;const g=new Ir(e[0].scalabilityMode);h.spatial=f+1,h.suffix=g.suffix,h.spatial===1&&(h.suffix=void 0),d.scalabilityMode=h.toString(),d.scaleResolutionDownBy=Math.pow(2,2-f),e[0].maxBitrate&&(d.maxBitrate=e[0].maxBitrate/(d.scaleResolutionDownBy*d.scaleResolutionDownBy))}}else a.forEach((d,h)=>{var f;let g=(f=d.rid)!==null&&f!==void 0?f:"";g===""&&(g="q");const p=uh(g),B=t.find(y=>y.quality===p);B&&d.active!==B.enabled&&(c=!0,d.active=B.enabled,i.debug("setting layer ".concat(B.quality," to ").concat(d.active?"enabled":"disabled"),r),bn()&&(B.enabled?(d.scaleResolutionDownBy=e[h].scaleResolutionDownBy,d.maxBitrate=e[h].maxBitrate,d.maxFrameRate=e[h].maxFrameRate):(d.scaleResolutionDownBy=4,d.maxBitrate=10,d.maxFrameRate=2)))});c&&(o.encodings=a,i.debug("setting encodings",Object.assign(Object.assign({},r),{encodings:o.encodings})),yield A.setParameters(o))}finally{s()}})}function uh(A){switch(A){case"f":return at.HIGH;case"h":return at.MEDIUM;case"q":return at.LOW;default:return at.HIGH}}function dh(A,e,t,n){if(!t)return[new NA({quality:at.HIGH,width:A,height:e,bitrate:0,ssrc:0})];if(n){const i=t[0].scalabilityMode,r=new Ir(i),s=[],o=r.suffix=="h"?1.5:2,a=r.suffix=="h"?2:3;for(let c=0;c<r.spatial;c+=1)s.push(new NA({quality:Math.min(at.HIGH,r.spatial-1)-c,width:Math.ceil(A/Math.pow(o,c)),height:Math.ceil(e/Math.pow(o,c)),bitrate:t[0].maxBitrate?Math.ceil(t[0].maxBitrate/Math.pow(a,c)):0,ssrc:0}));return s}return t.map(i=>{var r,s,o;const a=(r=i.scaleResolutionDownBy)!==null&&r!==void 0?r:1;let c=uh((s=i.rid)!==null&&s!==void 0?s:"");return new NA({quality:c,width:Math.ceil(A/a),height:Math.ceil(e/a),bitrate:(o=i.maxBitrate)!==null&&o!==void 0?o:0,ssrc:0})})}const hh="_lossy",fh="_reliable",Nv=2*1e3,Fa="leave-reconnect";var bt;(function(A){A[A.New=0]="New",A[A.Connected=1]="Connected",A[A.Disconnected=2]="Disconnected",A[A.Reconnecting=3]="Reconnecting",A[A.Closed=4]="Closed"})(bt||(bt={}));class Kv extends xt.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var t;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=ba.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.subscriberPrimary=!1,this.pcState=bt.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=j,this.handleDataChannel=n=>m(this,[n],void 0,function(i){var r=this;let{channel:s}=i;return function*(){if(s){if(s.label===fh)r.reliableDCSub=s;else if(s.label===hh)r.lossyDCSub=s;else return;r.log.debug("on data channel ".concat(s.id,", ").concat(s.label),r.logContext),s.onmessage=r.handleDataMessage}}()}),this.handleDataMessage=n=>m(this,void 0,void 0,function*(){var i,r;const s=yield this.dataProcessLock.lock();try{let o;if(n.data instanceof ArrayBuffer)o=n.data;else if(n.data instanceof Blob)o=yield n.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:n.data}));return}const a=Xe.fromBinary(new Uint8Array(o));((i=a.value)===null||i===void 0?void 0:i.case)==="speaker"?this.emit(I.ActiveSpeakersUpdate,a.value.value.speakers):(((r=a.value)===null||r===void 0?void 0:r.case)==="user"&&Gv(a,a.value.value),this.emit(I.DataPacketReceived,a))}finally{s()}}),this.handleDataError=n=>{const r=n.currentTarget.maxRetransmits===0?"lossy":"reliable";if(n instanceof ErrorEvent&&n.error){const{error:s}=n.error;this.log.error("DataChannel error on ".concat(r,": ").concat(n.message),Object.assign(Object.assign({},this.logContext),{error:s}))}else this.log.error("Unknown DataChannel error on ".concat(r),Object.assign(Object.assign({},this.logContext),{event:n}))},this.handleBufferedAmountLow=n=>{const r=n.currentTarget.maxRetransmits===0?Y.LOSSY:Y.RELIABLE;this.updateAndEmitDCBufferStatus(r)},this.handleDisconnect=(n,i)=>{if(this._isClosed)return;this.log.warn("".concat(n," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const r=a=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(a,"ms. giving up"),this.logContext),this.emit(I.Disconnected),this.close()},s=Date.now()-this.reconnectStart;let o=this.getNextRetryDelay({elapsedMs:s,retryCount:this.reconnectAttempts});if(o===null){r(s);return}n===Fa&&(o=0),this.log.debug("reconnecting in ".concat(o,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Fe.setTimeout(()=>this.attemptReconnect(i).finally(()=>this.reconnectTimeout=void 0),o)},this.waitForRestarted=()=>new Promise((n,i)=>{this.pcState===bt.Connected&&n();const r=()=>{this.off(I.Disconnected,s),n()},s=()=>{this.off(I.Restarted,r),i()};this.once(I.Restarted,r),this.once(I.Disconnected,s)}),this.updateAndEmitDCBufferStatus=n=>{const i=this.isBufferStatusLow(n);typeof i<"u"&&i!==this.dcBufferStatus.get(n)&&(this.dcBufferStatus.set(n,i),this.emit(I.DCBufferStatusChanged,i,n))},this.isBufferStatusLow=n=>{const i=this.dataChannelForKind(n);if(i)return i.bufferedAmount<=i.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===ae.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(pn.RR_SIGNAL_DISCONNECTED))},this.log=jt((t=e.loggerName)!==null&&t!==void 0?t:Ct.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new pa(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new We,this.dataProcessLock=new We,this.dcBufferStatus=new Map([[Y.LOSSY,!0],[Y.RELIABLE,!0]]),this.client.onParticipantUpdate=n=>this.emit(I.ParticipantUpdate,n),this.client.onConnectionQuality=n=>this.emit(I.ConnectionQualityUpdate,n),this.client.onRoomUpdate=n=>this.emit(I.RoomUpdate,n),this.client.onSubscriptionError=n=>this.emit(I.SubscriptionError,n),this.client.onSubscriptionPermissionUpdate=n=>this.emit(I.SubscriptionPermissionUpdate,n),this.client.onSpeakersChanged=n=>this.emit(I.SpeakersChanged,n),this.client.onStreamStateUpdate=n=>this.emit(I.StreamStateChanged,n),this.client.onRequestResponse=n=>this.emit(I.SignalRequestResponse,n)}get logContext(){var e,t,n,i,r,s,o,a;return{room:(t=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||t===void 0?void 0:t.name,roomID:(i=(n=this.latestJoinResponse)===null||n===void 0?void 0:n.room)===null||i===void 0?void 0:i.sid,participant:(s=(r=this.latestJoinResponse)===null||r===void 0?void 0:r.participant)===null||s===void 0?void 0:s.identity,pID:(a=(o=this.latestJoinResponse)===null||o===void 0?void 0:o.participant)===null||a===void 0?void 0:a.sid}}join(e,t,n,i){return m(this,void 0,void 0,function*(){this.url=e,this.token=t,this.signalOpts=n,this.maxJoinAttempts=n.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const r=yield this.client.join(e,t,n,i);return this._isClosed=!1,this.latestJoinResponse=r,this.subscriberPrimary=r.subscriberPrimary,this.pcManager||(yield this.configure(r)),(!this.subscriberPrimary||r.fastPublish)&&this.negotiate(),this.clientConfiguration=r.clientConfiguration,setTimeout(()=>{this.emit(I.SignalConnected)},10),r}catch(r){if(r instanceof se&&r.reason===W.ServerUnreachable&&(this.log.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts," of ").concat(this.maxJoinAttempts),this.logContext),this.joinAttempts<this.maxJoinAttempts))return this.join(e,t,n,i);throw r}})}close(){return m(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(I.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return m(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const t=n=>{n&&(n.close(),n.onbufferedamountlow=null,n.onclose=null,n.onclosing=null,n.onerror=null,n.onmessage=null,n.onopen=null)};t(this.lossyDC),t(this.lossyDCSub),t(this.reliableDC),t(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0})}cleanupClient(){return m(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new $t("a track with the same ID has already been published");return new Promise((t,n)=>{const i=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],n(new se("publication of local track timed out, no response from server",W.InternalError))},1e4);this.pendingTrackResolvers[e.cid]={resolve:r=>{clearTimeout(i),t(r)},reject:()=>{clearTimeout(i),n(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:t}=this.pendingTrackResolvers[e.track.id];t&&t(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(t){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:t}))}return!1}updateMuteStatus(e,t){this.client.sendMuteTrack(e,t)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return m(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return m(this,void 0,void 0,function*(){var t,n;if(this.pcManager&&this.pcManager.currentState!==fe.NEW)return;this.participantSid=(t=e.participant)===null||t===void 0?void 0:t.sid;const i=this.makeRTCConfiguration(e);this.pcManager=new Tv(i,e.subscriberPrimary,this.loggerOptions),this.emit(I.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(r,s)=>{this.client.sendIceCandidate(r,s)},this.pcManager.onPublisherOffer=r=>{this.client.sendOffer(r)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(r,s,o)=>m(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(r),this.logContext),["closed","disconnected","failed"].includes(s)&&(this.publisherConnectionPromise=void 0),r===fe.CONNECTED){const l=this.pcState===bt.New;this.pcState=bt.Connected,l&&this.emit(I.Connected,e)}else r===fe.FAILED&&this.pcState===bt.Connected&&(this.pcState=bt.Disconnected,this.handleDisconnect("peerconnection failed",o==="failed"?pn.RR_SUBSCRIBER_FAILED:pn.RR_PUBLISHER_FAILED));const a=this.client.isDisconnected||this.client.currentState===ae.RECONNECTING,c=[fe.FAILED,fe.CLOSING,fe.CLOSED].includes(r);a&&c&&!this._isClosed&&this.emit(I.Offline)}),this.pcManager.onTrack=r=>{this.emit(I.MediaTrackAdded,r.track,r.streams[0],r.receiver)},Vv((n=e.serverInfo)===null||n===void 0?void 0:n.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=e=>m(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type})),yield this.pcManager.setPublisherAnswer(e))}),this.client.onTrickle=(e,t)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:t})),this.pcManager.addIceCandidate(e,t))},this.client.onOffer=e=>m(this,void 0,void 0,function*(){if(!this.pcManager)return;const t=yield this.pcManager.createSubscriberAnswerFromOffer(e);this.client.sendAnswer(t)}),this.client.onLocalTrackPublished=e=>{var t;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(t=e.track)===null||t===void 0?void 0:t.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:n}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],n(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(I.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(I.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,t)=>{this.emit(I.RemoteMute,e,t)},this.client.onSubscribedQualityUpdate=e=>{this.emit(I.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var t;this.participantSid=(t=e.participant)===null||t===void 0?void 0:t.sid,this.emit(I.RoomMoved,e)},this.client.onClose=()=>{this.handleDisconnect("signal",pn.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e?.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case vn.DISCONNECT:this.emit(I.Disconnected,e?.reason),this.close();break;case vn.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Fa);break;case vn.RESUME:this.handleDisconnect(Fa)}}}makeRTCConfiguration(e){var t;const n=Object.assign({},this.rtcConfig);if(!((t=this.signalOpts)===null||t===void 0)&&t.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),n.encodedInsertableStreams=!0),e.iceServers&&!n.iceServers){const i=[];e.iceServers.forEach(r=>{const s={urls:r.urls};r.username&&(s.username=r.username),r.credential&&(s.credential=r.credential),i.push(s)}),n.iceServers=i}return e.clientConfiguration&&e.clientConfiguration.forceRelay===ni.ENABLED&&(n.iceTransportPolicy="relay"),n.sdpSemantics="unified-plan",n.continualGatheringPolicy="gather_continually",n}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(hh,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(fh,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow)}createSender(e,t,n){return m(this,void 0,void 0,function*(){if(Aa())return yield this.createTransceiverRTCRtpSender(e,t,n);if(na())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new Ee("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,t,n,i){return m(this,void 0,void 0,function*(){if(Aa())return this.createSimulcastTransceiverSender(e,t,n,i);if(na())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new Ee("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,t,n){return m(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ee("publisher is closed");const i=[];e.mediaStream&&i.push(e.mediaStream),Sn(e)&&(e.codec=t.videoCodec);const r={direction:"sendonly",streams:i};return n&&(r.sendEncodings=n),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,r)).sender})}createSimulcastTransceiverSender(e,t,n,i){return m(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ee("publisher is closed");const r={direction:"sendonly"};i&&(r.sendEncodings=i);const s=yield this.pcManager.addPublisherTransceiver(t.mediaStreamTrack,r);if(n.videoCodec)return e.setSimulcastTrackSender(n.videoCodec,s.sender),s.sender})}createRTCRtpSender(e){return m(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ee("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return m(this,void 0,void 0,function*(){var t,n,i;if(!this._isClosed){if(this.attemptingReconnect){j.warn("already attempting reconnect, returning early",this.logContext);return}(((t=this.clientConfiguration)===null||t===void 0?void 0:t.resumeConnection)===ni.DISABLED||((i=(n=this.pcManager)===null||n===void 0?void 0:n.currentState)!==null&&i!==void 0?i:fe.NEW)===fe.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(r){this.reconnectAttempts+=1;let s=!0;r instanceof Ee?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:r})),s=!1):r instanceof Tn||(this.fullReconnectOnNext=!0),s?this.handleDisconnect("reconnect",pn.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(I.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(t){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:t}))}return null}restartConnection(e){return m(this,void 0,void 0,function*(){var t,n,i;try{if(!this.url||!this.token)throw new Ee("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(I.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let r;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new Tn;r=yield this.join(e??this.url,this.token,this.signalOpts)}catch(s){throw s instanceof se&&s.reason===W.NotAllowed?new Ee("could not reconnect, token might be expired"):new Tn}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(I.SignalRestarted,r),yield this.waitForPCReconnected(),this.client.currentState!==ae.CONNECTED)throw new Tn("Signal connection got severed during reconnect");(t=this.regionUrlProvider)===null||t===void 0||t.resetAttempts(),this.emit(I.Restarted)}catch(r){const s=yield(n=this.regionUrlProvider)===null||n===void 0?void 0:n.getNextBestRegionUrl();if(s){yield this.restartConnection(s);return}else throw(i=this.regionUrlProvider)===null||i===void 0||i.resetAttempts(),r}})}resumeConnection(e){return m(this,void 0,void 0,function*(){var t;if(!this.url||!this.token)throw new Ee("could not reconnect, url or token not saved");if(!this.pcManager)throw new Ee("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(I.Resuming);let n;try{this.setupSignalClientCallbacks(),n=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(i){let r="";throw i instanceof Error&&(r=i.message,this.log.error(i.message,Object.assign(Object.assign({},this.logContext),{error:i}))),i instanceof se&&i.reason===W.NotAllowed?new Ee("could not reconnect, token might be expired"):i instanceof se&&i.reason===W.LeaveRequest?i:new Tn(r)}if(this.emit(I.SignalResumed),n){const i=this.makeRTCConfiguration(n);this.pcManager.updateConfiguration(i)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==ae.CONNECTED)throw new Tn("Signal connection got severed during reconnect");this.client.setReconnected(),((t=this.reliableDC)===null||t===void 0?void 0:t.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),this.emit(I.Resumed)})}waitForPCInitialConnection(e,t){return m(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ee("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(t,e)})}waitForPCReconnected(){return m(this,void 0,void 0,function*(){this.pcState=bt.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield qe(Nv),!this.pcManager)throw new Ee("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=bt.Connected}catch(e){throw this.pcState=bt.Disconnected,new se("could not establish PC connection, ".concat(e.message),W.InternalError)}})}publishRpcResponse(e,t,n,i){return m(this,void 0,void 0,function*(){const r=new Xe({destinationIdentities:[e],kind:Y.RELIABLE,value:{case:"rpcResponse",value:new Cu({requestId:t,value:i?{case:"error",value:i.toProto()}:{case:"payload",value:n??""}})}});yield this.sendDataPacket(r,Y.RELIABLE)})}publishRpcAck(e,t){return m(this,void 0,void 0,function*(){const n=new Xe({destinationIdentities:[e],kind:Y.RELIABLE,value:{case:"rpcAck",value:new vu({requestId:t})}});yield this.sendDataPacket(n,Y.RELIABLE)})}sendDataPacket(e,t){return m(this,void 0,void 0,function*(){const n=e.toBinary();yield this.ensurePublisherConnected(t);const i=this.dataChannelForKind(t);i&&i.send(n),this.updateAndEmitDCBufferStatus(t)})}waitForBufferStatusLow(e){return new Promise((t,n)=>m(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))t();else{const i=()=>n("Engine closed");for(this.once(I.Closing,i);!this.dcBufferStatus.get(e);)yield qe(10);this.off(I.Closing,i),t()}}))}ensureDataTransportConnected(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var r;if(!n.pcManager)throw new Ee("PC manager is closed");const s=i?n.pcManager.subscriber:n.pcManager.publisher,o=i?"Subscriber":"Publisher";if(!s)throw new se("".concat(o," connection not set"),W.InternalError);let a=!1;!i&&!n.dataChannelForKind(t,i)&&(n.createDataChannels(),a=!0),!a&&!i&&!n.pcManager.publisher.isICEConnected&&n.pcManager.publisher.getICEConnectionState()!=="checking"&&(a=!0),a&&n.negotiate();const c=n.dataChannelForKind(t,i);if(c?.readyState==="open")return;const l=new Date().getTime()+n.peerConnectionTimeout;for(;new Date().getTime()<l;){if(s.isICEConnected&&((r=n.dataChannelForKind(t,i))===null||r===void 0?void 0:r.readyState)==="open")return;yield qe(50)}throw new se("could not establish ".concat(o," connection, state: ").concat(s.getICEConnectionState()),W.InternalError)}()})}ensurePublisherConnected(e){return m(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==fe.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return m(this,void 0,void 0,function*(){return new Promise((e,t)=>m(this,void 0,void 0,function*(){if(!this.pcManager){t(new Xo("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const n=new AbortController,i=()=>{n.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&t("cannot negotiate on closed engine"),this.on(I.Closing,i),this.pcManager.publisher.once(Un.RTPVideoPayloadTypes,r=>{const s=new Map;r.forEach(o=>{const a=o.codec.toLowerCase();z0(a)&&s.set(o.payload,a)}),this.emit(I.RTPVideoMapUpdate,s)});try{yield this.pcManager.negotiate(n),e()}catch(r){r instanceof Xo&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",pn.RR_UNKNOWN),t(r)}finally{this.off(I.Closing,i)}}))})}dataChannelForKind(e,t){if(t){if(e===Y.LOSSY)return this.lossyDCSub;if(e===Y.RELIABLE)return this.reliableDCSub}else{if(e===Y.LOSSY)return this.lossyDC;if(e===Y.RELIABLE)return this.reliableDC}}sendSyncState(e,t){var n,i;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const r=this.pcManager.subscriber.getLocalDescription(),s=this.pcManager.subscriber.getRemoteDescription(),o=(i=(n=this.signalOpts)===null||n===void 0?void 0:n.autoSubscribe)!==null&&i!==void 0?i:!0,a=new Array,c=new Array;e.forEach(l=>{l.isDesired!==o&&a.push(l.trackSid),l.isEnabled||c.push(l.trackSid)}),this.client.sendSyncState(new Ou({answer:r?Qr({sdp:r.sdp,type:r.type}):void 0,offer:s?Qr({sdp:s.sdp,type:s.type}):void 0,subscription:new dr({trackSids:a,subscribe:!o,participantTracks:[]}),publishTracks:ov(t),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:c}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],t=(n,i)=>{n?.id!==void 0&&n.id!==null&&e.push(new Hu({label:n.label,id:n.id,target:i}))};return t(this.dataChannelForKind(Y.LOSSY),vt.PUBLISHER),t(this.dataChannelForKind(Y.RELIABLE),vt.PUBLISHER),t(this.dataChannelForKind(Y.LOSSY,!0),vt.SUBSCRIBER),t(this.dataChannelForKind(Y.RELIABLE,!0),vt.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Fe.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Ye()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){Ye()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class Tn extends Error{}function Vv(A){return A!==void 0&&A>13}function Gv(A,e){const t=A.participantIdentity?A.participantIdentity:e.participantIdentity;A.participantIdentity=t,e.participantIdentity=t;const n=A.destinationIdentities.length!==0?A.destinationIdentities:e.destinationIdentities;A.destinationIdentities=n,e.destinationIdentities=n}class ka{constructor(e,t){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=t}updateToken(e){this.token=e}isCloud(){return ra(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return m(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");(!this.regionSettings||Date.now()-this.lastUpdateAt>this.settingsCacheTime)&&(this.regionSettings=yield this.fetchRegionSettings(e));const t=this.regionSettings.regions.filter(n=>!this.attemptedRegions.find(i=>i.url===n.url));if(t.length>0){const n=t[0];return this.attemptedRegions.push(n),j.debug("next region: ".concat(n.region)),n.url}else return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return m(this,void 0,void 0,function*(){const t=yield fetch("".concat(jv(this.serverUrl),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});if(t.ok){const n=yield t.json();return this.lastUpdateAt=Date.now(),n}else throw new se("Could not fetch region settings: ".concat(t.statusText),t.status===401?W.NotAllowed:W.InternalError,t.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}function jv(A){return"".concat(A.protocol.replace("ws","http"),"//").concat(A.host,"/settings")}class gh{get info(){return this._info}constructor(e,t,n){this.reader=t,this.totalByteSize=n,this._info=e,this.bytesReceived=0}}class $v extends gh{handleChunkReceived(e){var t;this.bytesReceived+=e.content.byteLength;const n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(t=this.onProgress)===null||t===void 0||t.call(this,n)}[Symbol.asyncIterator](){const e=this.reader.getReader();return{next:()=>m(this,void 0,void 0,function*(){try{const{done:t,value:n}=yield e.read();return t?{done:!0,value:void 0}:(this.handleChunkReceived(n),{done:!1,value:n.content})}catch{return{done:!0,value:void 0}}}),return(){return m(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return m(this,void 0,void 0,function*(){var e,t,n,i;let r=new Set;try{for(var s=!0,o=sA(this),a;a=yield o.next(),e=a.done,!e;s=!0){i=a.value,s=!1;const c=i;r.add(c)}}catch(c){t={error:c}}finally{try{!s&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return Array.from(r)})}}class Wv extends gh{constructor(e,t,n){super(e,t,n),this.receivedChunks=new Map}handleChunkReceived(e){var t;const n=Ur(e.chunkIndex),i=this.receivedChunks.get(n);if(i&&i.version>e.version)return;this.receivedChunks.set(n,e),this.bytesReceived+=e.content.byteLength;const r=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(t=this.onProgress)===null||t===void 0||t.call(this,r)}[Symbol.asyncIterator](){const e=this.reader.getReader(),t=new TextDecoder;return{next:()=>m(this,void 0,void 0,function*(){try{const{done:n,value:i}=yield e.read();return n?{done:!0,value:void 0}:(this.handleChunkReceived(i),{done:!1,value:t.decode(i.content)})}catch{return{done:!0,value:void 0}}}),return(){return m(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return m(this,void 0,void 0,function*(){var e,t,n,i;let r="";try{for(var s=!0,o=sA(this),a;a=yield o.next(),e=a.done,!e;s=!0)i=a.value,s=!1,r+=i}catch(c){t={error:c}}finally{try{!s&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return r})}}class ph{constructor(e,t,n){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=n,this.info=t}write(e){return this.defaultWriter.write(e)}close(){return m(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class Jv extends ph{}class Xv extends ph{}class mh extends U{constructor(e,t,n,i,r){super(e,n,r),this.sid=t,this.receiver=i}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?k.Muted:k.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const t=n=>{n.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",t),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(k.Ended,this))};e.addEventListener("removetrack",t)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return m(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),Sa)),av()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var t;this.timeSyncHandle=requestAnimationFrame(()=>e());const n=(t=this.receiver)===null||t===void 0?void 0:t.getSynchronizationSources()[0];if(n){const{timestamp:i,rtpTimestamp:r}=n;r&&this.rtpTimestamp!==r&&(this.emit(k.TimeSyncUpdate,{timestamp:i,rtpTimestamp:r}),this.rtpTimestamp=r)}};e()}}class qv extends mh{constructor(e,t,n,i,r,s){super(e,t,U.Kind.Audio,n,s),this.monitorReceiver=()=>m(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const o=yield this.getReceiverStats();o&&this.prevStats&&this.receiver&&(this._currentBitrate=Fr(o,this.prevStats)),this.prevStats=o}),this.audioContext=i,this.webAudioPluginNodes=[],r&&(this.sinkId=r.deviceId)}setVolume(e){var t;for(const n of this.attachedElements)this.audioContext?(t=this.gainNode)===null||t===void 0||t.gain.setTargetAtTime(e,0,.1):n.volume=e;Rt()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(Rt())return 1;let e=0;return this.attachedElements.forEach(t=>{t.volume>e&&(e=t.volume)}),e}setSinkId(e){return m(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(t=>{if(ia(t))return t.setSinkId(e)}))})}attach(e){const t=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&ia(e)&&e.setSinkId(this.sinkId).catch(n=>{this.log.error("Failed to set sink id on remote audio track",n,this.logContext)}),this.audioContext&&t&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let t;return e?(t=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(t=super.detach(),this.disconnectWebAudio()),t}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,t){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(t.srcObject);let n=this.sourceNode;this.webAudioPluginNodes.forEach(i=>{n.connect(i),n=i}),this.gainNode=e.createGain(),n.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(k.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(i=>{this.emit(k.AudioPlaybackFailed,i)})}disconnectWebAudio(){var e,t;(e=this.gainNode)===null||e===void 0||e.disconnect(),(t=this.sourceNode)===null||t===void 0||t.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return m(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let t;return e.forEach(n=>{n.type==="inbound-rtp"&&(t={type:"audio",streamId:n.id,timestamp:n.timestamp,jitter:n.jitter,bytesReceived:n.bytesReceived,concealedSamples:n.concealedSamples,concealmentEvents:n.concealmentEvents,silentConcealedSamples:n.silentConcealedSamples,silentConcealmentEvents:n.silentConcealmentEvents,totalAudioEnergy:n.totalAudioEnergy,totalSamplesDuration:n.totalSamplesDuration})}),t})}}const Ia=100;class Yv extends mh{constructor(e,t,n,i,r){super(e,t,U.Kind.Video,n,r),this.elementInfos=[],this.monitorReceiver=()=>m(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const s=yield this.getReceiverStats();s&&this.prevStats&&this.receiver&&(this._currentBitrate=Fr(s,this.prevStats)),this.prevStats=s}),this.debouncedHandleResize=wa(()=>{this.updateDimensions()},Ia),this.adaptiveStreamSettings=i}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(t=>{e?yn(this._mediaStreamTrack,t):wn(this._mediaStreamTrack,t)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(t=>t.element===e)===void 0){const t=new zv(e);this.observeElementInfo(t)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(t=>t===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const t=this.elementInfos.filter(n=>n===e);for(const n of t)n.stopObserving();this.elementInfos=this.elementInfos.filter(n=>n!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let t=[];if(e)return this.stopObservingElement(e),super.detach(e);t=super.detach();for(const n of t)this.stopObservingElement(n);return t}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return m(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let t,n="",i=new Map;return e.forEach(r=>{r.type==="inbound-rtp"?(n=r.codecId,t={type:"video",streamId:r.id,framesDecoded:r.framesDecoded,framesDropped:r.framesDropped,framesReceived:r.framesReceived,packetsReceived:r.packetsReceived,packetsLost:r.packetsLost,frameWidth:r.frameWidth,frameHeight:r.frameHeight,pliCount:r.pliCount,firCount:r.firCount,nackCount:r.nackCount,jitter:r.jitter,timestamp:r.timestamp,bytesReceived:r.bytesReceived,decoderImplementation:r.decoderImplementation}):r.type==="codec"&&i.set(r.id,r)}),t&&n!==""&&i.get(n)&&(t.mimeType=i.get(n).mimeType),t})}stopObservingElement(e){const t=this.elementInfos.filter(n=>n.element===e);for(const n of t)this.stopObservingElementInfo(n)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return m(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(){var e,t;const n=this.elementInfos.reduce((o,a)=>Math.max(o,a.visibilityChangedAt||0),0),i=!((t=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pauseVideoInBackground)!==null&&t!==void 0)||t?this.isInBackground:!1,r=this.elementInfos.some(o=>o.pictureInPicture),s=this.elementInfos.some(o=>o.visible)&&!i||r;if(this.lastVisible!==s){if(!s&&Date.now()-n<Ia){Fe.setTimeout(()=>{this.updateVisibility()},Ia);return}this.lastVisible=s,this.emit(k.VisibilityChanged,s,this)}}updateDimensions(){var e,t;let n=0,i=0;const r=this.getPixelDensity();for(const s of this.elementInfos){const o=s.width()*r,a=s.height()*r;o+a>n+i&&(n=o,i=a)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===n&&((t=this.lastDimensions)===null||t===void 0?void 0:t.height)===i||(this.lastDimensions={width:n,height:i},this.emit(k.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const t=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return t==="screen"?Od():t||(Od()>2?2:1)}}class zv{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,t){this.onVisibilityChanged=n=>{var i;const{target:r,isIntersecting:s}=n;r===this.element&&(this.isIntersecting=s,this.isPiP=li(this.element),this.visibilityChangedAt=Date.now(),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this))},this.onEnterPiP=()=>{var n,i,r;(i=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP),this.isPiP=li(this.element),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this)},this.onLeavePiP=()=>{var n;this.isPiP=li(this.element),(n=this.handleVisibilityChanged)===null||n===void 0||n.call(this)},this.element=e,this.isIntersecting=t??_a(e),this.isPiP=Ye()&&li(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,t,n;this.isIntersecting=_a(this.element),this.isPiP=li(this.element),this.element.handleResize=()=>{var i;(i=this.handleResize)===null||i===void 0||i.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,Md().observe(this.element),Hd().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(n=(t=window.documentPictureInPicture)===null||t===void 0?void 0:t.window)===null||n===void 0||n.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,t,n,i,r;(e=Md())===null||e===void 0||e.unobserve(this.element),(t=Hd())===null||t===void 0||t.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(n=window.documentPictureInPicture)===null||n===void 0||n.removeEventListener("enter",this.onEnterPiP),(r=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||r===void 0||r.removeEventListener("pagehide",this.onLeavePiP)}}function li(A){var e,t;return document.pictureInPictureElement===A?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?_a(A,(t=window.documentPictureInPicture)===null||t===void 0?void 0:t.window):!1}function _a(A,e){const t=e||window;let n=A.offsetTop,i=A.offsetLeft;const r=A.offsetWidth,s=A.offsetHeight,{hidden:o}=A,{display:a}=getComputedStyle(A);for(;A.offsetParent;)A=A.offsetParent,n+=A.offsetTop,i+=A.offsetLeft;return n<t.pageYOffset+t.innerHeight&&i<t.pageXOffset+t.innerWidth&&n+s>t.pageYOffset&&i+r>t.pageXOffset&&!o&&a!=="none"}class Jt extends xt.EventEmitter{constructor(e,t,n,i){var r;super(),this.metadataMuted=!1,this.encryption=At.NONE,this.log=j,this.handleMuted=()=>{this.emit(k.Muted)},this.handleUnmuted=()=>{this.emit(k.Unmuted)},this.log=jt((r=i?.loggerName)!==null&&r!==void 0?r:Ct.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=t,this.trackName=n,this.source=U.Source.Unknown}setTrack(e){this.track&&(this.track.off(k.Muted,this.handleMuted),this.track.off(k.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(k.Muted,this.handleMuted),e.on(k.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),ee(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==At.NONE}get audioTrack(){if(Wt(this.track))return this.track}get videoTrack(){if(Sn(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=U.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===U.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(A){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(A.SubscriptionStatus||(A.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(A.PermissionStatus||(A.PermissionStatus={}))})(Jt||(Jt={}));class xa extends Jt{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,t,n,i){super(e,t.sid,t.name,i),this.track=void 0,this.handleTrackEnded=()=>{this.emit(k.Ended)},this.updateInfo(t),this.setTrack(n)}setTrack(e){this.track&&this.track.off(k.Ended,this.handleTrackEnded),super.setTrack(e),e&&e.on(k.Ended,this.handleTrackEnded)}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return m(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return m(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return m(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return m(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(Wt(this.track)){const t=this.track.getSourceTrackSettings(),n=new Set;return t.autoGainControl&&n.add(Bt.TF_AUTO_GAIN_CONTROL),t.echoCancellation&&n.add(Bt.TF_ECHO_CANCELLATION),t.noiseSuppression&&n.add(Bt.TF_NOISE_SUPPRESSION),t.channelCount&&t.channelCount>1&&n.add(Bt.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||n.add(Bt.TF_NO_DTX),this.track.enhancedNoiseCancellation&&n.add(Bt.TF_ENHANCED_NOISE_CANCELLATION),Array.from(n.values())}else return[]}}function xr(A,e){return m(this,void 0,void 0,function*(){A??(A={});let t=!1;const{audioProcessor:n,videoProcessor:i,optionsWithoutProcessor:r}=Wd(A);let s=r.audio,o=r.video;if(n&&typeof r.audio=="object"&&(r.audio.processor=n),i&&typeof r.video=="object"&&(r.video.processor=i),A.audio&&typeof r.audio=="object"&&typeof r.audio.deviceId=="string"){const u=r.audio.deviceId;r.audio.deviceId={exact:u},t=!0,s=Object.assign(Object.assign({},r.audio),{deviceId:{ideal:u}})}if(r.video&&typeof r.video=="object"&&typeof r.video.deviceId=="string"){const u=r.video.deviceId;r.video.deviceId={exact:u},t=!0,o=Object.assign(Object.assign({},r.video),{deviceId:{ideal:u}})}(r.audio===!0||typeof r.audio=="object"&&!r.audio.deviceId)&&(r.audio={deviceId:"default"}),r.video===!0?r.video={deviceId:"default"}:typeof r.video=="object"&&!r.video.deviceId&&(r.video.deviceId="default");const a=Vd(r,nh,ih),c=fa(a),l=navigator.mediaDevices.getUserMedia(c);r.audio&&(Ue.userMediaPromiseMap.set("audioinput",l),l.catch(()=>Ue.userMediaPromiseMap.delete("audioinput"))),r.video&&(Ue.userMediaPromiseMap.set("videoinput",l),l.catch(()=>Ue.userMediaPromiseMap.delete("videoinput")));try{const u=yield l;return yield Promise.all(u.getTracks().map(d=>m(this,void 0,void 0,function*(){const h=d.kind==="audio";let f=h?a.audio:a.video;(typeof f=="boolean"||!f)&&(f={});let g;const p=h?c.audio:c.video;typeof p!="boolean"&&(g=p);const B=d.getSettings().deviceId;g?.deviceId&&uA(g.deviceId)!==B?g.deviceId=B:g||(g={deviceId:B});const y=Fv(d,g,e);return y.kind===U.Kind.Video?y.source=U.Source.Camera:y.kind===U.Kind.Audio&&(y.source=U.Source.Microphone),y.mediaStream=u,Wt(y)&&n?yield y.setProcessor(n):Sn(y)&&i&&(yield y.setProcessor(i)),y})))}catch(u){if(!t)throw u;return xr(Object.assign(Object.assign({},A),{audio:s,video:o}),e)}})}function Zv(A){return m(this,void 0,void 0,function*(){return(yield xr({audio:!1,video:A??!0}))[0]})}function eC(A){return m(this,void 0,void 0,function*(){return(yield xr({audio:A??!0,video:!1}))[0]})}var fA;(function(A){A.Excellent="excellent",A.Good="good",A.Poor="poor",A.Lost="lost",A.Unknown="unknown"})(fA||(fA={}));function tC(A){switch(A){case Ai.EXCELLENT:return fA.Excellent;case Ai.GOOD:return fA.Good;case Ai.POOR:return fA.Poor;case Ai.LOST:return fA.Lost;default:return fA.Unknown}}class Bh extends xt.EventEmitter{get logContext(){var e,t;return Object.assign({},(t=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||t===void 0?void 0:t.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===ur.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===mn.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,t,n,i,r,s){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:ur.STANDARD;var a;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=fA.Unknown,this.log=j,this.log=jt((a=s?.loggerName)!==null&&a!==void 0?a:Ct.Participant),this.loggerOptions=s,this.setMaxListeners(100),this.sid=e,this.identity=t,this.name=n,this.metadata=i,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=o,this._attributes=r??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,t]of this.trackPublications)if(t.source===e)return t}getTrackPublicationByName(e){for(const[,t]of this.trackPublications)if(t.trackName===e)return t}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new ca,this.once(x.Active,()=>{var e,t;(t=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||t===void 0||t.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const t=this.getTrackPublication(U.Source.Camera);return!(!((e=t?.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const t=this.getTrackPublication(U.Source.Microphone);return!(!((e=t?.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(U.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var t;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===mn.ACTIVE&&((t=this.participantInfo)===null||t===void 0?void 0:t.state)!==mn.ACTIVE&&this.emit(x.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const t=this.metadata!==e,n=this.metadata;this.metadata=e,t&&this.emit(x.ParticipantMetadataChanged,n)}_setName(e){const t=this.name!==e;this.name=e,t&&this.emit(x.ParticipantNameChanged,e)}_setAttributes(e){const t=cv(this.attributes,e);this._attributes=e,Object.keys(t).length>0&&this.emit(x.AttributesChanged,t)}setPermissions(e){var t,n,i,r,s,o;const a=this.permissions,c=e.canPublish!==((t=this.permissions)===null||t===void 0?void 0:t.canPublish)||e.canSubscribe!==((n=this.permissions)===null||n===void 0?void 0:n.canSubscribe)||e.canPublishData!==((i=this.permissions)===null||i===void 0?void 0:i.canPublishData)||e.hidden!==((r=this.permissions)===null||r===void 0?void 0:r.hidden)||e.recorder!==((s=this.permissions)===null||s===void 0?void 0:s.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((l,u)=>{var d;return l!==((d=this.permissions)===null||d===void 0?void 0:d.canPublishSources[u])})||e.canSubscribeMetrics!==((o=this.permissions)===null||o===void 0?void 0:o.canSubscribeMetrics);return this.permissions=e,c&&this.emit(x.ParticipantPermissionsChanged,a),c}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(x.IsSpeakingChanged,e))}setConnectionQuality(e){const t=this._connectionQuality;this._connectionQuality=tC(e),t!==this._connectionQuality&&this.emit(x.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,t;this.activeFuture&&((t=(e=this.activeFuture).reject)===null||t===void 0||t.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(t=>Wt(t.track)&&t.track.setAudioContext(e))}addTrackPublication(e){e.on(k.Muted,()=>{this.emit(x.TrackMuted,e)}),e.on(k.Unmuted,()=>{this.emit(x.TrackUnmuted,e)});const t=e;switch(t.track&&(t.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case U.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case U.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function AC(A){var e,t,n;if(!A.participantSid&&!A.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new Lu({participantIdentity:(e=A.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(t=A.participantSid)!==null&&t!==void 0?t:"",allTracks:(n=A.allowAll)!==null&&n!==void 0?n:!1,trackSids:A.allowedTrackSids||[]})}const vh=15e3;class nC extends Bh{constructor(e,t,n,i,r){super(e,t,void 0,void 0,void 0,{loggerName:i.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=At.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new ca)},this.handleReconnected=()=>{var s,o;(o=(s=this.reconnectFuture)===null||s===void 0?void 0:s.resolve)===null||o===void 0||o.call(s),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var s,o;this.reconnectFuture&&(this.reconnectFuture.promise.catch(a=>this.log.warn(a.message,this.logContext)),(o=(s=this.reconnectFuture)===null||s===void 0?void 0:s.reject)===null||o===void 0||o.call(s,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0)},this.handleSignalRequestResponse=s=>{const{requestId:o,reason:a,message:c}=s,l=this.pendingSignalRequests.get(o);l&&(a!==Do.OK&&l.reject(new Id(c,a)),this.pendingSignalRequests.delete(o))},this.handleDataPacket=s=>{switch(s.value.case){case"rpcResponse":let o=s.value.value,a=null,c=null;o.value.case==="payload"?a=o.value.value:o.value.case==="error"&&(c=ge.fromProto(o.value.value)),this.handleIncomingRpcResponse(o.requestId,a,c);break;case"rpcAck":let l=s.value.value;this.handleIncomingRpcAck(l.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(s=>AC(s)))},this.onTrackUnmuted=s=>{this.onTrackMuted(s,s.isUpstreamPaused)},this.onTrackMuted=(s,o)=>{if(o===void 0&&(o=!0),!s.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),ee(s)));return}this.engine.updateMuteStatus(s.sid,o)},this.onTrackUpstreamPaused=s=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),ee(s))),this.onTrackMuted(s,!0)},this.onTrackUpstreamResumed=s=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),ee(s))),this.onTrackMuted(s,s.isMuted)},this.onTrackFeatureUpdate=s=>{const o=this.audioTrackPublications.get(s.sid);if(!o){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(s.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(o.trackSid,o.getTrackFeatures())},this.handleSubscribedQualityUpdate=s=>m(this,void 0,void 0,function*(){var o,a,c,l,u,d;if(!(!((u=this.roomOptions)===null||u===void 0)&&u.dynacast))return;const h=this.videoTrackPublications.get(s.trackSid);if(!h){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:s.trackSid}));return}if(s.subscribedCodecs.length>0){if(!h.videoTrack)return;const B=yield h.videoTrack.setPublishingCodecs(s.subscribedCodecs);try{for(var f=!0,g=sA(B),p;p=yield g.next(),o=p.done,!o;f=!0){l=p.value,f=!1;const y=l;N0(y)&&(this.log.debug("publish ".concat(y," for ").concat(h.videoTrack.sid),Object.assign(Object.assign({},this.logContext),ee(h))),yield this.publishAdditionalCodecForTrack(h.videoTrack,y,h.options))}}catch(y){a={error:y}}finally{try{!f&&!o&&(c=g.return)&&(yield c.call(g))}finally{if(a)throw a.error}}}else s.subscribedQualities.length>0&&(yield(d=h.videoTrack)===null||d===void 0?void 0:d.setPublishingLayers(s.subscribedQualities))}),this.handleLocalTrackUnpublished=s=>{const o=this.trackPublications.get(s.trackSid);if(!o){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:s.trackSid}));return}this.unpublishTrack(o.track)},this.handleTrackEnded=s=>m(this,void 0,void 0,function*(){if(s.source===U.Source.ScreenShare||s.source===U.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),ee(s))),this.unpublishTrack(s);else if(s.isUserProvided)yield s.mute();else if($A(s)||dA(s))try{if(Ye())try{const o=yield navigator?.permissions.query({name:s.source===U.Source.Camera?"camera":"microphone"});if(o&&o.state==="denied")throw this.log.warn("user has revoked access to ".concat(s.source),Object.assign(Object.assign({},this.logContext),ee(s))),o.onchange=()=>{o.state!=="denied"&&(s.isMuted||s.restartTrack(),o.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}s.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),ee(s))),$A(s)?yield s.restartTrack({deviceId:"default"}):yield s.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),ee(s))),yield s.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=n,this.roomOptions=i,this.setupEngine(n),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=r}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==At.NONE}getTrackPublication(e){const t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){const t=super.getTrackPublicationByName(e);if(t)return t}setupEngine(e){this.engine=e,this.engine.on(I.RemoteMute,(t,n)=>{const i=this.trackPublications.get(t);!i||!i.track||(n?i.mute():i.unmute())}),this.engine.on(I.Connected,this.handleReconnected).on(I.SignalRestarted,this.handleReconnected).on(I.SignalResumed,this.handleReconnected).on(I.Restarting,this.handleReconnecting).on(I.Resuming,this.handleReconnecting).on(I.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(I.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(I.Disconnected,this.handleDisconnected).on(I.SignalRequestResponse,this.handleSignalRequestResponse).on(I.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return m(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return m(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return m(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return m(this,arguments,void 0,function(t){var n=this;let{metadata:i,name:r,attributes:s}=t;return function*(){return new Promise((o,a)=>m(n,void 0,void 0,function*(){var c,l;try{let u=!1;const d=yield this.engine.client.sendUpdateLocalMetadata((c=i??this.metadata)!==null&&c!==void 0?c:"",(l=r??this.name)!==null&&l!==void 0?l:"",s),h=performance.now();for(this.pendingSignalRequests.set(d,{resolve:o,reject:f=>{a(f),u=!0},values:{name:r,metadata:i,attributes:s}});performance.now()-h<5e3&&!u;){if((!r||this.name===r)&&(!i||this.metadata===i)&&(!s||Object.entries(s).every(f=>{let[g,p]=f;return this.attributes[g]===p||p===""&&!this.attributes[g]}))){this.pendingSignalRequests.delete(d),o();return}yield qe(50)}a(new Id("Request to update local metadata timed out","TimeoutError"))}catch(u){u instanceof Error&&a(u)}}))}()})}setCameraEnabled(e,t,n){return this.setTrackEnabled(U.Source.Camera,e,t,n)}setMicrophoneEnabled(e,t,n){return this.setTrackEnabled(U.Source.Microphone,e,t,n)}setScreenShareEnabled(e,t,n){return this.setTrackEnabled(U.Source.ScreenShare,e,t,n)}setPermissions(e){const t=this.permissions,n=super.setPermissions(e);return n&&t&&this.emit(x.ParticipantPermissionsChanged,t),n}setE2EEEnabled(e){return m(this,void 0,void 0,function*(){this.encryptionType=e?At.GCM:At.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,t,n,i){return m(this,void 0,void 0,function*(){var r,s;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:t})),this.republishPromise&&(yield this.republishPromise);let o=this.getTrackPublication(e);if(t)if(o)yield o.unmute();else{let a;if(this.pendingPublishing.has(e)){const c=yield this.waitForPendingPublicationOfSource(e);return c||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield c?.unmute(),c}this.pendingPublishing.add(e);try{switch(e){case U.Source.Camera:a=yield this.createTracks({video:(r=n)!==null&&r!==void 0?r:!0});break;case U.Source.Microphone:a=yield this.createTracks({audio:(s=n)!==null&&s!==void 0?s:!0});break;case U.Source.ScreenShare:a=yield this.createScreenTracks(Object.assign({},n));break;default:throw new $t(e)}}catch(c){throw a?.forEach(l=>{l.stop()}),c instanceof Error&&this.emit(x.MediaDevicesError,c),this.pendingPublishing.delete(e),c}try{const c=[];for(const u of a)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),ee(u))),c.push(this.publishTrack(u,i));[o]=yield Promise.all(c)}catch(c){throw a?.forEach(l=>{l.stop()}),c}finally{this.pendingPublishing.delete(e)}}else if(!o?.track&&this.pendingPublishing.has(e)&&(o=yield this.waitForPendingPublicationOfSource(e),o||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),o&&o.track)if(e===U.Source.ScreenShare){o=yield this.unpublishTrack(o.track);const a=this.getTrackPublication(U.Source.ScreenShareAudio);a&&a.track&&this.unpublishTrack(a.track)}else yield o.mute();return o})}enableCameraAndMicrophone(){return m(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(U.Source.Camera)||this.pendingPublishing.has(U.Source.Microphone))){this.pendingPublishing.add(U.Source.Camera),this.pendingPublishing.add(U.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(t=>this.publishTrack(t)))}finally{this.pendingPublishing.delete(U.Source.Camera),this.pendingPublishing.delete(U.Source.Microphone)}}})}createTracks(e){return m(this,void 0,void 0,function*(){var t,n;e??(e={});const i=Vd(e,(t=this.roomOptions)===null||t===void 0?void 0:t.audioCaptureDefaults,(n=this.roomOptions)===null||n===void 0?void 0:n.videoCaptureDefaults);try{return(yield xr(i,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(o=>(Wt(o)&&(this.microphoneError=void 0,o.setAudioContext(this.audioContext),o.source=U.Source.Microphone,this.emit(x.AudioStreamAcquired)),Sn(o)&&(this.cameraError=void 0,o.source=U.Source.Camera),o))}catch(r){throw r instanceof Error&&(e.audio&&(this.microphoneError=r),e.video&&(this.cameraError=r)),r}})}createScreenTracks(e){return m(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new Jo("getDisplayMedia not supported");e.resolution===void 0&&!W0()&&(e.resolution=ta.h1080fps30.resolution);const t=sv(e),n=yield navigator.mediaDevices.getDisplayMedia(t),i=n.getVideoTracks();if(i.length===0)throw new $t("no video track found");const r=new _r(i[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});r.source=U.Source.ScreenShare,e.contentHint&&(r.mediaStreamTrack.contentHint=e.contentHint);const s=[r];if(n.getAudioTracks().length>0){this.emit(x.AudioStreamAcquired);const o=new kr(n.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});o.source=U.Source.ScreenShareAudio,s.push(o)}return s})}publishTrack(e,t){return m(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,t)})}publishOrRepublishTrack(e,t){return m(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var o,a,c,l;$A(n)&&n.setAudioContext(r.audioContext),yield(o=r.reconnectFuture)===null||o===void 0?void 0:o.promise,r.republishPromise&&!s&&(yield r.republishPromise),En(n)&&r.pendingPublishPromises.has(n)&&(yield r.pendingPublishPromises.get(n));let u;if(n instanceof MediaStreamTrack)u=n.getConstraints();else{u=n.constraints;let B;switch(n.source){case U.Source.Microphone:B="audioinput";break;case U.Source.Camera:B="videoinput"}B&&r.activeDeviceMap.has(B)&&(u=Object.assign(Object.assign({},u),{deviceId:r.activeDeviceMap.get(B)}))}if(n instanceof MediaStreamTrack)switch(n.kind){case"audio":n=new kr(n,u,!0,r.audioContext,{loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});break;case"video":n=new _r(n,u,!0,{loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});break;default:throw new $t("unsupported MediaStreamTrack kind ".concat(n.kind))}else n.updateLoggerOptions({loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});let d;if(r.trackPublications.forEach(B=>{B.track&&B.track===n&&(d=B)}),d)return r.log.warn("track has already been published, skipping",Object.assign(Object.assign({},r.logContext),ee(d))),d;const h="channelCount"in n.mediaStreamTrack.getSettings()&&n.mediaStreamTrack.getSettings().channelCount===2||n.mediaStreamTrack.getConstraints().channelCount===2,f=(a=i?.forceStereo)!==null&&a!==void 0?a:h;f&&(i||(i={}),i.dtx===void 0&&r.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},r.logContext),ee(n))),i.red===void 0&&r.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(c=i.dtx)!==null&&c!==void 0||(i.dtx=!1),(l=i.red)!==null&&l!==void 0||(i.red=!1));const g=Object.assign(Object.assign({},r.roomOptions.publishDefaults),i);!J0()&&r.roomOptions.e2ee&&(r.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},r.logContext)),g.simulcast=!1),g.source&&(n.source=g.source);const p=new Promise((B,y)=>m(r,void 0,void 0,function*(){try{if(this.engine.client.currentState!==ae.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:ee(n)}));const b=()=>m(this,void 0,void 0,function*(){try{const v=yield this.publish(n,g,f);B(v)}catch(v){y(v)}});setTimeout(()=>{this.engine.off(I.SignalConnected,b),y(new qo("publishing rejected as engine not connected within timeout",408))},15e3),this.engine.once(I.SignalConnected,b),this.engine.on(I.Closing,()=>{this.engine.off(I.SignalConnected,b),y(new qo("publishing rejected as engine closed",499))})}else try{const b=yield this.publish(n,g,f);B(b)}catch(b){y(b)}}catch(b){y(b)}}));r.pendingPublishPromises.set(n,p);try{return yield p}catch(B){throw B}finally{r.pendingPublishPromises.delete(n)}}()})}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),ee(e))),!1;const{canPublish:t,canPublishSources:n}=this.permissions;return t&&(n.length===0||n.map(i=>lv(i)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),ee(e))),!1)}publish(e,t,n){return m(this,void 0,void 0,function*(){var i,r,s,o,a,c,l,u,d,h;if(!this.hasPermissionsToPublish(e))throw new qo("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(C=>En(e)&&C.source===e.source)&&e.source!==U.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),ee(e))),t.stopMicTrackOnMute&&Wt(e)&&(e.stopOnMute=!0),e.source===U.Source.ScreenShare&&bn()&&(t.simulcast=!1),t.videoCodec==="av1"&&!G0()&&(t.videoCodec=void 0),t.videoCodec==="vp9"&&!j0()&&(t.videoCodec=void 0),t.videoCodec===void 0&&(t.videoCodec=ya),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(C=>t.videoCodec===Tr(C.mime))||(t.videoCodec=Tr(this.enabledPublishVideoCodecs[0].mime)));const g=t.videoCodec;e.on(k.Muted,this.onTrackMuted),e.on(k.Unmuted,this.onTrackUnmuted),e.on(k.Ended,this.handleTrackEnded),e.on(k.UpstreamPaused,this.onTrackUpstreamPaused),e.on(k.UpstreamResumed,this.onTrackUpstreamResumed),e.on(k.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const p=new _o({cid:e.mediaStreamTrack.id,name:t.name,type:U.kindToProto(e.kind),muted:e.isMuted,source:U.sourceToProto(e.source),disableDtx:!(!((i=t.dtx)!==null&&i!==void 0)||i),encryption:this.encryptionType,stereo:n,disableRed:this.isE2EEEnabled||!(!((r=t.red)!==null&&r!==void 0)||r),stream:t?.stream,backupCodecPolicy:t?.backupCodecPolicy});let B;if(e.kind===U.Kind.Video){let C={width:0,height:0};try{C=yield e.waitForDimensions()}catch{const S=(o=(s=this.roomOptions.videoCaptureDefaults)===null||s===void 0?void 0:s.resolution)!==null&&o!==void 0?o:si.h720.resolution;C={width:S.width,height:S.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),ee(e)),{dims:C}))}p.width=C.width,p.height=C.height,dA(e)&&(oi(g)&&(e.source===U.Source.ScreenShare&&(t.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),ee(e))))),t.scalabilityMode=(a=t.scalabilityMode)!==null&&a!==void 0?a:"L3T3_KEY"),p.simulcastCodecs=[new Io({codec:g,cid:e.mediaStreamTrack.id})],t.backupCodec===!0&&(t.backupCodec={codec:ya}),t.backupCodec&&g!==t.backupCodec.codec&&p.encryption===At.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),p.simulcastCodecs.push(new Io({codec:t.backupCodec.codec,cid:""})))),B=Ta(e.source===U.Source.ScreenShare,p.width,p.height,t),p.layers=dh(p.width,p.height,B,oi(t.videoCodec))}else e.kind===U.Kind.Audio&&(B=[{maxBitrate:(c=t.audioPreset)===null||c===void 0?void 0:c.maxBitrate,priority:(u=(l=t.audioPreset)===null||l===void 0?void 0:l.priority)!==null&&u!==void 0?u:"high",networkPriority:(h=(d=t.audioPreset)===null||d===void 0?void 0:d.priority)!==null&&h!==void 0?h:"high"}]);if(!this.engine||this.engine.isClosed)throw new Ee("cannot publish track when not connected");const y=()=>m(this,void 0,void 0,function*(){var C,w,S;if(!this.engine.pcManager)throw new Ee("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,t,B),dA(e)&&((C=t.degradationPreference)!==null&&C!==void 0||(t.degradationPreference=Hv(e)),e.setDegradationPreference(t.degradationPreference)),B)if(bn()&&e.kind===U.Kind.Audio){let F;for(const _ of this.engine.pcManager.publisher.getTransceivers())if(_.sender===e.sender){F=_;break}F&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:F,codec:"opus",maxbr:!((w=B[0])===null||w===void 0)&&w.maxBitrate?B[0].maxBitrate/1e3:0})}else e.codec&&oi(e.codec)&&(!((S=B[0])===null||S===void 0)&&S.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:p.cid,codec:e.codec,maxbr:B[0].maxBitrate/1e3});yield this.engine.negotiate()});let b;if(this.enabledPublishVideoCodecs.length>0)b=(yield Promise.all([this.engine.addTrack(p),y()]))[0];else{b=yield this.engine.addTrack(p);let C;if(b.codecs.forEach(w=>{C===void 0&&(C=w.mimeType)}),C&&e.kind===U.Kind.Video){const w=Tr(C);w!==g&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),ee(e)),{codec:w})),t.videoCodec=w,B=Ta(e.source===U.Source.ScreenShare,p.width,p.height,t))}yield y()}const v=new xa(e.kind,b,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});return v.options=t,e.sid=b.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:B,trackInfo:b})),dA(e)?e.startMonitor(this.engine.client):$A(e)&&e.startMonitor(),this.addTrackPublication(v),this.emit(x.LocalTrackPublished,v),v})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,t,n){return m(this,void 0,void 0,function*(){var i;if(this.encryptionType!==At.NONE)return;let r;if(this.trackPublications.forEach(h=>{h.track&&h.track===e&&(r=h)}),!r)throw new $t("track is not published");if(!dA(e))throw new $t("track is not a video track");const s=Object.assign(Object.assign({},(i=this.roomOptions)===null||i===void 0?void 0:i.publishDefaults),n),o=Lv(e,t,s);if(!o){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),ee(e)));return}const a=e.addSimulcastTrack(t,o);if(!a)return;const c=new _o({cid:a.mediaStreamTrack.id,type:U.kindToProto(e.kind),muted:e.isMuted,source:U.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:s.videoCodec,cid:a.mediaStreamTrack.id}]});if(c.layers=dh(c.width,c.height,o),!this.engine||this.engine.isClosed)throw new Ee("cannot publish track when not connected");const l=()=>m(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,a,s,o),yield this.engine.negotiate()}),d=(yield Promise.all([this.engine.addTrack(c),l()]))[0];this.log.debug("published ".concat(t," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:o,trackInfo:d}))})}unpublishTrack(e,t){return m(this,void 0,void 0,function*(){var n,i;if(En(e)){const c=this.pendingPublishPromises.get(e);c&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),ee(e))),yield c)}const r=this.getPublicationForTrack(e),s=r?ee(r):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),s)),!r||!r.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),s));return}e=r.track,e.off(k.Muted,this.onTrackMuted),e.off(k.Unmuted,this.onTrackUnmuted),e.off(k.Ended,this.handleTrackEnded),e.off(k.UpstreamPaused,this.onTrackUpstreamPaused),e.off(k.UpstreamResumed,this.onTrackUpstreamResumed),e.off(k.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),t===void 0&&(t=(i=(n=this.roomOptions)===null||n===void 0?void 0:n.stopLocalTrackOnUnpublish)!==null&&i!==void 0?i:!0),t?e.stop():e.stopMonitor();let o=!1;const a=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<fe.FAILED&&a)try{for(const c of this.engine.pcManager.publisher.getTransceivers())c.sender===a&&(c.direction="inactive",o=!0);if(this.engine.removeTrack(a)&&(o=!0),dA(e)){for(const[,c]of e.simulcastCodecs)c.sender&&(this.engine.removeTrack(c.sender)&&(o=!0),c.sender=void 0);e.simulcastCodecs.clear()}}catch(c){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),s),{error:c}))}switch(this.trackPublications.delete(r.trackSid),r.kind){case U.Kind.Audio:this.audioTrackPublications.delete(r.trackSid);break;case U.Kind.Video:this.videoTrackPublications.delete(r.trackSid);break}return this.emit(x.LocalTrackUnpublished,r),r.setTrack(void 0),o&&(yield this.engine.negotiate()),r})}unpublishTracks(e){return m(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>this.unpublishTrack(n)))).filter(n=>!!n)})}republishAllTracks(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){n.republishPromise&&(yield n.republishPromise),n.republishPromise=new Promise((r,s)=>m(n,void 0,void 0,function*(){try{const o=[];this.trackPublications.forEach(a=>{a.track&&(t&&(a.options=Object.assign(Object.assign({},a.options),t)),o.push(a))}),yield Promise.all(o.map(a=>m(this,void 0,void 0,function*(){const c=a.track;yield this.unpublishTrack(c,!1),i&&!c.isMuted&&c.source!==U.Source.ScreenShare&&c.source!==U.Source.ScreenShareAudio&&($A(c)||dA(c))&&!c.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:a.trackSid})),yield c.restartTrack()),yield this.publishOrRepublishTrack(c,a.options,!0)}))),r()}catch(o){s(o)}finally{this.republishPromise=void 0}})),yield n.republishPromise}()})}publishData(e){return m(this,arguments,void 0,function(t){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const r=i.reliable?Y.RELIABLE:Y.LOSSY,s=i.destinationIdentities,o=i.topic,a=new Xe({kind:r,value:{case:"user",value:new pu({participantIdentity:n.identity,payload:t,destinationIdentities:s,topic:o})}});yield n.engine.sendDataPacket(a,r)}()})}publishDtmf(e,t){return m(this,void 0,void 0,function*(){const n=new Xe({kind:Y.RELIABLE,value:{case:"sipDtmf",value:new mu({code:e,digit:t})}});yield this.engine.sendDataPacket(n,Y.RELIABLE)})}sendChatMessage(e,t){return m(this,void 0,void 0,function*(){const n={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:t?.attachments},i=new Xe({value:{case:"chatMessage",value:new So(Object.assign(Object.assign({},n),{timestamp:ue.parse(n.timestamp)}))}});return yield this.engine.sendDataPacket(i,Y.RELIABLE),this.emit(x.ChatMessage,n),n})}editChatMessage(e,t){return m(this,void 0,void 0,function*(){const n=Object.assign(Object.assign({},t),{message:e,editTimestamp:Date.now()}),i=new Xe({value:{case:"chatMessage",value:new So(Object.assign(Object.assign({},n),{timestamp:ue.parse(n.timestamp),editTimestamp:ue.parse(n.editTimestamp)}))}});return yield this.engine.sendDataPacket(i,Y.RELIABLE),this.emit(x.ChatMessage,n),n})}sendText(e,t){return m(this,void 0,void 0,function*(){var n;const i=crypto.randomUUID(),s=new TextEncoder().encode(e).byteLength,o=(n=t?.attachments)===null||n===void 0?void 0:n.map(()=>crypto.randomUUID()),a=new Array(o?o.length+1:1).fill(0),c=(u,d)=>{var h;a[d]=u;const f=a.reduce((g,p)=>g+p,0);(h=t?.onProgress)===null||h===void 0||h.call(t,f)},l=yield this.streamText({streamId:i,totalSize:s,destinationIdentities:t?.destinationIdentities,topic:t?.topic,attachedStreamIds:o,attributes:t?.attributes});return yield l.write(e),c(1,0),yield l.close(),t?.attachments&&o&&(yield Promise.all(t.attachments.map((u,d)=>m(this,void 0,void 0,function*(){return this._sendFile(o[d],u,{topic:t.topic,mimeType:u.type,onProgress:h=>{c(h,d+1)}})})))),l.info})}streamText(e){return m(this,void 0,void 0,function*(){var t,n;const i=(t=e?.streamId)!==null&&t!==void 0?t:crypto.randomUUID(),r={id:i,mimeType:"text/plain",timestamp:Date.now(),topic:(n=e?.topic)!==null&&n!==void 0?n:"",size:e?.totalSize,attributes:e?.attributes},s=new To({streamId:i,mimeType:r.mimeType,topic:r.topic,timestamp:jA(r.timestamp),totalLength:jA(e?.totalSize),attributes:r.attributes,contentHeader:{case:"textHeader",value:new Qu({version:e?.version,attachedStreamIds:e?.attachedStreamIds,replyToStreamId:e?.replyToStreamId,operationType:e?.type==="update"?Uo.UPDATE:Uo.CREATE})}}),o=e?.destinationIdentities,a=new Xe({destinationIdentities:o,value:{case:"streamHeader",value:s}});yield this.engine.sendDataPacket(a,Y.RELIABLE);let c=0;const l=this,u=new WritableStream({write(f){return m(this,void 0,void 0,function*(){for(const g of iv(f,vh)){yield l.engine.waitForBufferStatusLow(Y.RELIABLE);const p=new Qo({content:g,streamId:i,chunkIndex:jA(c)}),B=new Xe({destinationIdentities:o,value:{case:"streamChunk",value:p}});yield l.engine.sendDataPacket(B,Y.RELIABLE),c+=1}})},close(){return m(this,void 0,void 0,function*(){const f=new Fo({streamId:i}),g=new Xe({destinationIdentities:o,value:{case:"streamTrailer",value:f}});yield l.engine.sendDataPacket(g,Y.RELIABLE)})},abort(f){console.log("Sink error:",f)}});let d=()=>m(this,void 0,void 0,function*(){yield h.close()});l.engine.once(I.Closing,d);const h=new Jv(u,r,()=>this.engine.off(I.Closing,d));return h})}sendFile(e,t){return m(this,void 0,void 0,function*(){const n=crypto.randomUUID();return yield this._sendFile(n,e,t),{id:n}})}_sendFile(e,t,n){return m(this,void 0,void 0,function*(){var i;const r=yield this.streamBytes({streamId:e,totalSize:t.size,name:t.name,mimeType:(i=n?.mimeType)!==null&&i!==void 0?i:t.type,topic:n?.topic,destinationIdentities:n?.destinationIdentities}),s=t.stream().getReader();for(;;){const{done:o,value:a}=yield s.read();if(o)break;yield r.write(a)}return yield r.close(),r.info})}streamBytes(e){return m(this,void 0,void 0,function*(){var t,n,i,r,s;const o=(t=e?.streamId)!==null&&t!==void 0?t:crypto.randomUUID(),a=e?.destinationIdentities,c={id:o,mimeType:(n=e?.mimeType)!==null&&n!==void 0?n:"application/octet-stream",topic:(i=e?.topic)!==null&&i!==void 0?i:"",timestamp:Date.now(),attributes:e?.attributes,size:e?.totalSize,name:(r=e?.name)!==null&&r!==void 0?r:"unknown"},l=new To({totalLength:jA((s=c.size)!==null&&s!==void 0?s:0),mimeType:c.mimeType,streamId:o,topic:c.topic,timestamp:jA(Date.now()),attributes:c.attributes,contentHeader:{case:"byteHeader",value:new Fu({name:c.name})}}),u=new Xe({destinationIdentities:a,value:{case:"streamHeader",value:l}});yield this.engine.sendDataPacket(u,Y.RELIABLE);let d=0;const h=new We,f=this.engine,g=this.log,p=new WritableStream({write(y){return m(this,void 0,void 0,function*(){const b=yield h.lock();let v=0;try{for(;v<y.byteLength;){const C=y.slice(v,v+vh);yield f.waitForBufferStatusLow(Y.RELIABLE);const w=new Xe({destinationIdentities:a,value:{case:"streamChunk",value:new Qo({content:C,streamId:o,chunkIndex:jA(d)})}});yield f.sendDataPacket(w,Y.RELIABLE),d+=1,v+=C.byteLength}}finally{b()}})},close(){return m(this,void 0,void 0,function*(){const y=new Fo({streamId:o}),b=new Xe({destinationIdentities:a,value:{case:"streamTrailer",value:y}});yield f.sendDataPacket(b,Y.RELIABLE)})},abort(y){g.error("Sink error:",y)}});return new Xv(p,c)})}performRpc(e){return m(this,arguments,void 0,function(t){var n=this;let{destinationIdentity:i,method:r,payload:s,responseTimeout:o=1e4}=t;return function*(){return new Promise((c,l)=>m(n,void 0,void 0,function*(){var u,d,h,f;if(Ea(s)>rh){l(ge.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((d=(u=this.engine.latestJoinResponse)===null||u===void 0?void 0:u.serverInfo)===null||d===void 0)&&d.version&&GA((f=(h=this.engine.latestJoinResponse)===null||h===void 0?void 0:h.serverInfo)===null||f===void 0?void 0:f.version,"1.8.0")<0){l(ge.builtIn("UNSUPPORTED_SERVER"));return}const g=crypto.randomUUID();yield this.publishRpcRequest(i,g,r,s,o-2e3);const p=setTimeout(()=>{this.pendingAcks.delete(g),l(ge.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(g),clearTimeout(B)},2e3);this.pendingAcks.set(g,{resolve:()=>{clearTimeout(p)},participantIdentity:i});const B=setTimeout(()=>{this.pendingResponses.delete(g),l(ge.builtIn("RESPONSE_TIMEOUT"))},o);this.pendingResponses.set(g,{resolve:(y,b)=>{clearTimeout(B),this.pendingAcks.has(g)&&(console.warn("RPC response received before ack",g),this.pendingAcks.delete(g),clearTimeout(p)),b?l(b):c(y??"")},participantIdentity:i})}))}()})}registerRpcMethod(e,t){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=t,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const t=this.pendingAcks.get(e);t?(t.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,t,n){const i=this.pendingResponses.get(e);i?(i.resolve(t,n),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,t,n,i,r){return m(this,void 0,void 0,function*(){const s=new Xe({destinationIdentities:[e],kind:Y.RELIABLE,value:{case:"rpcRequest",value:new Bu({id:t,method:n,payload:i,responseTimeoutMs:r,version:1})}});yield this.engine.sendDataPacket(s,Y.RELIABLE)})}handleParticipantDisconnected(e){for(const[t,{participantIdentity:n}]of this.pendingAcks)n===e&&this.pendingAcks.delete(t);for(const[t,{participantIdentity:n,resolve:i}]of this.pendingResponses)n===e&&(i(null,ge.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(t))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(t=>t.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(t=>{var n,i;const r=this.trackPublications.get(t.sid);if(r){const s=r.isMuted||((i=(n=r.track)===null||n===void 0?void 0:n.isUpstreamPaused)!==null&&i!==void 0?i:!1);s!==t.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),ee(r)),{mutedOnServer:s})),this.engine.client.sendMuteTrack(t.sid,s))}}),!0):!1}getPublicationForTrack(e){let t;return this.trackPublications.forEach(n=>{const i=n.track;i&&(e instanceof MediaStreamTrack?($A(i)||dA(i))&&i.mediaStreamTrack===e&&(t=n):e===i&&(t=n))}),t}waitForPendingPublicationOfSource(e){return m(this,void 0,void 0,function*(){const n=Date.now();for(;Date.now()<n+1e4;){const i=Array.from(this.pendingPublishPromises.entries()).find(r=>{let[s]=r;return s.source===e});if(i)return i[1];yield qe(20)}})}}class iC extends Jt{constructor(e,t,n,i){super(e,t.sid,t.name,i),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=at.HIGH,this.handleEnded=r=>{this.setTrack(void 0),this.emit(k.Ended,r)},this.handleVisibilityChange=r=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(r),this.logContext),this.disabled=!r,this.emitTrackUpdate()},this.handleVideoDimensionsChange=r=>{this.log.debug("adaptivestream video dimensions ".concat(r.width,"x").concat(r.height),this.logContext),this.videoDimensions=r,this.emitTrackUpdate()},this.subscribed=n,this.updateInfo(t)}setSubscribed(e){const t=this.subscriptionStatus,n=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const i=new dr({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new yu({participantSid:"",trackSids:[this.trackSid]})]});this.emit(k.UpdateSubscription,i),this.emitSubscriptionUpdateIfChanged(t),this.emitPermissionUpdateIfChanged(n)}get subscriptionStatus(){return this.subscribed===!1?Jt.SubscriptionStatus.Unsubscribed:super.isSubscribed?Jt.SubscriptionStatus.Subscribed:Jt.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Jt.PermissionStatus.Allowed:Jt.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.disabled===!e||(this.disabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.currentVideoQuality===e||(this.currentVideoQuality=e,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var t,n;this.isManualOperationAllowed()&&(((t=this.videoDimensions)===null||t===void 0?void 0:t.width)===e.width&&((n=this.videoDimensions)===null||n===void 0?void 0:n.height)===e.height||(da(this.track)&&(this.videoDimensions=e),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&da(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(e){const t=this.subscriptionStatus,n=this.permissionStatus,i=this.track;i!==e&&(i&&(i.off(k.VideoDimensionsChanged,this.handleVideoDimensionsChange),i.off(k.VisibilityChanged,this.handleVisibilityChange),i.off(k.Ended,this.handleEnded),i.detach(),i.stopMonitor(),this.emit(k.Unsubscribed,i)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(k.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(k.VisibilityChanged,this.handleVisibilityChange),e.on(k.Ended,this.handleEnded),this.emit(k.Subscribed,e)),this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(t))}setAllowed(e){const t=this.subscriptionStatus,n=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(t)}setSubscriptionError(e){this.emit(k.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const t=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):t!==e.muted&&this.emit(e.muted?k.Muted:k.Unmuted)}emitSubscriptionUpdateIfChanged(e){const t=this.subscriptionStatus;e!==t&&this.emit(k.SubscriptionStatusChanged,t,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(k.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.kind===U.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return da(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new Iu({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(e.width=Math.ceil(this.videoDimensions.width),e.height=Math.ceil(this.videoDimensions.height)):this.currentVideoQuality!==void 0?e.quality=this.currentVideoQuality:e.quality=at.HIGH,this.emit(k.UpdateSettings,e)}}class Rr extends Bh{static fromParticipantInfo(e,t,n){return new Rr(e,t.sid,t.identity,t.name,t.metadata,t.attributes,n,t.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,t,n,i,r,s,o){let a=arguments.length>7&&arguments[7]!==void 0?arguments[7]:ur.STANDARD;super(t,n||"",i,r,s,o,a),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(k.UpdateSettings,t=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),ee(e))),this.signalClient.sendUpdateTrackSettings(t)}),e.on(k.UpdateSubscription,t=>{t.participantTracks.forEach(n=>{n.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(t)}),e.on(k.SubscriptionPermissionChanged,t=>{this.emit(x.TrackSubscriptionPermissionChanged,e,t)}),e.on(k.SubscriptionStatusChanged,t=>{this.emit(x.TrackSubscriptionStatusChanged,e,t)}),e.on(k.Subscribed,t=>{this.emit(x.TrackSubscribed,t,e)}),e.on(k.Unsubscribed,t=>{this.emit(x.TrackUnsubscribed,t,e)}),e.on(k.SubscriptionFailed,t=>{this.emit(x.TrackSubscriptionFailed,e.trackSid,t)})}getTrackPublication(e){const t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){const t=super.getTrackPublicationByName(e);if(t)return t}setVolume(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:U.Source.Microphone;this.volumeMap.set(t,e);const n=this.getTrackPublication(t);n&&n.track&&n.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:U.Source.Microphone;const t=this.getTrackPublication(e);return t&&t.track?t.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,t,n,i,r,s){let o=this.getTrackPublicationBySid(t);if(o||t.startsWith("TR")||this.trackPublications.forEach(l=>{!o&&e.kind===l.kind.toString()&&(o=l)}),!o){if(s===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:t})),this.emit(x.TrackSubscriptionFailed,t);return}s===void 0&&(s=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,t,n,i,r,s-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),ee(o))),this.emit(x.TrackSubscriptionFailed,t);return}const a=e.kind==="video";let c;return a?c=new Yv(e,t,i,r):c=new qv(e,t,i,this.audioContext,this.audioOutput),c.source=o.source,c.isMuted=o.isMuted,c.setMediaStream(n),c.start(),o.setTrack(c),this.volumeMap.has(o.source)&&ua(c)&&Wt(c)&&c.setVolume(this.volumeMap.get(o.source)),o}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const t=new Map,n=new Map;return e.tracks.forEach(i=>{var r,s;let o=this.getTrackPublicationBySid(i.sid);if(o)o.updateInfo(i);else{const a=U.kindFromProto(i.type);if(!a)return;o=new iC(a,i,(r=this.signalClient.connectOptions)===null||r===void 0?void 0:r.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(s=this.loggerOptions)===null||s===void 0?void 0:s.loggerName}),o.updateInfo(i),n.set(i.sid,o);const c=Array.from(this.trackPublications.values()).find(l=>l.source===o?.source);c&&o.source!==U.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(o.source),Object.assign(Object.assign({},this.logContext),{oldTrack:ee(c),newTrack:ee(o)})),this.addTrackPublication(o)}t.set(i.sid,o)}),this.trackPublications.forEach(i=>{t.has(i.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),ee(i))),this.unpublishTrack(i.trackSid,!0))}),n.forEach(i=>{this.emit(x.TrackPublished,i)}),!0}unpublishTrack(e,t){const n=this.trackPublications.get(e);if(!n)return;const{track:i}=n;switch(i&&(i.stop(),n.setTrack(void 0)),this.trackPublications.delete(e),n.kind){case U.Kind.Audio:this.audioTrackPublications.delete(e);break;case U.Kind.Video:this.videoTrackPublications.delete(e);break}t&&this.emit(x.TrackUnpublished,n)}setAudioOutput(e){return m(this,void 0,void 0,function*(){this.audioOutput=e;const t=[];this.audioTrackPublications.forEach(n=>{var i;Wt(n.track)&&ua(n.track)&&t.push(n.track.setSinkId((i=e.deviceId)!==null&&i!==void 0?i:"default"))}),yield Promise.all(t)})}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:n})),super.emit(e,...n)}}var z;(function(A){A.Disconnected="disconnected",A.Connecting="connecting",A.Connected="connected",A.Reconnecting="reconnecting",A.SignalReconnecting="signalReconnecting"})(z||(z={}));const rC=4*1e3;class WA extends xt.EventEmitter{constructor(e){var t,n,i,r;if(super(),t=this,this.state=z.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=j,this.bufferedEvents=[],this.isResuming=!1,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.rpcHandlers=new Map,this.connect=(s,o,a)=>m(this,void 0,void 0,function*(){var c;if(!$0())throw Rt()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const l=yield this.disconnectLock.lock();if(this.state===z.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),l(),Promise.resolve();if(this.connectFuture)return l(),this.connectFuture.promise;this.setAndEmitConnectionState(z.Connecting),((c=this.regionUrlProvider)===null||c===void 0?void 0:c.getServerUrl().toString())!==s&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),ra(new URL(s))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new ka(s,o):this.regionUrlProvider.updateToken(o),this.regionUrlProvider.fetchRegionSettings().then(h=>{var f;(f=this.regionUrlProvider)===null||f===void 0||f.setServerReportedRegions(h)}).catch(h=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:h}))}));const u=(h,f,g)=>m(this,void 0,void 0,function*(){var p,B;this.abortController&&this.abortController.abort();const y=new AbortController;this.abortController=y,l?.();try{yield this.attemptConnection(g??s,o,a,y),this.abortController=void 0,h()}catch(b){if(this.regionUrlProvider&&b instanceof se&&b.reason!==W.Cancelled&&b.reason!==W.NotAllowed){let v=null;try{v=yield this.regionUrlProvider.getNextBestRegionUrl((p=this.abortController)===null||p===void 0?void 0:p.signal)}catch(C){if(C instanceof se&&(C.status===401||C.reason===W.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),f(C);return}}v&&!(!((B=this.abortController)===null||B===void 0)&&B.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(b.message,". Retrying with another region: ").concat(v),this.logContext),this.recreateEngine(),yield u(h,f,v)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Kd(b)),f(b))}else{let v=mt.UNKNOWN_REASON;b instanceof se&&(v=Kd(b)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,v),f(b)}}}),d=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new ca((h,f)=>{u(h,f,d)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(s,o,a,c,l,u)=>m(this,void 0,void 0,function*(){var d,h,f;const g=yield a.join(s,o,{autoSubscribe:c.autoSubscribe,adaptiveStream:typeof l.adaptiveStream=="object"?!0:l.adaptiveStream,maxRetries:c.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:c.websocketTimeout},u.signal);let p=g.serverInfo;if(p||(p={version:g.serverVersion,region:g.serverRegion}),this.serverInfo=p,this.log.debug("connected to Livekit Server ".concat(Object.entries(p).map(B=>{let[y,b]=B;return"".concat(y,": ").concat(b)}).join(", ")),{room:(d=g.room)===null||d===void 0?void 0:d.name,roomSid:(h=g.room)===null||h===void 0?void 0:h.sid,identity:(f=g.participant)===null||f===void 0?void 0:f.identity}),!p.version)throw new I0("unknown server version");return p.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),l.dynacast=!1),g}),this.applyJoinResponse=s=>{const o=s.participant;if(this.localParticipant.sid=o.sid,this.localParticipant.identity=o.identity,this.localParticipant.setEnabledPublishCodecs(s.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(s.sifTrailer)}catch(a){this.log.error(a instanceof Error?a.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:a}))}this.handleParticipantUpdates([o,...s.otherParticipants]),s.room&&this.handleRoomUpdate(s.room)},this.attemptConnection=(s,o,a,c)=>m(this,void 0,void 0,function*(){var l,u;this.state===z.Reconnecting||this.isResuming||!((l=this.engine)===null||l===void 0)&&l.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((u=this.regionUrlProvider)===null||u===void 0)&&u.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},ba),a),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const d=yield this.connectSignal(s,o,this.engine,this.connOptions,this.options,c);this.applyJoinResponse(d),this.setupLocalParticipantEvents(),this.emit(Q.SignalConnected)}catch(d){yield this.engine.close(),this.recreateEngine();const h=new se("could not establish signal connection",W.ServerUnreachable);throw d instanceof Error&&(h.message="".concat(h.message,": ").concat(d.message)),d instanceof se&&(h.reason=d.reason,h.status=d.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:d})),h}if(c.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new se("Connection attempt aborted",W.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,c)}catch(d){throw yield this.engine.close(),this.recreateEngine(),d}Ye()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Ye()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(z.Connected),this.emit(Q.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];return m(t,[...o],void 0,function(){var c=this;let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var u,d,h,f;const g=yield c.disconnectLock.lock();try{if(c.state===z.Disconnected){c.log.debug("already disconnected",c.logContext);return}c.log.info("disconnect from room",Object.assign({},c.logContext)),(c.state===z.Connecting||c.state===z.Reconnecting||c.isResuming)&&(c.log.warn("abort connection attempt",c.logContext),(u=c.abortController)===null||u===void 0||u.abort(),(h=(d=c.connectFuture)===null||d===void 0?void 0:d.reject)===null||h===void 0||h.call(d,new se("Client initiated disconnect",W.Cancelled)),c.connectFuture=void 0),!((f=c.engine)===null||f===void 0)&&f.client.isDisconnected||(yield c.engine.client.sendLeave()),c.engine&&(yield c.engine.close()),c.handleDisconnect(l,mt.CLIENT_INITIATED),c.engine=void 0}finally{g()}}()})},this.onPageLeave=()=>m(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>m(this,void 0,void 0,function*(){const s=[],o=wt();if(o&&o.os==="iOS"){const a="livekit-dummy-audio-el";let c=document.getElementById(a);if(!c){c=document.createElement("audio"),c.id=a,c.autoplay=!0,c.hidden=!0;const l=aa();l.enabled=!0;const u=new MediaStream([l]);c.srcObject=u,document.addEventListener("visibilitychange",()=>{c&&(c.srcObject=document.hidden?null:u,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(c),this.once(Q.Disconnected,()=>{c?.remove(),c=null})}s.push(c)}this.remoteParticipants.forEach(a=>{a.audioTrackPublications.forEach(c=>{c.track&&c.track.attachedElements.forEach(l=>{s.push(l)})})});try{yield Promise.all([this.acquireAudioContext(),...s.map(a=>(a.muted=!1,a.play()))]),this.handleAudioPlaybackStarted()}catch(a){throw this.handleAudioPlaybackFailed(a),a}}),this.startVideo=()=>m(this,void 0,void 0,function*(){const s=[];for(const o of this.remoteParticipants.values())o.videoTrackPublications.forEach(a=>{var c;(c=a.track)===null||c===void 0||c.attachedElements.forEach(l=>{s.includes(l)||s.push(l)})});yield Promise.all(s.map(o=>o.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(o=>{o.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const s of this.remoteParticipants.values())this.handleParticipantDisconnected(s.identity,s);this.setAndEmitConnectionState(z.Reconnecting)&&this.emit(Q.Reconnecting)},this.handleSignalRestarted=s=>m(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(s.serverRegion),Object.assign(Object.assign({},this.logContext),{region:s.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(s);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(o){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:o}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:s.serverRegion}))}catch{return}this.setAndEmitConnectionState(z.Connected),this.emit(Q.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=s=>{s.forEach(o=>{var a;if(o.identity===this.localParticipant.identity){this.localParticipant.updateInfo(o);return}o.identity===""&&(o.identity=(a=this.sidToIdentity.get(o.sid))!==null&&a!==void 0?a:"");let c=this.remoteParticipants.get(o.identity);o.state===mn.DISCONNECTED?this.handleParticipantDisconnected(o.identity,c):c=this.getOrCreateParticipant(o.identity,o)})},this.handleActiveSpeakersUpdate=s=>{const o=[],a={};s.forEach(c=>{if(a[c.sid]=!0,c.sid===this.localParticipant.sid)this.localParticipant.audioLevel=c.level,this.localParticipant.setIsSpeaking(!0),o.push(this.localParticipant);else{const l=this.getRemoteParticipantBySid(c.sid);l&&(l.audioLevel=c.level,l.setIsSpeaking(!0),o.push(l))}}),a[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(c=>{a[c.sid]||(c.audioLevel=0,c.setIsSpeaking(!1))}),this.activeSpeakers=o,this.emitWhenConnected(Q.ActiveSpeakersChanged,o)},this.handleSpeakersChanged=s=>{const o=new Map;this.activeSpeakers.forEach(c=>{const l=this.remoteParticipants.get(c.identity);l&&l.sid!==c.sid||o.set(c.sid,c)}),s.forEach(c=>{let l=this.getRemoteParticipantBySid(c.sid);c.sid===this.localParticipant.sid&&(l=this.localParticipant),l&&(l.audioLevel=c.level,l.setIsSpeaking(c.active),c.active?o.set(c.sid,l):o.delete(c.sid))});const a=Array.from(o.values());a.sort((c,l)=>l.audioLevel-c.audioLevel),this.activeSpeakers=a,this.emitWhenConnected(Q.ActiveSpeakersChanged,a)},this.handleStreamStateUpdate=s=>{s.streamStates.forEach(o=>{const a=this.getRemoteParticipantBySid(o.participantSid);if(!a)return;const c=a.getTrackPublicationBySid(o.trackSid);if(!c||!c.track)return;const l=U.streamStateFromProto(o.state);l!==c.track.streamState&&(c.track.streamState=l,a.emit(x.TrackStreamStateChanged,c,c.track.streamState),this.emitWhenConnected(Q.TrackStreamStateChanged,c,c.track.streamState,a))})},this.handleSubscriptionPermissionUpdate=s=>{const o=this.getRemoteParticipantBySid(s.participantSid);if(!o)return;const a=o.getTrackPublicationBySid(s.trackSid);a&&a.setAllowed(s.allowed)},this.handleSubscriptionError=s=>{const o=Array.from(this.remoteParticipants.values()).find(c=>c.trackPublications.has(s.trackSid));if(!o)return;const a=o.getTrackPublicationBySid(s.trackSid);a&&a.setSubscriptionError(s.err)},this.handleDataPacket=s=>{const o=this.remoteParticipants.get(s.participantIdentity);if(s.value.case==="user")this.handleUserPacket(o,s.value.value,s.kind);else if(s.value.case==="transcription")this.handleTranscription(o,s.value.value);else if(s.value.case==="sipDtmf")this.handleSipDtmf(o,s.value.value);else if(s.value.case==="chatMessage")this.handleChatMessage(o,s.value.value);else if(s.value.case==="metrics")this.handleMetrics(s.value.value,o);else if(s.value.case==="streamHeader")this.handleStreamHeader(s.value.value,s.participantIdentity);else if(s.value.case==="streamChunk")this.handleStreamChunk(s.value.value);else if(s.value.case==="streamTrailer")this.handleStreamTrailer(s.value.value);else if(s.value.case==="rpcRequest"){const a=s.value.value;this.handleIncomingRpcRequest(s.participantIdentity,a.id,a.method,a.payload,a.responseTimeoutMs,a.version)}},this.handleUserPacket=(s,o,a)=>{this.emit(Q.DataReceived,o.payload,s,a,o.topic),s?.emit(x.DataReceived,o.payload,a)},this.handleSipDtmf=(s,o)=>{this.emit(Q.SipDTMFReceived,o,s),s?.emit(x.SipDTMFReceived,o)},this.bufferedSegments=new Map,this.handleTranscription=(s,o)=>{const a=o.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(o.transcribedParticipantIdentity),c=a?.trackPublications.get(o.trackId),l=ev(o,this.transcriptionReceivedTimes);c?.emit(k.TranscriptionReceived,l),a?.emit(x.TranscriptionReceived,l,c),this.emit(Q.TranscriptionReceived,l,a,c)},this.handleChatMessage=(s,o)=>{const a=tv(o);this.emit(Q.ChatMessage,a,s)},this.handleMetrics=(s,o)=>{this.emit(Q.MetricsReceived,s,o)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(Q.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=s=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:s})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(Q.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(Q.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(Q.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>m(this,void 0,void 0,function*(){var s,o,a;const c=Ue.getInstance().previousDevices,l=yield Ue.getInstance().getDevices(void 0,!1),u=wt();if(u?.name==="Chrome"&&u.os!=="iOS")for(let h of l){const f=c.find(g=>g.deviceId===h.deviceId);f&&f.label!==""&&f.kind===h.kind&&f.label!==h.label&&this.getActiveDevice(h.kind)==="default"&&this.emit(Q.ActiveDeviceChanged,h.kind,h.deviceId)}const d=["audiooutput","audioinput","videoinput"];for(let h of d){const f=rv(h),g=this.localParticipant.getTrackPublication(f);if(g&&(!((s=g.track)===null||s===void 0)&&s.isUserProvided))continue;const p=l.filter(y=>y.kind===h),B=this.getActiveDevice(h);if(B===((o=c.filter(y=>y.kind===h)[0])===null||o===void 0?void 0:o.deviceId)&&p.length>0&&((a=p[0])===null||a===void 0?void 0:a.deviceId)!==B){yield this.switchActiveDevice(h,p[0].deviceId);continue}h==="audioinput"&&!lA()||h==="videoinput"||p.length>0&&!p.find(y=>y.deviceId===this.getActiveDevice(h))&&(yield this.switchActiveDevice(h,p[0].deviceId))}this.emit(Q.MediaDevicesChanged)}),this.handleRoomUpdate=s=>{const o=this.roomInfo;this.roomInfo=s,o&&o.metadata!==s.metadata&&this.emitWhenConnected(Q.RoomMetadataChanged,s.metadata),o?.activeRecording!==s.activeRecording&&this.emitWhenConnected(Q.RecordingStatusChanged,s.activeRecording)},this.handleConnectionQualityUpdate=s=>{s.updates.forEach(o=>{if(o.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(o.quality);return}const a=this.getRemoteParticipantBySid(o.participantSid);a&&a.setConnectionQuality(o.quality)})},this.onLocalParticipantMetadataChanged=s=>{this.emit(Q.ParticipantMetadataChanged,s,this.localParticipant)},this.onLocalParticipantNameChanged=s=>{this.emit(Q.ParticipantNameChanged,s,this.localParticipant)},this.onLocalAttributesChanged=s=>{this.emit(Q.ParticipantAttributesChanged,s,this.localParticipant)},this.onLocalTrackMuted=s=>{this.emit(Q.TrackMuted,s,this.localParticipant)},this.onLocalTrackUnmuted=s=>{this.emit(Q.TrackUnmuted,s,this.localParticipant)},this.onTrackProcessorUpdate=s=>{var o;(o=s?.onPublish)===null||o===void 0||o.call(s,this)},this.onLocalTrackPublished=s=>m(this,void 0,void 0,function*(){var o,a,c,l,u,d;(o=s.track)===null||o===void 0||o.on(k.TrackProcessorUpdate,this.onTrackProcessorUpdate),(a=s.track)===null||a===void 0||a.on(k.Restarted,this.onLocalTrackRestarted),(u=(l=(c=s.track)===null||c===void 0?void 0:c.getProcessor())===null||l===void 0?void 0:l.onPublish)===null||u===void 0||u.call(l,this),this.emit(Q.LocalTrackPublished,s,this.localParticipant),$A(s.track)&&(yield s.track.checkForSilence())&&this.emit(Q.LocalAudioSilenceDetected,s);const h=yield(d=s.track)===null||d===void 0?void 0:d.getDeviceId(!1),f=$d(s.source);f&&h&&h!==this.localParticipant.activeDeviceMap.get(f)&&(this.localParticipant.activeDeviceMap.set(f,h),this.emit(Q.ActiveDeviceChanged,f,h))}),this.onLocalTrackUnpublished=s=>{var o,a;(o=s.track)===null||o===void 0||o.off(k.TrackProcessorUpdate,this.onTrackProcessorUpdate),(a=s.track)===null||a===void 0||a.off(k.Restarted,this.onLocalTrackRestarted),this.emit(Q.LocalTrackUnpublished,s,this.localParticipant)},this.onLocalTrackRestarted=s=>m(this,void 0,void 0,function*(){const o=yield s.getDeviceId(!1),a=$d(s.source);a&&o&&o!==this.localParticipant.activeDeviceMap.get(a)&&(this.log.debug("local track restarted, setting ".concat(a," ").concat(o," active"),this.logContext),this.localParticipant.activeDeviceMap.set(a,o),this.emit(Q.ActiveDeviceChanged,a,o))}),this.onLocalConnectionQualityChanged=s=>{this.emit(Q.ConnectionQualityChanged,s,this.localParticipant)},this.onMediaDevicesError=s=>{this.emit(Q.MediaDevicesError,s)},this.onLocalParticipantPermissionsChanged=s=>{this.emit(Q.ParticipantPermissionsChanged,s,this.localParticipant)},this.onLocalChatMessageSent=s=>{this.emit(Q.ChatMessage,s,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},Uv),e),this.log=jt((n=this.options.loggerName)!==null&&n!==void 0?n:Ct.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},nh),e?.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},ih),e?.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},Sv),e?.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new We,this.localParticipant=new nC("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",uA(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",uA(this.options.audioCaptureDefaults.deviceId)),!((i=this.options.audioOutput)===null||i===void 0)&&i.deviceId&&this.switchActiveDevice("audiooutput",uA(this.options.audioOutput.deviceId)).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message),this.logContext)),this.options.e2ee&&this.setupE2EE(),Ye()){const s=new AbortController;(r=navigator.mediaDevices)===null||r===void 0||r.addEventListener("devicechange",this.handleDeviceChange,{signal:s.signal}),WA.cleanupRegistry&&WA.cleanupRegistry.register(this,()=>{s.abort()})}}registerTextStreamHandler(e,t){if(this.textStreamHandlers.has(e))throw new TypeError('A text stream handler for topic "'.concat(e,'" has already been set.'));this.textStreamHandlers.set(e,t)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,t){if(this.byteStreamHandlers.has(e))throw new TypeError('A byte stream handler for topic "'.concat(e,'" has already been set.'));this.byteStreamHandlers.set(e,t)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}registerRpcMethod(e,t){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}handleIncomingRpcRequest(e,t,n,i,r,s){return m(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,t),s!==1){yield this.engine.publishRpcResponse(e,t,null,ge.builtIn("UNSUPPORTED_VERSION"));return}const o=this.rpcHandlers.get(n);if(!o){yield this.engine.publishRpcResponse(e,t,null,ge.builtIn("UNSUPPORTED_METHOD"));return}let a=null,c=null;try{const l=yield o({requestId:t,callerIdentity:e,payload:i,responseTimeout:r});Ea(l)>rh?(a=ge.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(n))):c=l}catch(l){l instanceof ge?a=l:(console.warn("Uncaught error returned by RPC handler for ".concat(n,". Returning APPLICATION_ERROR instead."),l),a=ge.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,t,c,a)})}setE2EEEnabled(e){return m(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new uv(this.options.e2ee),this.e2eeManager.on(aA.ParticipantEncryptionStatusChanged,(t,n)=>{nv(n)&&(this.isE2EEEnabled=t),this.emit(Q.ParticipantEncryptionStatusChanged,t,n)}),this.e2eeManager.on(aA.EncryptionError,t=>this.emit(Q.EncryptionError,t)),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&t!==void 0?t:!1}getSid(){return m(this,void 0,void 0,function*(){return this.state===z.Disconnected?"":this.roomInfo&&this.roomInfo.sid!==""?this.roomInfo.sid:new Promise((e,t)=>{const n=i=>{i.sid!==""&&(this.engine.off(I.RoomUpdate,n),e(i.sid))};this.engine.on(I.RoomUpdate,n),this.once(Q.Disconnected,()=>{this.engine.off(I.RoomUpdate,n),t("Room disconnected before room server id was available")})})})}get name(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&t!==void 0?t:0}get numPublishers(){var e,t;return(t=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&t!==void 0?t:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new Kv(this.options),this.engine.on(I.ParticipantUpdate,this.handleParticipantUpdates).on(I.RoomUpdate,this.handleRoomUpdate).on(I.SpeakersChanged,this.handleSpeakersChanged).on(I.StreamStateChanged,this.handleStreamStateUpdate).on(I.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(I.SubscriptionError,this.handleSubscriptionError).on(I.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(I.MediaTrackAdded,(e,t,n)=>{this.onTrackAdded(e,t,n)}).on(I.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(I.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(I.DataPacketReceived,this.handleDataPacket).on(I.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(z.SignalReconnecting)&&this.emit(Q.SignalReconnecting)}).on(I.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(z.Connected)&&this.emit(Q.Reconnected)}).on(I.SignalResumed,()=>{this.bufferedEvents=[],(this.state===z.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(I.Restarting,this.handleRestarting).on(I.SignalRestarted,this.handleSignalRestarted).on(I.Offline,()=>{this.setAndEmitConnectionState(z.Reconnecting)&&this.emit(Q.Reconnecting)}).on(I.DCBufferStatusChanged,(e,t)=>{this.emit(Q.DCBufferStatusChanged,e,t)}).on(I.LocalTrackSubscribed,e=>{const t=this.localParticipant.getTrackPublications().find(n=>{let{trackSid:i}=n;return i===e});if(!t){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(x.LocalTrackSubscribed,t),this.emitWhenConnected(Q.LocalTrackSubscribed,t,this.localParticipant)}).on(I.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((t,n)=>{this.handleParticipantDisconnected(n,t)}),this.emit(Q.Moved,e.room.name,e.token),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ue.getInstance().getDevices(e,t)}prepareConnection(e,t){return m(this,void 0,void 0,function*(){if(this.state===z.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(ra(new URL(e))&&t){this.regionUrlProvider=new ka(e,t);const n=yield this.regionUrlProvider.getNextBestRegionUrl();n&&this.state===z.Disconnected&&(this.regionUrl=n,yield fetch(la(n),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(n),this.logContext))}else yield fetch(la(e),{method:"HEAD"})}catch(n){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:n}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,t){return m(this,void 0,void 0,function*(){let n=()=>{},i;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":i=new _t({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":i=new _t({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":i=new _t({scenario:{case:"serverLeave",value:!0}});break;case"migration":i=new _t({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":n=()=>m(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new _t({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":n=()=>m(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new _t({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":i=new _t({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),n=()=>m(this,void 0,void 0,function*(){const r=this.engine.client.onLeave;r&&r(new hr({reason:mt.CLIENT_INITIATED,action:vn.RECONNECT}))});break;case"subscriber-bandwidth":if(t===void 0||typeof t!="number")throw new Error("subscriber-bandwidth requires a number as argument");i=new _t({scenario:{case:"subscriberBandwidth",value:jA(t)}});break;case"leave-full-reconnect":i=new _t({scenario:{case:"leaveRequestFullReconnect",value:!0}})}i&&(yield this.engine.client.sendSimulateScenario(i),yield n())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,t){return m(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var o,a,c,l,u,d,h,f;let g=!0,p=!1;const B=s?{exact:i}:i;if(n==="audioinput"){p=r.localParticipant.audioTrackPublications.size===0;const y=(o=r.getActiveDevice(n))!==null&&o!==void 0?o:r.options.audioCaptureDefaults.deviceId;r.options.audioCaptureDefaults.deviceId=B;const b=Array.from(r.localParticipant.audioTrackPublications.values()).filter(v=>v.source===U.Source.Microphone);try{g=(yield Promise.all(b.map(v=>{var C;return(C=v.audioTrack)===null||C===void 0?void 0:C.setDeviceId(B)}))).every(v=>v===!0)}catch(v){throw r.options.audioCaptureDefaults.deviceId=y,v}}else if(n==="videoinput"){p=r.localParticipant.videoTrackPublications.size===0;const y=(a=r.getActiveDevice(n))!==null&&a!==void 0?a:r.options.videoCaptureDefaults.deviceId;r.options.videoCaptureDefaults.deviceId=B;const b=Array.from(r.localParticipant.videoTrackPublications.values()).filter(v=>v.source===U.Source.Camera);try{g=(yield Promise.all(b.map(v=>{var C;return(C=v.videoTrack)===null||C===void 0?void 0:C.setDeviceId(B)}))).every(v=>v===!0)}catch(v){throw r.options.videoCaptureDefaults.deviceId=y,v}}else if(n==="audiooutput"){if(!ia()&&!r.options.webAudioMix||r.options.webAudioMix&&r.audioContext&&!("setSinkId"in r.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");r.options.webAudioMix&&(i=(c=yield Ue.getInstance().normalizeDeviceId("audiooutput",i))!==null&&c!==void 0?c:""),(l=(f=r.options).audioOutput)!==null&&l!==void 0||(f.audioOutput={});const y=(u=r.getActiveDevice(n))!==null&&u!==void 0?u:r.options.audioOutput.deviceId;r.options.audioOutput.deviceId=i;try{r.options.webAudioMix&&((d=r.audioContext)===null||d===void 0||d.setSinkId(i)),yield Promise.all(Array.from(r.remoteParticipants.values()).map(b=>b.setAudioOutput({deviceId:i})))}catch(b){throw r.options.audioOutput.deviceId=y,b}}return(p||n==="audiooutput")&&(r.localParticipant.activeDeviceMap.set(n,n==="audiooutput"&&((h=r.options.audioOutput)===null||h===void 0?void 0:h.deviceId)||i),r.emit(Q.ActiveDeviceChanged,n,i)),g}()})}setupLocalParticipantEvents(){this.localParticipant.on(x.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(x.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(x.AttributesChanged,this.onLocalAttributesChanged).on(x.TrackMuted,this.onLocalTrackMuted).on(x.TrackUnmuted,this.onLocalTrackUnmuted).on(x.LocalTrackPublished,this.onLocalTrackPublished).on(x.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(x.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(x.MediaDevicesError,this.onMediaDevicesError).on(x.AudioStreamAcquired,this.startAudio).on(x.ChatMessage,this.onLocalChatMessageSent).on(x.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,t,n){if(this.state===z.Connecting||this.state===z.Reconnecting){const l=()=>{this.onTrackAdded(e,t,n),u()},u=()=>{this.off(Q.Reconnected,l),this.off(Q.Connected,l),this.off(Q.Disconnected,u)};this.once(Q.Reconnected,l),this.once(Q.Connected,l),this.once(Q.Disconnected,u);return}if(this.state===z.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const i=V0(t.id),r=i[0];let s=i[1],o=e.id;if(s&&s.startsWith("TR")&&(o=s),r===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const a=Array.from(this.remoteParticipants.values()).find(l=>l.sid===r);if(!a){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(r),this.logContext);return}let c;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?c=this.options.adaptiveStream:c={}),a.addSubscribedMediaTrack(e,o,t,n,c)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1?arguments[1]:void 0;var n;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==z.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(i=>{i.trackPublications.forEach(r=>{i.unpublishTrack(r.trackSid)})}),this.localParticipant.trackPublications.forEach(i=>{var r,s,o;i.track&&this.localParticipant.unpublishTrack(i.track,e),e?((r=i.track)===null||r===void 0||r.detach(),(s=i.track)===null||s===void 0||s.stop()):(o=i.track)===null||o===void 0||o.stopMonitor()}),this.localParticipant.off(x.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(x.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(x.AttributesChanged,this.onLocalAttributesChanged).off(x.TrackMuted,this.onLocalTrackMuted).off(x.TrackUnmuted,this.onLocalTrackUnmuted).off(x.LocalTrackPublished,this.onLocalTrackPublished).off(x.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(x.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(x.MediaDevicesError,this.onMediaDevicesError).off(x.AudioStreamAcquired,this.startAudio).off(x.ChatMessage,this.onLocalChatMessageSent).off(x.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),Ye()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(n=navigator.mediaDevices)===null||n===void 0||n.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(z.Disconnected),this.emit(Q.Disconnected,t)}}}handleParticipantDisconnected(e,t){var n;this.remoteParticipants.delete(e),t&&(t.trackPublications.forEach(i=>{t.unpublishTrack(i.trackSid,!0)}),this.emit(Q.ParticipantDisconnected,t),t.setDisconnected(),(n=this.localParticipant)===null||n===void 0||n.handleParticipantDisconnected(t.identity))}handleStreamHeader(e,t){return m(this,void 0,void 0,function*(){var n;if(e.contentHeader.case==="byteHeader"){const i=this.byteStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let r;const s={id:e.streamId,name:(n=e.contentHeader.value.name)!==null&&n!==void 0?n:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Ur(e.timestamp),attributes:e.attributes},o=new ReadableStream({start:a=>{r=a,this.byteStreamControllers.set(e.streamId,{info:s,controller:r,startTime:Date.now()})}});i(new $v(s,o,Ur(e.totalLength)),{identity:t})}else if(e.contentHeader.case==="textHeader"){const i=this.textStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let r;const s={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes},o=new ReadableStream({start:a=>{r=a,this.textStreamControllers.set(e.streamId,{info:s,controller:r,startTime:Date.now()})}});i(new Wv(s,o,Ur(e.totalLength)),{identity:t})}})}handleStreamChunk(e){const t=this.byteStreamControllers.get(e.streamId);t&&e.content.length>0&&t.controller.enqueue(e);const n=this.textStreamControllers.get(e.streamId);n&&e.content.length>0&&n.controller.enqueue(e)}handleStreamTrailer(e){const t=this.textStreamControllers.get(e.streamId);t&&(t.info.attributes=Object.assign(Object.assign({},t.info.attributes),e.attributes),t.controller.close(),this.textStreamControllers.delete(e.streamId));const n=this.byteStreamControllers.get(e.streamId);n&&(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.byteStreamControllers.delete(e.streamId))}acquireAudioContext(){return m(this,void 0,void 0,function*(){var e,t;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=jd())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(i=>i.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),qe(200)])}catch(i){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:i}))}const n=((t=this.audioContext)===null||t===void 0?void 0:t.state)==="running";n!==this.canPlaybackAudio&&(this.audioEnabled=n,this.emit(Q.AudioPlaybackStatusChanged,n))})}createParticipant(e,t){var n;let i;return t?i=Rr.fromParticipantInfo(this.engine.client,t,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):i=new Rr(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&i.setAudioContext(this.audioContext),!((n=this.options.audioOutput)===null||n===void 0)&&n.deviceId&&i.setAudioOutput(this.options.audioOutput).catch(r=>this.log.warn("Could not set audio output: ".concat(r.message),this.logContext)),i}getOrCreateParticipant(e,t){if(this.remoteParticipants.has(e)){const i=this.remoteParticipants.get(e);return t&&i.updateInfo(t)&&this.sidToIdentity.set(t.sid,t.identity),i}const n=this.createParticipant(e,t);return this.remoteParticipants.set(e,n),this.sidToIdentity.set(t.sid,t.identity),this.emitWhenConnected(Q.ParticipantConnected,n),n.on(x.TrackPublished,i=>{this.emitWhenConnected(Q.TrackPublished,i,n)}).on(x.TrackSubscribed,(i,r)=>{i.kind===U.Kind.Audio?(i.on(k.AudioPlaybackStarted,this.handleAudioPlaybackStarted),i.on(k.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):i.kind===U.Kind.Video&&(i.on(k.VideoPlaybackFailed,this.handleVideoPlaybackFailed),i.on(k.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(Q.TrackSubscribed,i,r,n)}).on(x.TrackUnpublished,i=>{this.emit(Q.TrackUnpublished,i,n)}).on(x.TrackUnsubscribed,(i,r)=>{this.emit(Q.TrackUnsubscribed,i,r,n)}).on(x.TrackMuted,i=>{this.emitWhenConnected(Q.TrackMuted,i,n)}).on(x.TrackUnmuted,i=>{this.emitWhenConnected(Q.TrackUnmuted,i,n)}).on(x.ParticipantMetadataChanged,i=>{this.emitWhenConnected(Q.ParticipantMetadataChanged,i,n)}).on(x.ParticipantNameChanged,i=>{this.emitWhenConnected(Q.ParticipantNameChanged,i,n)}).on(x.AttributesChanged,i=>{this.emitWhenConnected(Q.ParticipantAttributesChanged,i,n)}).on(x.ConnectionQualityChanged,i=>{this.emitWhenConnected(Q.ConnectionQualityChanged,i,n)}).on(x.ParticipantPermissionsChanged,i=>{this.emitWhenConnected(Q.ParticipantPermissionsChanged,i,n)}).on(x.TrackSubscriptionStatusChanged,(i,r)=>{this.emitWhenConnected(Q.TrackSubscriptionStatusChanged,i,r,n)}).on(x.TrackSubscriptionFailed,(i,r)=>{this.emit(Q.TrackSubscriptionFailed,i,n,r)}).on(x.TrackSubscriptionPermissionChanged,(i,r)=>{this.emitWhenConnected(Q.TrackSubscriptionPermissionChanged,i,r,n)}).on(x.Active,()=>{this.emitWhenConnected(Q.ParticipantActive,n)}),t&&n.updateInfo(t),n}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((n,i)=>(n.push(...i.getTrackPublications()),n),[]),t=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,t)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const t of e.videoTrackPublications.values())t.isSubscribed&&Av(t)&&t.emitTrackUpdate()}getRemoteParticipantBySid(e){const t=this.sidToIdentity.get(e);if(t)return this.remoteParticipants.get(t)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Fe.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,mt.STATE_MISMATCH))):e=0},rC)}clearConnectionReconcile(){this.connectionReconcileInterval&&Fe.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(Q.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[t,n]=e;this.emit(t,...n)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(this.state===z.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,n]);else if(this.state===z.Connected)return this.emit(e,...n);return!1}simulateParticipants(e){return m(this,void 0,void 0,function*(){var t,n;const i=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),r=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new cr({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:ue.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new MA({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(Q.SignalConnected),this.emit(Q.Connected),this.setAndEmitConnectionState(z.Connected),i.video){const s=new xa(U.Kind.Video,new Bn({source:we.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:pt.AUDIO,name:"video-dummy"}),new _r(i.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:Nd(160*((t=r.aspectRatios[0])!==null&&t!==void 0?t:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(s),this.localParticipant.emit(x.LocalTrackPublished,s)}if(i.audio){const s=new xa(U.Kind.Audio,new Bn({source:we.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:pt.AUDIO}),new kr(i.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:aa(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(s),this.localParticipant.emit(x.LocalTrackPublished,s)}for(let s=0;s<r.count-1;s+=1){let o=new MA({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(s),state:mn.ACTIVE,tracks:[],joinedAt:ue.parse(Date.now())});const a=this.getOrCreateParticipant(o.identity,o);if(r.video){const c=Nd(160*((n=r.aspectRatios[s%r.aspectRatios.length])!==null&&n!==void 0?n:1),160,!1,!0),l=new Bn({source:we.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:pt.AUDIO});a.addSubscribedMediaTrack(c,l.sid,new MediaStream([c]),new RTCRtpReceiver),o.tracks=[...o.tracks,l]}if(r.audio){const c=aa(),l=new Bn({source:we.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:pt.AUDIO});a.addSubscribedMediaTrack(c,l.sid,new MediaStream([c]),new RTCRtpReceiver),o.tracks=[...o.tracks,l]}a.updateInfo(o)}})}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(e!==Q.ActiveSpeakersChanged&&e!==Q.TranscriptionReceived){const r=Ch(n).filter(s=>s!==void 0);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:r}))}return super.emit(e,...n)}}WA.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(A=>{A()});function Ch(A){return A.map(e=>{if(e)return Array.isArray(e)?Ch(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var Et;(function(A){A[A.IDLE=0]="IDLE",A[A.RUNNING=1]="RUNNING",A[A.SKIPPED=2]="SKIPPED",A[A.SUCCESS=3]="SUCCESS",A[A.FAILED=4]="FAILED"})(Et||(Et={}));class gA extends xt.EventEmitter{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=Et.IDLE,this.logs=[],this.options={},this.url=e,this.token=t,this.name=this.constructor.name,this.room=new WA(n.roomOptions),this.connectOptions=n.connectOptions,this.options=n}run(e){return m(this,void 0,void 0,function*(){if(this.status!==Et.IDLE)throw Error("check is running already");this.setStatus(Et.RUNNING);try{yield this.perform()}catch(t){t instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(t.message):this.appendError(t.message))}return yield this.disconnect(),yield new Promise(t=>setTimeout(t,500)),this.status!==Et.SKIPPED&&this.setStatus(this.isSuccess()?Et.SUCCESS:Et.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return m(this,void 0,void 0,function*(){return this.room.state===z.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return m(this,void 0,void 0,function*(){this.room&&this.room.state!==z.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(Et.SKIPPED)}switchProtocol(e){return m(this,void 0,void 0,function*(){let t=!1,n=!1;if(this.room.on(Q.Reconnecting,()=>{t=!0}),this.room.once(Q.Reconnected,()=>{n=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(r=>setTimeout(r,1e3)),!t)return;const i=Date.now()+1e4;for(;Date.now()<i;){if(n)return;yield qe(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class sC extends gA{get description(){return"Cloud regions"}perform(){return m(this,void 0,void 0,function*(){const e=new ka(this.url,this.token);if(!e.isCloud()){this.skip();return}const t=[],n=new Set;for(let r=0;r<3;r++){const s=yield e.getNextBestRegionUrl();if(!s)break;if(n.has(s))continue;n.add(s);const o=yield this.checkCloudRegion(s);this.appendMessage("".concat(o.region," RTT: ").concat(o.rtt,"ms, duration: ").concat(o.duration,"ms")),t.push(o)}t.sort((r,s)=>(r.duration-s.duration)*.5+(r.rtt-s.rtt)*.5);const i=t[0];this.bestStats=i,this.appendMessage("best Cloud region: ".concat(i.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return m(this,void 0,void 0,function*(){var t,n;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const i=(t=this.room.serverInfo)===null||t===void 0?void 0:t.region;if(!i)throw new Error("Region not found");const r=yield this.room.localParticipant.streamText({topic:"test"}),s=1e3,a=1e6/s,c="A".repeat(s),l=Date.now();for(let f=0;f<a;f++)yield r.write(c);yield r.close();const u=Date.now(),d=yield(n=this.room.engine.pcManager)===null||n===void 0?void 0:n.publisher.getStats(),h={region:i,rtt:1e4,duration:u-l};return d?.forEach(f=>{f.type==="candidate-pair"&&f.nominated&&(h.rtt=f.currentRoundTripTime*1e3)}),yield this.disconnect(),h})}}const Ra=1e4;class oC extends gA{get description(){return"Connection via UDP vs TCP"}perform(){return m(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),t=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-t.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-t.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=t):this.appendMessage("best connection quality via udp");const n=this.bestStats;this.appendMessage("upstream bitrate: ".concat((n.bitrateTotal/n.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((n.rttTotal/n.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((n.jitterTotal/n.count*1e3).toFixed(2)," ms")),n.packetsLost>0&&this.appendWarning("packets lost: ".concat((n.packetsLost/n.packetsSent*100).toFixed(2),"%")),n.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((n.qualityLimitationDurations.bandwidth/(Ra/1e3)*100).toFixed(2),"%")),n.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((n.qualityLimitationDurations.cpu/(Ra/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return m(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const t=document.createElement("canvas");t.width=1280,t.height=720;const n=t.getContext("2d");if(!n)throw new Error("Could not get canvas context");let i=0;const r=()=>{i=(i+1)%360,n.fillStyle="hsl(".concat(i,", 100%, 50%)"),n.fillRect(0,0,t.width,t.height),requestAnimationFrame(r)};r();const o=t.captureStream(30).getVideoTracks()[0],c=(yield this.room.localParticipant.publishTrack(o,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,l={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},u=setInterval(()=>m(this,void 0,void 0,function*(){const d=yield c.getRTCStatsReport();d?.forEach(h=>{h.type==="outbound-rtp"?(l.packetsSent=h.packetsSent,l.qualityLimitationDurations=h.qualityLimitationDurations,l.bitrateTotal+=h.targetBitrate,l.count++):h.type==="remote-inbound-rtp"&&(l.packetsLost=h.packetsLost,l.rttTotal+=h.roundTripTime,l.jitterTotal+=h.jitter)})}),1e3);return yield new Promise(d=>setTimeout(d,Ra)),clearInterval(u),o.stop(),t.remove(),yield this.disconnect(),l})}}class aC extends gA{get description(){return"Can publish audio"}perform(){return m(this,void 0,void 0,function*(){var e;const t=yield this.connect(),n=yield eC();if(yield Gd(n,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),t.localParticipant.publishTrack(n),yield new Promise(o=>setTimeout(o,3e3));const r=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!r)throw new Error("Could not get RTCStats");let s=0;if(r.forEach(o=>{o.type==="outbound-rtp"&&(o.kind==="audio"||!o.kind&&o.mediaType==="audio")&&(s=o.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," audio packets"))})}}class cC extends gA{get description(){return"Can publish video"}perform(){return m(this,void 0,void 0,function*(){var e;const t=yield this.connect(),n=yield Zv();yield this.checkForVideo(n.mediaStreamTrack),t.localParticipant.publishTrack(n),yield new Promise(s=>setTimeout(s,5e3));const i=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!i)throw new Error("Could not get RTCStats");let r=0;if(i.forEach(s=>{s.type==="outbound-rtp"&&(s.kind==="video"||!s.kind&&s.mediaType==="video")&&(r+=s.packetsSent)}),r===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(r," video packets"))})}checkForVideo(e){return m(this,void 0,void 0,function*(){const t=new MediaStream;t.addTrack(e.clone());const n=document.createElement("video");n.srcObject=t,n.muted=!0,yield new Promise(i=>{n.onplay=()=>{setTimeout(()=>{var r,s,o,a;const c=document.createElement("canvas"),l=e.getSettings(),u=(s=(r=l.width)!==null&&r!==void 0?r:n.videoWidth)!==null&&s!==void 0?s:1280,d=(a=(o=l.height)!==null&&o!==void 0?o:n.videoHeight)!==null&&a!==void 0?a:720;c.width=u,c.height=d;const h=c.getContext("2d");h.drawImage(n,0,0);const g=h.getImageData(0,0,c.width,c.height).data;let p=!0;for(let B=0;B<g.length;B+=4)if(g[B]!==0||g[B+1]!==0||g[B+2]!==0){p=!1;break}p?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),i()},1e3)},n.play()}),n.remove()})}}class lC extends gA{get description(){return"Resuming connection after interruption"}perform(){return m(this,void 0,void 0,function*(){var e;const t=yield this.connect();let n=!1,i=!1,r;const s=new Promise(c=>{setTimeout(c,5e3),r=c}),o=()=>{n=!0};t.on(Q.SignalReconnecting,o).on(Q.Reconnecting,o).on(Q.Reconnected,()=>{i=!0,r(!0)}),(e=t.engine.client.ws)===null||e===void 0||e.close();const a=t.engine.client.onClose;if(a&&a(""),yield s,n){if(!i||t.state!==z.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class uC extends gA{get description(){return"Can connect via TURN"}perform(){return m(this,void 0,void 0,function*(){var e,t;const n=new pa,i=yield n.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});let r=!1,s=!1,o=!1;for(let a of i.iceServers)for(let c of a.urls)c.startsWith("turn:")?(s=!0,o=!0):c.startsWith("turns:")&&(s=!0,o=!0,r=!0),c.startsWith("stun:")&&(o=!0);o?s&&!r&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield n.close(),!((t=(e=this.connectOptions)===null||e===void 0?void 0:e.rtcConfig)===null||t===void 0)&&t.iceServers||s?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(a=>setTimeout(a,0)))})}}class dC extends gA{get description(){return"Establishing WebRTC connection"}perform(){return m(this,void 0,void 0,function*(){let e=!1,t=!1;this.room.on(Q.SignalConnected,()=>{const n=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(i,r)=>{if(i.candidate){const s=new RTCIceCandidate(i);let o="".concat(s.protocol," ").concat(s.address,":").concat(s.port," ").concat(s.type);s.address&&(hC(s.address)?o+=" (private)":s.protocol==="tcp"&&s.tcpType==="passive"?(e=!0,o+=" (passive)"):s.protocol==="udp"&&(t=!0)),this.appendMessage(o)}n&&n(i,r)},this.room.engine.pcManager&&(this.room.engine.pcManager.subscriber.onIceCandidateError=i=>{i instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(i.errorCode," ").concat(i.errorText," ").concat(i.url))})});try{yield this.connect(),j.info("now the room is connected")}catch(n){throw this.appendWarning("ports need to be open on firewall in order to connect."),n}e||this.appendWarning("Server is not configured for ICE/TCP"),t||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function hC(A){const e=A.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const t=parseInt(e[1],10);if(t>=16&&t<=31)return!0}}return!1}class fC extends gA{get description(){return"Connecting to signal connection via WebSocket"}perform(){return m(this,void 0,void 0,function*(){var e,t,n;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let i=new pa;const r=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});this.appendMessage("Connected to server, version ".concat(r.serverVersion,".")),((e=r.serverInfo)===null||e===void 0?void 0:e.edition)===bu.Cloud&&(!((t=r.serverInfo)===null||t===void 0)&&t.region)&&this.appendMessage("LiveKit Cloud: ".concat((n=r.serverInfo)===null||n===void 0?void 0:n.region)),yield i.close()})}}class I1 extends xt.EventEmitter{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=t,this.options=n}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:Et.IDLE,name:"",description:""}),e}updateCheck(e,t){this.checkResults.set(e,t),this.emit("checkUpdate",e,t)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==Et.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return m(this,void 0,void 0,function*(){const t=this.getNextCheckId(),n=new e(this.url,this.token,this.options),i=s=>{this.updateCheck(t,s)};n.on("update",i);const r=yield n.run();return n.off("update",i),r})}checkWebsocket(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(fC)})}checkWebRTC(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(dC)})}checkTURN(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(uC)})}checkReconnect(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(lC)})}checkPublishAudio(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(aC)})}checkPublishVideo(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(cC)})}checkConnectionProtocol(){return m(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(oC);if(e.data&&"protocol"in e.data){const t=e.data;this.options.protocol=t.protocol}return e})}checkCloudRegion(){return m(this,void 0,void 0,function*(){return this.createAndRunCheck(sC)})}}const ze=Symbol.for("@ts-pattern/matcher"),wh=Symbol.for("@ts-pattern/isVariadic"),Pr="@ts-pattern/anonymous-select-key",Pa=A=>!!(A&&typeof A=="object"),Lr=A=>A&&!!A[ze],ke=(A,e,t)=>{if(Lr(A)){const n=A[ze](),{matched:i,selections:r}=n.match(e);return i&&r&&Object.keys(r).forEach(s=>t(s,r[s])),i}if(Pa(A)){if(!Pa(e))return!1;if(Array.isArray(A)){if(!Array.isArray(e))return!1;let n=[],i=[],r=[];for(const s of A.keys()){const o=A[s];Lr(o)&&o[wh]?r.push(o):r.length?i.push(o):n.push(o)}if(r.length){if(r.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(e.length<n.length+i.length)return!1;const s=e.slice(0,n.length),o=i.length===0?[]:e.slice(-i.length),a=e.slice(n.length,i.length===0?1/0:-i.length);return n.every((c,l)=>ke(c,s[l],t))&&i.every((c,l)=>ke(c,o[l],t))&&(r.length===0||ke(r[0],a,t))}return A.length===e.length&&A.every((s,o)=>ke(s,e[o],t))}return Reflect.ownKeys(A).every(n=>{const i=A[n];return(n in e||Lr(r=i)&&r[ze]().matcherType==="optional")&&ke(i,e[n],t);var r})}return Object.is(e,A)},nt=A=>{var e,t,n;return Pa(A)?Lr(A)?(e=(t=(n=A[ze]()).getSelectionKeys)==null?void 0:t.call(n))!=null?e:[]:Array.isArray(A)?ui(A,nt):ui(Object.values(A),nt):[]},ui=(A,e)=>A.reduce((t,n)=>t.concat(e(n)),[]);function gC(...A){if(A.length===1){const[e]=A;return t=>ke(e,t,()=>{})}if(A.length===2){const[e,t]=A;return ke(e,t,()=>{})}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${A.length}.`)}function Ie(A){return Object.assign(A,{optional:()=>Da(A),and:e=>ce(A,e),or:e=>yh(A,e),select:e=>e===void 0?di(A):di(e,A)})}function La(A){return Object.assign((e=>Object.assign(e,{[Symbol.iterator](){let t=0;const n=[{value:Object.assign(e,{[wh]:!0}),done:!1},{done:!0,value:void 0}];return{next:()=>{var i;return(i=n[t++])!=null?i:n.at(-1)}}}}))(A),{optional:()=>La(Da(A)),select:e=>La(e===void 0?di(A):di(e,A))})}function Da(A){return Ie({[ze]:()=>({match:e=>{let t={};const n=(i,r)=>{t[i]=r};return e===void 0?(nt(A).forEach(i=>n(i,void 0)),{matched:!0,selections:t}):{matched:ke(A,e,n),selections:t}},getSelectionKeys:()=>nt(A),matcherType:"optional"})})}const pC=(A,e)=>{for(const t of A)if(!e(t))return!1;return!0},mC=(A,e)=>{for(const[t,n]of A.entries())if(!e(n,t))return!1;return!0};function ce(...A){return Ie({[ze]:()=>({match:e=>{let t={};const n=(i,r)=>{t[i]=r};return{matched:A.every(i=>ke(i,e,n)),selections:t}},getSelectionKeys:()=>ui(A,nt),matcherType:"and"})})}function yh(...A){return Ie({[ze]:()=>({match:e=>{let t={};const n=(i,r)=>{t[i]=r};return ui(A,nt).forEach(i=>n(i,void 0)),{matched:A.some(i=>ke(i,e,n)),selections:t}},getSelectionKeys:()=>ui(A,nt),matcherType:"or"})})}function J(A){return{[ze]:()=>({match:e=>({matched:!!A(e)})})}}function di(...A){const e=typeof A[0]=="string"?A[0]:void 0,t=A.length===2?A[1]:typeof A[0]=="string"?void 0:A[0];return Ie({[ze]:()=>({match:n=>{let i={[e??Pr]:n};return{matched:t===void 0||ke(t,n,(r,s)=>{i[r]=s}),selections:i}},getSelectionKeys:()=>[e??Pr].concat(t===void 0?[]:nt(t))})})}function Pt(A){return typeof A=="number"}function pA(A){return typeof A=="string"}function mA(A){return typeof A=="bigint"}const bh=Ie(J(function(A){return!0})),BC=bh,BA=A=>Object.assign(Ie(A),{startsWith:e=>{return BA(ce(A,(t=e,J(n=>pA(n)&&n.startsWith(t)))));var t},endsWith:e=>{return BA(ce(A,(t=e,J(n=>pA(n)&&n.endsWith(t)))));var t},minLength:e=>BA(ce(A,(t=>J(n=>pA(n)&&n.length>=t))(e))),length:e=>BA(ce(A,(t=>J(n=>pA(n)&&n.length===t))(e))),maxLength:e=>BA(ce(A,(t=>J(n=>pA(n)&&n.length<=t))(e))),includes:e=>{return BA(ce(A,(t=e,J(n=>pA(n)&&n.includes(t)))));var t},regex:e=>{return BA(ce(A,(t=e,J(n=>pA(n)&&!!n.match(t)))));var t}}),vC=BA(J(pA)),Lt=A=>Object.assign(Ie(A),{between:(e,t)=>Lt(ce(A,((n,i)=>J(r=>Pt(r)&&n<=r&&i>=r))(e,t))),lt:e=>Lt(ce(A,(t=>J(n=>Pt(n)&&n<t))(e))),gt:e=>Lt(ce(A,(t=>J(n=>Pt(n)&&n>t))(e))),lte:e=>Lt(ce(A,(t=>J(n=>Pt(n)&&n<=t))(e))),gte:e=>Lt(ce(A,(t=>J(n=>Pt(n)&&n>=t))(e))),int:()=>Lt(ce(A,J(e=>Pt(e)&&Number.isInteger(e)))),finite:()=>Lt(ce(A,J(e=>Pt(e)&&Number.isFinite(e)))),positive:()=>Lt(ce(A,J(e=>Pt(e)&&e>0))),negative:()=>Lt(ce(A,J(e=>Pt(e)&&e<0)))}),CC=Lt(J(Pt)),vA=A=>Object.assign(Ie(A),{between:(e,t)=>vA(ce(A,((n,i)=>J(r=>mA(r)&&n<=r&&i>=r))(e,t))),lt:e=>vA(ce(A,(t=>J(n=>mA(n)&&n<t))(e))),gt:e=>vA(ce(A,(t=>J(n=>mA(n)&&n>t))(e))),lte:e=>vA(ce(A,(t=>J(n=>mA(n)&&n<=t))(e))),gte:e=>vA(ce(A,(t=>J(n=>mA(n)&&n>=t))(e))),positive:()=>vA(ce(A,J(e=>mA(e)&&e>0))),negative:()=>vA(ce(A,J(e=>mA(e)&&e<0)))}),wC=vA(J(mA)),yC=Ie(J(function(A){return typeof A=="boolean"})),bC=Ie(J(function(A){return typeof A=="symbol"})),EC=Ie(J(function(A){return A==null})),SC=Ie(J(function(A){return A!=null}));var UC={__proto__:null,matcher:ze,optional:Da,array:function(...A){return La({[ze]:()=>({match:e=>{if(!Array.isArray(e))return{matched:!1};if(A.length===0)return{matched:!0};const t=A[0];let n={};if(e.length===0)return nt(t).forEach(r=>{n[r]=[]}),{matched:!0,selections:n};const i=(r,s)=>{n[r]=(n[r]||[]).concat([s])};return{matched:e.every(r=>ke(t,r,i)),selections:n}},getSelectionKeys:()=>A.length===0?[]:nt(A[0])})})},set:function(...A){return Ie({[ze]:()=>({match:e=>{if(!(e instanceof Set))return{matched:!1};let t={};if(e.size===0)return{matched:!0,selections:t};if(A.length===0)return{matched:!0};const n=(r,s)=>{t[r]=(t[r]||[]).concat([s])},i=A[0];return{matched:pC(e,r=>ke(i,r,n)),selections:t}},getSelectionKeys:()=>A.length===0?[]:nt(A[0])})})},map:function(...A){return Ie({[ze]:()=>({match:e=>{if(!(e instanceof Map))return{matched:!1};let t={};if(e.size===0)return{matched:!0,selections:t};const n=(o,a)=>{t[o]=(t[o]||[]).concat([a])};if(A.length===0)return{matched:!0};var i;if(A.length===1)throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(i=A[0])==null?void 0:i.toString()}`);const[r,s]=A;return{matched:mC(e,(o,a)=>{const c=ke(r,a,n),l=ke(s,o,n);return c&&l}),selections:t}},getSelectionKeys:()=>A.length===0?[]:[...nt(A[0]),...nt(A[1])]})})},intersection:ce,union:yh,not:function(A){return Ie({[ze]:()=>({match:e=>({matched:!ke(A,e,()=>{})}),getSelectionKeys:()=>[],matcherType:"not"})})},when:J,select:di,any:bh,_:BC,string:vC,number:CC,bigint:wC,boolean:yC,symbol:bC,nullish:EC,nonNullable:SC,instanceOf:function(A){return Ie(J(function(e){return t=>t instanceof e}(A)))},shape:function(A){return Ie(J(gC(A)))}};class TC extends Error{constructor(e){let t;try{t=JSON.stringify(e)}catch{t=e}super(`Pattern matching error: no pattern matches value ${t}`),this.input=void 0,this.input=e}}const Oa={matched:!1,value:void 0};function hi(A){return new QC(A,Oa)}let QC=class _l{constructor(e,t){this.input=void 0,this.state=void 0,this.input=e,this.state=t}with(...e){if(this.state.matched)return this;const t=e[e.length-1],n=[e[0]];let i;e.length===3&&typeof e[1]=="function"?i=e[1]:e.length>2&&n.push(...e.slice(1,e.length-1));let r=!1,s={};const o=(c,l)=>{r=!0,s[c]=l},a=!n.some(c=>ke(c,this.input,o))||i&&!i(this.input)?Oa:{matched:!0,value:t(r?Pr in s?s[Pr]:s:this.input,this.input)};return new _l(this.input,a)}when(e,t){if(this.state.matched)return this;const n=!!e(this.input);return new _l(this.input,n?{matched:!0,value:t(this.input,this.input)}:Oa)}otherwise(e){return this.state.matched?this.state.value:e(this.input)}exhaustive(e=FC){return this.state.matched?this.state.value:e(this.input)}run(){return this.exhaustive()}returnType(){return this}};function FC(A){throw new TC(A)}const kC=/\{[^{}]+\}/g;function IC(){return Math.random().toString(36).slice(2,11)}function _C(A){let{baseUrl:e="",Request:t=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:i,bodySerializer:r,headers:s,...o}={...A};e=Th(e);const a=[];async function c(l,u){const{baseUrl:d,fetch:h=n,Request:f=t,headers:g,params:p={},parseAs:B="json",querySerializer:y,bodySerializer:b=r??RC,body:v,...C}=u||{};d&&(e=Th(d));let w=typeof i=="function"?i:Uh(i);y&&(w=typeof y=="function"?y:Uh({...typeof i=="object"?i:{},...y}));const S=v===void 0?void 0:b(v),F=S===void 0||S instanceof FormData?{}:{"Content-Type":"application/json"},_={redirect:"follow",...o,...C,body:S,headers:LC(F,s,g,p.header)};let D,H,M=new t(PC(l,{baseUrl:e,params:p,querySerializer:w}),_);for(const V in C)V in M||(M[V]=C[V]);if(a.length){D=IC(),H=Object.freeze({baseUrl:e,fetch:h,parseAs:B,querySerializer:w,bodySerializer:b});for(const V of a)if(V&&typeof V=="object"&&typeof V.onRequest=="function"){const q=await V.onRequest({request:M,schemaPath:l,params:p,options:H,id:D});if(q){if(!(q instanceof t))throw new Error("onRequest: must return new Request() when modifying the request");M=q}}}let K=await h(M);if(a.length)for(let V=a.length-1;V>=0;V--){const q=a[V];if(q&&typeof q=="object"&&typeof q.onResponse=="function"){const tt=await q.onResponse({request:M,response:K,schemaPath:l,params:p,options:H,id:D});if(tt){if(!(tt instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");K=tt}}}if(K.status===204||K.headers.get("Content-Length")==="0")return K.ok?{data:{},response:K}:{error:{},response:K};if(K.ok)return B==="stream"?{data:K.body,response:K}:{data:await K[B](),response:K};let Le=await K.text();try{Le=JSON.parse(Le)}catch{}return{error:Le,response:K}}return{GET(l,u){return c(l,{...u,method:"GET"})},PUT(l,u){return c(l,{...u,method:"PUT"})},POST(l,u){return c(l,{...u,method:"POST"})},DELETE(l,u){return c(l,{...u,method:"DELETE"})},OPTIONS(l,u){return c(l,{...u,method:"OPTIONS"})},HEAD(l,u){return c(l,{...u,method:"HEAD"})},PATCH(l,u){return c(l,{...u,method:"PATCH"})},TRACE(l,u){return c(l,{...u,method:"TRACE"})},use(...l){for(const u of l)if(u){if(typeof u!="object"||!("onRequest"in u||"onResponse"in u))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");a.push(u)}},eject(...l){for(const u of l){const d=a.indexOf(u);d!==-1&&a.splice(d,1)}}}}function Dr(A,e,t){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${A}=${t?.allowReserved===!0?e:encodeURIComponent(e)}`}function Eh(A,e,t){if(!e||typeof e!="object")return"";const n=[],i={simple:",",label:".",matrix:";"}[t.style]||"&";if(t.style!=="deepObject"&&t.explode===!1){for(const o in e)n.push(o,t.allowReserved===!0?e[o]:encodeURIComponent(e[o]));const s=n.join(",");switch(t.style){case"form":return`${A}=${s}`;case"label":return`.${s}`;case"matrix":return`;${A}=${s}`;default:return s}}for(const s in e){const o=t.style==="deepObject"?`${A}[${s}]`:s;n.push(Dr(o,e[s],t))}const r=n.join(i);return t.style==="label"||t.style==="matrix"?`${i}${r}`:r}function Sh(A,e,t){if(!Array.isArray(e))return"";if(t.explode===!1){const r={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[t.style]||",",s=(t.allowReserved===!0?e:e.map(o=>encodeURIComponent(o))).join(r);switch(t.style){case"simple":return s;case"label":return`.${s}`;case"matrix":return`;${A}=${s}`;default:return`${A}=${s}`}}const n={simple:",",label:".",matrix:";"}[t.style]||"&",i=[];for(const r of e)t.style==="simple"||t.style==="label"?i.push(t.allowReserved===!0?r:encodeURIComponent(r)):i.push(Dr(A,r,t));return t.style==="label"||t.style==="matrix"?`${n}${i.join(n)}`:i.join(n)}function Uh(A){return function(t){const n=[];if(t&&typeof t=="object")for(const i in t){const r=t[i];if(r!=null){if(Array.isArray(r)){if(r.length===0)continue;n.push(Sh(i,r,{style:"form",explode:!0,...A?.array,allowReserved:A?.allowReserved||!1}));continue}if(typeof r=="object"){n.push(Eh(i,r,{style:"deepObject",explode:!0,...A?.object,allowReserved:A?.allowReserved||!1}));continue}n.push(Dr(i,r,A))}}return n.join("&")}}function xC(A,e){let t=A;for(const n of A.match(kC)??[]){let i=n.substring(1,n.length-1),r=!1,s="simple";if(i.endsWith("*")&&(r=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(s="label",i=i.substring(1)):i.startsWith(";")&&(s="matrix",i=i.substring(1)),!e||e[i]===void 0||e[i]===null)continue;const o=e[i];if(Array.isArray(o)){t=t.replace(n,Sh(i,o,{style:s,explode:r}));continue}if(typeof o=="object"){t=t.replace(n,Eh(i,o,{style:s,explode:r}));continue}if(s==="matrix"){t=t.replace(n,`;${Dr(i,o)}`);continue}t=t.replace(n,s==="label"?`.${encodeURIComponent(o)}`:encodeURIComponent(o))}return t}function RC(A){return A instanceof FormData?A:JSON.stringify(A)}function PC(A,e){let t=`${e.baseUrl}${A}`;e.params?.path&&(t=xC(t,e.params.path));let n=e.querySerializer(e.params.query??{});return n.startsWith("?")&&(n=n.substring(1)),n&&(t+=`?${n}`),t}function LC(...A){const e=new Headers;for(const t of A){if(!t||typeof t!="object")continue;const n=t instanceof Headers?t.entries():Object.entries(t);for(const[i,r]of n)if(r===null)e.delete(i);else if(Array.isArray(r))for(const s of r)e.append(i,s);else r!==void 0&&e.set(i,r)}return e}function Th(A){return A.endsWith("/")?A.substring(0,A.length-1):A}class Qh{constructor(e){this.client=_C({baseUrl:e.baseUrl,headers:e.headers,fetch:e.fetch})}setAuthToken(e){this.client.use({onRequest({request:t}){return t.headers.set("Authorization",`Bearer ${e}`),t}})}setApiToken(e){this.client.use({onRequest({request:t}){return t.headers.set("Authorization",`Token ${e}`),t}})}async getAuthUrl(e){return await this.client.GET("/auth/{type}",{params:{path:{type:e}}})}async getConnectUrl(e){return await this.client.GET("/connect/{type}",{params:{path:{type:e}}})}async logout(){return await this.client.POST("/logout")}async getCurrentUser(){return await this.client.GET("/me")}async createPresignedUploadUrl(e){return await this.client.POST("/files",{body:e})}async createKnowledgeBlock(e){return await this.client.POST("/knowledge",{body:e})}async listOnboardees(){return await this.client.GET("/onboardees")}async getOnboardee(e){return await this.client.GET("/onboardees/{id}",{params:{path:{id:e}}})}async getOnboardeeWhitelistedDomains(e){return await this.client.GET("/onboardees/{id}/whitelisted-domains",{params:{path:{id:e}}})}async getOnboardeeWidgetConfig(e,t){return await this.client.GET("/onboardees/{id}/config",{params:{path:{id:e}},signal:t})}async listPlans(){return await this.client.GET("/plans")}async listProducts(){return await this.client.GET("/products")}async createProduct(e){return await this.client.POST("/products",{body:e})}async updateProduct(e,t){return await this.client.PATCH("/products/{id}",{params:{path:{id:e}},body:t})}async createPlan(e){return await this.client.POST("/plans",{body:e})}async getPlan(e){return await this.client.GET("/plans/{id}",{params:{path:{id:e}}})}async replacePlan(e,t){return await this.client.PUT("/plans/{id}",{params:{path:{id:e}},body:t})}async updatePlan(e,t){return await this.client.PATCH("/plans/{id}",{params:{path:{id:e}},body:t})}async getPlanVideoUrl(e){return await this.client.GET("/plans/{id}/video-url",{params:{path:{id:e}}})}async deletePlan(e){return await this.client.DELETE("/admin/plans/{id}",{params:{path:{id:e}}})}async publishPlanRevision(e,t){return await this.client.POST("/plans/{id}/publish",{params:{path:{id:e}},body:t})}async listPlanRevisions(e){return await this.client.GET("/plans/{id}/revisions",{params:{path:{id:e}}})}async getRevisionNavigationIndex(e){return await this.client.GET("/revisions/{id}/navigation-index",{params:{path:{id:e}}})}async replaceRevisionNavigationIndex(e,t){return await this.client.PUT("/revisions/{id}/navigation-index",{params:{path:{id:e}},body:t})}async getRevisionFAQ(e){return await this.client.GET("/revisions/{id}/faq",{params:{path:{id:e}}})}async replaceRevisionFAQ(e,t){return await this.client.PUT("/revisions/{id}/faq",{params:{path:{id:e}},body:t})}async listRevisionKnowledgeBlocks(e){return await this.client.GET("/revisions/{id}/knowledge-blocks",{params:{path:{id:e}}})}async replaceRevisionKnowledgeBlocks(e,t){return await this.client.PUT("/revisions/{id}/knowledge-blocks",{params:{path:{id:e}},body:t})}async createRevisionKnowledgeBlock(e,t){return await this.client.POST("/revisions/{id}/knowledge-blocks",{params:{path:{id:e}},body:t})}async updateRevisionKnowledgeBlock(e,t,n){return await this.client.PUT("/revisions/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:t}},body:n})}async deleteRevisionKnowledgeBlock(e,t){return await this.client.DELETE("/revisions/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:t}}})}async listSessions(e){return await this.client.GET("/sessions",{params:{query:e?{token:e}:{}}})}async createSession(e){return await this.client.POST("/sessions",{body:e})}async getSession(e){return await this.client.GET("/sessions/{id}",{params:{path:{id:e}}})}async startSession(e,t){return await this.client.GET("/sessions/{id}/start-session",{params:{path:{id:e},query:t?{token:t}:{}}})}async getSessionRecording(e){return await this.client.GET("/sessions/{id}/recording",{params:{path:{id:e}}})}async getSessionProductUrl(e){return await this.client.GET("/sessions/{id}/product-url",{params:{path:{id:e}}})}async getJoinToken(e,{skipIntro:t,user:n}={}){return await this.client.GET("/join-token",{params:{query:{token:e,...t&&{skip_intro:"true"},...n&&{user:encodeURIComponent(n)}}}})}getClient(){return this.client}}const DC="https://app.coragents.ai/api";var O;(function(A){A.READY="ready",A.ERROR="error",A.PAUSED="paused",A.LOADING="loading",A.THINKING="thinking",A.RESEARCHING="researching",A.AGENT_SPEAKING="agent_speaking",A.USER_SPEAKING="user_speaking",A.AWAITING_USER_INPUT="awaiting_user_input"})(O||(O={}));class OC{constructor({sessionId:e,apiBaseUrl:t,user:n}){this.currentState=O.READY,this.livekitState="speaking",this.assistantAudioContext=null,this.userAudioContext=null,this._assistantAudioTimer=null,this._userAudioTimer=null,this.user=void 0,this.sessionId=e,this.apiBaseUrl=t||DC,this.client=new Qh({baseUrl:this.apiBaseUrl}),this.emitter=new Pm,this.user=n}emit(e,t){this.emitter.emit(e,t)}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}setupRoomEventListeners(){this.room&&(this.room.on(Q.LocalTrackUnpublished,e=>{e.source===U.Source.ScreenShare&&(this.screenStream=void 0)}),this.room.on(Q.Disconnected,()=>{this.disconnect()}),this.room.on(Q.ParticipantDisconnected,()=>{this.disconnect()}),this.room.on(Q.TrackSubscribed,(e,t,n)=>{if(e.kind==="audio"&&e.attach(),e.source===U.Source.Microphone&&n.identity.includes("agent-")){const i=e.mediaStream;if(!i){console.error("No media stream available for assistant track");return}const r=new AudioContext,s=r.createAnalyser();r.createMediaStreamSource(i).connect(s),s.fftSize=2048;const a=new Uint8Array(s.frequencyBinCount);this.analyzeAudio(s,a,"ASSISTANT"),this.assistantAudioContext=r}}),this.room.on(Q.ParticipantAttributesChanged,e=>{if(!e["lk.agent.state"]||this.currentState===O.RESEARCHING||this.currentState===O.PAUSED)return;const t=e["lk.agent.state"],n=hi(t).with("listening",()=>O.USER_SPEAKING).with("speaking",()=>O.AGENT_SPEAKING).with("thinking",()=>O.THINKING).otherwise(()=>{});n&&(this.setState(n),this.livekitState=t)}),this.room.on(Q.DataReceived,async e=>{try{const t=JSON.parse(new TextDecoder().decode(e)),n=t.status||t.request;hi(n).with("using_tool",()=>{this.currentState=O.RESEARCHING,this.emitter.emit("stateChanged",O.RESEARCHING)}).with("using_tool_ended",()=>{this.currentState=O.AGENT_SPEAKING,this.emitter.emit("stateChanged",O.AGENT_SPEAKING)}).with("share_screen",()=>{this.shareScreen()}).with("prompt_user",()=>{this.promptContinue()}).with("capture_page_html",()=>{this.emitter.emit("capturePageHTML")}).with("fill",()=>{this.emitter.emit("fill",t.value)}).otherwise(()=>{console.warn("Unknown data received:",t)})}catch(t){console.error("Error parsing data:",t)}}),this.room.localParticipant.registerRpcMethod("screen_capture",async e=>(this.emitter.emit("screenCaptureRequested"),new Promise(t=>{this.emitter.once("screenCaptureComplete",async n=>{if(n==="error"){t("error");return}try{await this.room.localParticipant.sendFile(new File([n],"screen_capture.png",{type:"image/png"}),{mimeType:"image/png",topic:"screen_capture"}),t("ok")}catch{t("error")}})}))))}async connect(){if(!this.sessionId){console.error("No session ID found"),this.emitter.emit("error",new Error("No session ID provided"));return}try{await this.requestMicrophone(),this.room=new WA({adaptiveStream:!0,dynacast:!0}),this.setupRoomEventListeners();const e=await this.client.getJoinToken(this.sessionId,{skipIntro:!0,...this.user&&{user:JSON.stringify(this.user)}});if(await this.room.connect(e.data.url,e.data.token),this.microphoneStream){const t=this.microphoneStream.getAudioTracks()[0];await this.room.localParticipant.publishTrack(t,{name:"microphone",source:U.Source.Microphone})}return{url:e.data.url,token:e.data.token}}catch(e){throw console.error("Failed to connect to LiveKit:",e),this.disconnect(),this.emitter.emit("error",e instanceof Error?e:new Error(String(e))),e}}async disconnect(){this.room&&(this.room.disconnect(!0),this.room.removeAllListeners(),this.room=void 0),this.screenStream?.track&&this.screenStream.track.stop(),this.microphoneStream&&this.microphoneStream.getTracks().forEach(e=>e.stop()),this._userAudioTimer&&(window.clearTimeout(this._userAudioTimer),this._userAudioTimer=null),this._assistantAudioTimer&&(window.clearTimeout(this._assistantAudioTimer),this._assistantAudioTimer=null),await this.userAudioContext?.close().catch(()=>{}),this.userAudioContext=null,await this.assistantAudioContext?.close().catch(()=>{}),this.assistantAudioContext=null,this.setState(O.READY),this.emitter.emit("disconnected")}setState(e){e!==this.currentState&&(this.currentState=e,this.emitter.emit("stateChanged",e))}getCurrentState(){return this.currentState}async requestMicrophone(){try{const e=await navigator.mediaDevices.getUserMedia({audio:!0});this.microphoneStream=e;const t=new AudioContext;this.userAudioContext=t;const n=t.createAnalyser(),i=t.createMediaStreamSource(e),r=t.createGain();r.gain.value=1.5,i.connect(r),r.connect(n),n.fftSize=2048;const s=new Uint8Array(n.frequencyBinCount);this.analyzeAudio(n,s,"USER")}catch(e){throw console.error("Microphone permission denied:",e),new Error("Microphone permission denied")}}async shareScreen(){if(!this.room){console.warn("[obi] shareScreen called while not connected");return}this.emitter.emit("preScreenShare");try{if(this.screenStream=await this.room.localParticipant.setScreenShareEnabled(!0,{video:{displaySurface:"window"}}),!this.screenStream){console.warn("Failed to share screen");return}await this.room.localParticipant.publishData(new TextEncoder().encode(JSON.stringify({request:"share_screen",success:!0})),{reliable:!0})}catch(e){console.error("Error sharing screen:",e),this.emitter.emit("error",e instanceof Error?e:new Error(String(e)))}}pauseRecording(){this.room&&(this.setState(O.PAUSED),this.room.localParticipant.getTrackPublications().forEach(e=>{e.handleMuted(),e.track?.mediaStream?.getTracks().forEach(t=>t.enabled=!1)}),this.microphoneStream?.getTracks().forEach(e=>e.enabled=!1),this.screenStream?.track?.mute())}resumeRecording(){if(!this.room)return;const e=hi(this.livekitState).with("listening",()=>O.USER_SPEAKING).with("speaking",()=>O.AGENT_SPEAKING).otherwise(()=>O.THINKING);this.setState(e),this.room.localParticipant.getTrackPublications().forEach(t=>{t.handleUnmuted(),t.track?.mediaStream?.getTracks().forEach(n=>n.enabled=!0)}),this.microphoneStream?.getTracks().forEach(t=>t.enabled=!0),this.screenStream?.track?.unmute()}async promptContinue(){await this.room.localParticipant.publishData(new TextEncoder().encode(JSON.stringify({request:"prompt_user",success:!0})),{reliable:!0})}async analyzeAudio(e,t,n){if(n==="USER"&&this.currentState===O.USER_SPEAKING||n==="ASSISTANT"&&this.currentState===O.AGENT_SPEAKING){e.getByteFrequencyData(t);const i=t.reduce((o,a)=>o+a,0)/t.length,r=Math.max(.01,Math.min(1,i/128));let s;n==="USER"&&this.currentState===O.USER_SPEAKING?s="USER":n==="ASSISTANT"&&this.currentState===O.AGENT_SPEAKING&&(s="ASSISTANT"),s&&this.emitter.emit("volume",{speaker:s,spectrum:Array.from(t),volume:r})}n==="USER"?this._userAudioTimer=window.setTimeout(()=>this.analyzeAudio(e,t,n),200):this._assistantAudioTimer=window.setTimeout(()=>this.analyzeAudio(e,t,n),200)}async sendHTML(e){if(!this.room){console.log("Cannot send HTML: Not connected to room");return}try{const t={type:"page_content",html:e,timestamp:new Date().toISOString()},n=JSON.stringify(t),r=new TextEncoder().encode(n);await this.room.localParticipant.publishData(r,{reliable:!0})}catch(t){console.error("Error sending HTML to LiveKit:",t),this.emitter.emit("error",t instanceof Error?t:new Error(String(t)))}}async reconnect(e,t,n){try{if(!e||!t)return console.error("Missing room URL or token for reconnection"),this.emitter.emit("error",new Error("Missing room URL or token for reconnection")),!1;if(await this.requestMicrophone(),this.room=new WA({adaptiveStream:!0,dynacast:!0}),this.setupRoomEventListeners(),await this.room.connect(e,t),this.microphoneStream){const i=this.microphoneStream.getAudioTracks()[0];await this.room.localParticipant.publishTrack(i,{name:"microphone",source:U.Source.Microphone})}return this.setState(n),n===O.PAUSED&&this.pauseRecording(),!0}catch(i){return console.error("Failed to reconnect to room:",i),this.disconnect(),this.emitter.emit("error",i instanceof Error?i:new Error(String(i))),!1}}}/**
43
43
  * @license
44
44
  * Copyright 2019 Google LLC
45
45
  * SPDX-License-Identifier: BSD-3-Clause
@@ -47,15 +47,15 @@ a=extmap-allow-mixed`)!==-1){const r=i.sdp.split(`
47
47
  * @license
48
48
  * Copyright 2017 Google LLC
49
49
  * SPDX-License-Identifier: BSD-3-Clause
50
- */const{is:KC,defineProperty:GC,getOwnPropertyDescriptor:VC,getOwnPropertyNames:jC,getOwnPropertySymbols:$C,getPrototypeOf:WC}=Object,CA=globalThis,_h=CA.trustedTypes,JC=_h?_h.emptyScript:"",XC=CA.reactiveElementPolyfillSupport,fi=(A,e)=>A,Hr={toAttribute(A,e){switch(e){case Boolean:A=A?JC:null;break;case Object:case Array:A=A==null?A:JSON.stringify(A)}return A},fromAttribute(A,e){let t=A;switch(e){case Boolean:t=A!==null;break;case Number:t=A===null?null:Number(A);break;case Object:case Array:try{t=JSON.parse(A)}catch{t=null}}return t}},Ma=(A,e)=>!KC(A,e),xh={attribute:!0,type:String,converter:Hr,reflect:!1,useDefault:!1,hasChanged:Ma};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),CA.litPropertyMetadata??(CA.litPropertyMetadata=new WeakMap);class gi extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=xh){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&GC(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:r}=VC(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){const o=i?.call(this);r?.call(this,s),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??xh}static _$Ei(){if(this.hasOwnProperty(fi("elementProperties")))return;const e=WC(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(fi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(fi("properties"))){const t=this.properties,n=[...jC(t),...$C(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Ih(i))}else e!==void 0&&t.push(Ih(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return NC(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const r=(n.converter?.toAttribute!==void 0?n.converter:Hr).toAttribute(t,n.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const r=n.getPropertyOptions(i),s=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:Hr;this._$Em=i,this[i]=s.fromAttribute(t,r.type)??this._$Ej?.get(i)??null,this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){const i=this.constructor,r=this[e];if(n??(n=i.getPropertyOptions(e)),!((n.hasChanged??Ma)(r,t)||n.useDefault&&n.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:r},s){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,s??t??this[e]),r!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,r]of n){const{wrapped:s}=r,o=this[i];s!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,r,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}}gi.elementStyles=[],gi.shadowRootOptions={mode:"open"},gi[fi("elementProperties")]=new Map,gi[fi("finalized")]=new Map,XC?.({ReactiveElement:gi}),(CA.reactiveElementVersions??(CA.reactiveElementVersions=[])).push("2.1.0");/**
50
+ */const{is:KC,defineProperty:VC,getOwnPropertyDescriptor:GC,getOwnPropertyNames:jC,getOwnPropertySymbols:$C,getPrototypeOf:WC}=Object,CA=globalThis,_h=CA.trustedTypes,JC=_h?_h.emptyScript:"",XC=CA.reactiveElementPolyfillSupport,fi=(A,e)=>A,Hr={toAttribute(A,e){switch(e){case Boolean:A=A?JC:null;break;case Object:case Array:A=A==null?A:JSON.stringify(A)}return A},fromAttribute(A,e){let t=A;switch(e){case Boolean:t=A!==null;break;case Number:t=A===null?null:Number(A);break;case Object:case Array:try{t=JSON.parse(A)}catch{t=null}}return t}},Ma=(A,e)=>!KC(A,e),xh={attribute:!0,type:String,converter:Hr,reflect:!1,useDefault:!1,hasChanged:Ma};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),CA.litPropertyMetadata??(CA.litPropertyMetadata=new WeakMap);class gi extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=xh){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&VC(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:r}=GC(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){const o=i?.call(this);r?.call(this,s),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??xh}static _$Ei(){if(this.hasOwnProperty(fi("elementProperties")))return;const e=WC(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(fi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(fi("properties"))){const t=this.properties,n=[...jC(t),...$C(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Ih(i))}else e!==void 0&&t.push(Ih(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return NC(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const r=(n.converter?.toAttribute!==void 0?n.converter:Hr).toAttribute(t,n.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const r=n.getPropertyOptions(i),s=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:Hr;this._$Em=i,this[i]=s.fromAttribute(t,r.type)??this._$Ej?.get(i)??null,this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){const i=this.constructor,r=this[e];if(n??(n=i.getPropertyOptions(e)),!((n.hasChanged??Ma)(r,t)||n.useDefault&&n.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:r},s){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,s??t??this[e]),r!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,r]of n){const{wrapped:s}=r,o=this[i];s!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,r,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}}gi.elementStyles=[],gi.shadowRootOptions={mode:"open"},gi[fi("elementProperties")]=new Map,gi[fi("finalized")]=new Map,XC?.({ReactiveElement:gi}),(CA.reactiveElementVersions??(CA.reactiveElementVersions=[])).push("2.1.0");/**
51
51
  * @license
52
52
  * Copyright 2017 Google LLC
53
53
  * SPDX-License-Identifier: BSD-3-Clause
54
- */const qC={attribute:!0,type:String,converter:Hr,reflect:!1,hasChanged:Ma},YC=(A=qC,e,t)=>{const{kind:n,metadata:i}=t;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),n==="setter"&&((A=Object.create(A)).wrapped=!0),r.set(t.name,A),n==="accessor"){const{name:s}=t;return{set(o){const a=e.get.call(this);e.set.call(this,o),this.requestUpdate(s,a,A)},init(o){return o!==void 0&&this.C(s,void 0,A,o),o}}}if(n==="setter"){const{name:s}=t;return function(o){const a=this[s];e.call(this,o),this.requestUpdate(s,a,A)}}throw Error("Unsupported decorator location: "+n)};function ee(A){return(e,t)=>typeof t=="object"?YC(A,e,t):((n,i,r)=>{const s=i.hasOwnProperty(r);return i.constructor.createProperty(r,n),s?Object.getOwnPropertyDescriptor(i,r):void 0})(A,e,t)}/**
54
+ */const qC={attribute:!0,type:String,converter:Hr,reflect:!1,hasChanged:Ma},YC=(A=qC,e,t)=>{const{kind:n,metadata:i}=t;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),n==="setter"&&((A=Object.create(A)).wrapped=!0),r.set(t.name,A),n==="accessor"){const{name:s}=t;return{set(o){const a=e.get.call(this);e.set.call(this,o),this.requestUpdate(s,a,A)},init(o){return o!==void 0&&this.C(s,void 0,A,o),o}}}if(n==="setter"){const{name:s}=t;return function(o){const a=this[s];e.call(this,o),this.requestUpdate(s,a,A)}}throw Error("Unsupported decorator location: "+n)};function Z(A){return(e,t)=>typeof t=="object"?YC(A,e,t):((n,i,r)=>{const s=i.hasOwnProperty(r);return i.constructor.createProperty(r,n),s?Object.getOwnPropertyDescriptor(i,r):void 0})(A,e,t)}/**
55
55
  * @license
56
56
  * Copyright 2017 Google LLC
57
57
  * SPDX-License-Identifier: BSD-3-Clause
58
- */function oe(A){return ee({...A,state:!0,attribute:!1})}var zC=Object.defineProperty,ZC=Object.getOwnPropertyDescriptor,ew=(A,e,t,n)=>{for(var i=n>1?void 0:n?ZC(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&zC(e,t,i),i};class Na extends L.LitElement{constructor(){super(...arguments),this.state=O.READY}render(){return L.html`
58
+ */function oe(A){return Z({...A,state:!0,attribute:!1})}var zC=Object.defineProperty,ZC=Object.getOwnPropertyDescriptor,ew=(A,e,t,n)=>{for(var i=n>1?void 0:n?ZC(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&zC(e,t,i),i};class Na extends L.LitElement{constructor(){super(...arguments),this.state=O.READY}render(){return L.html`
59
59
  <div class="status-container">
60
60
  <div class="status-indicator ${this.state}"></div>
61
61
  <div class="status-text">${this.getStatusText()}</div>
@@ -99,29 +99,29 @@ a=extmap-allow-mixed`)!==-1){const r=i.sdp.split(`
99
99
  font-weight: 500;
100
100
  color: #1f2937;
101
101
  }
102
- `,ew([ee({type:String})],Na.prototype,"state",2),customElements.get("obi-status-widget")||customElements.define("obi-status-widget",Na);const Ka=__API_BASE_URL__,Mr="#a10fff";function Nr(A){if(A=A.replace(/^#/,""),!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(A))throw new Error(`Invalid hex color format: ${A}`);A.length===3&&(A=A.split("").map(c=>c+c).join(""));const e=parseInt(A.slice(0,2),16)/255,t=parseInt(A.slice(2,4),16)/255,n=parseInt(A.slice(4,6),16)/255,i=Math.max(e,t,n),r=Math.min(e,t,n);let s,o,a=(i+r)/2;if(i===r)s=o=0;else{const c=i-r;switch(o=a>.5?c/(2-i-r):c/(i+r),i){case e:s=(t-n)/c+(t<n?6:0);break;case t:s=(n-e)/c+2;break;case n:s=(e-t)/c+4;break;default:s=0}s/=6}return{h:s*360,s:o*100,l:a*100}}function Rh(A,e,t){A=A/360,e=e/100,t=t/100;const n=(a,c,l)=>(l<0&&(l+=1),l>1&&(l-=1),l<1/6?a+(c-a)*6*l:l<1/2?c:l<2/3?a+(c-a)*(2/3-l)*6:a);let i,r,s;if(e===0)i=r=s=t;else{const a=t<.5?t*(1+e):t+e-t*e,c=2*t-a;i=n(c,a,A+1/3),r=n(c,a,A),s=n(c,a,A-1/3)}const o=a=>{const c=Math.round(a*255).toString(16);return c.length===1?"0"+c:c};return`#${o(i)}${o(r)}${o(s)}`}function Ga(A,e){try{const t=Nr(Mr),n=Nr(e),i=(n.h-t.h+360)%360,r=i>180?i-360:i,s=n.s-t.s,o=n.l-t.l,a=Nr(A),c={h:(a.h+r+360)%360,s:Math.max(0,Math.min(100,a.s+s)),l:Math.max(0,Math.min(100,a.l+o))};return Rh(c.h,c.s,c.l)}catch(t){return console.warn("Failed to generate selected color, using fallback:",t),e}}function tw(A){try{const t={h:Nr(A).h,s:100,l:96};return Rh(t.h,t.s,t.l)}catch(e){return console.warn("Failed to transform to light tint, using fallback:",e),A}}const Ph="49206C6F7665204F6269_session";/*!
102
+ `,ew([Z({type:String})],Na.prototype,"state",2),customElements.get("obi-status-widget")||customElements.define("obi-status-widget",Na);const Ka=__API_BASE_URL__,Mr="#a10fff";function Nr(A){if(A=A.replace(/^#/,""),!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(A))throw new Error(`Invalid hex color format: ${A}`);A.length===3&&(A=A.split("").map(c=>c+c).join(""));const e=parseInt(A.slice(0,2),16)/255,t=parseInt(A.slice(2,4),16)/255,n=parseInt(A.slice(4,6),16)/255,i=Math.max(e,t,n),r=Math.min(e,t,n);let s,o,a=(i+r)/2;if(i===r)s=o=0;else{const c=i-r;switch(o=a>.5?c/(2-i-r):c/(i+r),i){case e:s=(t-n)/c+(t<n?6:0);break;case t:s=(n-e)/c+2;break;case n:s=(e-t)/c+4;break;default:s=0}s/=6}return{h:s*360,s:o*100,l:a*100}}function Rh(A,e,t){A=A/360,e=e/100,t=t/100;const n=(a,c,l)=>(l<0&&(l+=1),l>1&&(l-=1),l<1/6?a+(c-a)*6*l:l<1/2?c:l<2/3?a+(c-a)*(2/3-l)*6:a);let i,r,s;if(e===0)i=r=s=t;else{const a=t<.5?t*(1+e):t+e-t*e,c=2*t-a;i=n(c,a,A+1/3),r=n(c,a,A),s=n(c,a,A-1/3)}const o=a=>{const c=Math.round(a*255).toString(16);return c.length===1?"0"+c:c};return`#${o(i)}${o(r)}${o(s)}`}function Va(A,e){try{const t=Nr(Mr),n=Nr(e),i=(n.h-t.h+360)%360,r=i>180?i-360:i,s=n.s-t.s,o=n.l-t.l,a=Nr(A),c={h:(a.h+r+360)%360,s:Math.max(0,Math.min(100,a.s+s)),l:Math.max(0,Math.min(100,a.l+o))};return Rh(c.h,c.s,c.l)}catch(t){return console.warn("Failed to generate selected color, using fallback:",t),e}}function tw(A){try{const t={h:Nr(A).h,s:100,l:96};return Rh(t.h,t.s,t.l)}catch(e){return console.warn("Failed to transform to light tint, using fallback:",e),A}}const Ph="49206C6F7665204F6269_session";/*!
103
103
  * html2canvas-pro 1.5.11 <https://yorickshan.github.io/html2canvas-pro/>
104
104
  * Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
105
105
  * Released under MIT License
106
- */var Va=function(A,e){return Va=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Va(A,e)};function St(A,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Va(A,e);function t(){this.constructor=A}A.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ja=function(){return ja=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},ja.apply(this,arguments)};function Ke(A,e,t,n){function i(r){return r instanceof t?r:new t(function(s){s(r)})}return new(t||(t=Promise))(function(r,s){function o(l){try{c(n.next(l))}catch(u){s(u)}}function a(l){try{c(n.throw(l))}catch(u){s(u)}}function c(l){l.done?r(l.value):i(l.value).then(o,a)}c((n=n.apply(A,e||[])).next())})}function Oe(A,e){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(l){return a([c,l])}}function a(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(n=1,i&&(r=c[0]&2?i.return:c[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,c[1])).done)return r;switch(i=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(r=t.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){t.label=c[1];break}if(c[0]===6&&t.label<r[1]){t.label=r[1],r=c;break}if(r&&t.label<r[2]){t.label=r[2],t.ops.push(c);break}r[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(A,t)}catch(l){c=[6,l],i=0}finally{n=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Kr(A,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,r;n<i;n++)(r||!(n in e))&&(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return A.concat(r||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;for(var Jt=function(){function A(e,t,n,i){this.left=e,this.top=t,this.width=n,this.height=i}return A.prototype.add=function(e,t,n,i){return new A(this.left+e,this.top+t,this.width+n,this.height+i)},A.fromClientRect=function(e,t){return new A(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},A.fromDOMRectList=function(e,t){var n=Array.from(t).find(function(i){return i.width!==0});return n?new A(n.left+e.windowBounds.left,n.top+e.windowBounds.top,n.width,n.height):A.EMPTY},A.EMPTY=new A(0,0,0,0),A}(),Gr=function(A,e){return Jt.fromClientRect(A,e.getBoundingClientRect())},Aw=function(A){var e=A.body,t=A.documentElement;if(!e||!t)throw new Error("Unable to get document size");var n=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),i=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new Jt(0,0,n,i)},Vr=function(A){for(var e=[],t=0,n=A.length;t<n;){var i=A.charCodeAt(t++);if(i>=55296&&i<=56319&&t<n){var r=A.charCodeAt(t++);(r&64512)===56320?e.push(((i&1023)<<10)+(r&1023)+65536):(e.push(i),t--)}else e.push(i)}return e},Be=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var n=[],i=-1,r="";++i<t;){var s=A[i];s<=65535?n.push(s):(s-=65536,n.push((s>>10)+55296,s%1024+56320)),(i+1===t||n.length>16384)&&(r+=String.fromCharCode.apply(String,n),n.length=0)}return r},Lh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nw=typeof Uint8Array>"u"?[]:new Uint8Array(256),jr=0;jr<Lh.length;jr++)nw[Lh.charCodeAt(jr)]=jr;for(var Dh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pi=typeof Uint8Array>"u"?[]:new Uint8Array(256),$r=0;$r<Dh.length;$r++)pi[Dh.charCodeAt($r)]=$r;for(var iw=function(A){var e=A.length*.75,t=A.length,n,i=0,r,s,o,a;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),l=Array.isArray(c)?c:new Uint8Array(c);for(n=0;n<t;n+=4)r=pi[A.charCodeAt(n)],s=pi[A.charCodeAt(n+1)],o=pi[A.charCodeAt(n+2)],a=pi[A.charCodeAt(n+3)],l[i++]=r<<2|s>>4,l[i++]=(s&15)<<4|o>>2,l[i++]=(o&3)<<6|a&63;return c},rw=function(A){for(var e=A.length,t=[],n=0;n<e;n+=2)t.push(A[n+1]<<8|A[n]);return t},sw=function(A){for(var e=A.length,t=[],n=0;n<e;n+=4)t.push(A[n+3]<<24|A[n+2]<<16|A[n+1]<<8|A[n]);return t},WA=5,$a=6+5,Wa=2,ow=$a-WA,Oh=65536>>WA,aw=1<<WA,Ja=aw-1,cw=1024>>WA,lw=Oh+cw,uw=lw,dw=32,hw=uw+dw,fw=65536>>$a,gw=1<<ow,pw=gw-1,Hh=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},mw=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},Bw=function(A,e){var t=iw(A),n=Array.isArray(t)?sw(t):new Uint32Array(t),i=Array.isArray(t)?rw(t):new Uint16Array(t),r=24,s=Hh(i,r/2,n[4]/2),o=n[5]===2?Hh(i,(r+n[4])/2):mw(n,Math.ceil((r+n[4])/4));return new vw(n[0],n[1],n[2],n[3],s,o)},vw=function(){function A(e,t,n,i,r,s){this.initialValue=e,this.errorValue=t,this.highStart=n,this.highValueIndex=i,this.index=r,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>WA],t=(t<<Wa)+(e&Ja),this.data[t];if(e<=65535)return t=this.index[Oh+(e-55296>>WA)],t=(t<<Wa)+(e&Ja),this.data[t];if(e<this.highStart)return t=hw-fw+(e>>$a),t=this.index[t],t+=e>>WA&pw,t=this.index[t],t=(t<<Wa)+(e&Ja),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A}(),Mh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Wr=0;Wr<Mh.length;Wr++)Cw[Mh.charCodeAt(Wr)]=Wr;var ww="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Nh=50,yw=1,Kh=2,Gh=3,bw=4,Ew=5,Vh=7,jh=8,$h=9,wA=10,Xa=11,Wh=12,qa=13,Sw=14,mi=15,Ya=16,Jr=17,Bi=18,Uw=19,Jh=20,za=21,vi=22,Za=23,Qn=24,it=25,Ci=26,wi=27,Fn=28,Tw=29,JA=30,Qw=31,Xr=32,qr=33,ec=34,tc=35,Ac=36,yi=37,nc=38,Yr=39,zr=40,ic=41,Xh=42,Fw=43,kw=[9001,65288],qh="!",V="×",Zr="÷",rc=Bw(ww),Xt=[JA,Ac],sc=[yw,Kh,Gh,Ew],Yh=[wA,jh],zh=[wi,Ci],Iw=sc.concat(Yh),Zh=[nc,Yr,zr,ec,tc],_w=[mi,qa],xw=function(A,e){e===void 0&&(e="strict");var t=[],n=[],i=[];return A.forEach(function(r,s){var o=rc.get(r);if(o>Nh?(i.push(!0),o-=Nh):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(r)!==-1)return n.push(s),t.push(Ya);if(o===bw||o===Xa){if(s===0)return n.push(s),t.push(JA);var a=t[s-1];return Iw.indexOf(a)===-1?(n.push(n[s-1]),t.push(a)):(n.push(s),t.push(JA))}if(n.push(s),o===Qw)return t.push(e==="strict"?za:yi);if(o===Xh||o===Tw)return t.push(JA);if(o===Fw)return r>=131072&&r<=196605||r>=196608&&r<=262141?t.push(yi):t.push(JA);t.push(o)}),[n,t,i]},oc=function(A,e,t,n){var i=n[t];if(Array.isArray(A)?A.indexOf(i)!==-1:A===i)for(var r=t;r<=n.length;){r++;var s=n[r];if(s===e)return!0;if(s!==wA)break}if(i===wA)for(var r=t;r>0;){r--;var o=n[r];if(Array.isArray(A)?A.indexOf(o)!==-1:A===o)for(var a=t;a<=n.length;){a++;var s=n[a];if(s===e)return!0;if(s!==wA)break}if(o!==wA)break}return!1},ef=function(A,e){for(var t=A;t>=0;){var n=e[t];if(n===wA)t--;else return n}return 0},Rw=function(A,e,t,n,i){if(t[n]===0)return V;var r=n-1;if(Array.isArray(i)&&i[r]===!0)return V;var s=r-1,o=r+1,a=e[r],c=s>=0?e[s]:0,l=e[o];if(a===Kh&&l===Gh)return V;if(sc.indexOf(a)!==-1)return qh;if(sc.indexOf(l)!==-1||Yh.indexOf(l)!==-1)return V;if(ef(r,e)===jh)return Zr;if(rc.get(A[r])===Xa||(a===Xr||a===qr)&&rc.get(A[o])===Xa||a===Vh||l===Vh||a===$h||[wA,qa,mi].indexOf(a)===-1&&l===$h||[Jr,Bi,Uw,Qn,Fn].indexOf(l)!==-1||ef(r,e)===vi||oc(Za,vi,r,e)||oc([Jr,Bi],za,r,e)||oc(Wh,Wh,r,e))return V;if(a===wA)return Zr;if(a===Za||l===Za)return V;if(l===Ya||a===Ya)return Zr;if([qa,mi,za].indexOf(l)!==-1||a===Sw||c===Ac&&_w.indexOf(a)!==-1||a===Fn&&l===Ac||l===Jh||Xt.indexOf(l)!==-1&&a===it||Xt.indexOf(a)!==-1&&l===it||a===wi&&[yi,Xr,qr].indexOf(l)!==-1||[yi,Xr,qr].indexOf(a)!==-1&&l===Ci||Xt.indexOf(a)!==-1&&zh.indexOf(l)!==-1||zh.indexOf(a)!==-1&&Xt.indexOf(l)!==-1||[wi,Ci].indexOf(a)!==-1&&(l===it||[vi,mi].indexOf(l)!==-1&&e[o+1]===it)||[vi,mi].indexOf(a)!==-1&&l===it||a===it&&[it,Fn,Qn].indexOf(l)!==-1)return V;if([it,Fn,Qn,Jr,Bi].indexOf(l)!==-1)for(var u=r;u>=0;){var d=e[u];if(d===it)return V;if([Fn,Qn].indexOf(d)!==-1)u--;else break}if([wi,Ci].indexOf(l)!==-1)for(var u=[Jr,Bi].indexOf(a)!==-1?s:r;u>=0;){var d=e[u];if(d===it)return V;if([Fn,Qn].indexOf(d)!==-1)u--;else break}if(nc===a&&[nc,Yr,ec,tc].indexOf(l)!==-1||[Yr,ec].indexOf(a)!==-1&&[Yr,zr].indexOf(l)!==-1||[zr,tc].indexOf(a)!==-1&&l===zr||Zh.indexOf(a)!==-1&&[Jh,Ci].indexOf(l)!==-1||Zh.indexOf(l)!==-1&&a===wi||Xt.indexOf(a)!==-1&&Xt.indexOf(l)!==-1||a===Qn&&Xt.indexOf(l)!==-1||Xt.concat(it).indexOf(a)!==-1&&l===vi&&kw.indexOf(A[o])===-1||Xt.concat(it).indexOf(l)!==-1&&a===Bi)return V;if(a===ic&&l===ic){for(var h=t[r],f=1;h>0&&(h--,e[h]===ic);)f++;if(f%2!==0)return V}return a===Xr&&l===qr?V:Zr},Pw=function(A,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=xw(A,e.lineBreak),n=t[0],i=t[1],r=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(o){return[it,JA,Xh].indexOf(o)!==-1?yi:o}));var s=e.wordBreak==="keep-all"?r.map(function(o,a){return o&&A[a]>=19968&&A[a]<=40959}):void 0;return[n,i,s]},Lw=function(){function A(e,t,n,i){this.codePoints=e,this.required=t===qh,this.start=n,this.end=i}return A.prototype.slice=function(){return Be.apply(void 0,this.codePoints.slice(this.start,this.end))},A}(),Dw=function(A,e){var t=Vr(A),n=Pw(t,e),i=n[0],r=n[1],s=n[2],o=t.length,a=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var l=V;c<o&&(l=Rw(t,r,i,++c,s))===V;);if(l!==V||c===o){var u=new Lw(t,l,a,c);return a=c,{value:u,done:!1}}return{done:!0,value:null}}}},Ow=1,Hw=2,bi=4,tf=8,es=10,Af=47,Ei=92,Mw=9,Nw=32,ts=34,Si=61,Kw=35,Gw=36,Vw=37,As=39,ns=40,Ui=41,jw=95,Ze=45,$w=33,Ww=60,Jw=62,Xw=64,qw=91,Yw=93,zw=61,Zw=123,is=63,ey=125,nf=124,ty=126,Ay=128,rf=65533,ac=42,XA=43,ny=44,iy=58,ry=59,Ti=46,sy=0,oy=8,ay=11,cy=14,ly=31,uy=127,Dt=-1,sf=48,of=97,af=101,dy=102,hy=117,fy=122,cf=65,lf=69,uf=70,gy=85,py=90,He=function(A){return A>=sf&&A<=57},my=function(A){return A>=55296&&A<=57343},kn=function(A){return He(A)||A>=cf&&A<=uf||A>=of&&A<=dy},By=function(A){return A>=of&&A<=fy},vy=function(A){return A>=cf&&A<=py},Cy=function(A){return By(A)||vy(A)},wy=function(A){return A>=Ay},rs=function(A){return A===es||A===Mw||A===Nw},ss=function(A){return Cy(A)||wy(A)||A===jw},df=function(A){return ss(A)||He(A)||A===Ze},yy=function(A){return A>=sy&&A<=oy||A===ay||A>=cy&&A<=ly||A===uy},yA=function(A,e){return A!==Ei?!1:e!==es},os=function(A,e,t){return A===Ze?ss(e)||yA(e,t):ss(A)?!0:!!(A===Ei&&yA(A,e))},cc=function(A,e,t){return A===XA||A===Ze?He(e)?!0:e===Ti&&He(t):He(A===Ti?e:A)},by=function(A){var e=0,t=1;(A[e]===XA||A[e]===Ze)&&(A[e]===Ze&&(t=-1),e++);for(var n=[];He(A[e]);)n.push(A[e++]);var i=n.length?parseInt(Be.apply(void 0,n),10):0;A[e]===Ti&&e++;for(var r=[];He(A[e]);)r.push(A[e++]);var s=r.length,o=s?parseInt(Be.apply(void 0,r),10):0;(A[e]===lf||A[e]===af)&&e++;var a=1;(A[e]===XA||A[e]===Ze)&&(A[e]===Ze&&(a=-1),e++);for(var c=[];He(A[e]);)c.push(A[e++]);var l=c.length?parseInt(Be.apply(void 0,c),10):0;return t*(i+o*Math.pow(10,-s))*Math.pow(10,a*l)},Ey={type:2},Sy={type:3},Uy={type:4},Ty={type:13},Qy={type:8},Fy={type:21},ky={type:9},Iy={type:10},_y={type:11},xy={type:12},Ry={type:14},as={type:23},Py={type:1},Ly={type:25},Dy={type:24},Oy={type:26},Hy={type:27},My={type:28},Ny={type:29},Ky={type:31},lc={type:32},hf=function(){function A(){this._value=[]}return A.prototype.write=function(e){this._value=this._value.concat(Vr(e))},A.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==lc;)e.push(t),t=this.consumeToken();return e},A.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case ts:return this.consumeStringToken(ts);case Kw:var t=this.peekCodePoint(0),n=this.peekCodePoint(1),i=this.peekCodePoint(2);if(df(t)||yA(n,i)){var r=os(t,n,i)?Hw:Ow,s=this.consumeName();return{type:5,value:s,flags:r}}break;case Gw:if(this.peekCodePoint(0)===Si)return this.consumeCodePoint(),Ty;break;case As:return this.consumeStringToken(As);case ns:return Ey;case Ui:return Sy;case ac:if(this.peekCodePoint(0)===Si)return this.consumeCodePoint(),Ry;break;case XA:if(cc(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case ny:return Uy;case Ze:var o=e,a=this.peekCodePoint(0),c=this.peekCodePoint(1);if(cc(o,a,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(os(o,a,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(a===Ze&&c===Jw)return this.consumeCodePoint(),this.consumeCodePoint(),Dy;break;case Ti:if(cc(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Af:if(this.peekCodePoint(0)===ac)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===ac&&(l=this.consumeCodePoint(),l===Af))return this.consumeToken();if(l===Dt)return this.consumeToken()}break;case iy:return Oy;case ry:return Hy;case Ww:if(this.peekCodePoint(0)===$w&&this.peekCodePoint(1)===Ze&&this.peekCodePoint(2)===Ze)return this.consumeCodePoint(),this.consumeCodePoint(),Ly;break;case Xw:var u=this.peekCodePoint(0),d=this.peekCodePoint(1),h=this.peekCodePoint(2);if(os(u,d,h)){var s=this.consumeName();return{type:7,value:s}}break;case qw:return My;case Ei:if(yA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Yw:return Ny;case zw:if(this.peekCodePoint(0)===Si)return this.consumeCodePoint(),Qy;break;case Zw:return _y;case ey:return xy;case hy:case gy:var f=this.peekCodePoint(0),g=this.peekCodePoint(1);return f===XA&&(kn(g)||g===is)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case nf:if(this.peekCodePoint(0)===Si)return this.consumeCodePoint(),ky;if(this.peekCodePoint(0)===nf)return this.consumeCodePoint(),Fy;break;case ty:if(this.peekCodePoint(0)===Si)return this.consumeCodePoint(),Iy;break;case Dt:return lc}return rs(e)?(this.consumeWhiteSpace(),Ky):He(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ss(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Be(e)}},A.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},A.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},A.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},A.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();kn(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var n=!1;t===is&&e.length<6;)e.push(t),t=this.consumeCodePoint(),n=!0;if(n){var i=parseInt(Be.apply(void 0,e.map(function(a){return a===is?sf:a})),16),r=parseInt(Be.apply(void 0,e.map(function(a){return a===is?uf:a})),16);return{type:30,start:i,end:r}}var s=parseInt(Be.apply(void 0,e),16);if(this.peekCodePoint(0)===Ze&&kn(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];kn(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var r=parseInt(Be.apply(void 0,o),16);return{type:30,start:s,end:r}}else return{type:30,start:s,end:s}},A.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ns?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ns?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},A.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Dt)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===As||t===ts){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Dt||this.peekCodePoint(0)===Ui)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),as)}for(;;){var i=this.consumeCodePoint();if(i===Dt||i===Ui)return{type:22,value:Be.apply(void 0,e)};if(rs(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Dt||this.peekCodePoint(0)===Ui?(this.consumeCodePoint(),{type:22,value:Be.apply(void 0,e)}):(this.consumeBadUrlRemnants(),as);if(i===ts||i===As||i===ns||yy(i))return this.consumeBadUrlRemnants(),as;if(i===Ei)if(yA(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),as;else e.push(i)}},A.prototype.consumeWhiteSpace=function(){for(;rs(this.peekCodePoint(0));)this.consumeCodePoint()},A.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Ui||e===Dt)return;yA(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},A.prototype.consumeStringSlice=function(e){for(var t=5e4,n="";e>0;){var i=Math.min(t,e);n+=Be.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),n},A.prototype.consumeStringToken=function(e){var t="",n=0;do{var i=this._value[n];if(i===Dt||i===void 0||i===e)return t+=this.consumeStringSlice(n),{type:0,value:t};if(i===es)return this._value.splice(0,n),Py;if(i===Ei){var r=this._value[n+1];r!==Dt&&r!==void 0&&(r===es?(t+=this.consumeStringSlice(n),n=-1,this._value.shift()):yA(i,r)&&(t+=this.consumeStringSlice(n),t+=Be(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},A.prototype.consumeNumber=function(){var e=[],t=bi,n=this.peekCodePoint(0);for((n===XA||n===Ze)&&e.push(this.consumeCodePoint());He(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(n===Ti&&He(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=tf;He(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),i=this.peekCodePoint(1);var r=this.peekCodePoint(2);if((n===lf||n===af)&&((i===XA||i===Ze)&&He(r)||He(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=tf;He(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[by(e),t]},A.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],n=e[1],i=this.peekCodePoint(0),r=this.peekCodePoint(1),s=this.peekCodePoint(2);if(os(i,r,s)){var o=this.consumeName();return{type:15,number:t,flags:n,unit:o}}return i===Vw?(this.consumeCodePoint(),{type:16,number:t,flags:n}):{type:17,number:t,flags:n}},A.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(kn(e)){for(var t=Be(e);kn(this.peekCodePoint(0))&&t.length<6;)t+=Be(this.consumeCodePoint());rs(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(t,16);return n===0||my(n)||n>1114111?rf:n}return e===Dt?rf:e},A.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(df(t))e+=Be(t);else if(yA(t,this.peekCodePoint(0)))e+=Be(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},A}(),ff=function(){function A(e){this._tokens=e}return A.create=function(e){var t=new hf;return t.write(e),new A(t.read())},A.parseValue=function(e){return A.create(e).parseComponentValue()},A.parseValues=function(e){return A.create(e).parseComponentValues()},A.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},A.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},A.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},A.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},n=this.consumeToken();;){if(n.type===32||Vy(n,e))return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue()),n=this.consumeToken()}},A.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue())}},A.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?lc:e},A.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},A}(),bA=function(A){return A.type===15},ye=function(A){return A.type===17},$=function(A){return A.type===20},Gy=function(A){return A.type===0},uc=function(A,e){return $(A)&&A.value===e},gf=function(A){return A.type!==31},_e=function(A){return A.type!==31&&A.type!==4},Ot=function(A){var e=[],t=[];return A.forEach(function(n){if(n.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}n.type!==31&&t.push(n)}),t.length&&e.push(t),e},Vy=function(A,e){return e===11&&A.type===12||e===28&&A.type===29?!0:e===2&&A.type===3},EA=function(A){return A.type===17||A.type===15},le=function(A){return A.type===16||EA(A)},pf=function(A){return A.length>1?[A[0],A[1]]:[A[0]]},xe={type:17,number:0,flags:bi},dc={type:16,number:50,flags:bi},SA={type:16,number:100,flags:bi},Qi=function(A,e,t){var n=A[0],i=A[1];return[ne(n,e),ne(typeof i<"u"?i:n,t)]},ne=function(A,e){if(A.type===16)return A.number/100*e;if(bA(A))switch(A.unit){case"rem":case"em":return 16*A.number;case"px":default:return A.number}return A.number},mf="deg",Bf="grad",vf="rad",Cf="turn",cs={name:"angle",parse:function(A,e){if(e.type===15)switch(e.unit){case mf:return Math.PI*e.number/180;case Bf:return Math.PI/200*e.number;case vf:return e.number;case Cf:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},wf=function(A){return A.type===15&&(A.unit===mf||A.unit===Bf||A.unit===vf||A.unit===Cf)},yf=function(A){var e=A.filter($).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[xe,xe];case"to top":case"bottom":return ct(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[xe,SA];case"to right":case"left":return ct(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[SA,SA];case"to bottom":case"top":return ct(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[SA,xe];case"to left":case"right":return ct(270)}return 0},ct=function(A){return Math.PI*A/180},UA=function(A){return(255&A)===0},Te=function(A){var e=255&A,t=255&A>>8,n=255&A>>16,i=255&A>>24;return e<255?"rgba(".concat(i,",").concat(n,",").concat(t,",").concat(e/255,")"):"rgb(".concat(i,",").concat(n,",").concat(t,")")},Ht=function(A,e,t,n){return(A<<24|e<<16|t<<8|Math.round(n*255)<<0)>>>0},ls=function(A,e){if(A.type===17)return A.number;if(A.type===16){var t=e===3?1:255;return e===3?A.number/100*t:Math.round(A.number/100*t)}return 0},qA=function(A){return(A[0].type===20?A[0].value:"unknown")==="from"},pe=function(A,e,t){return Math.min(Math.max(A,e),t)},et=function(A,e){return[A[0]*e[0]+A[1]*e[1]+A[2]*e[2],A[3]*e[0]+A[4]*e[1]+A[5]*e[2],A[6]*e[0]+A[7]*e[1]+A[8]*e[2]]},jy=function(A){return Ht(pe(Math.round(A[0]*255),0,255),pe(Math.round(A[1]*255),0,255),pe(Math.round(A[2]*255),0,255),pe(A[3],0,1))},hc=function(A){var e=A[0],t=A[1],n=A[2],i=A[3],r=YA([e,t,n]);return Ht(pe(Math.round(r[0]*255),0,255),pe(Math.round(r[1]*255),0,255),pe(Math.round(r[2]*255),0,255),i)},Fi=function(A){var e=TA([A[0],A[1],A[2]]);return hc([e[0],e[1],e[2],A[3]])},$y=function(A,e){if(qA(e.filter(_e)))throw new Error("Relative color not supported for lab()");var t=us(e),n=t[0],i=t[1],r=t[2],s=t[3],o=YA(TA(fs([n,i,r])));return Ht(pe(Math.round(o[0]*255),0,255),pe(Math.round(o[1]*255),0,255),pe(Math.round(o[2]*255),0,255),s)},Wy=function(A,e){if(qA(e.filter(_e)))throw new Error("Relative color not supported for oklab()");var t=us(e),n=t[0],i=t[1],r=t[2],s=t[3],o=YA(TA(hs([n,i,r])));return Ht(pe(Math.round(o[0]*255),0,255),pe(Math.round(o[1]*255),0,255),pe(Math.round(o[2]*255),0,255),s)},Jy=function(A,e){if(qA(e.filter(_e)))throw new Error("Relative color not supported for oklch()");var t=Uf(e),n=t[0],i=t[1],r=t[2],s=t[3],o=YA(TA(hs(ds([n,i,r]))));return Ht(pe(Math.round(o[0]*255),0,255),pe(Math.round(o[1]*255),0,255),pe(Math.round(o[2]*255),0,255),s)},Xy=function(A,e){if(qA(e.filter(_e)))throw new Error("Relative color not supported for lch()");var t=Sf(e),n=t[0],i=t[1],r=t[2],s=t[3],o=YA(TA(fs(ds([n,i,r]))));return Ht(pe(Math.round(o[0]*255),0,255),pe(Math.round(o[1]*255),0,255),pe(Math.round(o[2]*255),0,255),s)},bf=function(A,e){var t=e.filter(_e),n=t[0],i=t[1],r=t[2],s=t[3],o=(n.type===17?ct(n.number):cs.parse(A,n))/(Math.PI*2),a=le(i)?i.number/100:0,c=le(r)?r.number/100:0,l=typeof s<"u"&&le(s)?ne(s,1):1;return[o,a,c,l]},Ef=function(A,e){if(qA(e))throw new Error("Relative color not supported for hsl()");var t=bf(A,e),n=t[0],i=t[1],r=t[2],s=t[3],o=Qf([n,i,r]);return Ht(o[0]*255,o[1]*255,o[2]*255,i===0?1:s)},Sf=function(A){var e=A.filter(_e),t=le(e[0])?e[0].number:0,n=le(e[1])?e[1].number:0,i=ye(e[2])||bA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&le(e[4])?ne(e[4],1):1;return[t,n,i,r]},us=function(A){var e=A.filter(_e),t=e[0].type===16?e[0].number/100:ye(e[0])?e[0].number:0,n=e[1].type===16?e[1].number/100:ye(e[1])?e[1].number:0,i=ye(e[2])||bA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&le(e[4])?ne(e[4],1):1;return[t,n,i,r]},Uf=function(A){var e=A.filter(_e),t=e[0].type===16?e[0].number/100:ye(e[0])?e[0].number:0,n=e[1].type===16?e[1].number/100:ye(e[1])?e[1].number:0,i=ye(e[2])||bA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&le(e[4])?ne(e[4],1):1;return[t,n,i,r]},Tf=function(A){return et([1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],A)},fc=function(A){return et([.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124],A)},gc=function(A,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-A)*t*6+A:t<1/2?e:t<2/3?(e-A)*6*(2/3-t)+A:A},Qf=function(A){var e=A[0],t=A[1],n=A[2];if(t===0)return[n*255,n*255,n*255];var i=n<=.5?n*(t+1):n+t-n*t,r=n*2-i,s=gc(r,i,e+1/3),o=gc(r,i,e),a=gc(r,i,e-1/3);return[s,o,a]},ds=function(A){var e=A[0],t=A[1],n=A[2];return t<0&&(t=0),isNaN(n)&&(n=0),[e,t*Math.cos(n*Math.PI/180),t*Math.sin(n*Math.PI/180)]},hs=function(A){var e=et([1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092],A),t=e.map(function(n){return Math.pow(n,3)});return et([1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],t)},fs=function(A){var e=(A[0]+16)/116,t=A[1]/500+e,n=e-A[2]/200,i=24389/27,r=24/116,s=[(t>r?Math.pow(t,3):(116*t-16)/i)*.3457/.3585,A[0]>8?Math.pow(e,3):A[0]/i,(n>r?Math.pow(n,3):(116*n-16)/i)*(1-.3457-.3585)/.3585];return fc([s[0],s[1],s[2]])},qy=function(A,e){var t=e.filter(_e);if(t.length===3){var n=t.map(ls),i=n[0],r=n[1],s=n[2],o=mc([i/255,r/255,s/255]),a=pc([o[0],o[1],o[2]]),c=a[0],l=a[1],u=a[2];return[c,l,u,1]}if(t.length===4){var d=t.map(ls),i=d[0],r=d[1],s=d[2],h=d[3],o=mc([i/255,r/255,s/255]),f=pc([o[0],o[1],o[2]]),c=f[0],l=f[1],u=f[2];return[c,l,u,h]}return[0,0,0,1]},Yy=function(A,e){var t=bf(A,e),n=t[0],i=t[1],r=t[2],s=t[3],o=mc(Qf([n,i,r])),a=pc([o[0],o[1],o[2]]),c=a[0],l=a[1],u=a[2];return[c,l,u,s]},zy=function(A,e){var t=us(e),n=t[0],i=t[1],r=t[2],s=t[3],o=fs([n,i,r]),a=o[0],c=o[1],l=o[2];return[a,c,l,s]},Zy=function(A,e){var t=Sf(e),n=t[0],i=t[1],r=t[2],s=t[3],o=fs(ds([n,i,r])),a=o[0],c=o[1],l=o[2];return[a,c,l,s]},eb=function(A,e){var t=Uf(e),n=t[0],i=t[1],r=t[2],s=t[3],o=hs(ds([n,i,r])),a=o[0],c=o[1],l=o[2];return[a,c,l,s]},tb=function(A,e){var t=us(e),n=t[0],i=t[1],r=t[2],s=t[3],o=hs([n,i,r]),a=o[0],c=o[1],l=o[2];return[a,c,l,s]},Ab=function(A){return fc([A[0],A[1],A[2]])},Ff=function(A){return A},nb=function(A){var e=Tf([A[0],A[2],A[3]]),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},kf=function(A){return Fi([A[0],A[1],A[2],A[3]])},ib=function(A){var e=Ab([A[0],A[1],A[2]]);return Fi([e[0],e[1],e[2],A[3]])},TA=function(A){return et([3.2409699419045226,-1.537383177570094,-.4986107602930034,-.9692436362808796,1.8759675015077202,.04155505740717559,.05563007969699366,-.20397695888897652,1.0569715142428786],A)},pc=function(A){return et([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],A)},YA=function(A){return A.map(function(e){var t=e<0?-1:1,n=Math.abs(e);return n>.0031308?t*(1.055*Math.pow(n,1/2.4)-.055):12.92*e})},mc=function(A){return A.map(function(e){var t=e<0?-1:1,n=Math.abs(e);return n<=.04045?e/12.92:t*Math.pow((n+.055)/1.055,2.4)})},rb=function(A){var e=YA(TA([A[0],A[1],A[2]])),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},sb=function(A){var e=TA([A[0],A[1],A[2]]),t=e[0],n=e[1],i=e[2];return[pe(Math.round(t*255),0,255),pe(Math.round(n*255),0,255),pe(Math.round(i*255),0,255),A[3]]},ob=function(A){return et([.4865709486482162,.26566769316909306,.1982172852343625,.2289745640697488,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],A)},ab=function(A){return et([2.493496911941425,-.9313836179191239,-.40271078445071684,-.8294889695615747,1.7626640603183463,.023624685841943577,.03584583024378447,-.07617238926804182,.9568845240076872],A)},cb=function(A){return A.map(function(e){var t=e<0?-1:1,n=e*t;return n<=.04045?e/12.92:t*Math.pow((e+.055)/1.055,2.4)||0})},lb=function(A){return YA(A)},ub=function(A){var e=cb([A[0],A[1],A[2]]);return ob([e[0],e[1],e[2]])},db=function(A){var e=lb(ab([A[0],A[1],A[2]])),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},hb=function(A){var e=ub([A[0],A[1],A[2]]);return Fi([e[0],e[1],e[2],A[3]])},fb=function(A){return et([2.0415879038107465,-.5650069742788596,-.34473135077832956,-.9692436362808795,1.8759675015077202,.04155505740717557,.013444280632031142,-.11836239223101838,1.0151749943912054],A)},gb=function(A){return et([.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.0752914584939978,.02703136138641234,.07068885253582723,.9913375368376388],A)},pb=function(A){var e=A.map(function(t){var n=t<0?-1:1,i=Math.abs(t);return n*Math.pow(i,2.19921875)});return[e[0],e[1],e[2]]},mb=function(A){var e=A.map(function(t){var n=t<0?-1:1,i=Math.abs(t);return n*Math.pow(i,.4547069271758437)});return[e[0],e[1],e[2]]},Bb=function(A){var e=mb(fb([A[0],A[1],A[2]])),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},vb=function(A){var e=TA(gb(pb([A[0],A[1],A[2]])));return hc([e[0],e[1],e[2],A[3]])},Cb=function(A){return et([.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602],A)},wb=function(A){return et([1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452],A)},yb=function(A){return A.map(function(e){return e<16/512?e/16:Math.pow(e,1.8)})},bb=function(A){return A.map(function(e){return e>1/512?Math.pow(e,1/1.8):e*16})},Eb=function(A){var e=yb([A[0],A[1],A[2]]);return fc(Cb([e[0],e[1],e[2]]))},Sb=function(A){var e=bb(wb(Tf([A[0],A[1],A[2]]))),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},Ub=function(A){var e=Eb([A[0],A[1],A[2]]);return Fi([e[0],e[1],e[2],A[3]])},gs=1.09929682680944,If=.018053968510807,Tb=function(A){return A.map(function(e){return e<If*4.5?e/4.5:Math.pow((e+gs-1)/gs,1/.45)})},Qb=function(A){return A.map(function(e){return e>=If?gs*Math.pow(e,.45)-(gs-1):4.5*e})},Fb=function(A){return et([.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.060985057710791],A)},kb=function(A){return et([1.716651187971268,-.355670783776392,-.25336628137366,-.666684351832489,1.616481236634939,.0157685458139111,.017639857445311,-.042770613257809,.942103121235474],A)},Ib=function(A){var e=Tb([A[0],A[1],A[2]]);return Fb([e[0],e[1],e[2]])},_b=function(A){var e=Qb(kb([A[0],A[1],A[2]])),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},xb=function(A){var e=Ib([A[0],A[1],A[2]]);return Fi([e[0],e[1],e[2],A[3]])},QA={name:"color",parse:function(A,e){if(e.type===18){var t=Db[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'.concat(e.name,'"'));return t(A,e.values)}if(e.type===5){var n=_f(e),i=n[0],r=n[1],s=n[2],o=n[3];return Ht(i,r,s,o)}if(e.type===20){var a=Mt[e.value.toUpperCase()];if(typeof a<"u")return a}return Mt.TRANSPARENT}},_f=function(A){if(A.value.length===3){var e=A.value.substring(0,1),t=A.value.substring(1,2),n=A.value.substring(2,3);return[parseInt(e+e,16),parseInt(t+t,16),parseInt(n+n,16),1]}if(A.value.length===4){var e=A.value.substring(0,1),t=A.value.substring(1,2),n=A.value.substring(2,3),i=A.value.substring(3,4);return[parseInt(e+e,16),parseInt(t+t,16),parseInt(n+n,16),parseInt(i+i,16)/255]}if(A.value.length===6){var e=A.value.substring(0,2),t=A.value.substring(2,4),n=A.value.substring(4,6);return[parseInt(e,16),parseInt(t,16),parseInt(n,16),1]}if(A.value.length===8){var e=A.value.substring(0,2),t=A.value.substring(2,4),n=A.value.substring(4,6),i=A.value.substring(6,8);return[parseInt(e,16),parseInt(t,16),parseInt(n,16),parseInt(i,16)/255]}return[0,0,0,1]},xf=function(A,e){var t=e.filter(_e);if(qA(t))throw new Error("Relative color not supported for rgb()");if(t.length===3){var n=t.map(ls),i=n[0],r=n[1],s=n[2];return Ht(i,r,s,1)}if(t.length===4){var o=t.map(ls),i=o[0],r=o[1],s=o[2],a=o[3];return Ht(i,r,s,a)}return 0},Rb=function(A,e){var t=e.filter(_e),n=t[0].type===20?t[0].value:"unknown",i=!qA(t);if(i){var r=n,s=Rf[r];if(typeof s>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(r,'" for color() function'));var o=ye(t[1])?t[1].number:0,a=ye(t[2])?t[2].number:0,c=ye(t[3])?t[3].number:0,l=t.length>4&&t[4].type===6&&t[4].value==="/"&&ye(t[5])?t[5].number:1;return s([o,a,c,l])}else{var u=function(G,q){if(ye(q))return q.number;var tt=function(je){return je==="r"||je==="x"?0:je==="g"||je==="y"?1:2};if($(q)){var Ne=tt(q.value);return G[Ne]}var De=function(je){for(var nA=je.filter(_e),kt="(",$e=0,qn=nA;$e<qn.length;$e++){var gt=qn[$e];kt+=gt.type===18&&gt.name==="calc"?De(gt.values):ye(gt)?gt.number:gt.type===6||$(gt)?gt.value:""}return kt+=")",kt};if(q.type===18){var AA=q.values.filter(_e);if(q.name==="calc"){var ft=De(AA).replace(/r|x/,G[0].toString()).replace(/g|y/,G[1].toString()).replace(/b|z/,G[2].toString());return new Function("return "+ft)()}}return null},d=t[1].type===18?t[1].name:$(t[1])||t[1].type===5?"rgb":"unknown",h=$(t[2])?t[2].value:"unknown",f=t[1].type===18?t[1].values:$(t[1])?[t[1]]:[];if($(t[1])){var g=Mt[t[1].value.toUpperCase()];if(typeof g>"u")throw new Error("Attempting to use unknown color in relative color 'from'");var p=In(A,t[1].value),B=255&p,y=255&p>>8,b=255&p>>16,v=255&p>>24;f=[{type:17,number:v,flags:1},{type:17,number:b,flags:1},{type:17,number:y,flags:1},{type:17,number:B>1?B/255:B,flags:1}]}else if(t[1].type===5){var C=_f(t[1]),v=C[0],b=C[1],y=C[2],B=C[3];f=[{type:17,number:v,flags:1},{type:17,number:b,flags:1},{type:17,number:y,flags:1},{type:17,number:B>1?B/255:B,flags:1}]}if(f.length===0)throw new Error("Attempting to use unknown color in relative color 'from'");if(h==="unknown")throw new Error("Attempting to use unknown colorspace in relative color 'to'");var w=Pb[d],S=Lb[h],F=Rf[h];if(typeof w>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(d,'" for color() function'));if(typeof S>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(h,'" for color() function'));var _=w(A,f),D=S(_),o=u(D,t[3]),a=u(D,t[4]),c=u(D,t[5]),l=t.length>6&&t[6].type===6&&t[6].value==="/"&&ye(t[7])?t[7].number:1;if(o===null||a===null||c===null)throw new Error("Invalid relative color in color() function");return F([o,a,c,l])}},Rf={srgb:jy,"srgb-linear":hc,"display-p3":hb,"a98-rgb":vb,"prophoto-rgb":Ub,xyz:kf,"xyz-d50":ib,"xyz-d65":kf,rec2020:xb},Pb={rgb:qy,hsl:Yy,lab:zy,lch:Zy,oklab:tb,oklch:eb},Lb={srgb:rb,"srgb-linear":sb,"display-p3":db,"a98-rgb":Bb,"prophoto-rgb":Sb,xyz:Ff,"xyz-d50":nb,"xyz-d65":Ff,rec2020:_b},Db={hsl:Ef,hsla:Ef,rgb:xf,rgba:xf,lch:Xy,oklch:Jy,oklab:Wy,lab:$y,color:Rb},In=function(A,e){return QA.parse(A,ff.create(e).parseComponentValue())},Mt={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Ob={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if($(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Hb={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ps=function(A,e){var t=QA.parse(A,e[0]),n=e[1];return n&&le(n)?{color:t,stop:n}:{color:t,stop:null}},Pf=function(A,e){var t=A[0],n=A[A.length-1];t.stop===null&&(t.stop=xe),n.stop===null&&(n.stop=SA);for(var i=[],r=0,s=0;s<A.length;s++){var o=A[s].stop;if(o!==null){var a=ne(o,e);a>r?i.push(a):i.push(r),r=a}else i.push(null)}for(var c=null,s=0;s<i.length;s++){var l=i[s];if(l===null)c===null&&(c=s);else if(c!==null){for(var u=s-c,d=i[c-1],h=(l-d)/(u+1),f=1;f<=u;f++)i[c+f-1]=h*f;c=null}}return A.map(function(g,p){var B=g.color;return{color:B,stop:Math.max(Math.min(1,i[p]/e),0)}})},Mb=function(A,e,t){var n=e/2,i=t/2,r=ne(A[0],e)-n,s=i-ne(A[1],t);return(Math.atan2(s,r)+Math.PI*2)%(Math.PI*2)},Nb=function(A,e,t){var n=typeof A=="number"?A:Mb(A,e,t),i=Math.abs(e*Math.sin(n))+Math.abs(t*Math.cos(n)),r=e/2,s=t/2,o=i/2,a=Math.sin(n-Math.PI/2)*o,c=Math.cos(n-Math.PI/2)*o;return[i,r-c,r+c,s-a,s+a]},Ut=function(A,e){return Math.sqrt(A*A+e*e)},Lf=function(A,e,t,n,i){var r=[[0,0],[0,e],[A,0],[A,e]];return r.reduce(function(s,o){var a=o[0],c=o[1],l=Ut(t-a,n-c);return(i?l<s.optimumDistance:l>s.optimumDistance)?{optimumCorner:o,optimumDistance:l}:s},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},Kb=function(A,e,t,n,i){var r=0,s=0;switch(A.size){case 0:A.shape===0?r=s=Math.min(Math.abs(e),Math.abs(e-n),Math.abs(t),Math.abs(t-i)):A.shape===1&&(r=Math.min(Math.abs(e),Math.abs(e-n)),s=Math.min(Math.abs(t),Math.abs(t-i)));break;case 2:if(A.shape===0)r=s=Math.min(Ut(e,t),Ut(e,t-i),Ut(e-n,t),Ut(e-n,t-i));else if(A.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-i))/Math.min(Math.abs(e),Math.abs(e-n)),a=Lf(n,i,e,t,!0),c=a[0],l=a[1];r=Ut(c-e,(l-t)/o),s=o*r}break;case 1:A.shape===0?r=s=Math.max(Math.abs(e),Math.abs(e-n),Math.abs(t),Math.abs(t-i)):A.shape===1&&(r=Math.max(Math.abs(e),Math.abs(e-n)),s=Math.max(Math.abs(t),Math.abs(t-i)));break;case 3:if(A.shape===0)r=s=Math.max(Ut(e,t),Ut(e,t-i),Ut(e-n,t),Ut(e-n,t-i));else if(A.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-i))/Math.max(Math.abs(e),Math.abs(e-n)),u=Lf(n,i,e,t,!1),c=u[0],l=u[1];r=Ut(c-e,(l-t)/o),s=o*r}break}return Array.isArray(A.size)&&(r=ne(A.size[0],n),s=A.size.length===2?ne(A.size[1],i):r),[r,s]},Gb=function(A,e){var t=ct(180),n=[];return Ot(e).forEach(function(i,r){if(r===0){var s=i[0];if(s.type===20&&s.value==="to"){t=yf(i);return}else if(wf(s)){t=cs.parse(A,s);return}}var o=ps(A,i);n.push(o)}),{angle:t,stops:n,type:1}},ms=function(A,e){var t=ct(180),n=[];return Ot(e).forEach(function(i,r){if(r===0){var s=i[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=yf(i);return}else if(wf(s)){t=(cs.parse(A,s)+ct(270))%ct(360);return}}var o=ps(A,i);n.push(o)}),{angle:t,stops:n,type:1}},Vb=function(A,e){var t=ct(180),n=[],i=1,r=0,s=3,o=[];return Ot(e).forEach(function(a,c){var l=a[0];if(c===0){if($(l)&&l.value==="linear"){i=1;return}else if($(l)&&l.value==="radial"){i=2;return}}if(l.type===18){if(l.name==="from"){var u=QA.parse(A,l.values[0]);n.push({stop:xe,color:u})}else if(l.name==="to"){var u=QA.parse(A,l.values[0]);n.push({stop:SA,color:u})}else if(l.name==="color-stop"){var d=l.values.filter(_e);if(d.length===2){var u=QA.parse(A,d[1]),h=d[0];ye(h)&&n.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(t+ct(180))%ct(360),stops:n,type:i}:{size:s,shape:r,stops:n,position:o,type:i}},Df="closest-side",Of="farthest-side",Hf="closest-corner",Mf="farthest-corner",Nf="circle",Kf="ellipse",Gf="cover",Vf="contain",jb=function(A,e){var t=0,n=3,i=[],r=[];return Ot(e).forEach(function(s,o){var a=!0;if(o===0){var c=!1;a=s.reduce(function(u,d){if(c)if($(d))switch(d.value){case"center":return r.push(dc),u;case"top":case"left":return r.push(xe),u;case"right":case"bottom":return r.push(SA),u}else(le(d)||EA(d))&&r.push(d);else if($(d))switch(d.value){case Nf:return t=0,!1;case Kf:return t=1,!1;case"at":return c=!0,!1;case Df:return n=0,!1;case Gf:case Of:return n=1,!1;case Vf:case Hf:return n=2,!1;case Mf:return n=3,!1}else if(EA(d)||le(d))return Array.isArray(n)||(n=[]),n.push(d),!1;return u},a)}if(a){var l=ps(A,s);i.push(l)}}),{size:n,shape:t,stops:i,position:r,type:2}},Bs=function(A,e){var t=0,n=3,i=[],r=[];return Ot(e).forEach(function(s,o){var a=!0;if(o===0?a=s.reduce(function(l,u){if($(u))switch(u.value){case"center":return r.push(dc),!1;case"top":case"left":return r.push(xe),!1;case"right":case"bottom":return r.push(SA),!1}else if(le(u)||EA(u))return r.push(u),!1;return l},a):o===1&&(a=s.reduce(function(l,u){if($(u))switch(u.value){case Nf:return t=0,!1;case Kf:return t=1,!1;case Vf:case Df:return n=0,!1;case Of:return n=1,!1;case Hf:return n=2,!1;case Gf:case Mf:return n=3,!1}else if(EA(u)||le(u))return Array.isArray(n)||(n=[]),n.push(u),!1;return l},a)),a){var c=ps(A,s);i.push(c)}}),{size:n,shape:t,stops:i,position:r,type:2}},$b=function(A){return A.type===1},Wb=function(A){return A.type===2},Bc={name:"image",parse:function(A,e){if(e.type===22){var t={url:e.value,type:0};return A.cache.addImage(e.value),t}if(e.type===18){var n=jf[e.name];if(typeof n>"u")throw new Error('Attempting to parse an unsupported image function "'.concat(e.name,'"'));return n(A,e.values)}throw new Error("Unsupported image type ".concat(e.type))}};function Jb(A){return!(A.type===20&&A.value==="none")&&(A.type!==18||!!jf[A.name])}var jf={"linear-gradient":Gb,"-moz-linear-gradient":ms,"-ms-linear-gradient":ms,"-o-linear-gradient":ms,"-webkit-linear-gradient":ms,"radial-gradient":jb,"-moz-radial-gradient":Bs,"-ms-radial-gradient":Bs,"-o-radial-gradient":Bs,"-webkit-radial-gradient":Bs,"-webkit-gradient":Vb},Xb={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(n){return _e(n)&&Jb(n)}).map(function(n){return Bc.parse(A,n)})}},qb={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if($(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Yb={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(A,e){return Ot(e).map(function(t){return t.filter(le)}).map(pf)}},zb={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(A,e){return Ot(e).map(function(t){return t.filter($).map(function(n){return n.value}).join(" ")}).map(Zb)}},Zb=function(A){switch(A){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},_n;(function(A){A.AUTO="auto",A.CONTAIN="contain",A.COVER="cover"})(_n||(_n={}));var eE={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(A,e){return Ot(e).map(function(t){return t.filter(tE)})}},tE=function(A){return $(A)||le(A)},vs=function(A){return{name:"border-".concat(A,"-color"),initialValue:"transparent",prefix:!1,type:3,format:"color"}},AE=vs("top"),nE=vs("right"),iE=vs("bottom"),rE=vs("left"),Cs=function(A){return{name:"border-radius-".concat(A),initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return pf(t.filter(le))}}},sE=Cs("top-left"),oE=Cs("top-right"),aE=Cs("bottom-right"),cE=Cs("bottom-left"),ws=function(A){return{name:"border-".concat(A,"-style"),initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},lE=ws("top"),uE=ws("right"),dE=ws("bottom"),hE=ws("left"),ys=function(A){return{name:"border-".concat(A,"-width"),initialValue:"0",type:0,prefix:!1,parse:function(e,t){return bA(t)?t.number:0}}},fE=ys("top"),gE=ys("right"),pE=ys("bottom"),mE=ys("left"),BE={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},vE={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(A,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},CE={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(A,e){return e.filter($).reduce(function(t,n){return t|wE(n.value)},0)}},wE=function(A){switch(A){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},yE={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},bE={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(A,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},bs;(function(A){A.NORMAL="normal",A.STRICT="strict"})(bs||(bs={}));var EE={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"strict":return bs.STRICT;case"normal":default:return bs.NORMAL}}},SE={name:"line-height",initialValue:"normal",prefix:!1,type:4},$f=function(A,e){return $(A)&&A.value==="normal"?1.2*e:A.type===17?e*A.number:le(A)?ne(A,e):e},UE={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(A,e){return e.type===20&&e.value==="none"?null:Bc.parse(A,e)}},TE={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(A,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},vc={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 52;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},Es=function(A){return{name:"margin-".concat(A),initialValue:"0",prefix:!1,type:4}},QE=Es("top"),FE=Es("right"),kE=Es("bottom"),IE=Es("left"),_E={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(A,e){return e.filter($).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},xE={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},Ss=function(A){return{name:"padding-".concat(A),initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},RE=Ss("top"),PE=Ss("right"),LE=Ss("bottom"),DE=Ss("left"),OE={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(A,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},HE={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(A,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},ME={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&uc(e[0],"none")?[]:Ot(e).map(function(t){for(var n={color:Mt.TRANSPARENT,offsetX:xe,offsetY:xe,blur:xe},i=0,r=0;r<t.length;r++){var s=t[r];EA(s)?(i===0?n.offsetX=s:i===1?n.offsetY=s:n.blur=s,i++):n.color=QA.parse(A,s)}return n})}},NE={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},KE={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(A,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=jE[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'.concat(e.name,'"'));return t(e.values)}return null}},GE=function(A){var e=A.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},VE=function(A){var e=A.filter(function(a){return a.type===17}).map(function(a){return a.number}),t=e[0],n=e[1];e[2],e[3];var i=e[4],r=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[t,n,i,r,s,o]:null},jE={matrix:GE,matrix3d:VE},Wf={type:16,number:50,flags:bi},$E=[Wf,Wf],WE={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(A,e){var t=e.filter(le);return t.length!==2?$E:[t[0],t[1]]}},JE={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},ki;(function(A){A.NORMAL="normal",A.BREAK_ALL="break-all",A.KEEP_ALL="keep-all"})(ki||(ki={}));for(var XE={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"break-all":return ki.BREAK_ALL;case"keep-all":return ki.KEEP_ALL;case"normal":default:return ki.NORMAL}}},qE={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(A,e){if(e.type===20)return{auto:!0,order:0};if(ye(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Jf={name:"time",parse:function(A,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},YE={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(A,e){return ye(e)?e.number:1}},zE={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ZE={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(A,e){return e.filter($).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},eS={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(A,e){var t=[],n=[];return e.forEach(function(i){switch(i.type){case 20:case 0:t.push(i.value);break;case 17:t.push(i.number.toString());break;case 4:n.push(t.join(" ")),t.length=0;break}}),t.length&&n.push(t.join(" ")),n.map(function(i){return i.indexOf(" ")===-1?i:"'".concat(i,"'")})}},tS={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},AS={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(A,e){if(ye(e))return e.number;if($(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},nS={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.filter($).map(function(t){return t.value})}},iS={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Se=function(A,e){return(A&e)!==0},rS={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},sS={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var n=[],i=e.filter(gf),r=0;r<i.length;r++){var s=i[r],o=i[r+1];if(s.type===20){var a=o&&ye(o)?o.number:1;n.push({counter:s.value,increment:a})}}return n}},oS={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return[];for(var t=[],n=e.filter(gf),i=0;i<n.length;i++){var r=n[i],s=n[i+1];if($(r)&&r.value!=="none"){var o=s&&ye(s)?s.number:0;t.push({counter:r.value,reset:o})}}return t}},aS={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(A,e){return e.filter(bA).map(function(t){return Jf.parse(A,t)})}},cS={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var n=[],i=e.filter(Gy);if(i.length%2!==0)return null;for(var r=0;r<i.length;r+=2){var s=i[r].value,o=i[r+1].value;n.push({open:s,close:o})}return n}},Xf=function(A,e,t){if(!A)return"";var n=A[Math.min(e,A.length-1)];return n?t?n.open:n.close:""},lS={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&uc(e[0],"none")?[]:Ot(e).map(function(t){for(var n={color:255,offsetX:xe,offsetY:xe,blur:xe,spread:xe,inset:!1},i=0,r=0;r<t.length;r++){var s=t[r];uc(s,"inset")?n.inset=!0:EA(s)?(i===0?n.offsetX=s:i===1?n.offsetY=s:i===2?n.blur=s:n.spread=s,i++):n.color=QA.parse(A,s)}return n})}},uS={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(A,e){var t=[0,1,2],n=[];return e.filter($).forEach(function(i){switch(i.value){case"stroke":n.push(1);break;case"fill":n.push(0);break;case"markers":n.push(2);break}}),t.forEach(function(i){n.indexOf(i)===-1&&n.push(i)}),n}},dS={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},hS={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(A,e){return bA(e)?e.number:0}},fS={name:"objectFit",initialValue:"fill",prefix:!1,type:1,parse:function(A,e){return e.filter($).reduce(function(t,n){return t|gS(n.value)},0)}},gS=function(A){switch(A){case"contain":return 2;case"cover":return 4;case"none":return 8;case"scale-down":return 16}return 0},pS=function(){function A(e,t){var n,i;this.animationDuration=P(e,aS,t.animationDuration),this.backgroundClip=P(e,Ob,t.backgroundClip),this.backgroundColor=P(e,Hb,t.backgroundColor),this.backgroundImage=P(e,Xb,t.backgroundImage),this.backgroundOrigin=P(e,qb,t.backgroundOrigin),this.backgroundPosition=P(e,Yb,t.backgroundPosition),this.backgroundRepeat=P(e,zb,t.backgroundRepeat),this.backgroundSize=P(e,eE,t.backgroundSize),this.borderTopColor=P(e,AE,t.borderTopColor),this.borderRightColor=P(e,nE,t.borderRightColor),this.borderBottomColor=P(e,iE,t.borderBottomColor),this.borderLeftColor=P(e,rE,t.borderLeftColor),this.borderTopLeftRadius=P(e,sE,t.borderTopLeftRadius),this.borderTopRightRadius=P(e,oE,t.borderTopRightRadius),this.borderBottomRightRadius=P(e,aE,t.borderBottomRightRadius),this.borderBottomLeftRadius=P(e,cE,t.borderBottomLeftRadius),this.borderTopStyle=P(e,lE,t.borderTopStyle),this.borderRightStyle=P(e,uE,t.borderRightStyle),this.borderBottomStyle=P(e,dE,t.borderBottomStyle),this.borderLeftStyle=P(e,hE,t.borderLeftStyle),this.borderTopWidth=P(e,fE,t.borderTopWidth),this.borderRightWidth=P(e,gE,t.borderRightWidth),this.borderBottomWidth=P(e,pE,t.borderBottomWidth),this.borderLeftWidth=P(e,mE,t.borderLeftWidth),this.boxShadow=P(e,lS,t.boxShadow),this.color=P(e,BE,t.color),this.direction=P(e,vE,t.direction),this.display=P(e,CE,t.display),this.float=P(e,yE,t.cssFloat),this.fontFamily=P(e,eS,t.fontFamily),this.fontSize=P(e,tS,t.fontSize),this.fontStyle=P(e,iS,t.fontStyle),this.fontVariant=P(e,nS,t.fontVariant),this.fontWeight=P(e,AS,t.fontWeight),this.letterSpacing=P(e,bE,t.letterSpacing),this.lineBreak=P(e,EE,t.lineBreak),this.lineHeight=P(e,SE,t.lineHeight),this.listStyleImage=P(e,UE,t.listStyleImage),this.listStylePosition=P(e,TE,t.listStylePosition),this.listStyleType=P(e,vc,t.listStyleType),this.marginTop=P(e,QE,t.marginTop),this.marginRight=P(e,FE,t.marginRight),this.marginBottom=P(e,kE,t.marginBottom),this.marginLeft=P(e,IE,t.marginLeft),this.opacity=P(e,YE,t.opacity);var r=P(e,_E,t.overflow);this.overflowX=r[0],this.overflowY=r[r.length>1?1:0],this.overflowWrap=P(e,xE,t.overflowWrap),this.paddingTop=P(e,RE,t.paddingTop),this.paddingRight=P(e,PE,t.paddingRight),this.paddingBottom=P(e,LE,t.paddingBottom),this.paddingLeft=P(e,DE,t.paddingLeft),this.paintOrder=P(e,uS,t.paintOrder),this.position=P(e,HE,t.position),this.textAlign=P(e,OE,t.textAlign),this.textDecorationColor=P(e,zE,(n=t.textDecorationColor)!==null&&n!==void 0?n:t.color),this.textDecorationLine=P(e,ZE,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=P(e,ME,t.textShadow),this.textTransform=P(e,NE,t.textTransform),this.transform=P(e,KE,t.transform),this.transformOrigin=P(e,WE,t.transformOrigin),this.visibility=P(e,JE,t.visibility),this.webkitTextStrokeColor=P(e,dS,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=P(e,hS,t.webkitTextStrokeWidth),this.wordBreak=P(e,XE,t.wordBreak),this.zIndex=P(e,qE,t.zIndex),this.objectFit=P(e,fS,t.objectFit)}return A.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},A.prototype.isTransparent=function(){return UA(this.backgroundColor)},A.prototype.isTransformed=function(){return this.transform!==null},A.prototype.isPositioned=function(){return this.position!==0},A.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},A.prototype.isFloating=function(){return this.float!==0},A.prototype.isInlineLevel=function(){return Se(this.display,4)||Se(this.display,33554432)||Se(this.display,268435456)||Se(this.display,536870912)||Se(this.display,67108864)||Se(this.display,134217728)},A}(),mS=function(){function A(e,t){this.content=P(e,rS,t.content),this.quotes=P(e,cS,t.quotes)}return A}(),qf=function(){function A(e,t){this.counterIncrement=P(e,sS,t.counterIncrement),this.counterReset=P(e,oS,t.counterReset)}return A}(),P=function(A,e,t){var n=new hf,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;n.write(i);var r=new ff(n.read());switch(e.type){case 2:var s=r.parseComponentValue();return e.parse(A,$(s)?s.value:e.initialValue);case 0:return e.parse(A,r.parseComponentValue());case 1:return e.parse(A,r.parseComponentValues());case 4:return r.parseComponentValue();case 3:switch(e.format){case"angle":return cs.parse(A,r.parseComponentValue());case"color":return QA.parse(A,r.parseComponentValue());case"image":return Bc.parse(A,r.parseComponentValue());case"length":var o=r.parseComponentValue();return EA(o)?o:xe;case"length-percentage":var a=r.parseComponentValue();return le(a)?a:xe;case"time":return Jf.parse(A,r.parseComponentValue())}break}},BS="data-html2canvas-debug",vS=function(A){var e=A.getAttribute(BS);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Cc=function(A,e){var t=vS(A);return t===1||e===t},Nt=function(){function A(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Cc(t,3))debugger;this.styles=new pS(e,window.getComputedStyle(t,null)),Rc(t)&&(this.styles.animationDuration.some(function(n){return n>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Gr(this.context,t),Cc(t,4)&&(this.flags|=16)}return A}(),CS="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Yf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ii=typeof Uint8Array>"u"?[]:new Uint8Array(256),Us=0;Us<Yf.length;Us++)Ii[Yf.charCodeAt(Us)]=Us;for(var wS=function(A){var e=A.length*.75,t=A.length,n,i=0,r,s,o,a;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),l=Array.isArray(c)?c:new Uint8Array(c);for(n=0;n<t;n+=4)r=Ii[A.charCodeAt(n)],s=Ii[A.charCodeAt(n+1)],o=Ii[A.charCodeAt(n+2)],a=Ii[A.charCodeAt(n+3)],l[i++]=r<<2|s>>4,l[i++]=(s&15)<<4|o>>2,l[i++]=(o&3)<<6|a&63;return c},yS=function(A){for(var e=A.length,t=[],n=0;n<e;n+=2)t.push(A[n+1]<<8|A[n]);return t},bS=function(A){for(var e=A.length,t=[],n=0;n<e;n+=4)t.push(A[n+3]<<24|A[n+2]<<16|A[n+1]<<8|A[n]);return t},zA=5,wc=6+5,yc=2,ES=wc-zA,zf=65536>>zA,SS=1<<zA,bc=SS-1,US=1024>>zA,TS=zf+US,QS=TS,FS=32,kS=QS+FS,IS=65536>>wc,_S=1<<ES,xS=_S-1,Zf=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},RS=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},PS=function(A,e){var t=wS(A),n=Array.isArray(t)?bS(t):new Uint32Array(t),i=Array.isArray(t)?yS(t):new Uint16Array(t),r=24,s=Zf(i,r/2,n[4]/2),o=n[5]===2?Zf(i,(r+n[4])/2):RS(n,Math.ceil((r+n[4])/4));return new LS(n[0],n[1],n[2],n[3],s,o)},LS=function(){function A(e,t,n,i,r,s){this.initialValue=e,this.errorValue=t,this.highStart=n,this.highValueIndex=i,this.index=r,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>zA],t=(t<<yc)+(e&bc),this.data[t];if(e<=65535)return t=this.index[zf+(e-55296>>zA)],t=(t<<yc)+(e&bc),this.data[t];if(e<this.highStart)return t=kS-IS+(e>>wc),t=this.index[t],t+=e>>zA&xS,t=this.index[t],t=(t<<yc)+(e&bc),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A}(),eg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",DS=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ts=0;Ts<eg.length;Ts++)DS[eg.charCodeAt(Ts)]=Ts;var OS=1,Ec=2,Sc=3,tg=4,Ag=5,HS=7,ng=8,Uc=9,Tc=10,ig=11,rg=12,sg=13,og=14,Qc=15,MS=function(A){for(var e=[],t=0,n=A.length;t<n;){var i=A.charCodeAt(t++);if(i>=55296&&i<=56319&&t<n){var r=A.charCodeAt(t++);(r&64512)===56320?e.push(((i&1023)<<10)+(r&1023)+65536):(e.push(i),t--)}else e.push(i)}return e},NS=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var n=[],i=-1,r="";++i<t;){var s=A[i];s<=65535?n.push(s):(s-=65536,n.push((s>>10)+55296,s%1024+56320)),(i+1===t||n.length>16384)&&(r+=String.fromCharCode.apply(String,n),n.length=0)}return r},KS=PS(CS),lt="×",Fc="÷",GS=function(A){return KS.get(A)},VS=function(A,e,t){var n=t-2,i=e[n],r=e[t-1],s=e[t];if(r===Ec&&s===Sc)return lt;if(r===Ec||r===Sc||r===tg||s===Ec||s===Sc||s===tg)return Fc;if(r===ng&&[ng,Uc,ig,rg].indexOf(s)!==-1||(r===ig||r===Uc)&&(s===Uc||s===Tc)||(r===rg||r===Tc)&&s===Tc||s===sg||s===Ag||s===HS||r===OS)return lt;if(r===sg&&s===og){for(;i===Ag;)i=e[--n];if(i===og)return lt}if(r===Qc&&s===Qc){for(var o=0;i===Qc;)o++,i=e[--n];if(o%2===0)return lt}return Fc},jS=function(A){var e=MS(A),t=e.length,n=0,i=0,r=e.map(GS);return{next:function(){if(n>=t)return{done:!0,value:null};for(var s=lt;n<t&&(s=VS(e,r,++n))===lt;);if(s!==lt||n===t){var o=NS.apply(null,e.slice(i,n));return i=n,{value:o,done:!1}}return{done:!0,value:null}}}},$S=function(A){for(var e=jS(A),t=[],n;!(n=e.next()).done;)n.value&&t.push(n.value.slice());return t},WS=function(A){var e=123;if(A.createRange){var t=A.createRange();if(t.getBoundingClientRect){var n=A.createElement("boundtest");n.style.height="".concat(e,"px"),n.style.display="block",A.body.appendChild(n),t.selectNode(n);var i=t.getBoundingClientRect(),r=Math.round(i.height);if(A.body.removeChild(n),r===e)return!0}}return!1},JS=function(A){var e=A.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",A.body.appendChild(e);var t=A.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var n=e.firstChild,i=Vr(n.data).map(function(a){return Be(a)}),r=0,s={},o=i.every(function(a,c){t.setStart(n,r),t.setEnd(n,r+a.length);var l=t.getBoundingClientRect();r+=a.length;var u=l.x>s.x||l.y>s.y;return s=l,c===0?!0:u});return A.body.removeChild(e),o},XS=function(){return typeof new Image().crossOrigin<"u"},qS=function(){return typeof new XMLHttpRequest().responseType=="string"},YS=function(A){var e=new Image,t=A.createElement("canvas"),n=t.getContext("2d");if(!n)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{n.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},ag=function(A){return A[0]===0&&A[1]===255&&A[2]===0&&A[3]===255},zS=function(A){var e=A.createElement("canvas"),t=100;e.width=t,e.height=t;var n=e.getContext("2d");if(!n)return Promise.reject(!1);n.fillStyle="rgb(0, 255, 0)",n.fillRect(0,0,t,t);var i=new Image,r=e.toDataURL();i.src=r;var s=kc(t,t,0,0,i);return n.fillStyle="red",n.fillRect(0,0,t,t),cg(s).then(function(o){n.drawImage(o,0,0);var a=n.getImageData(0,0,t,t).data;n.fillStyle="red",n.fillRect(0,0,t,t);var c=A.createElement("div");return c.style.backgroundImage="url(".concat(r,")"),c.style.height="".concat(t,"px"),ag(a)?cg(kc(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return n.drawImage(o,0,0),ag(n.getImageData(0,0,t,t).data)}).catch(function(){return!1})},kc=function(A,e,t,n,i){var r="http://www.w3.org/2000/svg",s=document.createElementNS(r,"svg"),o=document.createElementNS(r,"foreignObject");return s.setAttributeNS(null,"width",A.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",n.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(i),s},cg=function(A){return new Promise(function(e,t){var n=new Image;n.onload=function(){return e(n)},n.onerror=t,n.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(A)))})},Re={get SUPPORT_RANGE_BOUNDS(){var A=WS(document);return Object.defineProperty(Re,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_WORD_BREAKING(){var A=Re.SUPPORT_RANGE_BOUNDS&&JS(document);return Object.defineProperty(Re,"SUPPORT_WORD_BREAKING",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=YS(document);return Object.defineProperty(Re,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A=typeof Array.from=="function"&&typeof window.fetch=="function"?zS(document):Promise.resolve(!1);return Object.defineProperty(Re,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=XS();return Object.defineProperty(Re,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A=qS();return Object.defineProperty(Re,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Re,"SUPPORT_CORS_XHR",{value:A}),A},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var A=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Re,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:A}),A}},_i=function(){function A(e,t){this.text=e,this.bounds=t}return A}(),ZS=function(A,e,t,n){var i=AU(e,t),r=[],s=0;return i.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Re.SUPPORT_RANGE_BOUNDS){var a=lg(n,s,o.length).getClientRects();if(a.length>1){var c=Ic(o),l=0;c.forEach(function(d){r.push(new _i(d,Jt.fromDOMRectList(A,lg(n,l+s,d.length).getClientRects()))),l+=d.length})}else r.push(new _i(o,Jt.fromDOMRectList(A,a)))}else{var u=n.splitText(o.length);r.push(new _i(o,eU(A,n))),n=u}else Re.SUPPORT_RANGE_BOUNDS||(n=n.splitText(o.length));s+=o.length}),r},eU=function(A,e){var t=e.ownerDocument;if(t){var n=t.createElement("html2canvaswrapper");n.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(n,e);var r=Gr(A,n);return n.firstChild&&i.replaceChild(n.firstChild,n),r}}return Jt.EMPTY},lg=function(A,e,t){var n=A.ownerDocument;if(!n)throw new Error("Node has no owner document");var i=n.createRange();return i.setStart(A,e),i.setEnd(A,e+t),i},Ic=function(A){if(Re.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(A)).map(function(t){return t.segment})}return $S(A)},tU=function(A,e){if(Re.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(A)).map(function(n){return n.segment})}return iU(A,e)},AU=function(A,e){return e.letterSpacing!==0?Ic(A):tU(A,e)},nU=[32,160,4961,65792,65793,4153,4241],iU=function(A,e){for(var t=Dw(A,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),n=[],i,r=function(){if(i.value){var s=i.value.slice(),o=Vr(s),a="";o.forEach(function(c){nU.indexOf(c)===-1?a+=Be(c):(a.length&&n.push(a),n.push(Be(c)),a="")}),a.length&&n.push(a)}};!(i=t.next()).done;)r();return n},rU=function(){function A(e,t,n){this.text=sU(t.data,n.textTransform),this.textBounds=ZS(e,this.text,n,t)}return A}(),sU=function(A,e){switch(e){case 1:return A.toLowerCase();case 3:return A.replace(oU,aU);case 2:return A.toUpperCase();default:return A}},oU=/(^|\s|:|-|\(|\))([a-z])/g,aU=function(A,e,t){return A.length>0?e+t.toUpperCase():A},ug=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.src=n.currentSrc||n.src,i.intrinsicWidth=n.naturalWidth,i.intrinsicHeight=n.naturalHeight,i.context.cache.addImage(i.src),i}return e}(Nt),dg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.canvas=n,i.intrinsicWidth=n.width,i.intrinsicHeight=n.height,i}return e}(Nt),hg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this,r=new XMLSerializer,s=Gr(t,n);return n.setAttribute("width","".concat(s.width,"px")),n.setAttribute("height","".concat(s.height,"px")),i.svg="data:image/svg+xml,".concat(encodeURIComponent(r.serializeToString(n))),i.intrinsicWidth=n.width.baseVal.value,i.intrinsicHeight=n.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(Nt),fg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.value=n.value,i}return e}(Nt),_c=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.start=n.start,i.reversed=typeof n.reversed=="boolean"&&n.reversed===!0,i}return e}(Nt),cU=[{type:15,flags:0,unit:"px",number:3}],lU=[{type:16,flags:0,number:50}],uU=function(A){return A.width>A.height?new Jt(A.left+(A.width-A.height)/2,A.top,A.height,A.height):A.width<A.height?new Jt(A.left,A.top+(A.height-A.width)/2,A.width,A.width):A},dU=function(A){var e=A.type===hU?new Array(A.value.length+1).join("•"):A.value;return e.length===0?A.placeholder||"":e},Qs="checkbox",Fs="radio",hU="password",gg=707406591,xc=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;switch(i.type=n.type.toLowerCase(),i.checked=n.checked,i.value=dU(n),(i.type===Qs||i.type===Fs)&&(i.styles.backgroundColor=3739148031,i.styles.borderTopColor=i.styles.borderRightColor=i.styles.borderBottomColor=i.styles.borderLeftColor=2779096575,i.styles.borderTopWidth=i.styles.borderRightWidth=i.styles.borderBottomWidth=i.styles.borderLeftWidth=1,i.styles.borderTopStyle=i.styles.borderRightStyle=i.styles.borderBottomStyle=i.styles.borderLeftStyle=1,i.styles.backgroundClip=[0],i.styles.backgroundOrigin=[0],i.bounds=uU(i.bounds)),i.type){case Qs:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=cU;break;case Fs:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=lU;break}return i}return e}(Nt),pg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this,r=n.options[n.selectedIndex||0];return i.value=r&&r.text||"",i}return e}(Nt),mg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.value=n.value,i}return e}(Nt),Bg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;i.src=n.src,i.width=parseInt(n.width,10)||0,i.height=parseInt(n.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(n.contentWindow&&n.contentWindow.document&&n.contentWindow.document.documentElement){i.tree=Cg(t,n.contentWindow.document.documentElement);var r=n.contentWindow.document.documentElement?In(t,getComputedStyle(n.contentWindow.document.documentElement).backgroundColor):Mt.TRANSPARENT,s=n.contentWindow.document.body?In(t,getComputedStyle(n.contentWindow.document.body).backgroundColor):Mt.TRANSPARENT;i.backgroundColor=UA(r)?UA(s)?i.styles.backgroundColor:s:r}}catch{}return i}return e}(Nt),fU=["OL","UL","MENU"],ks=function(A,e,t,n){for(var i=e.firstChild,r=void 0;i;i=r)if(r=i.nextSibling,wg(i)&&i.data.length>0)t.textNodes.push(new rU(A,i,t.styles));else if(xn(i))if(Tg(i)&&i.assignedNodes)i.assignedNodes().forEach(function(o){return ks(A,o,t,n)});else{var s=vg(A,i);s.styles.isVisible()&&(gU(i,s,n)?s.flags|=4:pU(s.styles)&&(s.flags|=2),fU.indexOf(i.tagName)!==-1&&(s.flags|=8),t.elements.push(s),i.slot,i.shadowRoot?ks(A,i.shadowRoot,s,n):!_s(i)&&!yg(i)&&!xs(i)&&ks(A,i,s,n))}},vg=function(A,e){return Lc(e)?new ug(A,e):bg(e)?new dg(A,e):yg(e)?new hg(A,e):mU(e)?new fg(A,e):BU(e)?new _c(A,e):vU(e)?new xc(A,e):xs(e)?new pg(A,e):_s(e)?new mg(A,e):Sg(e)?new Bg(A,e):new Nt(A,e)},Cg=function(A,e){var t=vg(A,e);return t.flags|=4,ks(A,e,t,t),t},gU=function(A,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Pc(A)&&t.styles.isTransparent()},pU=function(A){return A.isPositioned()||A.isFloating()},wg=function(A){return A.nodeType===Node.TEXT_NODE},xn=function(A){return A.nodeType===Node.ELEMENT_NODE},Rc=function(A){return xn(A)&&typeof A.style<"u"&&!Is(A)},Is=function(A){return typeof A.className=="object"},mU=function(A){return A.tagName==="LI"},BU=function(A){return A.tagName==="OL"},vU=function(A){return A.tagName==="INPUT"},CU=function(A){return A.tagName==="HTML"},yg=function(A){return A.tagName==="svg"},Pc=function(A){return A.tagName==="BODY"},bg=function(A){return A.tagName==="CANVAS"},Eg=function(A){return A.tagName==="VIDEO"},Lc=function(A){return A.tagName==="IMG"},Sg=function(A){return A.tagName==="IFRAME"},Ug=function(A){return A.tagName==="STYLE"},wU=function(A){return A.tagName==="SCRIPT"},_s=function(A){return A.tagName==="TEXTAREA"},xs=function(A){return A.tagName==="SELECT"},Tg=function(A){return A.tagName==="SLOT"},Qg=function(A){return A.tagName.indexOf("-")>0},yU=function(){function A(){this.counters={}}return A.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},A.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},A.prototype.pop=function(e){var t=this;e.forEach(function(n){return t.counters[n].pop()})},A.prototype.parse=function(e){var t=this,n=e.counterIncrement,i=e.counterReset,r=!0;n!==null&&n.forEach(function(o){var a=t.counters[o.counter];a&&o.increment!==0&&(r=!1,a.length||a.push(1),a[Math.max(0,a.length-1)]+=o.increment)});var s=[];return r&&i.forEach(function(o){var a=t.counters[o.counter];s.push(o.counter),a||(a=t.counters[o.counter]=[]),a.push(o.reset)}),s},A}(),Fg={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},kg={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},bU={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},EU={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Rn=function(A,e,t,n,i,r){return A<e||A>t?Ri(A,i,r.length>0):n.integers.reduce(function(s,o,a){for(;A>=o;)A-=o,s+=n.values[a];return s},"")+r},Ig=function(A,e,t,n){var i="";do t||A--,i=n(A)+i,A/=e;while(A*e>=e);return i},ve=function(A,e,t,n,i){var r=t-e+1;return(A<0?"-":"")+(Ig(Math.abs(A),r,n,function(s){return Be(Math.floor(s%r)+e)})+i)},ZA=function(A,e,t){t===void 0&&(t=". ");var n=e.length;return Ig(Math.abs(A),n,!1,function(i){return e[Math.floor(i%n)]})+t},Pn=1,FA=2,kA=4,xi=8,qt=function(A,e,t,n,i,r){if(A<-9999||A>9999)return Ri(A,4,i.length>0);var s=Math.abs(A),o=i;if(s===0)return e[0]+o;for(var a=0;s>0&&a<=4;a++){var c=s%10;c===0&&Se(r,Pn)&&o!==""?o=e[c]+o:c>1||c===1&&a===0||c===1&&a===1&&Se(r,FA)||c===1&&a===1&&Se(r,kA)&&A>100||c===1&&a>1&&Se(r,xi)?o=e[c]+(a>0?t[a-1]:"")+o:c===1&&a>0&&(o=t[a-1]+o),s=Math.floor(s/10)}return(A<0?n:"")+o},_g="十百千萬",xg="拾佰仟萬",Rg="マイナス",Dc="마이너스",Ri=function(A,e,t){var n=t?". ":"",i=t?"、":"",r=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=ve(A,48,57,!0,n);return o.length<4?"0".concat(o):o;case 4:return ZA(A,"〇一二三四五六七八九",i);case 6:return Rn(A,1,3999,Fg,3,n).toLowerCase();case 7:return Rn(A,1,3999,Fg,3,n);case 8:return ve(A,945,969,!1,n);case 9:return ve(A,97,122,!1,n);case 10:return ve(A,65,90,!1,n);case 11:return ve(A,1632,1641,!0,n);case 12:case 49:return Rn(A,1,9999,kg,3,n);case 35:return Rn(A,1,9999,kg,3,n).toLowerCase();case 13:return ve(A,2534,2543,!0,n);case 14:case 30:return ve(A,6112,6121,!0,n);case 15:return ZA(A,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return ZA(A,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return qt(A,"零一二三四五六七八九",_g,"負",i,FA|kA|xi);case 47:return qt(A,"零壹貳參肆伍陸柒捌玖",xg,"負",i,Pn|FA|kA|xi);case 42:return qt(A,"零一二三四五六七八九",_g,"负",i,FA|kA|xi);case 41:return qt(A,"零壹贰叁肆伍陆柒捌玖",xg,"负",i,Pn|FA|kA|xi);case 26:return qt(A,"〇一二三四五六七八九","十百千万",Rg,i,0);case 25:return qt(A,"零壱弐参四伍六七八九","拾百千万",Rg,i,Pn|FA|kA);case 31:return qt(A,"영일이삼사오육칠팔구","십백천만",Dc,r,Pn|FA|kA);case 33:return qt(A,"零一二三四五六七八九","十百千萬",Dc,r,0);case 32:return qt(A,"零壹貳參四五六七八九","拾百千",Dc,r,Pn|FA|kA);case 18:return ve(A,2406,2415,!0,n);case 20:return Rn(A,1,19999,EU,3,n);case 21:return ve(A,2790,2799,!0,n);case 22:return ve(A,2662,2671,!0,n);case 52:return Rn(A,1,10999,bU,3,n);case 23:return ZA(A,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return ZA(A,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return ve(A,3302,3311,!0,n);case 28:return ZA(A,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return ZA(A,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return ve(A,3792,3801,!0,n);case 37:return ve(A,6160,6169,!0,n);case 38:return ve(A,4160,4169,!0,n);case 39:return ve(A,2918,2927,!0,n);case 40:return ve(A,1776,1785,!0,n);case 43:return ve(A,3046,3055,!0,n);case 44:return ve(A,3174,3183,!0,n);case 45:return ve(A,3664,3673,!0,n);case 46:return ve(A,3872,3881,!0,n);case 3:default:return ve(A,48,57,!0,n)}},Pg="data-html2canvas-ignore",Lg=function(){function A(e,t,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=t,this.counters=new yU,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return A.prototype.toIFrame=function(e,t){var n=this,i=SU(e,t);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var r=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=i.contentWindow,a=o.document,c=QU(i).then(function(){return Ke(n,void 0,void 0,function(){var u,d;return Oe(this,function(h){switch(h.label){case 0:return this.scrolledElements.forEach(_U),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),u=this.options.onclone,d=this.clonedReferenceElement,typeof d>"u"?[2,Promise.reject("Error finding the ".concat(this.referenceElement.nodeName," in the cloned document"))]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:h.sent(),h.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,TU(a)]:[3,4];case 3:h.sent(),h.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(a,d)}).then(function(){return i})]:[2,i]}})})}),l=a.adoptNode(this.documentElement);return DU(l,a),a.open(),a.write("".concat(kU(document.doctype),"<html></html>")),IU(this.referenceElement.ownerDocument,r,s),a.replaceChild(l,a.documentElement),a.close(),c},A.prototype.createElementClone=function(e){if(Cc(e,2))debugger;if(bg(e))return this.createCanvasClone(e);if(Eg(e))return this.createVideoClone(e);if(Ug(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Lc(t)&&(Lc(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Qg(t)?this.createCustomElementClone(t):t},A.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Oc(e.style,t),t},A.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var n=[].slice.call(t.cssRules,0).reduce(function(r,s){return s&&typeof s.cssText=="string"?r+s.cssText:r},""),i=e.cloneNode(!1);return i.textContent=n,i}}catch(r){if(this.context.logger.error("Unable to access cssRules property",r),r.name!=="SecurityError")throw r}return e.cloneNode(!1)},A.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var n=e.ownerDocument.createElement("img");try{return n.src=e.toDataURL(),n}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var i=e.cloneNode(!1);try{i.width=e.width,i.height=e.height;var r=e.getContext("2d"),s=i.getContext("2d",{willReadFrequently:!0});if(s)if(!this.options.allowTaint&&r)s.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(o){var a=o.getContextAttributes();a?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return i}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return i},A.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var n=t.getContext("2d");try{return n&&(n.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||n.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var i=e.ownerDocument.createElement("canvas");return i.width=e.offsetWidth,i.height=e.offsetHeight,i},A.prototype.appendChildNode=function(e,t,n){(!xn(t)||!wU(t)&&!t.hasAttribute(Pg)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!xn(t)||!Ug(t))&&e.appendChild(this.cloneNode(t,n))},A.prototype.cloneChildNodes=function(e,t,n){for(var i=this,r=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;r;r=r.nextSibling)if(xn(r)&&Tg(r)&&typeof r.assignedNodes=="function"){var s=r.assignedNodes();s.length&&s.forEach(function(o){return i.appendChildNode(t,o,n)})}else this.appendChildNode(t,r,n)},A.prototype.cloneNode=function(e,t){if(wg(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&xn(e)&&(Rc(e)||Is(e))){var i=this.createElementClone(e);i.style.transitionProperty="none";var r=n.getComputedStyle(e),s=n.getComputedStyle(e,":before"),o=n.getComputedStyle(e,":after");this.referenceElement===e&&Rc(i)&&(this.clonedReferenceElement=i),Pc(i)&&PU(i);var a=this.counters.parse(new qf(this.context,r)),c=this.resolvePseudoContent(e,i,s,Pi.BEFORE);Qg(e)&&(t=!0),Eg(e)||this.cloneChildNodes(e,i,t),c&&i.insertBefore(c,i.firstChild);var l=this.resolvePseudoContent(e,i,o,Pi.AFTER);return l&&i.appendChild(l),this.counters.pop(a),(r&&(this.options.copyStyles||Is(e))&&!Sg(e)||t)&&Oc(r,i),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([i,e.scrollLeft,e.scrollTop]),(_s(e)||xs(e))&&(_s(i)||xs(i))&&(i.value=e.value),i}return e.cloneNode(!1)},A.prototype.resolvePseudoContent=function(e,t,n,i){var r=this;if(n){var s=n.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||n.display==="none")){this.counters.parse(new qf(this.context,n));var a=new mS(this.context,n),c=o.createElement("html2canvaspseudoelement");Oc(n,c),a.content.forEach(function(u){if(u.type===0)c.appendChild(o.createTextNode(u.value));else if(u.type===22){var d=o.createElement("img");d.src=u.value,d.style.opacity="1",c.appendChild(d)}else if(u.type===18){if(u.name==="attr"){var h=u.values.filter($);h.length&&c.appendChild(o.createTextNode(e.getAttribute(h[0].value)||""))}else if(u.name==="counter"){var f=u.values.filter(_e),g=f[0],p=f[1];if(g&&$(g)){var B=r.counters.getCounterValue(g.value),y=p&&$(p)?vc.parse(r.context,p.value):3;c.appendChild(o.createTextNode(Ri(B,y,!1)))}}else if(u.name==="counters"){var b=u.values.filter(_e),g=b[0],v=b[1],p=b[2];if(g&&$(g)){var C=r.counters.getCounterValues(g.value),w=p&&$(p)?vc.parse(r.context,p.value):3,S=v&&v.type===0?v.value:"",F=C.map(function(H){return Ri(H,w,!1)}).join(S);c.appendChild(o.createTextNode(F))}}}else if(u.type===20)switch(u.value){case"open-quote":c.appendChild(o.createTextNode(Xf(a.quotes,r.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Xf(a.quotes,--r.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(u.value))}}),c.className="".concat(Hc," ").concat(Mc);var l=i===Pi.BEFORE?" ".concat(Hc):" ".concat(Mc);return Is(t)?t.className.baseValue+=l:t.className+=l,c}}},A.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},A}(),Pi;(function(A){A[A.BEFORE=0]="BEFORE",A[A.AFTER=1]="AFTER"})(Pi||(Pi={}));var SU=function(A,e){var t=A.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(Pg,"true"),A.body.appendChild(t),t},UU=function(A){return new Promise(function(e){if(A.complete){e();return}if(!A.src){e();return}A.onload=e,A.onerror=e})},TU=function(A){return Promise.all([].slice.call(A.images,0).map(UU))},QU=function(A){return new Promise(function(e,t){var n=A.contentWindow;if(!n)return t("No window assigned for iframe");var i=n.document;n.onload=A.onload=function(){n.onload=A.onload=null;var r=setInterval(function(){i.body.childNodes.length>0&&i.readyState==="complete"&&(clearInterval(r),e(A))},50)}})},FU=["all","d","content"],Oc=function(A,e){for(var t=A.length-1;t>=0;t--){var n=A.item(t);FU.indexOf(n)===-1&&e.style.setProperty(n,A.getPropertyValue(n))}return e},kU=function(A){var e="";return A&&(e+="<!DOCTYPE ",A.name&&(e+=A.name),A.internalSubset&&(e+=A.internalSubset),A.publicId&&(e+='"'.concat(A.publicId,'"')),A.systemId&&(e+='"'.concat(A.systemId,'"')),e+=">"),e},IU=function(A,e,t){A&&A.defaultView&&(e!==A.defaultView.pageXOffset||t!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(e,t)},_U=function(A){var e=A[0],t=A[1],n=A[2];e.scrollLeft=t,e.scrollTop=n},xU=":before",RU=":after",Hc="___html2canvas___pseudoelement_before",Mc="___html2canvas___pseudoelement_after",Dg=`{
106
+ */var Ga=function(A,e){return Ga=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Ga(A,e)};function St(A,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ga(A,e);function t(){this.constructor=A}A.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ja=function(){return ja=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},ja.apply(this,arguments)};function Ke(A,e,t,n){function i(r){return r instanceof t?r:new t(function(s){s(r)})}return new(t||(t=Promise))(function(r,s){function o(l){try{c(n.next(l))}catch(u){s(u)}}function a(l){try{c(n.throw(l))}catch(u){s(u)}}function c(l){l.done?r(l.value):i(l.value).then(o,a)}c((n=n.apply(A,e||[])).next())})}function Oe(A,e){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(l){return a([c,l])}}function a(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(n=1,i&&(r=c[0]&2?i.return:c[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,c[1])).done)return r;switch(i=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(r=t.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){t.label=c[1];break}if(c[0]===6&&t.label<r[1]){t.label=r[1],r=c;break}if(r&&t.label<r[2]){t.label=r[2],t.ops.push(c);break}r[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(A,t)}catch(l){c=[6,l],i=0}finally{n=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Kr(A,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,r;n<i;n++)(r||!(n in e))&&(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return A.concat(r||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;for(var Xt=function(){function A(e,t,n,i){this.left=e,this.top=t,this.width=n,this.height=i}return A.prototype.add=function(e,t,n,i){return new A(this.left+e,this.top+t,this.width+n,this.height+i)},A.fromClientRect=function(e,t){return new A(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},A.fromDOMRectList=function(e,t){var n=Array.from(t).find(function(i){return i.width!==0});return n?new A(n.left+e.windowBounds.left,n.top+e.windowBounds.top,n.width,n.height):A.EMPTY},A.EMPTY=new A(0,0,0,0),A}(),Vr=function(A,e){return Xt.fromClientRect(A,e.getBoundingClientRect())},Aw=function(A){var e=A.body,t=A.documentElement;if(!e||!t)throw new Error("Unable to get document size");var n=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),i=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new Xt(0,0,n,i)},Gr=function(A){for(var e=[],t=0,n=A.length;t<n;){var i=A.charCodeAt(t++);if(i>=55296&&i<=56319&&t<n){var r=A.charCodeAt(t++);(r&64512)===56320?e.push(((i&1023)<<10)+(r&1023)+65536):(e.push(i),t--)}else e.push(i)}return e},Be=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var n=[],i=-1,r="";++i<t;){var s=A[i];s<=65535?n.push(s):(s-=65536,n.push((s>>10)+55296,s%1024+56320)),(i+1===t||n.length>16384)&&(r+=String.fromCharCode.apply(String,n),n.length=0)}return r},Lh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nw=typeof Uint8Array>"u"?[]:new Uint8Array(256),jr=0;jr<Lh.length;jr++)nw[Lh.charCodeAt(jr)]=jr;for(var Dh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pi=typeof Uint8Array>"u"?[]:new Uint8Array(256),$r=0;$r<Dh.length;$r++)pi[Dh.charCodeAt($r)]=$r;for(var iw=function(A){var e=A.length*.75,t=A.length,n,i=0,r,s,o,a;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),l=Array.isArray(c)?c:new Uint8Array(c);for(n=0;n<t;n+=4)r=pi[A.charCodeAt(n)],s=pi[A.charCodeAt(n+1)],o=pi[A.charCodeAt(n+2)],a=pi[A.charCodeAt(n+3)],l[i++]=r<<2|s>>4,l[i++]=(s&15)<<4|o>>2,l[i++]=(o&3)<<6|a&63;return c},rw=function(A){for(var e=A.length,t=[],n=0;n<e;n+=2)t.push(A[n+1]<<8|A[n]);return t},sw=function(A){for(var e=A.length,t=[],n=0;n<e;n+=4)t.push(A[n+3]<<24|A[n+2]<<16|A[n+1]<<8|A[n]);return t},JA=5,$a=6+5,Wa=2,ow=$a-JA,Oh=65536>>JA,aw=1<<JA,Ja=aw-1,cw=1024>>JA,lw=Oh+cw,uw=lw,dw=32,hw=uw+dw,fw=65536>>$a,gw=1<<ow,pw=gw-1,Hh=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},mw=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},Bw=function(A,e){var t=iw(A),n=Array.isArray(t)?sw(t):new Uint32Array(t),i=Array.isArray(t)?rw(t):new Uint16Array(t),r=24,s=Hh(i,r/2,n[4]/2),o=n[5]===2?Hh(i,(r+n[4])/2):mw(n,Math.ceil((r+n[4])/4));return new vw(n[0],n[1],n[2],n[3],s,o)},vw=function(){function A(e,t,n,i,r,s){this.initialValue=e,this.errorValue=t,this.highStart=n,this.highValueIndex=i,this.index=r,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>JA],t=(t<<Wa)+(e&Ja),this.data[t];if(e<=65535)return t=this.index[Oh+(e-55296>>JA)],t=(t<<Wa)+(e&Ja),this.data[t];if(e<this.highStart)return t=hw-fw+(e>>$a),t=this.index[t],t+=e>>JA&pw,t=this.index[t],t=(t<<Wa)+(e&Ja),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A}(),Mh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Wr=0;Wr<Mh.length;Wr++)Cw[Mh.charCodeAt(Wr)]=Wr;var ww="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Nh=50,yw=1,Kh=2,Vh=3,bw=4,Ew=5,Gh=7,jh=8,$h=9,wA=10,Xa=11,Wh=12,qa=13,Sw=14,mi=15,Ya=16,Jr=17,Bi=18,Uw=19,Jh=20,za=21,vi=22,Za=23,Qn=24,it=25,Ci=26,wi=27,Fn=28,Tw=29,XA=30,Qw=31,Xr=32,qr=33,ec=34,tc=35,Ac=36,yi=37,nc=38,Yr=39,zr=40,ic=41,Xh=42,Fw=43,kw=[9001,65288],qh="!",G="×",Zr="÷",rc=Bw(ww),qt=[XA,Ac],sc=[yw,Kh,Vh,Ew],Yh=[wA,jh],zh=[wi,Ci],Iw=sc.concat(Yh),Zh=[nc,Yr,zr,ec,tc],_w=[mi,qa],xw=function(A,e){e===void 0&&(e="strict");var t=[],n=[],i=[];return A.forEach(function(r,s){var o=rc.get(r);if(o>Nh?(i.push(!0),o-=Nh):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(r)!==-1)return n.push(s),t.push(Ya);if(o===bw||o===Xa){if(s===0)return n.push(s),t.push(XA);var a=t[s-1];return Iw.indexOf(a)===-1?(n.push(n[s-1]),t.push(a)):(n.push(s),t.push(XA))}if(n.push(s),o===Qw)return t.push(e==="strict"?za:yi);if(o===Xh||o===Tw)return t.push(XA);if(o===Fw)return r>=131072&&r<=196605||r>=196608&&r<=262141?t.push(yi):t.push(XA);t.push(o)}),[n,t,i]},oc=function(A,e,t,n){var i=n[t];if(Array.isArray(A)?A.indexOf(i)!==-1:A===i)for(var r=t;r<=n.length;){r++;var s=n[r];if(s===e)return!0;if(s!==wA)break}if(i===wA)for(var r=t;r>0;){r--;var o=n[r];if(Array.isArray(A)?A.indexOf(o)!==-1:A===o)for(var a=t;a<=n.length;){a++;var s=n[a];if(s===e)return!0;if(s!==wA)break}if(o!==wA)break}return!1},ef=function(A,e){for(var t=A;t>=0;){var n=e[t];if(n===wA)t--;else return n}return 0},Rw=function(A,e,t,n,i){if(t[n]===0)return G;var r=n-1;if(Array.isArray(i)&&i[r]===!0)return G;var s=r-1,o=r+1,a=e[r],c=s>=0?e[s]:0,l=e[o];if(a===Kh&&l===Vh)return G;if(sc.indexOf(a)!==-1)return qh;if(sc.indexOf(l)!==-1||Yh.indexOf(l)!==-1)return G;if(ef(r,e)===jh)return Zr;if(rc.get(A[r])===Xa||(a===Xr||a===qr)&&rc.get(A[o])===Xa||a===Gh||l===Gh||a===$h||[wA,qa,mi].indexOf(a)===-1&&l===$h||[Jr,Bi,Uw,Qn,Fn].indexOf(l)!==-1||ef(r,e)===vi||oc(Za,vi,r,e)||oc([Jr,Bi],za,r,e)||oc(Wh,Wh,r,e))return G;if(a===wA)return Zr;if(a===Za||l===Za)return G;if(l===Ya||a===Ya)return Zr;if([qa,mi,za].indexOf(l)!==-1||a===Sw||c===Ac&&_w.indexOf(a)!==-1||a===Fn&&l===Ac||l===Jh||qt.indexOf(l)!==-1&&a===it||qt.indexOf(a)!==-1&&l===it||a===wi&&[yi,Xr,qr].indexOf(l)!==-1||[yi,Xr,qr].indexOf(a)!==-1&&l===Ci||qt.indexOf(a)!==-1&&zh.indexOf(l)!==-1||zh.indexOf(a)!==-1&&qt.indexOf(l)!==-1||[wi,Ci].indexOf(a)!==-1&&(l===it||[vi,mi].indexOf(l)!==-1&&e[o+1]===it)||[vi,mi].indexOf(a)!==-1&&l===it||a===it&&[it,Fn,Qn].indexOf(l)!==-1)return G;if([it,Fn,Qn,Jr,Bi].indexOf(l)!==-1)for(var u=r;u>=0;){var d=e[u];if(d===it)return G;if([Fn,Qn].indexOf(d)!==-1)u--;else break}if([wi,Ci].indexOf(l)!==-1)for(var u=[Jr,Bi].indexOf(a)!==-1?s:r;u>=0;){var d=e[u];if(d===it)return G;if([Fn,Qn].indexOf(d)!==-1)u--;else break}if(nc===a&&[nc,Yr,ec,tc].indexOf(l)!==-1||[Yr,ec].indexOf(a)!==-1&&[Yr,zr].indexOf(l)!==-1||[zr,tc].indexOf(a)!==-1&&l===zr||Zh.indexOf(a)!==-1&&[Jh,Ci].indexOf(l)!==-1||Zh.indexOf(l)!==-1&&a===wi||qt.indexOf(a)!==-1&&qt.indexOf(l)!==-1||a===Qn&&qt.indexOf(l)!==-1||qt.concat(it).indexOf(a)!==-1&&l===vi&&kw.indexOf(A[o])===-1||qt.concat(it).indexOf(l)!==-1&&a===Bi)return G;if(a===ic&&l===ic){for(var h=t[r],f=1;h>0&&(h--,e[h]===ic);)f++;if(f%2!==0)return G}return a===Xr&&l===qr?G:Zr},Pw=function(A,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=xw(A,e.lineBreak),n=t[0],i=t[1],r=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(o){return[it,XA,Xh].indexOf(o)!==-1?yi:o}));var s=e.wordBreak==="keep-all"?r.map(function(o,a){return o&&A[a]>=19968&&A[a]<=40959}):void 0;return[n,i,s]},Lw=function(){function A(e,t,n,i){this.codePoints=e,this.required=t===qh,this.start=n,this.end=i}return A.prototype.slice=function(){return Be.apply(void 0,this.codePoints.slice(this.start,this.end))},A}(),Dw=function(A,e){var t=Gr(A),n=Pw(t,e),i=n[0],r=n[1],s=n[2],o=t.length,a=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var l=G;c<o&&(l=Rw(t,r,i,++c,s))===G;);if(l!==G||c===o){var u=new Lw(t,l,a,c);return a=c,{value:u,done:!1}}return{done:!0,value:null}}}},Ow=1,Hw=2,bi=4,tf=8,es=10,Af=47,Ei=92,Mw=9,Nw=32,ts=34,Si=61,Kw=35,Vw=36,Gw=37,As=39,ns=40,Ui=41,jw=95,Ze=45,$w=33,Ww=60,Jw=62,Xw=64,qw=91,Yw=93,zw=61,Zw=123,is=63,ey=125,nf=124,ty=126,Ay=128,rf=65533,ac=42,qA=43,ny=44,iy=58,ry=59,Ti=46,sy=0,oy=8,ay=11,cy=14,ly=31,uy=127,Dt=-1,sf=48,of=97,af=101,dy=102,hy=117,fy=122,cf=65,lf=69,uf=70,gy=85,py=90,He=function(A){return A>=sf&&A<=57},my=function(A){return A>=55296&&A<=57343},kn=function(A){return He(A)||A>=cf&&A<=uf||A>=of&&A<=dy},By=function(A){return A>=of&&A<=fy},vy=function(A){return A>=cf&&A<=py},Cy=function(A){return By(A)||vy(A)},wy=function(A){return A>=Ay},rs=function(A){return A===es||A===Mw||A===Nw},ss=function(A){return Cy(A)||wy(A)||A===jw},df=function(A){return ss(A)||He(A)||A===Ze},yy=function(A){return A>=sy&&A<=oy||A===ay||A>=cy&&A<=ly||A===uy},yA=function(A,e){return A!==Ei?!1:e!==es},os=function(A,e,t){return A===Ze?ss(e)||yA(e,t):ss(A)?!0:!!(A===Ei&&yA(A,e))},cc=function(A,e,t){return A===qA||A===Ze?He(e)?!0:e===Ti&&He(t):He(A===Ti?e:A)},by=function(A){var e=0,t=1;(A[e]===qA||A[e]===Ze)&&(A[e]===Ze&&(t=-1),e++);for(var n=[];He(A[e]);)n.push(A[e++]);var i=n.length?parseInt(Be.apply(void 0,n),10):0;A[e]===Ti&&e++;for(var r=[];He(A[e]);)r.push(A[e++]);var s=r.length,o=s?parseInt(Be.apply(void 0,r),10):0;(A[e]===lf||A[e]===af)&&e++;var a=1;(A[e]===qA||A[e]===Ze)&&(A[e]===Ze&&(a=-1),e++);for(var c=[];He(A[e]);)c.push(A[e++]);var l=c.length?parseInt(Be.apply(void 0,c),10):0;return t*(i+o*Math.pow(10,-s))*Math.pow(10,a*l)},Ey={type:2},Sy={type:3},Uy={type:4},Ty={type:13},Qy={type:8},Fy={type:21},ky={type:9},Iy={type:10},_y={type:11},xy={type:12},Ry={type:14},as={type:23},Py={type:1},Ly={type:25},Dy={type:24},Oy={type:26},Hy={type:27},My={type:28},Ny={type:29},Ky={type:31},lc={type:32},hf=function(){function A(){this._value=[]}return A.prototype.write=function(e){this._value=this._value.concat(Gr(e))},A.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==lc;)e.push(t),t=this.consumeToken();return e},A.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case ts:return this.consumeStringToken(ts);case Kw:var t=this.peekCodePoint(0),n=this.peekCodePoint(1),i=this.peekCodePoint(2);if(df(t)||yA(n,i)){var r=os(t,n,i)?Hw:Ow,s=this.consumeName();return{type:5,value:s,flags:r}}break;case Vw:if(this.peekCodePoint(0)===Si)return this.consumeCodePoint(),Ty;break;case As:return this.consumeStringToken(As);case ns:return Ey;case Ui:return Sy;case ac:if(this.peekCodePoint(0)===Si)return this.consumeCodePoint(),Ry;break;case qA:if(cc(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case ny:return Uy;case Ze:var o=e,a=this.peekCodePoint(0),c=this.peekCodePoint(1);if(cc(o,a,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(os(o,a,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(a===Ze&&c===Jw)return this.consumeCodePoint(),this.consumeCodePoint(),Dy;break;case Ti:if(cc(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Af:if(this.peekCodePoint(0)===ac)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===ac&&(l=this.consumeCodePoint(),l===Af))return this.consumeToken();if(l===Dt)return this.consumeToken()}break;case iy:return Oy;case ry:return Hy;case Ww:if(this.peekCodePoint(0)===$w&&this.peekCodePoint(1)===Ze&&this.peekCodePoint(2)===Ze)return this.consumeCodePoint(),this.consumeCodePoint(),Ly;break;case Xw:var u=this.peekCodePoint(0),d=this.peekCodePoint(1),h=this.peekCodePoint(2);if(os(u,d,h)){var s=this.consumeName();return{type:7,value:s}}break;case qw:return My;case Ei:if(yA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Yw:return Ny;case zw:if(this.peekCodePoint(0)===Si)return this.consumeCodePoint(),Qy;break;case Zw:return _y;case ey:return xy;case hy:case gy:var f=this.peekCodePoint(0),g=this.peekCodePoint(1);return f===qA&&(kn(g)||g===is)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case nf:if(this.peekCodePoint(0)===Si)return this.consumeCodePoint(),ky;if(this.peekCodePoint(0)===nf)return this.consumeCodePoint(),Fy;break;case ty:if(this.peekCodePoint(0)===Si)return this.consumeCodePoint(),Iy;break;case Dt:return lc}return rs(e)?(this.consumeWhiteSpace(),Ky):He(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ss(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Be(e)}},A.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},A.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},A.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},A.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();kn(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var n=!1;t===is&&e.length<6;)e.push(t),t=this.consumeCodePoint(),n=!0;if(n){var i=parseInt(Be.apply(void 0,e.map(function(a){return a===is?sf:a})),16),r=parseInt(Be.apply(void 0,e.map(function(a){return a===is?uf:a})),16);return{type:30,start:i,end:r}}var s=parseInt(Be.apply(void 0,e),16);if(this.peekCodePoint(0)===Ze&&kn(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];kn(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var r=parseInt(Be.apply(void 0,o),16);return{type:30,start:s,end:r}}else return{type:30,start:s,end:s}},A.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ns?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ns?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},A.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Dt)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===As||t===ts){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Dt||this.peekCodePoint(0)===Ui)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),as)}for(;;){var i=this.consumeCodePoint();if(i===Dt||i===Ui)return{type:22,value:Be.apply(void 0,e)};if(rs(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Dt||this.peekCodePoint(0)===Ui?(this.consumeCodePoint(),{type:22,value:Be.apply(void 0,e)}):(this.consumeBadUrlRemnants(),as);if(i===ts||i===As||i===ns||yy(i))return this.consumeBadUrlRemnants(),as;if(i===Ei)if(yA(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),as;else e.push(i)}},A.prototype.consumeWhiteSpace=function(){for(;rs(this.peekCodePoint(0));)this.consumeCodePoint()},A.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Ui||e===Dt)return;yA(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},A.prototype.consumeStringSlice=function(e){for(var t=5e4,n="";e>0;){var i=Math.min(t,e);n+=Be.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),n},A.prototype.consumeStringToken=function(e){var t="",n=0;do{var i=this._value[n];if(i===Dt||i===void 0||i===e)return t+=this.consumeStringSlice(n),{type:0,value:t};if(i===es)return this._value.splice(0,n),Py;if(i===Ei){var r=this._value[n+1];r!==Dt&&r!==void 0&&(r===es?(t+=this.consumeStringSlice(n),n=-1,this._value.shift()):yA(i,r)&&(t+=this.consumeStringSlice(n),t+=Be(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},A.prototype.consumeNumber=function(){var e=[],t=bi,n=this.peekCodePoint(0);for((n===qA||n===Ze)&&e.push(this.consumeCodePoint());He(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(n===Ti&&He(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=tf;He(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),i=this.peekCodePoint(1);var r=this.peekCodePoint(2);if((n===lf||n===af)&&((i===qA||i===Ze)&&He(r)||He(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=tf;He(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[by(e),t]},A.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],n=e[1],i=this.peekCodePoint(0),r=this.peekCodePoint(1),s=this.peekCodePoint(2);if(os(i,r,s)){var o=this.consumeName();return{type:15,number:t,flags:n,unit:o}}return i===Gw?(this.consumeCodePoint(),{type:16,number:t,flags:n}):{type:17,number:t,flags:n}},A.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(kn(e)){for(var t=Be(e);kn(this.peekCodePoint(0))&&t.length<6;)t+=Be(this.consumeCodePoint());rs(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(t,16);return n===0||my(n)||n>1114111?rf:n}return e===Dt?rf:e},A.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(df(t))e+=Be(t);else if(yA(t,this.peekCodePoint(0)))e+=Be(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},A}(),ff=function(){function A(e){this._tokens=e}return A.create=function(e){var t=new hf;return t.write(e),new A(t.read())},A.parseValue=function(e){return A.create(e).parseComponentValue()},A.parseValues=function(e){return A.create(e).parseComponentValues()},A.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},A.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},A.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},A.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},n=this.consumeToken();;){if(n.type===32||Gy(n,e))return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue()),n=this.consumeToken()}},A.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return t;this.reconsumeToken(n),t.values.push(this.consumeComponentValue())}},A.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?lc:e},A.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},A}(),bA=function(A){return A.type===15},ye=function(A){return A.type===17},$=function(A){return A.type===20},Vy=function(A){return A.type===0},uc=function(A,e){return $(A)&&A.value===e},gf=function(A){return A.type!==31},_e=function(A){return A.type!==31&&A.type!==4},Ot=function(A){var e=[],t=[];return A.forEach(function(n){if(n.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}n.type!==31&&t.push(n)}),t.length&&e.push(t),e},Gy=function(A,e){return e===11&&A.type===12||e===28&&A.type===29?!0:e===2&&A.type===3},EA=function(A){return A.type===17||A.type===15},le=function(A){return A.type===16||EA(A)},pf=function(A){return A.length>1?[A[0],A[1]]:[A[0]]},xe={type:17,number:0,flags:bi},dc={type:16,number:50,flags:bi},SA={type:16,number:100,flags:bi},Qi=function(A,e,t){var n=A[0],i=A[1];return[ne(n,e),ne(typeof i<"u"?i:n,t)]},ne=function(A,e){if(A.type===16)return A.number/100*e;if(bA(A))switch(A.unit){case"rem":case"em":return 16*A.number;case"px":default:return A.number}return A.number},mf="deg",Bf="grad",vf="rad",Cf="turn",cs={name:"angle",parse:function(A,e){if(e.type===15)switch(e.unit){case mf:return Math.PI*e.number/180;case Bf:return Math.PI/200*e.number;case vf:return e.number;case Cf:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},wf=function(A){return A.type===15&&(A.unit===mf||A.unit===Bf||A.unit===vf||A.unit===Cf)},yf=function(A){var e=A.filter($).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[xe,xe];case"to top":case"bottom":return ct(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[xe,SA];case"to right":case"left":return ct(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[SA,SA];case"to bottom":case"top":return ct(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[SA,xe];case"to left":case"right":return ct(270)}return 0},ct=function(A){return Math.PI*A/180},UA=function(A){return(255&A)===0},Te=function(A){var e=255&A,t=255&A>>8,n=255&A>>16,i=255&A>>24;return e<255?"rgba(".concat(i,",").concat(n,",").concat(t,",").concat(e/255,")"):"rgb(".concat(i,",").concat(n,",").concat(t,")")},Ht=function(A,e,t,n){return(A<<24|e<<16|t<<8|Math.round(n*255)<<0)>>>0},ls=function(A,e){if(A.type===17)return A.number;if(A.type===16){var t=e===3?1:255;return e===3?A.number/100*t:Math.round(A.number/100*t)}return 0},YA=function(A){return(A[0].type===20?A[0].value:"unknown")==="from"},pe=function(A,e,t){return Math.min(Math.max(A,e),t)},et=function(A,e){return[A[0]*e[0]+A[1]*e[1]+A[2]*e[2],A[3]*e[0]+A[4]*e[1]+A[5]*e[2],A[6]*e[0]+A[7]*e[1]+A[8]*e[2]]},jy=function(A){return Ht(pe(Math.round(A[0]*255),0,255),pe(Math.round(A[1]*255),0,255),pe(Math.round(A[2]*255),0,255),pe(A[3],0,1))},hc=function(A){var e=A[0],t=A[1],n=A[2],i=A[3],r=zA([e,t,n]);return Ht(pe(Math.round(r[0]*255),0,255),pe(Math.round(r[1]*255),0,255),pe(Math.round(r[2]*255),0,255),i)},Fi=function(A){var e=TA([A[0],A[1],A[2]]);return hc([e[0],e[1],e[2],A[3]])},$y=function(A,e){if(YA(e.filter(_e)))throw new Error("Relative color not supported for lab()");var t=us(e),n=t[0],i=t[1],r=t[2],s=t[3],o=zA(TA(fs([n,i,r])));return Ht(pe(Math.round(o[0]*255),0,255),pe(Math.round(o[1]*255),0,255),pe(Math.round(o[2]*255),0,255),s)},Wy=function(A,e){if(YA(e.filter(_e)))throw new Error("Relative color not supported for oklab()");var t=us(e),n=t[0],i=t[1],r=t[2],s=t[3],o=zA(TA(hs([n,i,r])));return Ht(pe(Math.round(o[0]*255),0,255),pe(Math.round(o[1]*255),0,255),pe(Math.round(o[2]*255),0,255),s)},Jy=function(A,e){if(YA(e.filter(_e)))throw new Error("Relative color not supported for oklch()");var t=Uf(e),n=t[0],i=t[1],r=t[2],s=t[3],o=zA(TA(hs(ds([n,i,r]))));return Ht(pe(Math.round(o[0]*255),0,255),pe(Math.round(o[1]*255),0,255),pe(Math.round(o[2]*255),0,255),s)},Xy=function(A,e){if(YA(e.filter(_e)))throw new Error("Relative color not supported for lch()");var t=Sf(e),n=t[0],i=t[1],r=t[2],s=t[3],o=zA(TA(fs(ds([n,i,r]))));return Ht(pe(Math.round(o[0]*255),0,255),pe(Math.round(o[1]*255),0,255),pe(Math.round(o[2]*255),0,255),s)},bf=function(A,e){var t=e.filter(_e),n=t[0],i=t[1],r=t[2],s=t[3],o=(n.type===17?ct(n.number):cs.parse(A,n))/(Math.PI*2),a=le(i)?i.number/100:0,c=le(r)?r.number/100:0,l=typeof s<"u"&&le(s)?ne(s,1):1;return[o,a,c,l]},Ef=function(A,e){if(YA(e))throw new Error("Relative color not supported for hsl()");var t=bf(A,e),n=t[0],i=t[1],r=t[2],s=t[3],o=Qf([n,i,r]);return Ht(o[0]*255,o[1]*255,o[2]*255,i===0?1:s)},Sf=function(A){var e=A.filter(_e),t=le(e[0])?e[0].number:0,n=le(e[1])?e[1].number:0,i=ye(e[2])||bA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&le(e[4])?ne(e[4],1):1;return[t,n,i,r]},us=function(A){var e=A.filter(_e),t=e[0].type===16?e[0].number/100:ye(e[0])?e[0].number:0,n=e[1].type===16?e[1].number/100:ye(e[1])?e[1].number:0,i=ye(e[2])||bA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&le(e[4])?ne(e[4],1):1;return[t,n,i,r]},Uf=function(A){var e=A.filter(_e),t=e[0].type===16?e[0].number/100:ye(e[0])?e[0].number:0,n=e[1].type===16?e[1].number/100:ye(e[1])?e[1].number:0,i=ye(e[2])||bA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&le(e[4])?ne(e[4],1):1;return[t,n,i,r]},Tf=function(A){return et([1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],A)},fc=function(A){return et([.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124],A)},gc=function(A,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-A)*t*6+A:t<1/2?e:t<2/3?(e-A)*6*(2/3-t)+A:A},Qf=function(A){var e=A[0],t=A[1],n=A[2];if(t===0)return[n*255,n*255,n*255];var i=n<=.5?n*(t+1):n+t-n*t,r=n*2-i,s=gc(r,i,e+1/3),o=gc(r,i,e),a=gc(r,i,e-1/3);return[s,o,a]},ds=function(A){var e=A[0],t=A[1],n=A[2];return t<0&&(t=0),isNaN(n)&&(n=0),[e,t*Math.cos(n*Math.PI/180),t*Math.sin(n*Math.PI/180)]},hs=function(A){var e=et([1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092],A),t=e.map(function(n){return Math.pow(n,3)});return et([1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],t)},fs=function(A){var e=(A[0]+16)/116,t=A[1]/500+e,n=e-A[2]/200,i=24389/27,r=24/116,s=[(t>r?Math.pow(t,3):(116*t-16)/i)*.3457/.3585,A[0]>8?Math.pow(e,3):A[0]/i,(n>r?Math.pow(n,3):(116*n-16)/i)*(1-.3457-.3585)/.3585];return fc([s[0],s[1],s[2]])},qy=function(A,e){var t=e.filter(_e);if(t.length===3){var n=t.map(ls),i=n[0],r=n[1],s=n[2],o=mc([i/255,r/255,s/255]),a=pc([o[0],o[1],o[2]]),c=a[0],l=a[1],u=a[2];return[c,l,u,1]}if(t.length===4){var d=t.map(ls),i=d[0],r=d[1],s=d[2],h=d[3],o=mc([i/255,r/255,s/255]),f=pc([o[0],o[1],o[2]]),c=f[0],l=f[1],u=f[2];return[c,l,u,h]}return[0,0,0,1]},Yy=function(A,e){var t=bf(A,e),n=t[0],i=t[1],r=t[2],s=t[3],o=mc(Qf([n,i,r])),a=pc([o[0],o[1],o[2]]),c=a[0],l=a[1],u=a[2];return[c,l,u,s]},zy=function(A,e){var t=us(e),n=t[0],i=t[1],r=t[2],s=t[3],o=fs([n,i,r]),a=o[0],c=o[1],l=o[2];return[a,c,l,s]},Zy=function(A,e){var t=Sf(e),n=t[0],i=t[1],r=t[2],s=t[3],o=fs(ds([n,i,r])),a=o[0],c=o[1],l=o[2];return[a,c,l,s]},eb=function(A,e){var t=Uf(e),n=t[0],i=t[1],r=t[2],s=t[3],o=hs(ds([n,i,r])),a=o[0],c=o[1],l=o[2];return[a,c,l,s]},tb=function(A,e){var t=us(e),n=t[0],i=t[1],r=t[2],s=t[3],o=hs([n,i,r]),a=o[0],c=o[1],l=o[2];return[a,c,l,s]},Ab=function(A){return fc([A[0],A[1],A[2]])},Ff=function(A){return A},nb=function(A){var e=Tf([A[0],A[2],A[3]]),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},kf=function(A){return Fi([A[0],A[1],A[2],A[3]])},ib=function(A){var e=Ab([A[0],A[1],A[2]]);return Fi([e[0],e[1],e[2],A[3]])},TA=function(A){return et([3.2409699419045226,-1.537383177570094,-.4986107602930034,-.9692436362808796,1.8759675015077202,.04155505740717559,.05563007969699366,-.20397695888897652,1.0569715142428786],A)},pc=function(A){return et([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],A)},zA=function(A){return A.map(function(e){var t=e<0?-1:1,n=Math.abs(e);return n>.0031308?t*(1.055*Math.pow(n,1/2.4)-.055):12.92*e})},mc=function(A){return A.map(function(e){var t=e<0?-1:1,n=Math.abs(e);return n<=.04045?e/12.92:t*Math.pow((n+.055)/1.055,2.4)})},rb=function(A){var e=zA(TA([A[0],A[1],A[2]])),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},sb=function(A){var e=TA([A[0],A[1],A[2]]),t=e[0],n=e[1],i=e[2];return[pe(Math.round(t*255),0,255),pe(Math.round(n*255),0,255),pe(Math.round(i*255),0,255),A[3]]},ob=function(A){return et([.4865709486482162,.26566769316909306,.1982172852343625,.2289745640697488,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],A)},ab=function(A){return et([2.493496911941425,-.9313836179191239,-.40271078445071684,-.8294889695615747,1.7626640603183463,.023624685841943577,.03584583024378447,-.07617238926804182,.9568845240076872],A)},cb=function(A){return A.map(function(e){var t=e<0?-1:1,n=e*t;return n<=.04045?e/12.92:t*Math.pow((e+.055)/1.055,2.4)||0})},lb=function(A){return zA(A)},ub=function(A){var e=cb([A[0],A[1],A[2]]);return ob([e[0],e[1],e[2]])},db=function(A){var e=lb(ab([A[0],A[1],A[2]])),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},hb=function(A){var e=ub([A[0],A[1],A[2]]);return Fi([e[0],e[1],e[2],A[3]])},fb=function(A){return et([2.0415879038107465,-.5650069742788596,-.34473135077832956,-.9692436362808795,1.8759675015077202,.04155505740717557,.013444280632031142,-.11836239223101838,1.0151749943912054],A)},gb=function(A){return et([.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.0752914584939978,.02703136138641234,.07068885253582723,.9913375368376388],A)},pb=function(A){var e=A.map(function(t){var n=t<0?-1:1,i=Math.abs(t);return n*Math.pow(i,2.19921875)});return[e[0],e[1],e[2]]},mb=function(A){var e=A.map(function(t){var n=t<0?-1:1,i=Math.abs(t);return n*Math.pow(i,.4547069271758437)});return[e[0],e[1],e[2]]},Bb=function(A){var e=mb(fb([A[0],A[1],A[2]])),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},vb=function(A){var e=TA(gb(pb([A[0],A[1],A[2]])));return hc([e[0],e[1],e[2],A[3]])},Cb=function(A){return et([.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602],A)},wb=function(A){return et([1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452],A)},yb=function(A){return A.map(function(e){return e<16/512?e/16:Math.pow(e,1.8)})},bb=function(A){return A.map(function(e){return e>1/512?Math.pow(e,1/1.8):e*16})},Eb=function(A){var e=yb([A[0],A[1],A[2]]);return fc(Cb([e[0],e[1],e[2]]))},Sb=function(A){var e=bb(wb(Tf([A[0],A[1],A[2]]))),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},Ub=function(A){var e=Eb([A[0],A[1],A[2]]);return Fi([e[0],e[1],e[2],A[3]])},gs=1.09929682680944,If=.018053968510807,Tb=function(A){return A.map(function(e){return e<If*4.5?e/4.5:Math.pow((e+gs-1)/gs,1/.45)})},Qb=function(A){return A.map(function(e){return e>=If?gs*Math.pow(e,.45)-(gs-1):4.5*e})},Fb=function(A){return et([.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.060985057710791],A)},kb=function(A){return et([1.716651187971268,-.355670783776392,-.25336628137366,-.666684351832489,1.616481236634939,.0157685458139111,.017639857445311,-.042770613257809,.942103121235474],A)},Ib=function(A){var e=Tb([A[0],A[1],A[2]]);return Fb([e[0],e[1],e[2]])},_b=function(A){var e=Qb(kb([A[0],A[1],A[2]])),t=e[0],n=e[1],i=e[2];return[t,n,i,A[3]]},xb=function(A){var e=Ib([A[0],A[1],A[2]]);return Fi([e[0],e[1],e[2],A[3]])},QA={name:"color",parse:function(A,e){if(e.type===18){var t=Db[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'.concat(e.name,'"'));return t(A,e.values)}if(e.type===5){var n=_f(e),i=n[0],r=n[1],s=n[2],o=n[3];return Ht(i,r,s,o)}if(e.type===20){var a=Mt[e.value.toUpperCase()];if(typeof a<"u")return a}return Mt.TRANSPARENT}},_f=function(A){if(A.value.length===3){var e=A.value.substring(0,1),t=A.value.substring(1,2),n=A.value.substring(2,3);return[parseInt(e+e,16),parseInt(t+t,16),parseInt(n+n,16),1]}if(A.value.length===4){var e=A.value.substring(0,1),t=A.value.substring(1,2),n=A.value.substring(2,3),i=A.value.substring(3,4);return[parseInt(e+e,16),parseInt(t+t,16),parseInt(n+n,16),parseInt(i+i,16)/255]}if(A.value.length===6){var e=A.value.substring(0,2),t=A.value.substring(2,4),n=A.value.substring(4,6);return[parseInt(e,16),parseInt(t,16),parseInt(n,16),1]}if(A.value.length===8){var e=A.value.substring(0,2),t=A.value.substring(2,4),n=A.value.substring(4,6),i=A.value.substring(6,8);return[parseInt(e,16),parseInt(t,16),parseInt(n,16),parseInt(i,16)/255]}return[0,0,0,1]},xf=function(A,e){var t=e.filter(_e);if(YA(t))throw new Error("Relative color not supported for rgb()");if(t.length===3){var n=t.map(ls),i=n[0],r=n[1],s=n[2];return Ht(i,r,s,1)}if(t.length===4){var o=t.map(ls),i=o[0],r=o[1],s=o[2],a=o[3];return Ht(i,r,s,a)}return 0},Rb=function(A,e){var t=e.filter(_e),n=t[0].type===20?t[0].value:"unknown",i=!YA(t);if(i){var r=n,s=Rf[r];if(typeof s>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(r,'" for color() function'));var o=ye(t[1])?t[1].number:0,a=ye(t[2])?t[2].number:0,c=ye(t[3])?t[3].number:0,l=t.length>4&&t[4].type===6&&t[4].value==="/"&&ye(t[5])?t[5].number:1;return s([o,a,c,l])}else{var u=function(V,q){if(ye(q))return q.number;var tt=function(je){return je==="r"||je==="x"?0:je==="g"||je==="y"?1:2};if($(q)){var Ne=tt(q.value);return V[Ne]}var De=function(je){for(var nA=je.filter(_e),kt="(",$e=0,qn=nA;$e<qn.length;$e++){var gt=qn[$e];kt+=gt.type===18&&gt.name==="calc"?De(gt.values):ye(gt)?gt.number:gt.type===6||$(gt)?gt.value:""}return kt+=")",kt};if(q.type===18){var AA=q.values.filter(_e);if(q.name==="calc"){var ft=De(AA).replace(/r|x/,V[0].toString()).replace(/g|y/,V[1].toString()).replace(/b|z/,V[2].toString());return new Function("return "+ft)()}}return null},d=t[1].type===18?t[1].name:$(t[1])||t[1].type===5?"rgb":"unknown",h=$(t[2])?t[2].value:"unknown",f=t[1].type===18?t[1].values:$(t[1])?[t[1]]:[];if($(t[1])){var g=Mt[t[1].value.toUpperCase()];if(typeof g>"u")throw new Error("Attempting to use unknown color in relative color 'from'");var p=In(A,t[1].value),B=255&p,y=255&p>>8,b=255&p>>16,v=255&p>>24;f=[{type:17,number:v,flags:1},{type:17,number:b,flags:1},{type:17,number:y,flags:1},{type:17,number:B>1?B/255:B,flags:1}]}else if(t[1].type===5){var C=_f(t[1]),v=C[0],b=C[1],y=C[2],B=C[3];f=[{type:17,number:v,flags:1},{type:17,number:b,flags:1},{type:17,number:y,flags:1},{type:17,number:B>1?B/255:B,flags:1}]}if(f.length===0)throw new Error("Attempting to use unknown color in relative color 'from'");if(h==="unknown")throw new Error("Attempting to use unknown colorspace in relative color 'to'");var w=Pb[d],S=Lb[h],F=Rf[h];if(typeof w>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(d,'" for color() function'));if(typeof S>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(h,'" for color() function'));var _=w(A,f),D=S(_),o=u(D,t[3]),a=u(D,t[4]),c=u(D,t[5]),l=t.length>6&&t[6].type===6&&t[6].value==="/"&&ye(t[7])?t[7].number:1;if(o===null||a===null||c===null)throw new Error("Invalid relative color in color() function");return F([o,a,c,l])}},Rf={srgb:jy,"srgb-linear":hc,"display-p3":hb,"a98-rgb":vb,"prophoto-rgb":Ub,xyz:kf,"xyz-d50":ib,"xyz-d65":kf,rec2020:xb},Pb={rgb:qy,hsl:Yy,lab:zy,lch:Zy,oklab:tb,oklch:eb},Lb={srgb:rb,"srgb-linear":sb,"display-p3":db,"a98-rgb":Bb,"prophoto-rgb":Sb,xyz:Ff,"xyz-d50":nb,"xyz-d65":Ff,rec2020:_b},Db={hsl:Ef,hsla:Ef,rgb:xf,rgba:xf,lch:Xy,oklch:Jy,oklab:Wy,lab:$y,color:Rb},In=function(A,e){return QA.parse(A,ff.create(e).parseComponentValue())},Mt={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Ob={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if($(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Hb={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ps=function(A,e){var t=QA.parse(A,e[0]),n=e[1];return n&&le(n)?{color:t,stop:n}:{color:t,stop:null}},Pf=function(A,e){var t=A[0],n=A[A.length-1];t.stop===null&&(t.stop=xe),n.stop===null&&(n.stop=SA);for(var i=[],r=0,s=0;s<A.length;s++){var o=A[s].stop;if(o!==null){var a=ne(o,e);a>r?i.push(a):i.push(r),r=a}else i.push(null)}for(var c=null,s=0;s<i.length;s++){var l=i[s];if(l===null)c===null&&(c=s);else if(c!==null){for(var u=s-c,d=i[c-1],h=(l-d)/(u+1),f=1;f<=u;f++)i[c+f-1]=h*f;c=null}}return A.map(function(g,p){var B=g.color;return{color:B,stop:Math.max(Math.min(1,i[p]/e),0)}})},Mb=function(A,e,t){var n=e/2,i=t/2,r=ne(A[0],e)-n,s=i-ne(A[1],t);return(Math.atan2(s,r)+Math.PI*2)%(Math.PI*2)},Nb=function(A,e,t){var n=typeof A=="number"?A:Mb(A,e,t),i=Math.abs(e*Math.sin(n))+Math.abs(t*Math.cos(n)),r=e/2,s=t/2,o=i/2,a=Math.sin(n-Math.PI/2)*o,c=Math.cos(n-Math.PI/2)*o;return[i,r-c,r+c,s-a,s+a]},Ut=function(A,e){return Math.sqrt(A*A+e*e)},Lf=function(A,e,t,n,i){var r=[[0,0],[0,e],[A,0],[A,e]];return r.reduce(function(s,o){var a=o[0],c=o[1],l=Ut(t-a,n-c);return(i?l<s.optimumDistance:l>s.optimumDistance)?{optimumCorner:o,optimumDistance:l}:s},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},Kb=function(A,e,t,n,i){var r=0,s=0;switch(A.size){case 0:A.shape===0?r=s=Math.min(Math.abs(e),Math.abs(e-n),Math.abs(t),Math.abs(t-i)):A.shape===1&&(r=Math.min(Math.abs(e),Math.abs(e-n)),s=Math.min(Math.abs(t),Math.abs(t-i)));break;case 2:if(A.shape===0)r=s=Math.min(Ut(e,t),Ut(e,t-i),Ut(e-n,t),Ut(e-n,t-i));else if(A.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-i))/Math.min(Math.abs(e),Math.abs(e-n)),a=Lf(n,i,e,t,!0),c=a[0],l=a[1];r=Ut(c-e,(l-t)/o),s=o*r}break;case 1:A.shape===0?r=s=Math.max(Math.abs(e),Math.abs(e-n),Math.abs(t),Math.abs(t-i)):A.shape===1&&(r=Math.max(Math.abs(e),Math.abs(e-n)),s=Math.max(Math.abs(t),Math.abs(t-i)));break;case 3:if(A.shape===0)r=s=Math.max(Ut(e,t),Ut(e,t-i),Ut(e-n,t),Ut(e-n,t-i));else if(A.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-i))/Math.max(Math.abs(e),Math.abs(e-n)),u=Lf(n,i,e,t,!1),c=u[0],l=u[1];r=Ut(c-e,(l-t)/o),s=o*r}break}return Array.isArray(A.size)&&(r=ne(A.size[0],n),s=A.size.length===2?ne(A.size[1],i):r),[r,s]},Vb=function(A,e){var t=ct(180),n=[];return Ot(e).forEach(function(i,r){if(r===0){var s=i[0];if(s.type===20&&s.value==="to"){t=yf(i);return}else if(wf(s)){t=cs.parse(A,s);return}}var o=ps(A,i);n.push(o)}),{angle:t,stops:n,type:1}},ms=function(A,e){var t=ct(180),n=[];return Ot(e).forEach(function(i,r){if(r===0){var s=i[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=yf(i);return}else if(wf(s)){t=(cs.parse(A,s)+ct(270))%ct(360);return}}var o=ps(A,i);n.push(o)}),{angle:t,stops:n,type:1}},Gb=function(A,e){var t=ct(180),n=[],i=1,r=0,s=3,o=[];return Ot(e).forEach(function(a,c){var l=a[0];if(c===0){if($(l)&&l.value==="linear"){i=1;return}else if($(l)&&l.value==="radial"){i=2;return}}if(l.type===18){if(l.name==="from"){var u=QA.parse(A,l.values[0]);n.push({stop:xe,color:u})}else if(l.name==="to"){var u=QA.parse(A,l.values[0]);n.push({stop:SA,color:u})}else if(l.name==="color-stop"){var d=l.values.filter(_e);if(d.length===2){var u=QA.parse(A,d[1]),h=d[0];ye(h)&&n.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(t+ct(180))%ct(360),stops:n,type:i}:{size:s,shape:r,stops:n,position:o,type:i}},Df="closest-side",Of="farthest-side",Hf="closest-corner",Mf="farthest-corner",Nf="circle",Kf="ellipse",Vf="cover",Gf="contain",jb=function(A,e){var t=0,n=3,i=[],r=[];return Ot(e).forEach(function(s,o){var a=!0;if(o===0){var c=!1;a=s.reduce(function(u,d){if(c)if($(d))switch(d.value){case"center":return r.push(dc),u;case"top":case"left":return r.push(xe),u;case"right":case"bottom":return r.push(SA),u}else(le(d)||EA(d))&&r.push(d);else if($(d))switch(d.value){case Nf:return t=0,!1;case Kf:return t=1,!1;case"at":return c=!0,!1;case Df:return n=0,!1;case Vf:case Of:return n=1,!1;case Gf:case Hf:return n=2,!1;case Mf:return n=3,!1}else if(EA(d)||le(d))return Array.isArray(n)||(n=[]),n.push(d),!1;return u},a)}if(a){var l=ps(A,s);i.push(l)}}),{size:n,shape:t,stops:i,position:r,type:2}},Bs=function(A,e){var t=0,n=3,i=[],r=[];return Ot(e).forEach(function(s,o){var a=!0;if(o===0?a=s.reduce(function(l,u){if($(u))switch(u.value){case"center":return r.push(dc),!1;case"top":case"left":return r.push(xe),!1;case"right":case"bottom":return r.push(SA),!1}else if(le(u)||EA(u))return r.push(u),!1;return l},a):o===1&&(a=s.reduce(function(l,u){if($(u))switch(u.value){case Nf:return t=0,!1;case Kf:return t=1,!1;case Gf:case Df:return n=0,!1;case Of:return n=1,!1;case Hf:return n=2,!1;case Vf:case Mf:return n=3,!1}else if(EA(u)||le(u))return Array.isArray(n)||(n=[]),n.push(u),!1;return l},a)),a){var c=ps(A,s);i.push(c)}}),{size:n,shape:t,stops:i,position:r,type:2}},$b=function(A){return A.type===1},Wb=function(A){return A.type===2},Bc={name:"image",parse:function(A,e){if(e.type===22){var t={url:e.value,type:0};return A.cache.addImage(e.value),t}if(e.type===18){var n=jf[e.name];if(typeof n>"u")throw new Error('Attempting to parse an unsupported image function "'.concat(e.name,'"'));return n(A,e.values)}throw new Error("Unsupported image type ".concat(e.type))}};function Jb(A){return!(A.type===20&&A.value==="none")&&(A.type!==18||!!jf[A.name])}var jf={"linear-gradient":Vb,"-moz-linear-gradient":ms,"-ms-linear-gradient":ms,"-o-linear-gradient":ms,"-webkit-linear-gradient":ms,"radial-gradient":jb,"-moz-radial-gradient":Bs,"-ms-radial-gradient":Bs,"-o-radial-gradient":Bs,"-webkit-radial-gradient":Bs,"-webkit-gradient":Gb},Xb={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(n){return _e(n)&&Jb(n)}).map(function(n){return Bc.parse(A,n)})}},qb={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if($(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Yb={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(A,e){return Ot(e).map(function(t){return t.filter(le)}).map(pf)}},zb={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(A,e){return Ot(e).map(function(t){return t.filter($).map(function(n){return n.value}).join(" ")}).map(Zb)}},Zb=function(A){switch(A){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},_n;(function(A){A.AUTO="auto",A.CONTAIN="contain",A.COVER="cover"})(_n||(_n={}));var eE={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(A,e){return Ot(e).map(function(t){return t.filter(tE)})}},tE=function(A){return $(A)||le(A)},vs=function(A){return{name:"border-".concat(A,"-color"),initialValue:"transparent",prefix:!1,type:3,format:"color"}},AE=vs("top"),nE=vs("right"),iE=vs("bottom"),rE=vs("left"),Cs=function(A){return{name:"border-radius-".concat(A),initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return pf(t.filter(le))}}},sE=Cs("top-left"),oE=Cs("top-right"),aE=Cs("bottom-right"),cE=Cs("bottom-left"),ws=function(A){return{name:"border-".concat(A,"-style"),initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},lE=ws("top"),uE=ws("right"),dE=ws("bottom"),hE=ws("left"),ys=function(A){return{name:"border-".concat(A,"-width"),initialValue:"0",type:0,prefix:!1,parse:function(e,t){return bA(t)?t.number:0}}},fE=ys("top"),gE=ys("right"),pE=ys("bottom"),mE=ys("left"),BE={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},vE={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(A,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},CE={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(A,e){return e.filter($).reduce(function(t,n){return t|wE(n.value)},0)}},wE=function(A){switch(A){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},yE={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},bE={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(A,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},bs;(function(A){A.NORMAL="normal",A.STRICT="strict"})(bs||(bs={}));var EE={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"strict":return bs.STRICT;case"normal":default:return bs.NORMAL}}},SE={name:"line-height",initialValue:"normal",prefix:!1,type:4},$f=function(A,e){return $(A)&&A.value==="normal"?1.2*e:A.type===17?e*A.number:le(A)?ne(A,e):e},UE={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(A,e){return e.type===20&&e.value==="none"?null:Bc.parse(A,e)}},TE={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(A,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},vc={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 52;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},Es=function(A){return{name:"margin-".concat(A),initialValue:"0",prefix:!1,type:4}},QE=Es("top"),FE=Es("right"),kE=Es("bottom"),IE=Es("left"),_E={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(A,e){return e.filter($).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},xE={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},Ss=function(A){return{name:"padding-".concat(A),initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},RE=Ss("top"),PE=Ss("right"),LE=Ss("bottom"),DE=Ss("left"),OE={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(A,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},HE={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(A,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},ME={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&uc(e[0],"none")?[]:Ot(e).map(function(t){for(var n={color:Mt.TRANSPARENT,offsetX:xe,offsetY:xe,blur:xe},i=0,r=0;r<t.length;r++){var s=t[r];EA(s)?(i===0?n.offsetX=s:i===1?n.offsetY=s:n.blur=s,i++):n.color=QA.parse(A,s)}return n})}},NE={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},KE={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(A,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=jE[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'.concat(e.name,'"'));return t(e.values)}return null}},VE=function(A){var e=A.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},GE=function(A){var e=A.filter(function(a){return a.type===17}).map(function(a){return a.number}),t=e[0],n=e[1];e[2],e[3];var i=e[4],r=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[t,n,i,r,s,o]:null},jE={matrix:VE,matrix3d:GE},Wf={type:16,number:50,flags:bi},$E=[Wf,Wf],WE={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(A,e){var t=e.filter(le);return t.length!==2?$E:[t[0],t[1]]}},JE={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},ki;(function(A){A.NORMAL="normal",A.BREAK_ALL="break-all",A.KEEP_ALL="keep-all"})(ki||(ki={}));for(var XE={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"break-all":return ki.BREAK_ALL;case"keep-all":return ki.KEEP_ALL;case"normal":default:return ki.NORMAL}}},qE={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(A,e){if(e.type===20)return{auto:!0,order:0};if(ye(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Jf={name:"time",parse:function(A,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},YE={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(A,e){return ye(e)?e.number:1}},zE={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ZE={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(A,e){return e.filter($).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},eS={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(A,e){var t=[],n=[];return e.forEach(function(i){switch(i.type){case 20:case 0:t.push(i.value);break;case 17:t.push(i.number.toString());break;case 4:n.push(t.join(" ")),t.length=0;break}}),t.length&&n.push(t.join(" ")),n.map(function(i){return i.indexOf(" ")===-1?i:"'".concat(i,"'")})}},tS={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},AS={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(A,e){if(ye(e))return e.number;if($(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},nS={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.filter($).map(function(t){return t.value})}},iS={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Se=function(A,e){return(A&e)!==0},rS={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},sS={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var n=[],i=e.filter(gf),r=0;r<i.length;r++){var s=i[r],o=i[r+1];if(s.type===20){var a=o&&ye(o)?o.number:1;n.push({counter:s.value,increment:a})}}return n}},oS={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return[];for(var t=[],n=e.filter(gf),i=0;i<n.length;i++){var r=n[i],s=n[i+1];if($(r)&&r.value!=="none"){var o=s&&ye(s)?s.number:0;t.push({counter:r.value,reset:o})}}return t}},aS={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(A,e){return e.filter(bA).map(function(t){return Jf.parse(A,t)})}},cS={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var n=[],i=e.filter(Vy);if(i.length%2!==0)return null;for(var r=0;r<i.length;r+=2){var s=i[r].value,o=i[r+1].value;n.push({open:s,close:o})}return n}},Xf=function(A,e,t){if(!A)return"";var n=A[Math.min(e,A.length-1)];return n?t?n.open:n.close:""},lS={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&uc(e[0],"none")?[]:Ot(e).map(function(t){for(var n={color:255,offsetX:xe,offsetY:xe,blur:xe,spread:xe,inset:!1},i=0,r=0;r<t.length;r++){var s=t[r];uc(s,"inset")?n.inset=!0:EA(s)?(i===0?n.offsetX=s:i===1?n.offsetY=s:i===2?n.blur=s:n.spread=s,i++):n.color=QA.parse(A,s)}return n})}},uS={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(A,e){var t=[0,1,2],n=[];return e.filter($).forEach(function(i){switch(i.value){case"stroke":n.push(1);break;case"fill":n.push(0);break;case"markers":n.push(2);break}}),t.forEach(function(i){n.indexOf(i)===-1&&n.push(i)}),n}},dS={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},hS={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(A,e){return bA(e)?e.number:0}},fS={name:"objectFit",initialValue:"fill",prefix:!1,type:1,parse:function(A,e){return e.filter($).reduce(function(t,n){return t|gS(n.value)},0)}},gS=function(A){switch(A){case"contain":return 2;case"cover":return 4;case"none":return 8;case"scale-down":return 16}return 0},pS=function(){function A(e,t){var n,i;this.animationDuration=P(e,aS,t.animationDuration),this.backgroundClip=P(e,Ob,t.backgroundClip),this.backgroundColor=P(e,Hb,t.backgroundColor),this.backgroundImage=P(e,Xb,t.backgroundImage),this.backgroundOrigin=P(e,qb,t.backgroundOrigin),this.backgroundPosition=P(e,Yb,t.backgroundPosition),this.backgroundRepeat=P(e,zb,t.backgroundRepeat),this.backgroundSize=P(e,eE,t.backgroundSize),this.borderTopColor=P(e,AE,t.borderTopColor),this.borderRightColor=P(e,nE,t.borderRightColor),this.borderBottomColor=P(e,iE,t.borderBottomColor),this.borderLeftColor=P(e,rE,t.borderLeftColor),this.borderTopLeftRadius=P(e,sE,t.borderTopLeftRadius),this.borderTopRightRadius=P(e,oE,t.borderTopRightRadius),this.borderBottomRightRadius=P(e,aE,t.borderBottomRightRadius),this.borderBottomLeftRadius=P(e,cE,t.borderBottomLeftRadius),this.borderTopStyle=P(e,lE,t.borderTopStyle),this.borderRightStyle=P(e,uE,t.borderRightStyle),this.borderBottomStyle=P(e,dE,t.borderBottomStyle),this.borderLeftStyle=P(e,hE,t.borderLeftStyle),this.borderTopWidth=P(e,fE,t.borderTopWidth),this.borderRightWidth=P(e,gE,t.borderRightWidth),this.borderBottomWidth=P(e,pE,t.borderBottomWidth),this.borderLeftWidth=P(e,mE,t.borderLeftWidth),this.boxShadow=P(e,lS,t.boxShadow),this.color=P(e,BE,t.color),this.direction=P(e,vE,t.direction),this.display=P(e,CE,t.display),this.float=P(e,yE,t.cssFloat),this.fontFamily=P(e,eS,t.fontFamily),this.fontSize=P(e,tS,t.fontSize),this.fontStyle=P(e,iS,t.fontStyle),this.fontVariant=P(e,nS,t.fontVariant),this.fontWeight=P(e,AS,t.fontWeight),this.letterSpacing=P(e,bE,t.letterSpacing),this.lineBreak=P(e,EE,t.lineBreak),this.lineHeight=P(e,SE,t.lineHeight),this.listStyleImage=P(e,UE,t.listStyleImage),this.listStylePosition=P(e,TE,t.listStylePosition),this.listStyleType=P(e,vc,t.listStyleType),this.marginTop=P(e,QE,t.marginTop),this.marginRight=P(e,FE,t.marginRight),this.marginBottom=P(e,kE,t.marginBottom),this.marginLeft=P(e,IE,t.marginLeft),this.opacity=P(e,YE,t.opacity);var r=P(e,_E,t.overflow);this.overflowX=r[0],this.overflowY=r[r.length>1?1:0],this.overflowWrap=P(e,xE,t.overflowWrap),this.paddingTop=P(e,RE,t.paddingTop),this.paddingRight=P(e,PE,t.paddingRight),this.paddingBottom=P(e,LE,t.paddingBottom),this.paddingLeft=P(e,DE,t.paddingLeft),this.paintOrder=P(e,uS,t.paintOrder),this.position=P(e,HE,t.position),this.textAlign=P(e,OE,t.textAlign),this.textDecorationColor=P(e,zE,(n=t.textDecorationColor)!==null&&n!==void 0?n:t.color),this.textDecorationLine=P(e,ZE,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=P(e,ME,t.textShadow),this.textTransform=P(e,NE,t.textTransform),this.transform=P(e,KE,t.transform),this.transformOrigin=P(e,WE,t.transformOrigin),this.visibility=P(e,JE,t.visibility),this.webkitTextStrokeColor=P(e,dS,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=P(e,hS,t.webkitTextStrokeWidth),this.wordBreak=P(e,XE,t.wordBreak),this.zIndex=P(e,qE,t.zIndex),this.objectFit=P(e,fS,t.objectFit)}return A.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},A.prototype.isTransparent=function(){return UA(this.backgroundColor)},A.prototype.isTransformed=function(){return this.transform!==null},A.prototype.isPositioned=function(){return this.position!==0},A.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},A.prototype.isFloating=function(){return this.float!==0},A.prototype.isInlineLevel=function(){return Se(this.display,4)||Se(this.display,33554432)||Se(this.display,268435456)||Se(this.display,536870912)||Se(this.display,67108864)||Se(this.display,134217728)},A}(),mS=function(){function A(e,t){this.content=P(e,rS,t.content),this.quotes=P(e,cS,t.quotes)}return A}(),qf=function(){function A(e,t){this.counterIncrement=P(e,sS,t.counterIncrement),this.counterReset=P(e,oS,t.counterReset)}return A}(),P=function(A,e,t){var n=new hf,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;n.write(i);var r=new ff(n.read());switch(e.type){case 2:var s=r.parseComponentValue();return e.parse(A,$(s)?s.value:e.initialValue);case 0:return e.parse(A,r.parseComponentValue());case 1:return e.parse(A,r.parseComponentValues());case 4:return r.parseComponentValue();case 3:switch(e.format){case"angle":return cs.parse(A,r.parseComponentValue());case"color":return QA.parse(A,r.parseComponentValue());case"image":return Bc.parse(A,r.parseComponentValue());case"length":var o=r.parseComponentValue();return EA(o)?o:xe;case"length-percentage":var a=r.parseComponentValue();return le(a)?a:xe;case"time":return Jf.parse(A,r.parseComponentValue())}break}},BS="data-html2canvas-debug",vS=function(A){var e=A.getAttribute(BS);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Cc=function(A,e){var t=vS(A);return t===1||e===t},Nt=function(){function A(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Cc(t,3))debugger;this.styles=new pS(e,window.getComputedStyle(t,null)),Rc(t)&&(this.styles.animationDuration.some(function(n){return n>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Vr(this.context,t),Cc(t,4)&&(this.flags|=16)}return A}(),CS="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Yf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ii=typeof Uint8Array>"u"?[]:new Uint8Array(256),Us=0;Us<Yf.length;Us++)Ii[Yf.charCodeAt(Us)]=Us;for(var wS=function(A){var e=A.length*.75,t=A.length,n,i=0,r,s,o,a;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),l=Array.isArray(c)?c:new Uint8Array(c);for(n=0;n<t;n+=4)r=Ii[A.charCodeAt(n)],s=Ii[A.charCodeAt(n+1)],o=Ii[A.charCodeAt(n+2)],a=Ii[A.charCodeAt(n+3)],l[i++]=r<<2|s>>4,l[i++]=(s&15)<<4|o>>2,l[i++]=(o&3)<<6|a&63;return c},yS=function(A){for(var e=A.length,t=[],n=0;n<e;n+=2)t.push(A[n+1]<<8|A[n]);return t},bS=function(A){for(var e=A.length,t=[],n=0;n<e;n+=4)t.push(A[n+3]<<24|A[n+2]<<16|A[n+1]<<8|A[n]);return t},ZA=5,wc=6+5,yc=2,ES=wc-ZA,zf=65536>>ZA,SS=1<<ZA,bc=SS-1,US=1024>>ZA,TS=zf+US,QS=TS,FS=32,kS=QS+FS,IS=65536>>wc,_S=1<<ES,xS=_S-1,Zf=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},RS=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},PS=function(A,e){var t=wS(A),n=Array.isArray(t)?bS(t):new Uint32Array(t),i=Array.isArray(t)?yS(t):new Uint16Array(t),r=24,s=Zf(i,r/2,n[4]/2),o=n[5]===2?Zf(i,(r+n[4])/2):RS(n,Math.ceil((r+n[4])/4));return new LS(n[0],n[1],n[2],n[3],s,o)},LS=function(){function A(e,t,n,i,r,s){this.initialValue=e,this.errorValue=t,this.highStart=n,this.highValueIndex=i,this.index=r,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>ZA],t=(t<<yc)+(e&bc),this.data[t];if(e<=65535)return t=this.index[zf+(e-55296>>ZA)],t=(t<<yc)+(e&bc),this.data[t];if(e<this.highStart)return t=kS-IS+(e>>wc),t=this.index[t],t+=e>>ZA&xS,t=this.index[t],t=(t<<yc)+(e&bc),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A}(),eg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",DS=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ts=0;Ts<eg.length;Ts++)DS[eg.charCodeAt(Ts)]=Ts;var OS=1,Ec=2,Sc=3,tg=4,Ag=5,HS=7,ng=8,Uc=9,Tc=10,ig=11,rg=12,sg=13,og=14,Qc=15,MS=function(A){for(var e=[],t=0,n=A.length;t<n;){var i=A.charCodeAt(t++);if(i>=55296&&i<=56319&&t<n){var r=A.charCodeAt(t++);(r&64512)===56320?e.push(((i&1023)<<10)+(r&1023)+65536):(e.push(i),t--)}else e.push(i)}return e},NS=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var n=[],i=-1,r="";++i<t;){var s=A[i];s<=65535?n.push(s):(s-=65536,n.push((s>>10)+55296,s%1024+56320)),(i+1===t||n.length>16384)&&(r+=String.fromCharCode.apply(String,n),n.length=0)}return r},KS=PS(CS),lt="×",Fc="÷",VS=function(A){return KS.get(A)},GS=function(A,e,t){var n=t-2,i=e[n],r=e[t-1],s=e[t];if(r===Ec&&s===Sc)return lt;if(r===Ec||r===Sc||r===tg||s===Ec||s===Sc||s===tg)return Fc;if(r===ng&&[ng,Uc,ig,rg].indexOf(s)!==-1||(r===ig||r===Uc)&&(s===Uc||s===Tc)||(r===rg||r===Tc)&&s===Tc||s===sg||s===Ag||s===HS||r===OS)return lt;if(r===sg&&s===og){for(;i===Ag;)i=e[--n];if(i===og)return lt}if(r===Qc&&s===Qc){for(var o=0;i===Qc;)o++,i=e[--n];if(o%2===0)return lt}return Fc},jS=function(A){var e=MS(A),t=e.length,n=0,i=0,r=e.map(VS);return{next:function(){if(n>=t)return{done:!0,value:null};for(var s=lt;n<t&&(s=GS(e,r,++n))===lt;);if(s!==lt||n===t){var o=NS.apply(null,e.slice(i,n));return i=n,{value:o,done:!1}}return{done:!0,value:null}}}},$S=function(A){for(var e=jS(A),t=[],n;!(n=e.next()).done;)n.value&&t.push(n.value.slice());return t},WS=function(A){var e=123;if(A.createRange){var t=A.createRange();if(t.getBoundingClientRect){var n=A.createElement("boundtest");n.style.height="".concat(e,"px"),n.style.display="block",A.body.appendChild(n),t.selectNode(n);var i=t.getBoundingClientRect(),r=Math.round(i.height);if(A.body.removeChild(n),r===e)return!0}}return!1},JS=function(A){var e=A.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",A.body.appendChild(e);var t=A.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var n=e.firstChild,i=Gr(n.data).map(function(a){return Be(a)}),r=0,s={},o=i.every(function(a,c){t.setStart(n,r),t.setEnd(n,r+a.length);var l=t.getBoundingClientRect();r+=a.length;var u=l.x>s.x||l.y>s.y;return s=l,c===0?!0:u});return A.body.removeChild(e),o},XS=function(){return typeof new Image().crossOrigin<"u"},qS=function(){return typeof new XMLHttpRequest().responseType=="string"},YS=function(A){var e=new Image,t=A.createElement("canvas"),n=t.getContext("2d");if(!n)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{n.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},ag=function(A){return A[0]===0&&A[1]===255&&A[2]===0&&A[3]===255},zS=function(A){var e=A.createElement("canvas"),t=100;e.width=t,e.height=t;var n=e.getContext("2d");if(!n)return Promise.reject(!1);n.fillStyle="rgb(0, 255, 0)",n.fillRect(0,0,t,t);var i=new Image,r=e.toDataURL();i.src=r;var s=kc(t,t,0,0,i);return n.fillStyle="red",n.fillRect(0,0,t,t),cg(s).then(function(o){n.drawImage(o,0,0);var a=n.getImageData(0,0,t,t).data;n.fillStyle="red",n.fillRect(0,0,t,t);var c=A.createElement("div");return c.style.backgroundImage="url(".concat(r,")"),c.style.height="".concat(t,"px"),ag(a)?cg(kc(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return n.drawImage(o,0,0),ag(n.getImageData(0,0,t,t).data)}).catch(function(){return!1})},kc=function(A,e,t,n,i){var r="http://www.w3.org/2000/svg",s=document.createElementNS(r,"svg"),o=document.createElementNS(r,"foreignObject");return s.setAttributeNS(null,"width",A.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",n.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(i),s},cg=function(A){return new Promise(function(e,t){var n=new Image;n.onload=function(){return e(n)},n.onerror=t,n.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(A)))})},Re={get SUPPORT_RANGE_BOUNDS(){var A=WS(document);return Object.defineProperty(Re,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_WORD_BREAKING(){var A=Re.SUPPORT_RANGE_BOUNDS&&JS(document);return Object.defineProperty(Re,"SUPPORT_WORD_BREAKING",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=YS(document);return Object.defineProperty(Re,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A=typeof Array.from=="function"&&typeof window.fetch=="function"?zS(document):Promise.resolve(!1);return Object.defineProperty(Re,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=XS();return Object.defineProperty(Re,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A=qS();return Object.defineProperty(Re,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Re,"SUPPORT_CORS_XHR",{value:A}),A},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var A=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Re,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:A}),A}},_i=function(){function A(e,t){this.text=e,this.bounds=t}return A}(),ZS=function(A,e,t,n){var i=AU(e,t),r=[],s=0;return i.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Re.SUPPORT_RANGE_BOUNDS){var a=lg(n,s,o.length).getClientRects();if(a.length>1){var c=Ic(o),l=0;c.forEach(function(d){r.push(new _i(d,Xt.fromDOMRectList(A,lg(n,l+s,d.length).getClientRects()))),l+=d.length})}else r.push(new _i(o,Xt.fromDOMRectList(A,a)))}else{var u=n.splitText(o.length);r.push(new _i(o,eU(A,n))),n=u}else Re.SUPPORT_RANGE_BOUNDS||(n=n.splitText(o.length));s+=o.length}),r},eU=function(A,e){var t=e.ownerDocument;if(t){var n=t.createElement("html2canvaswrapper");n.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(n,e);var r=Vr(A,n);return n.firstChild&&i.replaceChild(n.firstChild,n),r}}return Xt.EMPTY},lg=function(A,e,t){var n=A.ownerDocument;if(!n)throw new Error("Node has no owner document");var i=n.createRange();return i.setStart(A,e),i.setEnd(A,e+t),i},Ic=function(A){if(Re.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(A)).map(function(t){return t.segment})}return $S(A)},tU=function(A,e){if(Re.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(A)).map(function(n){return n.segment})}return iU(A,e)},AU=function(A,e){return e.letterSpacing!==0?Ic(A):tU(A,e)},nU=[32,160,4961,65792,65793,4153,4241],iU=function(A,e){for(var t=Dw(A,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),n=[],i,r=function(){if(i.value){var s=i.value.slice(),o=Gr(s),a="";o.forEach(function(c){nU.indexOf(c)===-1?a+=Be(c):(a.length&&n.push(a),n.push(Be(c)),a="")}),a.length&&n.push(a)}};!(i=t.next()).done;)r();return n},rU=function(){function A(e,t,n){this.text=sU(t.data,n.textTransform),this.textBounds=ZS(e,this.text,n,t)}return A}(),sU=function(A,e){switch(e){case 1:return A.toLowerCase();case 3:return A.replace(oU,aU);case 2:return A.toUpperCase();default:return A}},oU=/(^|\s|:|-|\(|\))([a-z])/g,aU=function(A,e,t){return A.length>0?e+t.toUpperCase():A},ug=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.src=n.currentSrc||n.src,i.intrinsicWidth=n.naturalWidth,i.intrinsicHeight=n.naturalHeight,i.context.cache.addImage(i.src),i}return e}(Nt),dg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.canvas=n,i.intrinsicWidth=n.width,i.intrinsicHeight=n.height,i}return e}(Nt),hg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this,r=new XMLSerializer,s=Vr(t,n);return n.setAttribute("width","".concat(s.width,"px")),n.setAttribute("height","".concat(s.height,"px")),i.svg="data:image/svg+xml,".concat(encodeURIComponent(r.serializeToString(n))),i.intrinsicWidth=n.width.baseVal.value,i.intrinsicHeight=n.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(Nt),fg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.value=n.value,i}return e}(Nt),_c=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.start=n.start,i.reversed=typeof n.reversed=="boolean"&&n.reversed===!0,i}return e}(Nt),cU=[{type:15,flags:0,unit:"px",number:3}],lU=[{type:16,flags:0,number:50}],uU=function(A){return A.width>A.height?new Xt(A.left+(A.width-A.height)/2,A.top,A.height,A.height):A.width<A.height?new Xt(A.left,A.top+(A.height-A.width)/2,A.width,A.width):A},dU=function(A){var e=A.type===hU?new Array(A.value.length+1).join("•"):A.value;return e.length===0?A.placeholder||"":e},Qs="checkbox",Fs="radio",hU="password",gg=707406591,xc=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;switch(i.type=n.type.toLowerCase(),i.checked=n.checked,i.value=dU(n),(i.type===Qs||i.type===Fs)&&(i.styles.backgroundColor=3739148031,i.styles.borderTopColor=i.styles.borderRightColor=i.styles.borderBottomColor=i.styles.borderLeftColor=2779096575,i.styles.borderTopWidth=i.styles.borderRightWidth=i.styles.borderBottomWidth=i.styles.borderLeftWidth=1,i.styles.borderTopStyle=i.styles.borderRightStyle=i.styles.borderBottomStyle=i.styles.borderLeftStyle=1,i.styles.backgroundClip=[0],i.styles.backgroundOrigin=[0],i.bounds=uU(i.bounds)),i.type){case Qs:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=cU;break;case Fs:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=lU;break}return i}return e}(Nt),pg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this,r=n.options[n.selectedIndex||0];return i.value=r&&r.text||"",i}return e}(Nt),mg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.value=n.value,i}return e}(Nt),Bg=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;i.src=n.src,i.width=parseInt(n.width,10)||0,i.height=parseInt(n.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(n.contentWindow&&n.contentWindow.document&&n.contentWindow.document.documentElement){i.tree=Cg(t,n.contentWindow.document.documentElement);var r=n.contentWindow.document.documentElement?In(t,getComputedStyle(n.contentWindow.document.documentElement).backgroundColor):Mt.TRANSPARENT,s=n.contentWindow.document.body?In(t,getComputedStyle(n.contentWindow.document.body).backgroundColor):Mt.TRANSPARENT;i.backgroundColor=UA(r)?UA(s)?i.styles.backgroundColor:s:r}}catch{}return i}return e}(Nt),fU=["OL","UL","MENU"],ks=function(A,e,t,n){for(var i=e.firstChild,r=void 0;i;i=r)if(r=i.nextSibling,wg(i)&&i.data.length>0)t.textNodes.push(new rU(A,i,t.styles));else if(xn(i))if(Tg(i)&&i.assignedNodes)i.assignedNodes().forEach(function(o){return ks(A,o,t,n)});else{var s=vg(A,i);s.styles.isVisible()&&(gU(i,s,n)?s.flags|=4:pU(s.styles)&&(s.flags|=2),fU.indexOf(i.tagName)!==-1&&(s.flags|=8),t.elements.push(s),i.slot,i.shadowRoot?ks(A,i.shadowRoot,s,n):!_s(i)&&!yg(i)&&!xs(i)&&ks(A,i,s,n))}},vg=function(A,e){return Lc(e)?new ug(A,e):bg(e)?new dg(A,e):yg(e)?new hg(A,e):mU(e)?new fg(A,e):BU(e)?new _c(A,e):vU(e)?new xc(A,e):xs(e)?new pg(A,e):_s(e)?new mg(A,e):Sg(e)?new Bg(A,e):new Nt(A,e)},Cg=function(A,e){var t=vg(A,e);return t.flags|=4,ks(A,e,t,t),t},gU=function(A,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Pc(A)&&t.styles.isTransparent()},pU=function(A){return A.isPositioned()||A.isFloating()},wg=function(A){return A.nodeType===Node.TEXT_NODE},xn=function(A){return A.nodeType===Node.ELEMENT_NODE},Rc=function(A){return xn(A)&&typeof A.style<"u"&&!Is(A)},Is=function(A){return typeof A.className=="object"},mU=function(A){return A.tagName==="LI"},BU=function(A){return A.tagName==="OL"},vU=function(A){return A.tagName==="INPUT"},CU=function(A){return A.tagName==="HTML"},yg=function(A){return A.tagName==="svg"},Pc=function(A){return A.tagName==="BODY"},bg=function(A){return A.tagName==="CANVAS"},Eg=function(A){return A.tagName==="VIDEO"},Lc=function(A){return A.tagName==="IMG"},Sg=function(A){return A.tagName==="IFRAME"},Ug=function(A){return A.tagName==="STYLE"},wU=function(A){return A.tagName==="SCRIPT"},_s=function(A){return A.tagName==="TEXTAREA"},xs=function(A){return A.tagName==="SELECT"},Tg=function(A){return A.tagName==="SLOT"},Qg=function(A){return A.tagName.indexOf("-")>0},yU=function(){function A(){this.counters={}}return A.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},A.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},A.prototype.pop=function(e){var t=this;e.forEach(function(n){return t.counters[n].pop()})},A.prototype.parse=function(e){var t=this,n=e.counterIncrement,i=e.counterReset,r=!0;n!==null&&n.forEach(function(o){var a=t.counters[o.counter];a&&o.increment!==0&&(r=!1,a.length||a.push(1),a[Math.max(0,a.length-1)]+=o.increment)});var s=[];return r&&i.forEach(function(o){var a=t.counters[o.counter];s.push(o.counter),a||(a=t.counters[o.counter]=[]),a.push(o.reset)}),s},A}(),Fg={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},kg={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},bU={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},EU={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Rn=function(A,e,t,n,i,r){return A<e||A>t?Ri(A,i,r.length>0):n.integers.reduce(function(s,o,a){for(;A>=o;)A-=o,s+=n.values[a];return s},"")+r},Ig=function(A,e,t,n){var i="";do t||A--,i=n(A)+i,A/=e;while(A*e>=e);return i},ve=function(A,e,t,n,i){var r=t-e+1;return(A<0?"-":"")+(Ig(Math.abs(A),r,n,function(s){return Be(Math.floor(s%r)+e)})+i)},en=function(A,e,t){t===void 0&&(t=". ");var n=e.length;return Ig(Math.abs(A),n,!1,function(i){return e[Math.floor(i%n)]})+t},Pn=1,FA=2,kA=4,xi=8,Yt=function(A,e,t,n,i,r){if(A<-9999||A>9999)return Ri(A,4,i.length>0);var s=Math.abs(A),o=i;if(s===0)return e[0]+o;for(var a=0;s>0&&a<=4;a++){var c=s%10;c===0&&Se(r,Pn)&&o!==""?o=e[c]+o:c>1||c===1&&a===0||c===1&&a===1&&Se(r,FA)||c===1&&a===1&&Se(r,kA)&&A>100||c===1&&a>1&&Se(r,xi)?o=e[c]+(a>0?t[a-1]:"")+o:c===1&&a>0&&(o=t[a-1]+o),s=Math.floor(s/10)}return(A<0?n:"")+o},_g="十百千萬",xg="拾佰仟萬",Rg="マイナス",Dc="마이너스",Ri=function(A,e,t){var n=t?". ":"",i=t?"、":"",r=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=ve(A,48,57,!0,n);return o.length<4?"0".concat(o):o;case 4:return en(A,"〇一二三四五六七八九",i);case 6:return Rn(A,1,3999,Fg,3,n).toLowerCase();case 7:return Rn(A,1,3999,Fg,3,n);case 8:return ve(A,945,969,!1,n);case 9:return ve(A,97,122,!1,n);case 10:return ve(A,65,90,!1,n);case 11:return ve(A,1632,1641,!0,n);case 12:case 49:return Rn(A,1,9999,kg,3,n);case 35:return Rn(A,1,9999,kg,3,n).toLowerCase();case 13:return ve(A,2534,2543,!0,n);case 14:case 30:return ve(A,6112,6121,!0,n);case 15:return en(A,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return en(A,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return Yt(A,"零一二三四五六七八九",_g,"負",i,FA|kA|xi);case 47:return Yt(A,"零壹貳參肆伍陸柒捌玖",xg,"負",i,Pn|FA|kA|xi);case 42:return Yt(A,"零一二三四五六七八九",_g,"负",i,FA|kA|xi);case 41:return Yt(A,"零壹贰叁肆伍陆柒捌玖",xg,"负",i,Pn|FA|kA|xi);case 26:return Yt(A,"〇一二三四五六七八九","十百千万",Rg,i,0);case 25:return Yt(A,"零壱弐参四伍六七八九","拾百千万",Rg,i,Pn|FA|kA);case 31:return Yt(A,"영일이삼사오육칠팔구","십백천만",Dc,r,Pn|FA|kA);case 33:return Yt(A,"零一二三四五六七八九","十百千萬",Dc,r,0);case 32:return Yt(A,"零壹貳參四五六七八九","拾百千",Dc,r,Pn|FA|kA);case 18:return ve(A,2406,2415,!0,n);case 20:return Rn(A,1,19999,EU,3,n);case 21:return ve(A,2790,2799,!0,n);case 22:return ve(A,2662,2671,!0,n);case 52:return Rn(A,1,10999,bU,3,n);case 23:return en(A,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return en(A,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return ve(A,3302,3311,!0,n);case 28:return en(A,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return en(A,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return ve(A,3792,3801,!0,n);case 37:return ve(A,6160,6169,!0,n);case 38:return ve(A,4160,4169,!0,n);case 39:return ve(A,2918,2927,!0,n);case 40:return ve(A,1776,1785,!0,n);case 43:return ve(A,3046,3055,!0,n);case 44:return ve(A,3174,3183,!0,n);case 45:return ve(A,3664,3673,!0,n);case 46:return ve(A,3872,3881,!0,n);case 3:default:return ve(A,48,57,!0,n)}},Pg="data-html2canvas-ignore",Lg=function(){function A(e,t,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=t,this.counters=new yU,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return A.prototype.toIFrame=function(e,t){var n=this,i=SU(e,t);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var r=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=i.contentWindow,a=o.document,c=QU(i).then(function(){return Ke(n,void 0,void 0,function(){var u,d;return Oe(this,function(h){switch(h.label){case 0:return this.scrolledElements.forEach(_U),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),u=this.options.onclone,d=this.clonedReferenceElement,typeof d>"u"?[2,Promise.reject("Error finding the ".concat(this.referenceElement.nodeName," in the cloned document"))]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:h.sent(),h.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,TU(a)]:[3,4];case 3:h.sent(),h.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(a,d)}).then(function(){return i})]:[2,i]}})})}),l=a.adoptNode(this.documentElement);return DU(l,a),a.open(),a.write("".concat(kU(document.doctype),"<html></html>")),IU(this.referenceElement.ownerDocument,r,s),a.replaceChild(l,a.documentElement),a.close(),c},A.prototype.createElementClone=function(e){if(Cc(e,2))debugger;if(bg(e))return this.createCanvasClone(e);if(Eg(e))return this.createVideoClone(e);if(Ug(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Lc(t)&&(Lc(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Qg(t)?this.createCustomElementClone(t):t},A.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Oc(e.style,t),t},A.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var n=[].slice.call(t.cssRules,0).reduce(function(r,s){return s&&typeof s.cssText=="string"?r+s.cssText:r},""),i=e.cloneNode(!1);return i.textContent=n,i}}catch(r){if(this.context.logger.error("Unable to access cssRules property",r),r.name!=="SecurityError")throw r}return e.cloneNode(!1)},A.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var n=e.ownerDocument.createElement("img");try{return n.src=e.toDataURL(),n}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var i=e.cloneNode(!1);try{i.width=e.width,i.height=e.height;var r=e.getContext("2d"),s=i.getContext("2d",{willReadFrequently:!0});if(s)if(!this.options.allowTaint&&r)s.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(o){var a=o.getContextAttributes();a?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return i}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return i},A.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var n=t.getContext("2d");try{return n&&(n.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||n.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var i=e.ownerDocument.createElement("canvas");return i.width=e.offsetWidth,i.height=e.offsetHeight,i},A.prototype.appendChildNode=function(e,t,n){(!xn(t)||!wU(t)&&!t.hasAttribute(Pg)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!xn(t)||!Ug(t))&&e.appendChild(this.cloneNode(t,n))},A.prototype.cloneChildNodes=function(e,t,n){for(var i=this,r=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;r;r=r.nextSibling)if(xn(r)&&Tg(r)&&typeof r.assignedNodes=="function"){var s=r.assignedNodes();s.length&&s.forEach(function(o){return i.appendChildNode(t,o,n)})}else this.appendChildNode(t,r,n)},A.prototype.cloneNode=function(e,t){if(wg(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&xn(e)&&(Rc(e)||Is(e))){var i=this.createElementClone(e);i.style.transitionProperty="none";var r=n.getComputedStyle(e),s=n.getComputedStyle(e,":before"),o=n.getComputedStyle(e,":after");this.referenceElement===e&&Rc(i)&&(this.clonedReferenceElement=i),Pc(i)&&PU(i);var a=this.counters.parse(new qf(this.context,r)),c=this.resolvePseudoContent(e,i,s,Pi.BEFORE);Qg(e)&&(t=!0),Eg(e)||this.cloneChildNodes(e,i,t),c&&i.insertBefore(c,i.firstChild);var l=this.resolvePseudoContent(e,i,o,Pi.AFTER);return l&&i.appendChild(l),this.counters.pop(a),(r&&(this.options.copyStyles||Is(e))&&!Sg(e)||t)&&Oc(r,i),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([i,e.scrollLeft,e.scrollTop]),(_s(e)||xs(e))&&(_s(i)||xs(i))&&(i.value=e.value),i}return e.cloneNode(!1)},A.prototype.resolvePseudoContent=function(e,t,n,i){var r=this;if(n){var s=n.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||n.display==="none")){this.counters.parse(new qf(this.context,n));var a=new mS(this.context,n),c=o.createElement("html2canvaspseudoelement");Oc(n,c),a.content.forEach(function(u){if(u.type===0)c.appendChild(o.createTextNode(u.value));else if(u.type===22){var d=o.createElement("img");d.src=u.value,d.style.opacity="1",c.appendChild(d)}else if(u.type===18){if(u.name==="attr"){var h=u.values.filter($);h.length&&c.appendChild(o.createTextNode(e.getAttribute(h[0].value)||""))}else if(u.name==="counter"){var f=u.values.filter(_e),g=f[0],p=f[1];if(g&&$(g)){var B=r.counters.getCounterValue(g.value),y=p&&$(p)?vc.parse(r.context,p.value):3;c.appendChild(o.createTextNode(Ri(B,y,!1)))}}else if(u.name==="counters"){var b=u.values.filter(_e),g=b[0],v=b[1],p=b[2];if(g&&$(g)){var C=r.counters.getCounterValues(g.value),w=p&&$(p)?vc.parse(r.context,p.value):3,S=v&&v.type===0?v.value:"",F=C.map(function(H){return Ri(H,w,!1)}).join(S);c.appendChild(o.createTextNode(F))}}}else if(u.type===20)switch(u.value){case"open-quote":c.appendChild(o.createTextNode(Xf(a.quotes,r.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Xf(a.quotes,--r.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(u.value))}}),c.className="".concat(Hc," ").concat(Mc);var l=i===Pi.BEFORE?" ".concat(Hc):" ".concat(Mc);return Is(t)?t.className.baseValue+=l:t.className+=l,c}}},A.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},A}(),Pi;(function(A){A[A.BEFORE=0]="BEFORE",A[A.AFTER=1]="AFTER"})(Pi||(Pi={}));var SU=function(A,e){var t=A.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(Pg,"true"),A.body.appendChild(t),t},UU=function(A){return new Promise(function(e){if(A.complete){e();return}if(!A.src){e();return}A.onload=e,A.onerror=e})},TU=function(A){return Promise.all([].slice.call(A.images,0).map(UU))},QU=function(A){return new Promise(function(e,t){var n=A.contentWindow;if(!n)return t("No window assigned for iframe");var i=n.document;n.onload=A.onload=function(){n.onload=A.onload=null;var r=setInterval(function(){i.body.childNodes.length>0&&i.readyState==="complete"&&(clearInterval(r),e(A))},50)}})},FU=["all","d","content"],Oc=function(A,e){for(var t=A.length-1;t>=0;t--){var n=A.item(t);FU.indexOf(n)===-1&&e.style.setProperty(n,A.getPropertyValue(n))}return e},kU=function(A){var e="";return A&&(e+="<!DOCTYPE ",A.name&&(e+=A.name),A.internalSubset&&(e+=A.internalSubset),A.publicId&&(e+='"'.concat(A.publicId,'"')),A.systemId&&(e+='"'.concat(A.systemId,'"')),e+=">"),e},IU=function(A,e,t){A&&A.defaultView&&(e!==A.defaultView.pageXOffset||t!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(e,t)},_U=function(A){var e=A[0],t=A[1],n=A[2];e.scrollLeft=t,e.scrollTop=n},xU=":before",RU=":after",Hc="___html2canvas___pseudoelement_before",Mc="___html2canvas___pseudoelement_after",Dg=`{
107
107
  content: "" !important;
108
108
  display: none !important;
109
109
  }`,PU=function(A){LU(A,".".concat(Hc).concat(xU).concat(Dg,`
110
- .`).concat(Mc).concat(RU).concat(Dg))},LU=function(A,e){var t=A.ownerDocument;if(t){var n=t.createElement("style");n.textContent=e,A.appendChild(n)}},DU=function(A,e){var t,n=e.createElement("base");n.href=e.baseURI;var i=A.getElementsByTagName("head").item(0);i?.insertBefore(n,(t=i?.firstChild)!==null&&t!==void 0?t:null)},Nc=function(){function A(){}return A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A}(),OU=function(){function A(e,t){this.context=e,this._options=t,this._cache={}}return A.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(Gc(e)||KU(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return Ke(this,void 0,void 0,function(){var t,n,i,r,s,o=this;return Oe(this,function(a){switch(a.label){case 0:return typeof this._options.customIsSameOrigin!="function"?[3,2]:[4,this._options.customIsSameOrigin(e,Nc.isSameOrigin)];case 1:return n=a.sent(),[3,3];case 2:n=Nc.isSameOrigin(e),a.label=3;case 3:return t=n,i=!Kc(e)&&this._options.useCORS===!0&&Re.SUPPORT_CORS_IMAGES&&!t,r=!Kc(e)&&!t&&!Gc(e)&&typeof this._options.proxy=="string"&&Re.SUPPORT_CORS_XHR&&!i,!t&&this._options.allowTaint===!1&&!Kc(e)&&!Gc(e)&&!r&&!i?[2]:(s=e,r?[4,this.proxy(s)]:[3,5]);case 4:s=a.sent(),a.label=5;case 5:return this.context.logger.debug("Added image ".concat(e.substring(0,256))),[4,new Promise(function(c,l){var u=new Image;u.onload=function(){return c(u)},u.onerror=l,(GU(s)||i)&&(u.crossOrigin="anonymous"),u.src=s,u.complete===!0&&setTimeout(function(){return c(u)},500),o._options.imageTimeout>0&&setTimeout(function(){return l("Timed out (".concat(o._options.imageTimeout,"ms) loading image"))},o._options.imageTimeout)})];case 6:return[2,a.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var t=this,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(r,s){var o=Re.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(o==="text")r(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return r(u.result)},!1),u.addEventListener("error",function(d){return s(d)},!1),u.readAsDataURL(a.response)}else s("Failed to proxy resource ".concat(i," with status code ").concat(a.status))},a.onerror=s;var c=n.indexOf("?")>-1?"&":"?";if(a.open("GET","".concat(n).concat(c,"url=").concat(encodeURIComponent(e),"&responseType=").concat(o)),o!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=o),t._options.imageTimeout){var l=t._options.imageTimeout;a.timeout=l,a.ontimeout=function(){return s("Timed out (".concat(l,"ms) proxying ").concat(i))}}a.send()})},A}(),HU=/^data:image\/svg\+xml/i,MU=/^data:image\/.*;base64,/i,NU=/^data:image\/.*/i,KU=function(A){return Re.SUPPORT_SVG_DRAWING||!VU(A)},Kc=function(A){return NU.test(A)},GU=function(A){return MU.test(A)},Gc=function(A){return A.substr(0,4)==="blob"},VU=function(A){return A.substr(-3).toLowerCase()==="svg"||HU.test(A)},R=function(){function A(e,t){this.type=0,this.x=e,this.y=t}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A}(),Ln=function(A,e,t){return new R(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},Rs=function(){function A(e,t,n,i){this.type=1,this.start=e,this.startControl=t,this.endControl=n,this.end=i}return A.prototype.subdivide=function(e,t){var n=Ln(this.start,this.startControl,e),i=Ln(this.startControl,this.endControl,e),r=Ln(this.endControl,this.end,e),s=Ln(n,i,e),o=Ln(i,r,e),a=Ln(s,o,e);return t?new A(this.start,n,s,a):new A(a,o,r,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A}(),ut=function(A){return A.type===1},jU=function(){function A(e){var t=e.styles,n=e.bounds,i=Qi(t.borderTopLeftRadius,n.width,n.height),r=i[0],s=i[1],o=Qi(t.borderTopRightRadius,n.width,n.height),a=o[0],c=o[1],l=Qi(t.borderBottomRightRadius,n.width,n.height),u=l[0],d=l[1],h=Qi(t.borderBottomLeftRadius,n.width,n.height),f=h[0],g=h[1],p=[];p.push((r+a)/n.width),p.push((f+u)/n.width),p.push((s+g)/n.height),p.push((c+d)/n.height);var B=Math.max.apply(Math,p);B>1&&(r/=B,s/=B,a/=B,c/=B,u/=B,d/=B,f/=B,g/=B);var y=n.width-a,b=n.height-d,v=n.width-u,C=n.height-g,w=t.borderTopWidth,S=t.borderRightWidth,F=t.borderBottomWidth,_=t.borderLeftWidth,D=ne(t.paddingTop,e.bounds.width),H=ne(t.paddingRight,e.bounds.width),M=ne(t.paddingBottom,e.bounds.width),K=ne(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=r>0||s>0?de(n.left+_/3,n.top+w/3,r-_/3,s-w/3,te.TOP_LEFT):new R(n.left+_/3,n.top+w/3),this.topRightBorderDoubleOuterBox=r>0||s>0?de(n.left+y,n.top+w/3,a-S/3,c-w/3,te.TOP_RIGHT):new R(n.left+n.width-S/3,n.top+w/3),this.bottomRightBorderDoubleOuterBox=u>0||d>0?de(n.left+v,n.top+b,u-S/3,d-F/3,te.BOTTOM_RIGHT):new R(n.left+n.width-S/3,n.top+n.height-F/3),this.bottomLeftBorderDoubleOuterBox=f>0||g>0?de(n.left+_/3,n.top+C,f-_/3,g-F/3,te.BOTTOM_LEFT):new R(n.left+_/3,n.top+n.height-F/3),this.topLeftBorderDoubleInnerBox=r>0||s>0?de(n.left+_*2/3,n.top+w*2/3,r-_*2/3,s-w*2/3,te.TOP_LEFT):new R(n.left+_*2/3,n.top+w*2/3),this.topRightBorderDoubleInnerBox=r>0||s>0?de(n.left+y,n.top+w*2/3,a-S*2/3,c-w*2/3,te.TOP_RIGHT):new R(n.left+n.width-S*2/3,n.top+w*2/3),this.bottomRightBorderDoubleInnerBox=u>0||d>0?de(n.left+v,n.top+b,u-S*2/3,d-F*2/3,te.BOTTOM_RIGHT):new R(n.left+n.width-S*2/3,n.top+n.height-F*2/3),this.bottomLeftBorderDoubleInnerBox=f>0||g>0?de(n.left+_*2/3,n.top+C,f-_*2/3,g-F*2/3,te.BOTTOM_LEFT):new R(n.left+_*2/3,n.top+n.height-F*2/3),this.topLeftBorderStroke=r>0||s>0?de(n.left+_/2,n.top+w/2,r-_/2,s-w/2,te.TOP_LEFT):new R(n.left+_/2,n.top+w/2),this.topRightBorderStroke=r>0||s>0?de(n.left+y,n.top+w/2,a-S/2,c-w/2,te.TOP_RIGHT):new R(n.left+n.width-S/2,n.top+w/2),this.bottomRightBorderStroke=u>0||d>0?de(n.left+v,n.top+b,u-S/2,d-F/2,te.BOTTOM_RIGHT):new R(n.left+n.width-S/2,n.top+n.height-F/2),this.bottomLeftBorderStroke=f>0||g>0?de(n.left+_/2,n.top+C,f-_/2,g-F/2,te.BOTTOM_LEFT):new R(n.left+_/2,n.top+n.height-F/2),this.topLeftBorderBox=r>0||s>0?de(n.left,n.top,r,s,te.TOP_LEFT):new R(n.left,n.top),this.topRightBorderBox=a>0||c>0?de(n.left+y,n.top,a,c,te.TOP_RIGHT):new R(n.left+n.width,n.top),this.bottomRightBorderBox=u>0||d>0?de(n.left+v,n.top+b,u,d,te.BOTTOM_RIGHT):new R(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=f>0||g>0?de(n.left,n.top+C,f,g,te.BOTTOM_LEFT):new R(n.left,n.top+n.height),this.topLeftPaddingBox=r>0||s>0?de(n.left+_,n.top+w,Math.max(0,r-_),Math.max(0,s-w),te.TOP_LEFT):new R(n.left+_,n.top+w),this.topRightPaddingBox=a>0||c>0?de(n.left+Math.min(y,n.width-S),n.top+w,y>n.width+S?0:Math.max(0,a-S),Math.max(0,c-w),te.TOP_RIGHT):new R(n.left+n.width-S,n.top+w),this.bottomRightPaddingBox=u>0||d>0?de(n.left+Math.min(v,n.width-_),n.top+Math.min(b,n.height-F),Math.max(0,u-S),Math.max(0,d-F),te.BOTTOM_RIGHT):new R(n.left+n.width-S,n.top+n.height-F),this.bottomLeftPaddingBox=f>0||g>0?de(n.left+_,n.top+Math.min(C,n.height-F),Math.max(0,f-_),Math.max(0,g-F),te.BOTTOM_LEFT):new R(n.left+_,n.top+n.height-F),this.topLeftContentBox=r>0||s>0?de(n.left+_+K,n.top+w+D,Math.max(0,r-(_+K)),Math.max(0,s-(w+D)),te.TOP_LEFT):new R(n.left+_+K,n.top+w+D),this.topRightContentBox=a>0||c>0?de(n.left+Math.min(y,n.width+_+K),n.top+w+D,y>n.width+_+K?0:a-_+K,c-(w+D),te.TOP_RIGHT):new R(n.left+n.width-(S+H),n.top+w+D),this.bottomRightContentBox=u>0||d>0?de(n.left+Math.min(v,n.width-(_+K)),n.top+Math.min(b,n.height+w+D),Math.max(0,u-(S+H)),d-(F+M),te.BOTTOM_RIGHT):new R(n.left+n.width-(S+H),n.top+n.height-(F+M)),this.bottomLeftContentBox=f>0||g>0?de(n.left+_+K,n.top+C,Math.max(0,f-(_+K)),g-(F+M),te.BOTTOM_LEFT):new R(n.left+_+K,n.top+n.height-(F+M))}return A}(),te;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(te||(te={}));var de=function(A,e,t,n,i){var r=4*((Math.sqrt(2)-1)/3),s=t*r,o=n*r,a=A+t,c=e+n;switch(i){case te.TOP_LEFT:return new Rs(new R(A,c),new R(A,c-o),new R(a-s,e),new R(a,e));case te.TOP_RIGHT:return new Rs(new R(A,e),new R(A+s,e),new R(a,c-o),new R(a,c));case te.BOTTOM_RIGHT:return new Rs(new R(a,e),new R(a,e+o),new R(A+s,c),new R(A,c));case te.BOTTOM_LEFT:default:return new Rs(new R(a,c),new R(a-s,c),new R(A,e+o),new R(A,e))}},Ps=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},$U=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Ls=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},WU=function(){function A(e,t,n){this.offsetX=e,this.offsetY=t,this.matrix=n,this.type=0,this.target=6}return A}(),Ds=function(){function A(e,t){this.path=e,this.target=t,this.type=1}return A}(),JU=function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A}(),XU=function(A){return A.type===0},Og=function(A){return A.type===1},qU=function(A){return A.type===2},Hg=function(A,e){return A.length===e.length?A.some(function(t,n){return t===e[n]}):!1},YU=function(A,e,t,n,i){return A.map(function(r,s){switch(s){case 0:return r.add(e,t);case 1:return r.add(e+n,t);case 2:return r.add(e+n,t+i);case 3:return r.add(e,t+i)}return r})},Mg=function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A}(),Ng=function(){function A(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new jU(this.container),this.container.styles.opacity<1&&this.effects.push(new JU(this.container.styles.opacity)),this.container.styles.transform!==null){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,r=this.container.styles.transform;this.effects.push(new WU(n,i,r))}if(this.container.styles.overflowX!==0){var s=Ps(this.curves),o=Ls(this.curves);Hg(s,o)?this.effects.push(new Ds(s,6)):(this.effects.push(new Ds(s,2)),this.effects.push(new Ds(o,4)))}}return A.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,n=this.parent,i=this.effects.slice(0);n;){var r=n.effects.filter(function(a){return!Og(a)});if(t||n.container.styles.position!==0||!n.parent){if(t=[2,3].indexOf(n.container.styles.position)===-1,n.container.styles.overflowX!==0){var s=Ps(n.curves),o=Ls(n.curves);Hg(s,o)||i.unshift(new Ds(o,6))}i.unshift.apply(i,r)}else i.unshift.apply(i,r);n=n.parent}return i.filter(function(a){return Se(a.target,e)})},A}(),Vc=function(A,e,t,n){A.container.elements.forEach(function(i){var r=Se(i.flags,4),s=Se(i.flags,2),o=new Ng(i,A);Se(i.styles.display,2048)&&n.push(o);var a=Se(i.flags,8)?[]:n;if(r||s){var c=r||i.styles.isPositioned()?t:e,l=new Mg(o);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var d=0;c.negativeZIndex.some(function(f,g){return u>f.element.container.styles.zIndex.order?(d=g,!1):d>0}),c.negativeZIndex.splice(d,0,l)}else if(u>0){var h=0;c.positiveZIndex.some(function(f,g){return u>=f.element.container.styles.zIndex.order?(h=g+1,!1):h>0}),c.positiveZIndex.splice(h,0,l)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else i.styles.isFloating()?c.nonPositionedFloats.push(l):c.nonPositionedInlineLevel.push(l);Vc(o,l,r?l:t,a)}else i.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Vc(o,e,t,a);Se(i.flags,8)&&Kg(i,a)})},Kg=function(A,e){for(var t=A instanceof _c?A.start:1,n=A instanceof _c?A.reversed:!1,i=0;i<e.length;i++){var r=e[i];r.container instanceof fg&&typeof r.container.value=="number"&&r.container.value!==0&&(t=r.container.value),r.listValue=Ri(t,r.container.styles.listStyleType,!0),t+=n?-1:1}},zU=function(A){var e=new Ng(A,null),t=new Mg(e),n=[];return Vc(e,t,t,n),Kg(e.container,n),t},Gg=function(A,e){switch(e){case 0:return dt(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return dt(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return dt(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);case 3:default:return dt(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},ZU=function(A,e){switch(e){case 0:return dt(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return dt(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return dt(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);case 3:default:return dt(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},eT=function(A,e){switch(e){case 0:return dt(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return dt(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return dt(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);case 3:default:return dt(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},tT=function(A,e){switch(e){case 0:return Os(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return Os(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return Os(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);case 3:default:return Os(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},Os=function(A,e){var t=[];return ut(A)?t.push(A.subdivide(.5,!1)):t.push(A),ut(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},dt=function(A,e,t,n){var i=[];return ut(A)?i.push(A.subdivide(.5,!1)):i.push(A),ut(t)?i.push(t.subdivide(.5,!0)):i.push(t),ut(n)?i.push(n.subdivide(.5,!0).reverse()):i.push(n),ut(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},Vg=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},Hs=function(A){var e=A.styles,t=A.bounds,n=ne(e.paddingLeft,t.width),i=ne(e.paddingRight,t.width),r=ne(e.paddingTop,t.width),s=ne(e.paddingBottom,t.width);return t.add(n+e.borderLeftWidth,r+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+n+i),-(e.borderTopWidth+e.borderBottomWidth+r+s))},AT=function(A,e){return A===0?e.bounds:A===2?Hs(e):Vg(e)},nT=function(A,e){return A===0?e.bounds:A===2?Hs(e):Vg(e)},jc=function(A,e,t){var n=AT(On(A.styles.backgroundOrigin,e),A),i=nT(On(A.styles.backgroundClip,e),A),r=iT(On(A.styles.backgroundSize,e),t,n),s=r[0],o=r[1],a=Qi(On(A.styles.backgroundPosition,e),n.width-s,n.height-o),c=rT(On(A.styles.backgroundRepeat,e),a,r,n,i),l=Math.round(n.left+a[0]),u=Math.round(n.top+a[1]);return s=Math.max(1,s),o=Math.max(1,o),[c,l,u,s,o]},Dn=function(A){return $(A)&&A.value===_n.AUTO},Ms=function(A){return typeof A=="number"},iT=function(A,e,t){var n=e[0],i=e[1],r=e[2],s=A[0],o=A[1];if(!s)return[0,0];if(le(s)&&o&&le(o))return[ne(s,t.width),ne(o,t.height)];var a=Ms(r);if($(s)&&(s.value===_n.CONTAIN||s.value===_n.COVER)){if(Ms(r)){var c=t.width/t.height;return c<r!=(s.value===_n.COVER)?[t.width,t.width/r]:[t.height*r,t.height]}return[t.width,t.height]}var l=Ms(n),u=Ms(i),d=l||u;if(Dn(s)&&(!o||Dn(o))){if(l&&u)return[n,i];if(!a&&!d)return[t.width,t.height];if(d&&a){var h=l?n:i*r,f=u?i:n/r;return[h,f]}var g=l?n:t.width,p=u?i:t.height;return[g,p]}if(a){var B=0,y=0;return le(s)?B=ne(s,t.width):le(o)&&(y=ne(o,t.height)),Dn(s)?B=y*r:(!o||Dn(o))&&(y=B/r),[B,y]}var b=null,v=null;if(le(s)?b=ne(s,t.width):o&&le(o)&&(v=ne(o,t.height)),b!==null&&(!o||Dn(o))&&(v=l&&u?b/n*i:t.height),v!==null&&Dn(s)&&(b=l&&u?v/i*n:t.width),b!==null&&v!==null)return[b,v];throw new Error("Unable to calculate background-size for element")},On=function(A,e){var t=A[e];return typeof t>"u"?A[0]:t},rT=function(A,e,t,n,i){var r=e[0],s=e[1],o=t[0],a=t[1];switch(A){case 2:return[new R(Math.round(n.left),Math.round(n.top+s)),new R(Math.round(n.left+n.width),Math.round(n.top+s)),new R(Math.round(n.left+n.width),Math.round(a+n.top+s)),new R(Math.round(n.left),Math.round(a+n.top+s))];case 3:return[new R(Math.round(n.left+r),Math.round(n.top)),new R(Math.round(n.left+r+o),Math.round(n.top)),new R(Math.round(n.left+r+o),Math.round(n.height+n.top)),new R(Math.round(n.left+r),Math.round(n.height+n.top))];case 1:return[new R(Math.round(n.left+r),Math.round(n.top+s)),new R(Math.round(n.left+r+o),Math.round(n.top+s)),new R(Math.round(n.left+r+o),Math.round(n.top+s+a)),new R(Math.round(n.left+r),Math.round(n.top+s+a))];default:return[new R(Math.round(i.left),Math.round(i.top)),new R(Math.round(i.left+i.width),Math.round(i.top)),new R(Math.round(i.left+i.width),Math.round(i.height+i.top)),new R(Math.round(i.left),Math.round(i.height+i.top))]}},sT="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",jg="Hidden Text",oT=function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,t){var n=this._document.createElement("div"),i=this._document.createElement("img"),r=this._document.createElement("span"),s=this._document.body;n.style.visibility="hidden",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",s.appendChild(n),i.src=sT,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.appendChild(this._document.createTextNode(jg)),n.appendChild(r),n.appendChild(i);var o=i.offsetTop-r.offsetTop+2;n.removeChild(r),n.appendChild(this._document.createTextNode(jg)),n.style.lineHeight="normal",i.style.verticalAlign="super";var a=i.offsetTop-n.offsetTop+2;return s.removeChild(n),{baseline:o,middle:a}},A.prototype.getMetrics=function(e,t){var n="".concat(e," ").concat(t);return typeof this._data[n]>"u"&&(this._data[n]=this.parseMetrics(e,t)),this._data[n]},A}(),$g=function(){function A(e,t){this.context=e,this.options=t}return A}(),aT=1e4,cT=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i._activeEffects=[],i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),n.canvas||(i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width="".concat(n.width,"px"),i.canvas.style.height="".concat(n.height,"px")),i.fontMetrics=new oT(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized (".concat(n.width,"x").concat(n.height,") with scale ").concat(n.scale)),i}return e.prototype.applyEffects=function(t){for(var n=this;this._activeEffects.length;)this.popEffect();t.forEach(function(i){return n.applyEffect(i)})},e.prototype.applyEffect=function(t){this.ctx.save(),qU(t)&&(this.ctx.globalAlpha=t.opacity),XU(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),Og(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return Ke(this,void 0,void 0,function(){var n;return Oe(this,function(i){switch(i.label){case 0:return n=t.element.container.styles,n.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return Ke(this,void 0,void 0,function(){return Oe(this,function(n){switch(n.label){case 0:if(Se(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return n.sent(),[4,this.renderNodeContent(t)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,n,i){var r=this;if(n===0)navigator.userAgent.indexOf("Firefox")===-1?(this.ctx.textBaseline="ideographic",this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+t.bounds.height)):this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var s=Ic(t.text);s.reduce(function(o,a){return r.ctx.fillText(a,o,t.bounds.top+i),o+r.ctx.measureText(a).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var n=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),i=fT(t.fontFamily).join(", "),r=bA(t.fontSize)?"".concat(t.fontSize.number).concat(t.fontSize.unit):"".concat(t.fontSize.number,"px");return[[t.fontStyle,n,t.fontWeight,r,i].join(" "),i,r]},e.prototype.renderTextNode=function(t,n){return Ke(this,void 0,void 0,function(){var i,r,s=this;return Oe(this,function(o){return i=this.createFontStyle(n)[0],this.ctx.font=i,this.ctx.direction=n.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",r=n.paintOrder,t.textBounds.forEach(function(a){r.forEach(function(c){switch(c){case 0:s.ctx.fillStyle=Te(n.color),s.renderTextWithLetterSpacing(a,n.letterSpacing,n.fontSize.number);var l=n.textShadow;if(l.length&&a.text.trim().length&&(l.slice(0).reverse().forEach(function(d){s.ctx.shadowColor=Te(d.color),s.ctx.shadowOffsetX=d.offsetX.number*s.options.scale,s.ctx.shadowOffsetY=d.offsetY.number*s.options.scale,s.ctx.shadowBlur=d.blur.number,s.renderTextWithLetterSpacing(a,n.letterSpacing,n.fontSize.number)}),s.ctx.shadowColor="",s.ctx.shadowOffsetX=0,s.ctx.shadowOffsetY=0,s.ctx.shadowBlur=0),n.textDecorationLine.length){s.ctx.fillStyle=Te(n.textDecorationColor||n.color);var u=1;n.textDecorationLine.forEach(function(d){switch(d){case 1:s.ctx.fillRect(a.bounds.left,a.bounds.top+a.bounds.height-u,a.bounds.width,u);break;case 2:s.ctx.fillRect(a.bounds.left,a.bounds.top,a.bounds.width,u);break;case 3:s.ctx.fillRect(a.bounds.left,a.bounds.top+(a.bounds.height/2-u/2),a.bounds.width,u);break}})}break;case 1:n.webkitTextStrokeWidth&&a.text.trim().length&&(s.ctx.strokeStyle=Te(n.webkitTextStrokeColor),s.ctx.lineWidth=n.webkitTextStrokeWidth,s.ctx.lineJoin=window.chrome?"miter":"round",s.ctx.strokeText(a.text,a.bounds.left,a.bounds.top+a.bounds.height)),s.ctx.strokeStyle="",s.ctx.lineWidth=0,s.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,n,i){var r=i.naturalWidth||t.intrinsicWidth,s=i.naturalHeight||t.intrinsicHeight;if(i&&r>0&&s>0){var o=Hs(t),a=Ls(n);this.path(a),this.ctx.save(),this.ctx.clip();var c=0,l=0,u=r,d=s,h=o.left,f=o.top,g=o.width,p=o.height,B=t.styles.objectFit,y=g/p,b=u/d;if(B===2)b>y?(p=g/b,f+=(o.height-p)/2):(g=p*b,h+=(o.width-g)/2);else if(B===4)b>y?(u=d*y,c+=(r-u)/2):(d=u/y,l+=(s-d)/2);else if(B===8)u>g?(c+=(u-g)/2,u=g):(h+=(g-u)/2,g=u),d>p?(l+=(d-p)/2,d=p):(f+=(p-d)/2,p=d);else if(B===16){var v=b>y?g:p*b,C=u>g?u:g;v<C?b>y?(p=g/b,f+=(o.height-p)/2):(g=p*b,h+=(o.width-g)/2):(u>g?(c+=(u-g)/2,u=g):(h+=(g-u)/2,g=u),d>p?(l+=(d-p)/2,d=p):(f+=(p-d)/2,p=d))}this.ctx.drawImage(i,c,l,u,d,h,f,g,p),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return Ke(this,void 0,void 0,function(){var n,i,r,s,o,a,b,b,c,l,u,d,C,h,f,g,w,p,B,y,b,v,C,w;return Oe(this,function(S){switch(S.label){case 0:this.applyEffects(t.getEffects(4)),n=t.container,i=t.curves,r=n.styles,s=0,o=n.textNodes,S.label=1;case 1:return s<o.length?(a=o[s],[4,this.renderTextNode(a,r)]):[3,4];case 2:S.sent(),S.label=3;case 3:return s++,[3,1];case 4:if(!(n instanceof ug))return[3,8];S.label=5;case 5:return S.trys.push([5,7,,8]),[4,this.context.cache.match(n.src)];case 6:return b=S.sent(),this.renderReplacedElement(n,i,b),[3,8];case 7:return S.sent(),this.context.logger.error("Error loading image ".concat(n.src)),[3,8];case 8:if(n instanceof dg&&this.renderReplacedElement(n,i,n.canvas),!(n instanceof hg))return[3,12];S.label=9;case 9:return S.trys.push([9,11,,12]),[4,this.context.cache.match(n.svg)];case 10:return b=S.sent(),this.renderReplacedElement(n,i,b),[3,12];case 11:return S.sent(),this.context.logger.error("Error loading svg ".concat(n.svg.substring(0,255))),[3,12];case 12:return n instanceof Bg&&n.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:n.backgroundColor,x:0,y:0,width:n.width,height:n.height}),[4,c.render(n.tree)]):[3,14];case 13:l=S.sent(),n.width&&n.height&&this.ctx.drawImage(l,0,0,n.width,n.height,n.bounds.left,n.bounds.top,n.bounds.width,n.bounds.height),S.label=14;case 14:if(n instanceof xc&&(u=Math.min(n.bounds.width,n.bounds.height),n.type===Qs?n.checked&&(this.ctx.save(),this.path([new R(n.bounds.left+u*.39363,n.bounds.top+u*.79),new R(n.bounds.left+u*.16,n.bounds.top+u*.5549),new R(n.bounds.left+u*.27347,n.bounds.top+u*.44071),new R(n.bounds.left+u*.39694,n.bounds.top+u*.5649),new R(n.bounds.left+u*.72983,n.bounds.top+u*.23),new R(n.bounds.left+u*.84,n.bounds.top+u*.34085),new R(n.bounds.left+u*.39363,n.bounds.top+u*.79)]),this.ctx.fillStyle=Te(gg),this.ctx.fill(),this.ctx.restore()):n.type===Fs&&n.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.bounds.left+u/2,n.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=Te(gg),this.ctx.fill(),this.ctx.restore())),lT(n)&&n.value.length){switch(d=this.createFontStyle(r),C=d[0],h=d[1],f=d[2],g=this.fontMetrics.getMetrics(h,f).baseline,this.ctx.font=C,this.ctx.fillStyle=Te(r.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=dT(n.styles.textAlign),w=Hs(n),p=0,n.styles.textAlign){case 1:p+=w.width/2;break;case 2:p+=w.width;break}B=w.add(p,0,0,-w.height/2+1),this.ctx.save(),this.path([new R(w.left,w.top),new R(w.left+w.width,w.top),new R(w.left+w.width,w.top+w.height),new R(w.left,w.top+w.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new _i(n.value,B),r.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Se(n.styles.display,2048))return[3,20];if(n.styles.listStyleImage===null)return[3,19];if(y=n.styles.listStyleImage,y.type!==0)return[3,18];b=void 0,v=y.url,S.label=15;case 15:return S.trys.push([15,17,,18]),[4,this.context.cache.match(v)];case 16:return b=S.sent(),this.ctx.drawImage(b,n.bounds.left-(b.width+10),n.bounds.top),[3,18];case 17:return S.sent(),this.context.logger.error("Error loading list-style-image ".concat(v)),[3,18];case 18:return[3,20];case 19:t.listValue&&n.styles.listStyleType!==-1&&(C=this.createFontStyle(r)[0],this.ctx.font=C,this.ctx.fillStyle=Te(r.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",w=new Jt(n.bounds.left,n.bounds.top+ne(n.styles.paddingTop,n.bounds.width),n.bounds.width,$f(r.lineHeight,r.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new _i(t.listValue,w),r.letterSpacing,$f(r.lineHeight,r.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),S.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return Ke(this,void 0,void 0,function(){var n,i,B,r,s,B,o,a,B,c,l,B,u,d,B,h,f,B,g,p,B;return Oe(this,function(y){switch(y.label){case 0:if(Se(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:y.sent(),n=0,i=t.negativeZIndex,y.label=2;case 2:return n<i.length?(B=i[n],[4,this.renderStack(B)]):[3,5];case 3:y.sent(),y.label=4;case 4:return n++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:y.sent(),r=0,s=t.nonInlineLevel,y.label=7;case 7:return r<s.length?(B=s[r],[4,this.renderNode(B)]):[3,10];case 8:y.sent(),y.label=9;case 9:return r++,[3,7];case 10:o=0,a=t.nonPositionedFloats,y.label=11;case 11:return o<a.length?(B=a[o],[4,this.renderStack(B)]):[3,14];case 12:y.sent(),y.label=13;case 13:return o++,[3,11];case 14:c=0,l=t.nonPositionedInlineLevel,y.label=15;case 15:return c<l.length?(B=l[c],[4,this.renderStack(B)]):[3,18];case 16:y.sent(),y.label=17;case 17:return c++,[3,15];case 18:u=0,d=t.inlineLevel,y.label=19;case 19:return u<d.length?(B=d[u],[4,this.renderNode(B)]):[3,22];case 20:y.sent(),y.label=21;case 21:return u++,[3,19];case 22:h=0,f=t.zeroOrAutoZIndexOrTransformedOrOpacity,y.label=23;case 23:return h<f.length?(B=f[h],[4,this.renderStack(B)]):[3,26];case 24:y.sent(),y.label=25;case 25:return h++,[3,23];case 26:g=0,p=t.positiveZIndex,y.label=27;case 27:return g<p.length?(B=p[g],[4,this.renderStack(B)]):[3,30];case 28:y.sent(),y.label=29;case 29:return g++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var n=this;t.forEach(function(i,r){var s=ut(i)?i.start:i;r===0?n.ctx.moveTo(s.x,s.y):n.ctx.lineTo(s.x,s.y),ut(i)&&n.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(t,n,i,r){this.path(t),this.ctx.fillStyle=n,this.ctx.translate(i,r),this.ctx.fill(),this.ctx.translate(-i,-r)},e.prototype.resizeImage=function(t,n,i){var r,s=(r=this.canvas.ownerDocument)!==null&&r!==void 0?r:document,o=s.createElement("canvas");o.width=Math.max(1,n),o.height=Math.max(1,i);var a=o.getContext("2d");return a.drawImage(t,0,0,t.width,t.height,0,0,n,i),o},e.prototype.renderBackgroundImage=function(t){return Ke(this,void 0,void 0,function(){var n,i,r,s,o,a;return Oe(this,function(c){switch(c.label){case 0:n=t.styles.backgroundImage.length-1,i=function(l){var u,d,h,f,g,M,Ne,De,G,q,D,p,M,Ne,De,G,q,B,y,b,v,C,w,S,F,_,D,H,M,K,Le,G,q,tt,Ne,De,AA,ft,je,nA,kt,$e,qn,gt;return Oe(this,function(Yn){switch(Yn.label){case 0:if(l.type!==0)return[3,5];u=void 0,d=l.url,Yn.label=1;case 1:return Yn.trys.push([1,3,,4]),[4,r.context.cache.match(d)];case 2:return u=Yn.sent(),[3,4];case 3:return Yn.sent(),r.context.logger.error("Error loading background-image ".concat(d)),[3,4];case 4:return u&&(h=isNaN(u.width)||u.width===0?1:u.width,f=isNaN(u.height)||u.height===0?1:u.height,g=jc(t,n,[h,f,h/f]),M=g[0],Ne=g[1],De=g[2],G=g[3],q=g[4],D=r.ctx.createPattern(r.resizeImage(u,G,q),"repeat"),r.renderRepeat(M,D,Ne,De)),[3,6];case 5:$b(l)?(p=jc(t,n,[null,null,null]),M=p[0],Ne=p[1],De=p[2],G=p[3],q=p[4],B=Nb(l.angle,G,q),y=B[0],b=B[1],v=B[2],C=B[3],w=B[4],S=document.createElement("canvas"),S.width=G,S.height=q,F=S.getContext("2d"),_=F.createLinearGradient(b,C,v,w),Pf(l.stops,y||1).forEach(function(Zi){return _.addColorStop(Zi.stop,Te(Zi.color))}),F.fillStyle=_,F.fillRect(0,0,G,q),G>0&&q>0&&(D=r.ctx.createPattern(S,"repeat"),r.renderRepeat(M,D,Ne,De))):Wb(l)&&(H=jc(t,n,[null,null,null]),M=H[0],K=H[1],Le=H[2],G=H[3],q=H[4],tt=l.position.length===0?[dc]:l.position,Ne=ne(tt[0],G),De=ne(tt[tt.length-1],q),AA=Kb(l,Ne,De,G,q),ft=AA[0],je=AA[1],ft>0&&je>0&&(nA=r.ctx.createRadialGradient(K+Ne,Le+De,0,K+Ne,Le+De,ft),Pf(l.stops,ft*2).forEach(function(Zi){return nA.addColorStop(Zi.stop,Te(Zi.color))}),r.path(M),r.ctx.fillStyle=nA,ft!==je?(kt=t.bounds.left+.5*t.bounds.width,$e=t.bounds.top+.5*t.bounds.height,qn=je/ft,gt=1/qn,r.ctx.save(),r.ctx.translate(kt,$e),r.ctx.transform(1,0,0,qn,0,0),r.ctx.translate(-kt,-$e),r.ctx.fillRect(K,gt*(Le-$e)+$e,G,q*gt),r.ctx.restore()):r.ctx.fill())),Yn.label=6;case 6:return n--,[2]}})},r=this,s=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<o.length?(a=o[s],[5,i(a)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,n,i){return Ke(this,void 0,void 0,function(){return Oe(this,function(r){return this.path(Gg(i,n)),this.ctx.fillStyle=Te(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,n,i,r){return Ke(this,void 0,void 0,function(){var s,o;return Oe(this,function(a){switch(a.label){case 0:return n<3?[4,this.renderSolidBorder(t,i,r)]:[3,2];case 1:return a.sent(),[2];case 2:return s=ZU(r,i),this.path(s),this.ctx.fillStyle=Te(t),this.ctx.fill(),o=eT(r,i),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Ke(this,void 0,void 0,function(){var n,i,r,s,o,a,c,l,u=this;return Oe(this,function(d){switch(d.label){case 0:return this.applyEffects(t.getEffects(2)),n=t.container.styles,i=!UA(n.backgroundColor)||n.backgroundImage.length,r=[{style:n.borderTopStyle,color:n.borderTopColor,width:n.borderTopWidth},{style:n.borderRightStyle,color:n.borderRightColor,width:n.borderRightWidth},{style:n.borderBottomStyle,color:n.borderBottomColor,width:n.borderBottomWidth},{style:n.borderLeftStyle,color:n.borderLeftColor,width:n.borderLeftWidth}],s=uT(On(n.backgroundClip,0),t.curves),i||n.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),UA(n.backgroundColor)||(this.ctx.fillStyle=Te(n.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:d.sent(),this.ctx.restore(),n.boxShadow.slice(0).reverse().forEach(function(h){u.ctx.save();var f=Ps(t.curves),g=h.inset?0:aT,p=YU(f,-g+(h.inset?1:-1)*h.spread.number,(h.inset?1:-1)*h.spread.number,h.spread.number*(h.inset?-2:2),h.spread.number*(h.inset?-2:2));h.inset?(u.path(f),u.ctx.clip(),u.mask(p)):(u.mask(f),u.ctx.clip(),u.path(p)),u.ctx.shadowOffsetX=h.offsetX.number+g,u.ctx.shadowOffsetY=h.offsetY.number,u.ctx.shadowColor=Te(h.color),u.ctx.shadowBlur=h.blur.number,u.ctx.fillStyle=h.inset?Te(h.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),d.label=2;case 2:o=0,a=0,c=r,d.label=3;case 3:return a<c.length?(l=c[a],l.style!==0&&!UA(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return d.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,o,t.curves,3)];case 6:return d.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,o,t.curves)];case 8:return d.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,o,t.curves)];case 10:d.sent(),d.label=11;case 11:o++,d.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,n,i,r,s){return Ke(this,void 0,void 0,function(){var o,a,c,l,u,d,h,f,g,p,B,y,b,v,C,w,C,w;return Oe(this,function(S){return this.ctx.save(),o=tT(r,i),a=Gg(r,i),s===2&&(this.path(a),this.ctx.clip()),ut(a[0])?(c=a[0].start.x,l=a[0].start.y):(c=a[0].x,l=a[0].y),ut(a[1])?(u=a[1].end.x,d=a[1].end.y):(u=a[1].x,d=a[1].y),i===0||i===2?h=Math.abs(c-u):h=Math.abs(l-d),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(a.slice(0,2)),f=n<3?n*3:n*2,g=n<3?n*2:n,s===3&&(f=n,g=n),p=!0,h<=f*2?p=!1:h<=f*2+g?(B=h/(2*f+g),f*=B,g*=B):(y=Math.floor((h+g)/(f+g)),b=(h-y*f)/(y-1),v=(h-(y+1)*f)/y,g=v<=0||Math.abs(g-b)<Math.abs(g-v)?b:v),p&&(s===3?this.ctx.setLineDash([0,f+g]):this.ctx.setLineDash([f,g])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=n):this.ctx.lineWidth=n*2+1.1,this.ctx.strokeStyle=Te(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(ut(a[0])&&(C=a[3],w=a[0],this.ctx.beginPath(),this.formatPath([new R(C.end.x,C.end.y),new R(w.start.x,w.start.y)]),this.ctx.stroke()),ut(a[1])&&(C=a[1],w=a[2],this.ctx.beginPath(),this.formatPath([new R(C.end.x,C.end.y),new R(w.start.x,w.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Ke(this,void 0,void 0,function(){var n;return Oe(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Te(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),n=zU(t),[4,this.renderStack(n)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}($g),lT=function(A){return A instanceof mg||A instanceof pg?!0:A instanceof xc&&A.type!==Fs&&A.type!==Qs},uT=function(A,e){switch(A){case 0:return Ps(e);case 2:return $U(e);case 1:default:return Ls(e)}},dT=function(A){switch(A){case 1:return"center";case 2:return"right";case 0:default:return"left"}},hT=["-apple-system","system-ui"],fT=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return hT.indexOf(e)===-1}):A},gT=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=n,i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width="".concat(n.width,"px"),i.canvas.style.height="".concat(n.height,"px"),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (".concat(n.width,"x").concat(n.height," at ").concat(n.x,",").concat(n.y,") with scale ").concat(n.scale)),i}return e.prototype.render=function(t){return Ke(this,void 0,void 0,function(){var n,i;return Oe(this,function(r){switch(r.label){case 0:return n=kc(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,pT(n)];case 1:return i=r.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Te(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}($g),pT=function(A){return new Promise(function(e,t){var n=new Image;n.onload=function(){e(n)},n.onerror=t,n.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(A)))})},mT=function(){function A(e){var t=e.id,n=e.enabled;this.id=t,this.enabled=n,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Kr([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Kr([this.id,"".concat(this.getTime(),"ms")],e,!1))},A.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Kr([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Kr([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},A.instances={},A}(),BT=function(){function A(e,t){var n;this.windowBounds=t,this.instanceName="#".concat(A.instanceCount++),this.logger=new mT({id:this.instanceName,enabled:e.logging}),this.cache=(n=e.cache)!==null&&n!==void 0?n:new OU(this,e)}return A.instanceCount=1,A}(),vT=function(A,e){return e===void 0&&(e={}),CT(A,e)};typeof window<"u"&&Nc.setContext(window);var CT=function(A,e){return Ke(void 0,void 0,void 0,function(){var t,n,i,r,s,o,a,c,l,u,d,h,f,g,p,B,y,b,v,C,S,w,S,F,_,D,H,M,K,Le,G,q,tt,Ne,De,AA,ft,je,nA,kt;return Oe(this,function($e){switch($e.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=A.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(n=t.defaultView,!n)throw new Error("Document is not attached to a Window");return i={allowTaint:(F=e.allowTaint)!==null&&F!==void 0?F:!1,imageTimeout:(_=e.imageTimeout)!==null&&_!==void 0?_:15e3,proxy:e.proxy,useCORS:(D=e.useCORS)!==null&&D!==void 0?D:!1,customIsSameOrigin:e.customIsSameOrigin},r=ja({logging:(H=e.logging)!==null&&H!==void 0?H:!0,cache:e.cache},i),s={windowWidth:(M=e.windowWidth)!==null&&M!==void 0?M:n.innerWidth,windowHeight:(K=e.windowHeight)!==null&&K!==void 0?K:n.innerHeight,scrollX:(Le=e.scrollX)!==null&&Le!==void 0?Le:n.pageXOffset,scrollY:(G=e.scrollY)!==null&&G!==void 0?G:n.pageYOffset},o=new Jt(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),a=new BT(r,o),c=(q=e.foreignObjectRendering)!==null&&q!==void 0?q:!1,l={allowTaint:(tt=e.allowTaint)!==null&&tt!==void 0?tt:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},a.logger.debug("Starting document clone with size ".concat(o.width,"x").concat(o.height," scrolled to ").concat(-o.left,",").concat(-o.top)),u=new Lg(a,A,l),d=u.clonedReferenceElement,d?[4,u.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return h=$e.sent(),f=Pc(d)||CU(d)?Aw(d.ownerDocument):Gr(a,d),g=f.width,p=f.height,B=f.left,y=f.top,b=wT(a,d,e.backgroundColor),v={canvas:e.canvas,backgroundColor:b,scale:(De=(Ne=e.scale)!==null&&Ne!==void 0?Ne:n.devicePixelRatio)!==null&&De!==void 0?De:1,x:((AA=e.x)!==null&&AA!==void 0?AA:0)+B,y:((ft=e.y)!==null&&ft!==void 0?ft:0)+y,width:(je=e.width)!==null&&je!==void 0?je:Math.ceil(g),height:(nA=e.height)!==null&&nA!==void 0?nA:Math.ceil(p)},c?(a.logger.debug("Document cloned, using foreign object rendering"),S=new gT(a,v),[4,S.render(d)]):[3,3];case 2:return C=$e.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at ".concat(B,",").concat(y," with size ").concat(g,"x").concat(p," using computed rendering")),a.logger.debug("Starting DOM parsing"),w=Cg(a,d),b===w.styles.backgroundColor&&(w.styles.backgroundColor=Mt.TRANSPARENT),a.logger.debug("Starting renderer for element at ".concat(v.x,",").concat(v.y," with size ").concat(v.width,"x").concat(v.height)),S=new cT(a,v),[4,S.render(w)];case 4:C=$e.sent(),$e.label=5;case 5:return(!((kt=e.removeContainer)!==null&&kt!==void 0)||kt)&&(Lg.destroy(h)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,C]}})})},wT=function(A,e,t){var n=e.ownerDocument,i=n.documentElement?In(A,getComputedStyle(n.documentElement).backgroundColor):Mt.TRANSPARENT,r=n.body?In(A,getComputedStyle(n.body).backgroundColor):Mt.TRANSPARENT,s=typeof t=="string"?In(A,t):t===null?Mt.TRANSPARENT:4294967295;return e===n.documentElement?UA(i)?UA(r)?s:r:i:s};const X=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,en="9.23.0",Ae=globalThis;function Ns(){return Ks(Ae),Ae}function Ks(A){const e=A.__SENTRY__=A.__SENTRY__||{};return e.version=e.version||en,e[en]=e[en]||{}}function Gs(A,e,t=Ae){const n=t.__SENTRY__=t.__SENTRY__||{},i=n[en]=n[en]||{};return i[A]||(i[A]=e())}const Wg=Object.prototype.toString;function $c(A){switch(Wg.call(A)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return IA(A,Error)}}function Hn(A,e){return Wg.call(A)===`[object ${e}]`}function Jg(A){return Hn(A,"ErrorEvent")}function Xg(A){return Hn(A,"DOMError")}function yT(A){return Hn(A,"DOMException")}function Yt(A){return Hn(A,"String")}function Wc(A){return typeof A=="object"&&A!==null&&"__sentry_template_string__"in A&&"__sentry_template_values__"in A}function Jc(A){return A===null||Wc(A)||typeof A!="object"&&typeof A!="function"}function Li(A){return Hn(A,"Object")}function Vs(A){return typeof Event<"u"&&IA(A,Event)}function bT(A){return typeof Element<"u"&&IA(A,Element)}function ET(A){return Hn(A,"RegExp")}function js(A){return!!(A?.then&&typeof A.then=="function")}function ST(A){return Li(A)&&"nativeEvent"in A&&"preventDefault"in A&&"stopPropagation"in A}function IA(A,e){try{return A instanceof e}catch{return!1}}function qg(A){return!!(typeof A=="object"&&A!==null&&(A.__isVue||A._isVue))}function UT(A){return typeof Request<"u"&&IA(A,Request)}const Xc=Ae,TT=80;function Yg(A,e={}){if(!A)return"<unknown>";try{let t=A;const n=5,i=[];let r=0,s=0;const o=" > ",a=o.length;let c;const l=Array.isArray(e)?e:e.keyAttrs,u=!Array.isArray(e)&&e.maxStringLength||TT;for(;t&&r++<n&&(c=QT(t,l),!(c==="html"||r>1&&s+i.length*a+c.length>=u));)i.push(c),s+=c.length,t=t.parentNode;return i.reverse().join(o)}catch{return"<unknown>"}}function QT(A,e){const t=A,n=[];if(!t?.tagName)return"";if(Xc.HTMLElement&&t instanceof HTMLElement&&t.dataset){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}n.push(t.tagName.toLowerCase());const i=e?.length?e.filter(s=>t.getAttribute(s)).map(s=>[s,t.getAttribute(s)]):null;if(i?.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{t.id&&n.push(`#${t.id}`);const s=t.className;if(s&&Yt(s)){const o=s.split(/\s+/);for(const a of o)n.push(`.${a}`)}}const r=["aria-label","type","name","title","alt"];for(const s of r){const o=t.getAttribute(s);o&&n.push(`[${s}="${o}"]`)}return n.join("")}function zg(){try{return Xc.document.location.href}catch{return""}}function FT(A){if(!Xc.HTMLElement)return null;let e=A;const t=5;for(let n=0;n<t;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}const kT="Sentry Logger ",qc=["debug","info","warn","error","log","assert","trace"],$s={};function Ws(A){if(!("console"in Ae))return A();const e=Ae.console,t={},n=Object.keys($s);n.forEach(i=>{const r=$s[i];t[i]=e[i],e[i]=r});try{return A()}finally{n.forEach(i=>{e[i]=t[i]})}}function IT(){let A=!1;const e={enable:()=>{A=!0},disable:()=>{A=!1},isEnabled:()=>A};return X?qc.forEach(t=>{e[t]=(...n)=>{A&&Ws(()=>{Ae.console[t](`${kT}[${t}]:`,...n)})}}):qc.forEach(t=>{e[t]=()=>{}}),e}const N=Gs("logger",IT);function Js(A,e=0){return typeof A!="string"||e===0||A.length<=e?A:`${A.slice(0,e)}...`}function Zg(A,e){if(!Array.isArray(A))return"";const t=[];for(let n=0;n<A.length;n++){const i=A[n];try{qg(i)?t.push("[VueViewModel]"):t.push(String(i))}catch{t.push("[value cannot be serialized]")}}return t.join(e)}function _T(A,e,t=!1){return Yt(A)?ET(e)?e.test(A):Yt(e)?t?A===e:A.includes(e):!1:!1}function Xs(A,e=[],t=!1){return e.some(n=>_T(A,n,t))}function rt(A,e,t){if(!(e in A))return;const n=A[e];if(typeof n!="function")return;const i=t(n);typeof i=="function"&&ep(i,n);try{A[e]=i}catch{X&&N.log(`Failed to replace method "${e}" in object`,A)}}function tn(A,e,t){try{Object.defineProperty(A,e,{value:t,writable:!0,configurable:!0})}catch{X&&N.log(`Failed to add non-enumerable property "${e}" to object`,A)}}function ep(A,e){try{const t=e.prototype||{};A.prototype=e.prototype=t,tn(A,"__sentry_original__",e)}catch{}}function Yc(A){return A.__sentry_original__}function tp(A){if($c(A))return{message:A.message,name:A.name,stack:A.stack,...np(A)};if(Vs(A)){const e={type:A.type,target:Ap(A.target),currentTarget:Ap(A.currentTarget),...np(A)};return typeof CustomEvent<"u"&&IA(A,CustomEvent)&&(e.detail=A.detail),e}else return A}function Ap(A){try{return bT(A)?Yg(A):Object.prototype.toString.call(A)}catch{return"<unknown>"}}function np(A){if(typeof A=="object"&&A!==null){const e={};for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t]);return e}else return{}}function xT(A,e=40){const t=Object.keys(tp(A));t.sort();const n=t[0];if(!n)return"[object has no keys]";if(n.length>=e)return Js(n,e);for(let i=t.length;i>0;i--){const r=t.slice(0,i).join(", ");if(!(r.length>e))return i===t.length?r:Js(r,e)}return""}function RT(){const A=Ae;return A.crypto||A.msCrypto}function ht(A=RT()){let e=()=>Math.random()*16;try{if(A?.randomUUID)return A.randomUUID().replace(/-/g,"");A?.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return A.getRandomValues(t),t[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,t=>(t^(e()&15)>>t/4).toString(16))}function ip(A){return A.exception?.values?.[0]}function An(A){const{message:e,event_id:t}=A;if(e)return e;const n=ip(A);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||t||"<unknown>":t||"<unknown>"}function zc(A,e,t){const n=A.exception=A.exception||{},i=n.values=n.values||[],r=i[0]=i[0]||{};r.value||(r.value=e||""),r.type||(r.type=t||"Error")}function Mn(A,e){const t=ip(A);if(!t)return;const n={type:"generic",handled:!0},i=t.mechanism;if(t.mechanism={...n,...i,...e},e&&"data"in e){const r={...i?.data,...e.data};t.mechanism.data=r}}function rp(A){if(PT(A))return!0;try{tn(A,"__sentry_captured__",!0)}catch{}return!1}function PT(A){try{return A.__sentry_captured__}catch{}}const sp=1e3;function Di(){return Date.now()/sp}function LT(){const{performance:A}=Ae;if(!A?.now)return Di;const e=Date.now()-A.now(),t=A.timeOrigin==null?e:A.timeOrigin;return()=>(t+A.now())/sp}const zt=LT();function DT(A){const e=zt(),t={sid:ht(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>HT(t)};return A&&Nn(t,A),t}function Nn(A,e={}){if(e.user&&(!A.ipAddress&&e.user.ip_address&&(A.ipAddress=e.user.ip_address),!A.did&&!e.did&&(A.did=e.user.id||e.user.email||e.user.username)),A.timestamp=e.timestamp||zt(),e.abnormal_mechanism&&(A.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(A.ignoreDuration=e.ignoreDuration),e.sid&&(A.sid=e.sid.length===32?e.sid:ht()),e.init!==void 0&&(A.init=e.init),!A.did&&e.did&&(A.did=`${e.did}`),typeof e.started=="number"&&(A.started=e.started),A.ignoreDuration)A.duration=void 0;else if(typeof e.duration=="number")A.duration=e.duration;else{const t=A.timestamp-A.started;A.duration=t>=0?t:0}e.release&&(A.release=e.release),e.environment&&(A.environment=e.environment),!A.ipAddress&&e.ipAddress&&(A.ipAddress=e.ipAddress),!A.userAgent&&e.userAgent&&(A.userAgent=e.userAgent),typeof e.errors=="number"&&(A.errors=e.errors),e.status&&(A.status=e.status)}function OT(A,e){let t={};e?t={status:e}:A.status==="ok"&&(t={status:"exited"}),Nn(A,t)}function HT(A){return{sid:`${A.sid}`,init:A.init,started:new Date(A.started*1e3).toISOString(),timestamp:new Date(A.timestamp*1e3).toISOString(),status:A.status,errors:A.errors,did:typeof A.did=="number"||typeof A.did=="string"?`${A.did}`:void 0,duration:A.duration,abnormal_mechanism:A.abnormal_mechanism,attrs:{release:A.release,environment:A.environment,ip_address:A.ipAddress,user_agent:A.userAgent}}}function Oi(A,e,t=2){if(!e||typeof e!="object"||t<=0)return e;if(A&&Object.keys(e).length===0)return A;const n={...A};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Oi(n[i],e[i],t-1));return n}const Zc="_sentrySpan";function op(A,e){e?tn(A,Zc,e):delete A[Zc]}function ap(A){return A[Zc]}function cp(){return ht()}function lp(){return ht().substring(16)}const MT=100;class Tt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:cp(),sampleRand:Math.random()}}clone(){const e=new Tt;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,op(e,ap(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Nn(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t=typeof e=="function"?e(this):e,n=t instanceof Tt?t.getScopeData():Li(t)?e:void 0,{tags:i,extra:r,user:s,contexts:o,level:a,fingerprint:c=[],propagationContext:l}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...r},this._contexts={...this._contexts,...o},s&&Object.keys(s).length&&(this._user=s),a&&(this._level=a),c.length&&(this._fingerprint=c),l&&(this._propagationContext=l),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,op(this,void 0),this._attachments=[],this.setPropagationContext({traceId:cp(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n=typeof t=="number"?t:MT;if(n<=0)return this;const i={timestamp:Di(),...e,message:e.message?Js(e.message,2048):e.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ap(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Oi(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t?.event_id||ht();if(!this._client)return N.warn("No client configured on scope - will not capture exception!"),n;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...t,event_id:n},this),n}captureMessage(e,t,n){const i=n?.event_id||ht();if(!this._client)return N.warn("No client configured on scope - will not capture message!"),i;const r=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:r,...n,event_id:i},this),i}captureEvent(e,t){const n=t?.event_id||ht();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(N.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function NT(){return Gs("defaultCurrentScope",()=>new Tt)}function KT(){return Gs("defaultIsolationScope",()=>new Tt)}class GT{constructor(e,t){let n;e?n=e:n=new Tt;let i;t?i=t:i=new Tt,this._stack=[{scope:n}],this._isolationScope=i}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(i){throw this._popScope(),i}return js(n)?n.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Kn(){const A=Ns(),e=Ks(A);return e.stack=e.stack||new GT(NT(),KT())}function VT(A){return Kn().withScope(A)}function jT(A,e){const t=Kn();return t.withScope(()=>(t.getStackTop().scope=A,e(A)))}function up(A){return Kn().withScope(()=>A(Kn().getIsolationScope()))}function $T(){return{withIsolationScope:up,withScope:VT,withSetScope:jT,withSetIsolationScope:(A,e)=>up(e),getCurrentScope:()=>Kn().getScope(),getIsolationScope:()=>Kn().getIsolationScope()}}function el(A){const e=Ks(A);return e.acs?e.acs:$T()}function Gn(){const A=Ns();return el(A).getCurrentScope()}function Hi(){const A=Ns();return el(A).getIsolationScope()}function WT(){return Gs("globalScope",()=>new Tt)}function dp(...A){const e=Ns(),t=el(e);if(A.length===2){const[n,i]=A;return n?t.withSetScope(n,i):t.withScope(i)}return t.withScope(A[0])}function Ge(){return Gn().getClient()}function JT(A){const e=A.getPropagationContext(),{traceId:t,parentSpanId:n,propagationSpanId:i}=e,r={trace_id:t,span_id:i||lp()};return n&&(r.parent_span_id=n),r}const XT="sentry.source",qT="sentry.sample_rate",YT="sentry.previous_trace_sample_rate",zT="sentry.op",ZT="sentry.origin",hp="sentry.profile_id",fp="sentry.exclusive_time",eQ=0,tQ=1,AQ="_sentryScope",nQ="_sentryIsolationScope";function gp(A){return{scope:A[AQ],isolationScope:A[nQ]}}function iQ(A){if(typeof A=="boolean")return Number(A);const e=typeof A=="string"?parseFloat(A):A;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const rQ="sentry-",sQ=/^sentry-/;function oQ(A){const e=aQ(A);if(!e)return;const t=Object.entries(e).reduce((n,[i,r])=>{if(i.match(sQ)){const s=i.slice(rQ.length);n[s]=r}return n},{});if(Object.keys(t).length>0)return t}function aQ(A){if(!(!A||!Yt(A)&&!Array.isArray(A)))return Array.isArray(A)?A.reduce((e,t)=>{const n=pp(t);return Object.entries(n).forEach(([i,r])=>{e[i]=r}),e},{}):pp(A)}function pp(A){return A.split(",").map(e=>e.split("=").map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}const mp=1;let Bp=!1;function cQ(A){const{spanId:e,traceId:t,isRemote:n}=A.spanContext(),i=n?e:tl(A).parent_span_id,r=gp(A).scope,s=n?r?.getPropagationContext().propagationSpanId||lp():e;return{parent_span_id:i,span_id:s,trace_id:t}}function lQ(A){if(A&&A.length>0)return A.map(({context:{spanId:e,traceId:t,traceFlags:n,...i},attributes:r})=>({span_id:e,trace_id:t,sampled:n===mp,attributes:r,...i}))}function vp(A){return typeof A=="number"?Cp(A):Array.isArray(A)?A[0]+A[1]/1e9:A instanceof Date?Cp(A.getTime()):zt()}function Cp(A){return A>9999999999?A/1e3:A}function tl(A){if(dQ(A))return A.getSpanJSON();const{spanId:e,traceId:t}=A.spanContext();if(uQ(A)){const{attributes:n,startTime:i,name:r,endTime:s,status:o,links:a}=A,c="parentSpanId"in A?A.parentSpanId:"parentSpanContext"in A?A.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:t,data:n,description:r,parent_span_id:c,start_timestamp:vp(i),timestamp:vp(s)||void 0,status:fQ(o),op:n[zT],origin:n[ZT],links:lQ(a)}}return{span_id:e,trace_id:t,start_timestamp:0,data:{}}}function uQ(A){const e=A;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function dQ(A){return typeof A.getSpanJSON=="function"}function hQ(A){const{traceFlags:e}=A.spanContext();return e===mp}function fQ(A){if(!(!A||A.code===eQ))return A.code===tQ?"ok":A.message||"unknown_error"}const gQ="_sentryRootSpan";function wp(A){return A[gQ]||A}function yp(){Bp||(Ws(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),Bp=!0)}const bp=50,nn="?",Ep=/\(error: (.*)\)/,Sp=/captureMessage|captureException/;function pQ(...A){const e=A.sort((t,n)=>t[0]-n[0]).map(t=>t[1]);return(t,n=0,i=0)=>{const r=[],s=t.split(`
111
- `);for(let o=n;o<s.length;o++){const a=s[o];if(a.length>1024)continue;const c=Ep.test(a)?a.replace(Ep,"$1"):a;if(!c.match(/\S*Error: /)){for(const l of e){const u=l(c);if(u){r.push(u);break}}if(r.length>=bp+i)break}}return mQ(r.slice(i))}}function mQ(A){if(!A.length)return[];const e=Array.from(A);return/sentryWrapped/.test(qs(e).function||"")&&e.pop(),e.reverse(),Sp.test(qs(e).function||"")&&(e.pop(),Sp.test(qs(e).function||"")&&e.pop()),e.slice(0,bp).map(t=>({...t,filename:t.filename||qs(e).filename,function:t.function||nn}))}function qs(A){return A[A.length-1]||{}}const Al="<anonymous>";function _A(A){try{return!A||typeof A!="function"?Al:A.name||Al}catch{return Al}}function Up(A){const e=A.exception;if(e){const t=[];try{return e.values.forEach(n=>{n.stacktrace.frames&&t.push(...n.stacktrace.frames)}),t}catch{return}}}const Ys={},Tp={};function rn(A,e){Ys[A]=Ys[A]||[],Ys[A].push(e)}function sn(A,e){if(!Tp[A]){Tp[A]=!0;try{e()}catch(t){X&&N.error(`Error while instrumenting ${A}`,t)}}}function Qt(A,e){const t=A&&Ys[A];if(t)for(const n of t)try{n(e)}catch(i){X&&N.error(`Error while triggering instrumentation handler.
110
+ .`).concat(Mc).concat(RU).concat(Dg))},LU=function(A,e){var t=A.ownerDocument;if(t){var n=t.createElement("style");n.textContent=e,A.appendChild(n)}},DU=function(A,e){var t,n=e.createElement("base");n.href=e.baseURI;var i=A.getElementsByTagName("head").item(0);i?.insertBefore(n,(t=i?.firstChild)!==null&&t!==void 0?t:null)},Nc=function(){function A(){}return A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A}(),OU=function(){function A(e,t){this.context=e,this._options=t,this._cache={}}return A.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(Vc(e)||KU(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return Ke(this,void 0,void 0,function(){var t,n,i,r,s,o=this;return Oe(this,function(a){switch(a.label){case 0:return typeof this._options.customIsSameOrigin!="function"?[3,2]:[4,this._options.customIsSameOrigin(e,Nc.isSameOrigin)];case 1:return n=a.sent(),[3,3];case 2:n=Nc.isSameOrigin(e),a.label=3;case 3:return t=n,i=!Kc(e)&&this._options.useCORS===!0&&Re.SUPPORT_CORS_IMAGES&&!t,r=!Kc(e)&&!t&&!Vc(e)&&typeof this._options.proxy=="string"&&Re.SUPPORT_CORS_XHR&&!i,!t&&this._options.allowTaint===!1&&!Kc(e)&&!Vc(e)&&!r&&!i?[2]:(s=e,r?[4,this.proxy(s)]:[3,5]);case 4:s=a.sent(),a.label=5;case 5:return this.context.logger.debug("Added image ".concat(e.substring(0,256))),[4,new Promise(function(c,l){var u=new Image;u.onload=function(){return c(u)},u.onerror=l,(VU(s)||i)&&(u.crossOrigin="anonymous"),u.src=s,u.complete===!0&&setTimeout(function(){return c(u)},500),o._options.imageTimeout>0&&setTimeout(function(){return l("Timed out (".concat(o._options.imageTimeout,"ms) loading image"))},o._options.imageTimeout)})];case 6:return[2,a.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var t=this,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(r,s){var o=Re.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(o==="text")r(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return r(u.result)},!1),u.addEventListener("error",function(d){return s(d)},!1),u.readAsDataURL(a.response)}else s("Failed to proxy resource ".concat(i," with status code ").concat(a.status))},a.onerror=s;var c=n.indexOf("?")>-1?"&":"?";if(a.open("GET","".concat(n).concat(c,"url=").concat(encodeURIComponent(e),"&responseType=").concat(o)),o!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=o),t._options.imageTimeout){var l=t._options.imageTimeout;a.timeout=l,a.ontimeout=function(){return s("Timed out (".concat(l,"ms) proxying ").concat(i))}}a.send()})},A}(),HU=/^data:image\/svg\+xml/i,MU=/^data:image\/.*;base64,/i,NU=/^data:image\/.*/i,KU=function(A){return Re.SUPPORT_SVG_DRAWING||!GU(A)},Kc=function(A){return NU.test(A)},VU=function(A){return MU.test(A)},Vc=function(A){return A.substr(0,4)==="blob"},GU=function(A){return A.substr(-3).toLowerCase()==="svg"||HU.test(A)},R=function(){function A(e,t){this.type=0,this.x=e,this.y=t}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A}(),Ln=function(A,e,t){return new R(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},Rs=function(){function A(e,t,n,i){this.type=1,this.start=e,this.startControl=t,this.endControl=n,this.end=i}return A.prototype.subdivide=function(e,t){var n=Ln(this.start,this.startControl,e),i=Ln(this.startControl,this.endControl,e),r=Ln(this.endControl,this.end,e),s=Ln(n,i,e),o=Ln(i,r,e),a=Ln(s,o,e);return t?new A(this.start,n,s,a):new A(a,o,r,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A}(),ut=function(A){return A.type===1},jU=function(){function A(e){var t=e.styles,n=e.bounds,i=Qi(t.borderTopLeftRadius,n.width,n.height),r=i[0],s=i[1],o=Qi(t.borderTopRightRadius,n.width,n.height),a=o[0],c=o[1],l=Qi(t.borderBottomRightRadius,n.width,n.height),u=l[0],d=l[1],h=Qi(t.borderBottomLeftRadius,n.width,n.height),f=h[0],g=h[1],p=[];p.push((r+a)/n.width),p.push((f+u)/n.width),p.push((s+g)/n.height),p.push((c+d)/n.height);var B=Math.max.apply(Math,p);B>1&&(r/=B,s/=B,a/=B,c/=B,u/=B,d/=B,f/=B,g/=B);var y=n.width-a,b=n.height-d,v=n.width-u,C=n.height-g,w=t.borderTopWidth,S=t.borderRightWidth,F=t.borderBottomWidth,_=t.borderLeftWidth,D=ne(t.paddingTop,e.bounds.width),H=ne(t.paddingRight,e.bounds.width),M=ne(t.paddingBottom,e.bounds.width),K=ne(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=r>0||s>0?de(n.left+_/3,n.top+w/3,r-_/3,s-w/3,te.TOP_LEFT):new R(n.left+_/3,n.top+w/3),this.topRightBorderDoubleOuterBox=r>0||s>0?de(n.left+y,n.top+w/3,a-S/3,c-w/3,te.TOP_RIGHT):new R(n.left+n.width-S/3,n.top+w/3),this.bottomRightBorderDoubleOuterBox=u>0||d>0?de(n.left+v,n.top+b,u-S/3,d-F/3,te.BOTTOM_RIGHT):new R(n.left+n.width-S/3,n.top+n.height-F/3),this.bottomLeftBorderDoubleOuterBox=f>0||g>0?de(n.left+_/3,n.top+C,f-_/3,g-F/3,te.BOTTOM_LEFT):new R(n.left+_/3,n.top+n.height-F/3),this.topLeftBorderDoubleInnerBox=r>0||s>0?de(n.left+_*2/3,n.top+w*2/3,r-_*2/3,s-w*2/3,te.TOP_LEFT):new R(n.left+_*2/3,n.top+w*2/3),this.topRightBorderDoubleInnerBox=r>0||s>0?de(n.left+y,n.top+w*2/3,a-S*2/3,c-w*2/3,te.TOP_RIGHT):new R(n.left+n.width-S*2/3,n.top+w*2/3),this.bottomRightBorderDoubleInnerBox=u>0||d>0?de(n.left+v,n.top+b,u-S*2/3,d-F*2/3,te.BOTTOM_RIGHT):new R(n.left+n.width-S*2/3,n.top+n.height-F*2/3),this.bottomLeftBorderDoubleInnerBox=f>0||g>0?de(n.left+_*2/3,n.top+C,f-_*2/3,g-F*2/3,te.BOTTOM_LEFT):new R(n.left+_*2/3,n.top+n.height-F*2/3),this.topLeftBorderStroke=r>0||s>0?de(n.left+_/2,n.top+w/2,r-_/2,s-w/2,te.TOP_LEFT):new R(n.left+_/2,n.top+w/2),this.topRightBorderStroke=r>0||s>0?de(n.left+y,n.top+w/2,a-S/2,c-w/2,te.TOP_RIGHT):new R(n.left+n.width-S/2,n.top+w/2),this.bottomRightBorderStroke=u>0||d>0?de(n.left+v,n.top+b,u-S/2,d-F/2,te.BOTTOM_RIGHT):new R(n.left+n.width-S/2,n.top+n.height-F/2),this.bottomLeftBorderStroke=f>0||g>0?de(n.left+_/2,n.top+C,f-_/2,g-F/2,te.BOTTOM_LEFT):new R(n.left+_/2,n.top+n.height-F/2),this.topLeftBorderBox=r>0||s>0?de(n.left,n.top,r,s,te.TOP_LEFT):new R(n.left,n.top),this.topRightBorderBox=a>0||c>0?de(n.left+y,n.top,a,c,te.TOP_RIGHT):new R(n.left+n.width,n.top),this.bottomRightBorderBox=u>0||d>0?de(n.left+v,n.top+b,u,d,te.BOTTOM_RIGHT):new R(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=f>0||g>0?de(n.left,n.top+C,f,g,te.BOTTOM_LEFT):new R(n.left,n.top+n.height),this.topLeftPaddingBox=r>0||s>0?de(n.left+_,n.top+w,Math.max(0,r-_),Math.max(0,s-w),te.TOP_LEFT):new R(n.left+_,n.top+w),this.topRightPaddingBox=a>0||c>0?de(n.left+Math.min(y,n.width-S),n.top+w,y>n.width+S?0:Math.max(0,a-S),Math.max(0,c-w),te.TOP_RIGHT):new R(n.left+n.width-S,n.top+w),this.bottomRightPaddingBox=u>0||d>0?de(n.left+Math.min(v,n.width-_),n.top+Math.min(b,n.height-F),Math.max(0,u-S),Math.max(0,d-F),te.BOTTOM_RIGHT):new R(n.left+n.width-S,n.top+n.height-F),this.bottomLeftPaddingBox=f>0||g>0?de(n.left+_,n.top+Math.min(C,n.height-F),Math.max(0,f-_),Math.max(0,g-F),te.BOTTOM_LEFT):new R(n.left+_,n.top+n.height-F),this.topLeftContentBox=r>0||s>0?de(n.left+_+K,n.top+w+D,Math.max(0,r-(_+K)),Math.max(0,s-(w+D)),te.TOP_LEFT):new R(n.left+_+K,n.top+w+D),this.topRightContentBox=a>0||c>0?de(n.left+Math.min(y,n.width+_+K),n.top+w+D,y>n.width+_+K?0:a-_+K,c-(w+D),te.TOP_RIGHT):new R(n.left+n.width-(S+H),n.top+w+D),this.bottomRightContentBox=u>0||d>0?de(n.left+Math.min(v,n.width-(_+K)),n.top+Math.min(b,n.height+w+D),Math.max(0,u-(S+H)),d-(F+M),te.BOTTOM_RIGHT):new R(n.left+n.width-(S+H),n.top+n.height-(F+M)),this.bottomLeftContentBox=f>0||g>0?de(n.left+_+K,n.top+C,Math.max(0,f-(_+K)),g-(F+M),te.BOTTOM_LEFT):new R(n.left+_+K,n.top+n.height-(F+M))}return A}(),te;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(te||(te={}));var de=function(A,e,t,n,i){var r=4*((Math.sqrt(2)-1)/3),s=t*r,o=n*r,a=A+t,c=e+n;switch(i){case te.TOP_LEFT:return new Rs(new R(A,c),new R(A,c-o),new R(a-s,e),new R(a,e));case te.TOP_RIGHT:return new Rs(new R(A,e),new R(A+s,e),new R(a,c-o),new R(a,c));case te.BOTTOM_RIGHT:return new Rs(new R(a,e),new R(a,e+o),new R(A+s,c),new R(A,c));case te.BOTTOM_LEFT:default:return new Rs(new R(a,c),new R(a-s,c),new R(A,e+o),new R(A,e))}},Ps=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},$U=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Ls=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},WU=function(){function A(e,t,n){this.offsetX=e,this.offsetY=t,this.matrix=n,this.type=0,this.target=6}return A}(),Ds=function(){function A(e,t){this.path=e,this.target=t,this.type=1}return A}(),JU=function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A}(),XU=function(A){return A.type===0},Og=function(A){return A.type===1},qU=function(A){return A.type===2},Hg=function(A,e){return A.length===e.length?A.some(function(t,n){return t===e[n]}):!1},YU=function(A,e,t,n,i){return A.map(function(r,s){switch(s){case 0:return r.add(e,t);case 1:return r.add(e+n,t);case 2:return r.add(e+n,t+i);case 3:return r.add(e,t+i)}return r})},Mg=function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A}(),Ng=function(){function A(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new jU(this.container),this.container.styles.opacity<1&&this.effects.push(new JU(this.container.styles.opacity)),this.container.styles.transform!==null){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,r=this.container.styles.transform;this.effects.push(new WU(n,i,r))}if(this.container.styles.overflowX!==0){var s=Ps(this.curves),o=Ls(this.curves);Hg(s,o)?this.effects.push(new Ds(s,6)):(this.effects.push(new Ds(s,2)),this.effects.push(new Ds(o,4)))}}return A.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,n=this.parent,i=this.effects.slice(0);n;){var r=n.effects.filter(function(a){return!Og(a)});if(t||n.container.styles.position!==0||!n.parent){if(t=[2,3].indexOf(n.container.styles.position)===-1,n.container.styles.overflowX!==0){var s=Ps(n.curves),o=Ls(n.curves);Hg(s,o)||i.unshift(new Ds(o,6))}i.unshift.apply(i,r)}else i.unshift.apply(i,r);n=n.parent}return i.filter(function(a){return Se(a.target,e)})},A}(),Gc=function(A,e,t,n){A.container.elements.forEach(function(i){var r=Se(i.flags,4),s=Se(i.flags,2),o=new Ng(i,A);Se(i.styles.display,2048)&&n.push(o);var a=Se(i.flags,8)?[]:n;if(r||s){var c=r||i.styles.isPositioned()?t:e,l=new Mg(o);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var d=0;c.negativeZIndex.some(function(f,g){return u>f.element.container.styles.zIndex.order?(d=g,!1):d>0}),c.negativeZIndex.splice(d,0,l)}else if(u>0){var h=0;c.positiveZIndex.some(function(f,g){return u>=f.element.container.styles.zIndex.order?(h=g+1,!1):h>0}),c.positiveZIndex.splice(h,0,l)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else i.styles.isFloating()?c.nonPositionedFloats.push(l):c.nonPositionedInlineLevel.push(l);Gc(o,l,r?l:t,a)}else i.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Gc(o,e,t,a);Se(i.flags,8)&&Kg(i,a)})},Kg=function(A,e){for(var t=A instanceof _c?A.start:1,n=A instanceof _c?A.reversed:!1,i=0;i<e.length;i++){var r=e[i];r.container instanceof fg&&typeof r.container.value=="number"&&r.container.value!==0&&(t=r.container.value),r.listValue=Ri(t,r.container.styles.listStyleType,!0),t+=n?-1:1}},zU=function(A){var e=new Ng(A,null),t=new Mg(e),n=[];return Gc(e,t,t,n),Kg(e.container,n),t},Vg=function(A,e){switch(e){case 0:return dt(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return dt(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return dt(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);case 3:default:return dt(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},ZU=function(A,e){switch(e){case 0:return dt(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return dt(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return dt(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);case 3:default:return dt(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},eT=function(A,e){switch(e){case 0:return dt(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return dt(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return dt(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);case 3:default:return dt(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},tT=function(A,e){switch(e){case 0:return Os(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return Os(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return Os(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);case 3:default:return Os(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},Os=function(A,e){var t=[];return ut(A)?t.push(A.subdivide(.5,!1)):t.push(A),ut(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},dt=function(A,e,t,n){var i=[];return ut(A)?i.push(A.subdivide(.5,!1)):i.push(A),ut(t)?i.push(t.subdivide(.5,!0)):i.push(t),ut(n)?i.push(n.subdivide(.5,!0).reverse()):i.push(n),ut(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},Gg=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},Hs=function(A){var e=A.styles,t=A.bounds,n=ne(e.paddingLeft,t.width),i=ne(e.paddingRight,t.width),r=ne(e.paddingTop,t.width),s=ne(e.paddingBottom,t.width);return t.add(n+e.borderLeftWidth,r+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+n+i),-(e.borderTopWidth+e.borderBottomWidth+r+s))},AT=function(A,e){return A===0?e.bounds:A===2?Hs(e):Gg(e)},nT=function(A,e){return A===0?e.bounds:A===2?Hs(e):Gg(e)},jc=function(A,e,t){var n=AT(On(A.styles.backgroundOrigin,e),A),i=nT(On(A.styles.backgroundClip,e),A),r=iT(On(A.styles.backgroundSize,e),t,n),s=r[0],o=r[1],a=Qi(On(A.styles.backgroundPosition,e),n.width-s,n.height-o),c=rT(On(A.styles.backgroundRepeat,e),a,r,n,i),l=Math.round(n.left+a[0]),u=Math.round(n.top+a[1]);return s=Math.max(1,s),o=Math.max(1,o),[c,l,u,s,o]},Dn=function(A){return $(A)&&A.value===_n.AUTO},Ms=function(A){return typeof A=="number"},iT=function(A,e,t){var n=e[0],i=e[1],r=e[2],s=A[0],o=A[1];if(!s)return[0,0];if(le(s)&&o&&le(o))return[ne(s,t.width),ne(o,t.height)];var a=Ms(r);if($(s)&&(s.value===_n.CONTAIN||s.value===_n.COVER)){if(Ms(r)){var c=t.width/t.height;return c<r!=(s.value===_n.COVER)?[t.width,t.width/r]:[t.height*r,t.height]}return[t.width,t.height]}var l=Ms(n),u=Ms(i),d=l||u;if(Dn(s)&&(!o||Dn(o))){if(l&&u)return[n,i];if(!a&&!d)return[t.width,t.height];if(d&&a){var h=l?n:i*r,f=u?i:n/r;return[h,f]}var g=l?n:t.width,p=u?i:t.height;return[g,p]}if(a){var B=0,y=0;return le(s)?B=ne(s,t.width):le(o)&&(y=ne(o,t.height)),Dn(s)?B=y*r:(!o||Dn(o))&&(y=B/r),[B,y]}var b=null,v=null;if(le(s)?b=ne(s,t.width):o&&le(o)&&(v=ne(o,t.height)),b!==null&&(!o||Dn(o))&&(v=l&&u?b/n*i:t.height),v!==null&&Dn(s)&&(b=l&&u?v/i*n:t.width),b!==null&&v!==null)return[b,v];throw new Error("Unable to calculate background-size for element")},On=function(A,e){var t=A[e];return typeof t>"u"?A[0]:t},rT=function(A,e,t,n,i){var r=e[0],s=e[1],o=t[0],a=t[1];switch(A){case 2:return[new R(Math.round(n.left),Math.round(n.top+s)),new R(Math.round(n.left+n.width),Math.round(n.top+s)),new R(Math.round(n.left+n.width),Math.round(a+n.top+s)),new R(Math.round(n.left),Math.round(a+n.top+s))];case 3:return[new R(Math.round(n.left+r),Math.round(n.top)),new R(Math.round(n.left+r+o),Math.round(n.top)),new R(Math.round(n.left+r+o),Math.round(n.height+n.top)),new R(Math.round(n.left+r),Math.round(n.height+n.top))];case 1:return[new R(Math.round(n.left+r),Math.round(n.top+s)),new R(Math.round(n.left+r+o),Math.round(n.top+s)),new R(Math.round(n.left+r+o),Math.round(n.top+s+a)),new R(Math.round(n.left+r),Math.round(n.top+s+a))];default:return[new R(Math.round(i.left),Math.round(i.top)),new R(Math.round(i.left+i.width),Math.round(i.top)),new R(Math.round(i.left+i.width),Math.round(i.height+i.top)),new R(Math.round(i.left),Math.round(i.height+i.top))]}},sT="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",jg="Hidden Text",oT=function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,t){var n=this._document.createElement("div"),i=this._document.createElement("img"),r=this._document.createElement("span"),s=this._document.body;n.style.visibility="hidden",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",s.appendChild(n),i.src=sT,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.appendChild(this._document.createTextNode(jg)),n.appendChild(r),n.appendChild(i);var o=i.offsetTop-r.offsetTop+2;n.removeChild(r),n.appendChild(this._document.createTextNode(jg)),n.style.lineHeight="normal",i.style.verticalAlign="super";var a=i.offsetTop-n.offsetTop+2;return s.removeChild(n),{baseline:o,middle:a}},A.prototype.getMetrics=function(e,t){var n="".concat(e," ").concat(t);return typeof this._data[n]>"u"&&(this._data[n]=this.parseMetrics(e,t)),this._data[n]},A}(),$g=function(){function A(e,t){this.context=e,this.options=t}return A}(),aT=1e4,cT=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i._activeEffects=[],i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),n.canvas||(i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width="".concat(n.width,"px"),i.canvas.style.height="".concat(n.height,"px")),i.fontMetrics=new oT(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized (".concat(n.width,"x").concat(n.height,") with scale ").concat(n.scale)),i}return e.prototype.applyEffects=function(t){for(var n=this;this._activeEffects.length;)this.popEffect();t.forEach(function(i){return n.applyEffect(i)})},e.prototype.applyEffect=function(t){this.ctx.save(),qU(t)&&(this.ctx.globalAlpha=t.opacity),XU(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),Og(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return Ke(this,void 0,void 0,function(){var n;return Oe(this,function(i){switch(i.label){case 0:return n=t.element.container.styles,n.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return Ke(this,void 0,void 0,function(){return Oe(this,function(n){switch(n.label){case 0:if(Se(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return n.sent(),[4,this.renderNodeContent(t)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,n,i){var r=this;if(n===0)navigator.userAgent.indexOf("Firefox")===-1?(this.ctx.textBaseline="ideographic",this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+t.bounds.height)):this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var s=Ic(t.text);s.reduce(function(o,a){return r.ctx.fillText(a,o,t.bounds.top+i),o+r.ctx.measureText(a).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var n=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),i=fT(t.fontFamily).join(", "),r=bA(t.fontSize)?"".concat(t.fontSize.number).concat(t.fontSize.unit):"".concat(t.fontSize.number,"px");return[[t.fontStyle,n,t.fontWeight,r,i].join(" "),i,r]},e.prototype.renderTextNode=function(t,n){return Ke(this,void 0,void 0,function(){var i,r,s=this;return Oe(this,function(o){return i=this.createFontStyle(n)[0],this.ctx.font=i,this.ctx.direction=n.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",r=n.paintOrder,t.textBounds.forEach(function(a){r.forEach(function(c){switch(c){case 0:s.ctx.fillStyle=Te(n.color),s.renderTextWithLetterSpacing(a,n.letterSpacing,n.fontSize.number);var l=n.textShadow;if(l.length&&a.text.trim().length&&(l.slice(0).reverse().forEach(function(d){s.ctx.shadowColor=Te(d.color),s.ctx.shadowOffsetX=d.offsetX.number*s.options.scale,s.ctx.shadowOffsetY=d.offsetY.number*s.options.scale,s.ctx.shadowBlur=d.blur.number,s.renderTextWithLetterSpacing(a,n.letterSpacing,n.fontSize.number)}),s.ctx.shadowColor="",s.ctx.shadowOffsetX=0,s.ctx.shadowOffsetY=0,s.ctx.shadowBlur=0),n.textDecorationLine.length){s.ctx.fillStyle=Te(n.textDecorationColor||n.color);var u=1;n.textDecorationLine.forEach(function(d){switch(d){case 1:s.ctx.fillRect(a.bounds.left,a.bounds.top+a.bounds.height-u,a.bounds.width,u);break;case 2:s.ctx.fillRect(a.bounds.left,a.bounds.top,a.bounds.width,u);break;case 3:s.ctx.fillRect(a.bounds.left,a.bounds.top+(a.bounds.height/2-u/2),a.bounds.width,u);break}})}break;case 1:n.webkitTextStrokeWidth&&a.text.trim().length&&(s.ctx.strokeStyle=Te(n.webkitTextStrokeColor),s.ctx.lineWidth=n.webkitTextStrokeWidth,s.ctx.lineJoin=window.chrome?"miter":"round",s.ctx.strokeText(a.text,a.bounds.left,a.bounds.top+a.bounds.height)),s.ctx.strokeStyle="",s.ctx.lineWidth=0,s.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,n,i){var r=i.naturalWidth||t.intrinsicWidth,s=i.naturalHeight||t.intrinsicHeight;if(i&&r>0&&s>0){var o=Hs(t),a=Ls(n);this.path(a),this.ctx.save(),this.ctx.clip();var c=0,l=0,u=r,d=s,h=o.left,f=o.top,g=o.width,p=o.height,B=t.styles.objectFit,y=g/p,b=u/d;if(B===2)b>y?(p=g/b,f+=(o.height-p)/2):(g=p*b,h+=(o.width-g)/2);else if(B===4)b>y?(u=d*y,c+=(r-u)/2):(d=u/y,l+=(s-d)/2);else if(B===8)u>g?(c+=(u-g)/2,u=g):(h+=(g-u)/2,g=u),d>p?(l+=(d-p)/2,d=p):(f+=(p-d)/2,p=d);else if(B===16){var v=b>y?g:p*b,C=u>g?u:g;v<C?b>y?(p=g/b,f+=(o.height-p)/2):(g=p*b,h+=(o.width-g)/2):(u>g?(c+=(u-g)/2,u=g):(h+=(g-u)/2,g=u),d>p?(l+=(d-p)/2,d=p):(f+=(p-d)/2,p=d))}this.ctx.drawImage(i,c,l,u,d,h,f,g,p),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return Ke(this,void 0,void 0,function(){var n,i,r,s,o,a,b,b,c,l,u,d,C,h,f,g,w,p,B,y,b,v,C,w;return Oe(this,function(S){switch(S.label){case 0:this.applyEffects(t.getEffects(4)),n=t.container,i=t.curves,r=n.styles,s=0,o=n.textNodes,S.label=1;case 1:return s<o.length?(a=o[s],[4,this.renderTextNode(a,r)]):[3,4];case 2:S.sent(),S.label=3;case 3:return s++,[3,1];case 4:if(!(n instanceof ug))return[3,8];S.label=5;case 5:return S.trys.push([5,7,,8]),[4,this.context.cache.match(n.src)];case 6:return b=S.sent(),this.renderReplacedElement(n,i,b),[3,8];case 7:return S.sent(),this.context.logger.error("Error loading image ".concat(n.src)),[3,8];case 8:if(n instanceof dg&&this.renderReplacedElement(n,i,n.canvas),!(n instanceof hg))return[3,12];S.label=9;case 9:return S.trys.push([9,11,,12]),[4,this.context.cache.match(n.svg)];case 10:return b=S.sent(),this.renderReplacedElement(n,i,b),[3,12];case 11:return S.sent(),this.context.logger.error("Error loading svg ".concat(n.svg.substring(0,255))),[3,12];case 12:return n instanceof Bg&&n.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:n.backgroundColor,x:0,y:0,width:n.width,height:n.height}),[4,c.render(n.tree)]):[3,14];case 13:l=S.sent(),n.width&&n.height&&this.ctx.drawImage(l,0,0,n.width,n.height,n.bounds.left,n.bounds.top,n.bounds.width,n.bounds.height),S.label=14;case 14:if(n instanceof xc&&(u=Math.min(n.bounds.width,n.bounds.height),n.type===Qs?n.checked&&(this.ctx.save(),this.path([new R(n.bounds.left+u*.39363,n.bounds.top+u*.79),new R(n.bounds.left+u*.16,n.bounds.top+u*.5549),new R(n.bounds.left+u*.27347,n.bounds.top+u*.44071),new R(n.bounds.left+u*.39694,n.bounds.top+u*.5649),new R(n.bounds.left+u*.72983,n.bounds.top+u*.23),new R(n.bounds.left+u*.84,n.bounds.top+u*.34085),new R(n.bounds.left+u*.39363,n.bounds.top+u*.79)]),this.ctx.fillStyle=Te(gg),this.ctx.fill(),this.ctx.restore()):n.type===Fs&&n.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.bounds.left+u/2,n.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=Te(gg),this.ctx.fill(),this.ctx.restore())),lT(n)&&n.value.length){switch(d=this.createFontStyle(r),C=d[0],h=d[1],f=d[2],g=this.fontMetrics.getMetrics(h,f).baseline,this.ctx.font=C,this.ctx.fillStyle=Te(r.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=dT(n.styles.textAlign),w=Hs(n),p=0,n.styles.textAlign){case 1:p+=w.width/2;break;case 2:p+=w.width;break}B=w.add(p,0,0,-w.height/2+1),this.ctx.save(),this.path([new R(w.left,w.top),new R(w.left+w.width,w.top),new R(w.left+w.width,w.top+w.height),new R(w.left,w.top+w.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new _i(n.value,B),r.letterSpacing,g),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Se(n.styles.display,2048))return[3,20];if(n.styles.listStyleImage===null)return[3,19];if(y=n.styles.listStyleImage,y.type!==0)return[3,18];b=void 0,v=y.url,S.label=15;case 15:return S.trys.push([15,17,,18]),[4,this.context.cache.match(v)];case 16:return b=S.sent(),this.ctx.drawImage(b,n.bounds.left-(b.width+10),n.bounds.top),[3,18];case 17:return S.sent(),this.context.logger.error("Error loading list-style-image ".concat(v)),[3,18];case 18:return[3,20];case 19:t.listValue&&n.styles.listStyleType!==-1&&(C=this.createFontStyle(r)[0],this.ctx.font=C,this.ctx.fillStyle=Te(r.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",w=new Xt(n.bounds.left,n.bounds.top+ne(n.styles.paddingTop,n.bounds.width),n.bounds.width,$f(r.lineHeight,r.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new _i(t.listValue,w),r.letterSpacing,$f(r.lineHeight,r.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),S.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return Ke(this,void 0,void 0,function(){var n,i,B,r,s,B,o,a,B,c,l,B,u,d,B,h,f,B,g,p,B;return Oe(this,function(y){switch(y.label){case 0:if(Se(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:y.sent(),n=0,i=t.negativeZIndex,y.label=2;case 2:return n<i.length?(B=i[n],[4,this.renderStack(B)]):[3,5];case 3:y.sent(),y.label=4;case 4:return n++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:y.sent(),r=0,s=t.nonInlineLevel,y.label=7;case 7:return r<s.length?(B=s[r],[4,this.renderNode(B)]):[3,10];case 8:y.sent(),y.label=9;case 9:return r++,[3,7];case 10:o=0,a=t.nonPositionedFloats,y.label=11;case 11:return o<a.length?(B=a[o],[4,this.renderStack(B)]):[3,14];case 12:y.sent(),y.label=13;case 13:return o++,[3,11];case 14:c=0,l=t.nonPositionedInlineLevel,y.label=15;case 15:return c<l.length?(B=l[c],[4,this.renderStack(B)]):[3,18];case 16:y.sent(),y.label=17;case 17:return c++,[3,15];case 18:u=0,d=t.inlineLevel,y.label=19;case 19:return u<d.length?(B=d[u],[4,this.renderNode(B)]):[3,22];case 20:y.sent(),y.label=21;case 21:return u++,[3,19];case 22:h=0,f=t.zeroOrAutoZIndexOrTransformedOrOpacity,y.label=23;case 23:return h<f.length?(B=f[h],[4,this.renderStack(B)]):[3,26];case 24:y.sent(),y.label=25;case 25:return h++,[3,23];case 26:g=0,p=t.positiveZIndex,y.label=27;case 27:return g<p.length?(B=p[g],[4,this.renderStack(B)]):[3,30];case 28:y.sent(),y.label=29;case 29:return g++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var n=this;t.forEach(function(i,r){var s=ut(i)?i.start:i;r===0?n.ctx.moveTo(s.x,s.y):n.ctx.lineTo(s.x,s.y),ut(i)&&n.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(t,n,i,r){this.path(t),this.ctx.fillStyle=n,this.ctx.translate(i,r),this.ctx.fill(),this.ctx.translate(-i,-r)},e.prototype.resizeImage=function(t,n,i){var r,s=(r=this.canvas.ownerDocument)!==null&&r!==void 0?r:document,o=s.createElement("canvas");o.width=Math.max(1,n),o.height=Math.max(1,i);var a=o.getContext("2d");return a.drawImage(t,0,0,t.width,t.height,0,0,n,i),o},e.prototype.renderBackgroundImage=function(t){return Ke(this,void 0,void 0,function(){var n,i,r,s,o,a;return Oe(this,function(c){switch(c.label){case 0:n=t.styles.backgroundImage.length-1,i=function(l){var u,d,h,f,g,M,Ne,De,V,q,D,p,M,Ne,De,V,q,B,y,b,v,C,w,S,F,_,D,H,M,K,Le,V,q,tt,Ne,De,AA,ft,je,nA,kt,$e,qn,gt;return Oe(this,function(Yn){switch(Yn.label){case 0:if(l.type!==0)return[3,5];u=void 0,d=l.url,Yn.label=1;case 1:return Yn.trys.push([1,3,,4]),[4,r.context.cache.match(d)];case 2:return u=Yn.sent(),[3,4];case 3:return Yn.sent(),r.context.logger.error("Error loading background-image ".concat(d)),[3,4];case 4:return u&&(h=isNaN(u.width)||u.width===0?1:u.width,f=isNaN(u.height)||u.height===0?1:u.height,g=jc(t,n,[h,f,h/f]),M=g[0],Ne=g[1],De=g[2],V=g[3],q=g[4],D=r.ctx.createPattern(r.resizeImage(u,V,q),"repeat"),r.renderRepeat(M,D,Ne,De)),[3,6];case 5:$b(l)?(p=jc(t,n,[null,null,null]),M=p[0],Ne=p[1],De=p[2],V=p[3],q=p[4],B=Nb(l.angle,V,q),y=B[0],b=B[1],v=B[2],C=B[3],w=B[4],S=document.createElement("canvas"),S.width=V,S.height=q,F=S.getContext("2d"),_=F.createLinearGradient(b,C,v,w),Pf(l.stops,y||1).forEach(function(Zi){return _.addColorStop(Zi.stop,Te(Zi.color))}),F.fillStyle=_,F.fillRect(0,0,V,q),V>0&&q>0&&(D=r.ctx.createPattern(S,"repeat"),r.renderRepeat(M,D,Ne,De))):Wb(l)&&(H=jc(t,n,[null,null,null]),M=H[0],K=H[1],Le=H[2],V=H[3],q=H[4],tt=l.position.length===0?[dc]:l.position,Ne=ne(tt[0],V),De=ne(tt[tt.length-1],q),AA=Kb(l,Ne,De,V,q),ft=AA[0],je=AA[1],ft>0&&je>0&&(nA=r.ctx.createRadialGradient(K+Ne,Le+De,0,K+Ne,Le+De,ft),Pf(l.stops,ft*2).forEach(function(Zi){return nA.addColorStop(Zi.stop,Te(Zi.color))}),r.path(M),r.ctx.fillStyle=nA,ft!==je?(kt=t.bounds.left+.5*t.bounds.width,$e=t.bounds.top+.5*t.bounds.height,qn=je/ft,gt=1/qn,r.ctx.save(),r.ctx.translate(kt,$e),r.ctx.transform(1,0,0,qn,0,0),r.ctx.translate(-kt,-$e),r.ctx.fillRect(K,gt*(Le-$e)+$e,V,q*gt),r.ctx.restore()):r.ctx.fill())),Yn.label=6;case 6:return n--,[2]}})},r=this,s=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<o.length?(a=o[s],[5,i(a)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,n,i){return Ke(this,void 0,void 0,function(){return Oe(this,function(r){return this.path(Vg(i,n)),this.ctx.fillStyle=Te(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,n,i,r){return Ke(this,void 0,void 0,function(){var s,o;return Oe(this,function(a){switch(a.label){case 0:return n<3?[4,this.renderSolidBorder(t,i,r)]:[3,2];case 1:return a.sent(),[2];case 2:return s=ZU(r,i),this.path(s),this.ctx.fillStyle=Te(t),this.ctx.fill(),o=eT(r,i),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Ke(this,void 0,void 0,function(){var n,i,r,s,o,a,c,l,u=this;return Oe(this,function(d){switch(d.label){case 0:return this.applyEffects(t.getEffects(2)),n=t.container.styles,i=!UA(n.backgroundColor)||n.backgroundImage.length,r=[{style:n.borderTopStyle,color:n.borderTopColor,width:n.borderTopWidth},{style:n.borderRightStyle,color:n.borderRightColor,width:n.borderRightWidth},{style:n.borderBottomStyle,color:n.borderBottomColor,width:n.borderBottomWidth},{style:n.borderLeftStyle,color:n.borderLeftColor,width:n.borderLeftWidth}],s=uT(On(n.backgroundClip,0),t.curves),i||n.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),UA(n.backgroundColor)||(this.ctx.fillStyle=Te(n.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:d.sent(),this.ctx.restore(),n.boxShadow.slice(0).reverse().forEach(function(h){u.ctx.save();var f=Ps(t.curves),g=h.inset?0:aT,p=YU(f,-g+(h.inset?1:-1)*h.spread.number,(h.inset?1:-1)*h.spread.number,h.spread.number*(h.inset?-2:2),h.spread.number*(h.inset?-2:2));h.inset?(u.path(f),u.ctx.clip(),u.mask(p)):(u.mask(f),u.ctx.clip(),u.path(p)),u.ctx.shadowOffsetX=h.offsetX.number+g,u.ctx.shadowOffsetY=h.offsetY.number,u.ctx.shadowColor=Te(h.color),u.ctx.shadowBlur=h.blur.number,u.ctx.fillStyle=h.inset?Te(h.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),d.label=2;case 2:o=0,a=0,c=r,d.label=3;case 3:return a<c.length?(l=c[a],l.style!==0&&!UA(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return d.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,o,t.curves,3)];case 6:return d.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,o,t.curves)];case 8:return d.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,o,t.curves)];case 10:d.sent(),d.label=11;case 11:o++,d.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,n,i,r,s){return Ke(this,void 0,void 0,function(){var o,a,c,l,u,d,h,f,g,p,B,y,b,v,C,w,C,w;return Oe(this,function(S){return this.ctx.save(),o=tT(r,i),a=Vg(r,i),s===2&&(this.path(a),this.ctx.clip()),ut(a[0])?(c=a[0].start.x,l=a[0].start.y):(c=a[0].x,l=a[0].y),ut(a[1])?(u=a[1].end.x,d=a[1].end.y):(u=a[1].x,d=a[1].y),i===0||i===2?h=Math.abs(c-u):h=Math.abs(l-d),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(a.slice(0,2)),f=n<3?n*3:n*2,g=n<3?n*2:n,s===3&&(f=n,g=n),p=!0,h<=f*2?p=!1:h<=f*2+g?(B=h/(2*f+g),f*=B,g*=B):(y=Math.floor((h+g)/(f+g)),b=(h-y*f)/(y-1),v=(h-(y+1)*f)/y,g=v<=0||Math.abs(g-b)<Math.abs(g-v)?b:v),p&&(s===3?this.ctx.setLineDash([0,f+g]):this.ctx.setLineDash([f,g])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=n):this.ctx.lineWidth=n*2+1.1,this.ctx.strokeStyle=Te(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(ut(a[0])&&(C=a[3],w=a[0],this.ctx.beginPath(),this.formatPath([new R(C.end.x,C.end.y),new R(w.start.x,w.start.y)]),this.ctx.stroke()),ut(a[1])&&(C=a[1],w=a[2],this.ctx.beginPath(),this.formatPath([new R(C.end.x,C.end.y),new R(w.start.x,w.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Ke(this,void 0,void 0,function(){var n;return Oe(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Te(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),n=zU(t),[4,this.renderStack(n)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}($g),lT=function(A){return A instanceof mg||A instanceof pg?!0:A instanceof xc&&A.type!==Fs&&A.type!==Qs},uT=function(A,e){switch(A){case 0:return Ps(e);case 2:return $U(e);case 1:default:return Ls(e)}},dT=function(A){switch(A){case 1:return"center";case 2:return"right";case 0:default:return"left"}},hT=["-apple-system","system-ui"],fT=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return hT.indexOf(e)===-1}):A},gT=function(A){St(e,A);function e(t,n){var i=A.call(this,t,n)||this;return i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=n,i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width="".concat(n.width,"px"),i.canvas.style.height="".concat(n.height,"px"),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (".concat(n.width,"x").concat(n.height," at ").concat(n.x,",").concat(n.y,") with scale ").concat(n.scale)),i}return e.prototype.render=function(t){return Ke(this,void 0,void 0,function(){var n,i;return Oe(this,function(r){switch(r.label){case 0:return n=kc(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,pT(n)];case 1:return i=r.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Te(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}($g),pT=function(A){return new Promise(function(e,t){var n=new Image;n.onload=function(){e(n)},n.onerror=t,n.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(A)))})},mT=function(){function A(e){var t=e.id,n=e.enabled;this.id=t,this.enabled=n,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Kr([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Kr([this.id,"".concat(this.getTime(),"ms")],e,!1))},A.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Kr([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Kr([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},A.instances={},A}(),BT=function(){function A(e,t){var n;this.windowBounds=t,this.instanceName="#".concat(A.instanceCount++),this.logger=new mT({id:this.instanceName,enabled:e.logging}),this.cache=(n=e.cache)!==null&&n!==void 0?n:new OU(this,e)}return A.instanceCount=1,A}(),vT=function(A,e){return e===void 0&&(e={}),CT(A,e)};typeof window<"u"&&Nc.setContext(window);var CT=function(A,e){return Ke(void 0,void 0,void 0,function(){var t,n,i,r,s,o,a,c,l,u,d,h,f,g,p,B,y,b,v,C,S,w,S,F,_,D,H,M,K,Le,V,q,tt,Ne,De,AA,ft,je,nA,kt;return Oe(this,function($e){switch($e.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=A.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(n=t.defaultView,!n)throw new Error("Document is not attached to a Window");return i={allowTaint:(F=e.allowTaint)!==null&&F!==void 0?F:!1,imageTimeout:(_=e.imageTimeout)!==null&&_!==void 0?_:15e3,proxy:e.proxy,useCORS:(D=e.useCORS)!==null&&D!==void 0?D:!1,customIsSameOrigin:e.customIsSameOrigin},r=ja({logging:(H=e.logging)!==null&&H!==void 0?H:!0,cache:e.cache},i),s={windowWidth:(M=e.windowWidth)!==null&&M!==void 0?M:n.innerWidth,windowHeight:(K=e.windowHeight)!==null&&K!==void 0?K:n.innerHeight,scrollX:(Le=e.scrollX)!==null&&Le!==void 0?Le:n.pageXOffset,scrollY:(V=e.scrollY)!==null&&V!==void 0?V:n.pageYOffset},o=new Xt(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),a=new BT(r,o),c=(q=e.foreignObjectRendering)!==null&&q!==void 0?q:!1,l={allowTaint:(tt=e.allowTaint)!==null&&tt!==void 0?tt:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},a.logger.debug("Starting document clone with size ".concat(o.width,"x").concat(o.height," scrolled to ").concat(-o.left,",").concat(-o.top)),u=new Lg(a,A,l),d=u.clonedReferenceElement,d?[4,u.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return h=$e.sent(),f=Pc(d)||CU(d)?Aw(d.ownerDocument):Vr(a,d),g=f.width,p=f.height,B=f.left,y=f.top,b=wT(a,d,e.backgroundColor),v={canvas:e.canvas,backgroundColor:b,scale:(De=(Ne=e.scale)!==null&&Ne!==void 0?Ne:n.devicePixelRatio)!==null&&De!==void 0?De:1,x:((AA=e.x)!==null&&AA!==void 0?AA:0)+B,y:((ft=e.y)!==null&&ft!==void 0?ft:0)+y,width:(je=e.width)!==null&&je!==void 0?je:Math.ceil(g),height:(nA=e.height)!==null&&nA!==void 0?nA:Math.ceil(p)},c?(a.logger.debug("Document cloned, using foreign object rendering"),S=new gT(a,v),[4,S.render(d)]):[3,3];case 2:return C=$e.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at ".concat(B,",").concat(y," with size ").concat(g,"x").concat(p," using computed rendering")),a.logger.debug("Starting DOM parsing"),w=Cg(a,d),b===w.styles.backgroundColor&&(w.styles.backgroundColor=Mt.TRANSPARENT),a.logger.debug("Starting renderer for element at ".concat(v.x,",").concat(v.y," with size ").concat(v.width,"x").concat(v.height)),S=new cT(a,v),[4,S.render(w)];case 4:C=$e.sent(),$e.label=5;case 5:return(!((kt=e.removeContainer)!==null&&kt!==void 0)||kt)&&(Lg.destroy(h)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,C]}})})},wT=function(A,e,t){var n=e.ownerDocument,i=n.documentElement?In(A,getComputedStyle(n.documentElement).backgroundColor):Mt.TRANSPARENT,r=n.body?In(A,getComputedStyle(n.body).backgroundColor):Mt.TRANSPARENT,s=typeof t=="string"?In(A,t):t===null?Mt.TRANSPARENT:4294967295;return e===n.documentElement?UA(i)?UA(r)?s:r:i:s};const X=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,tn="9.23.0",Ae=globalThis;function Ns(){return Ks(Ae),Ae}function Ks(A){const e=A.__SENTRY__=A.__SENTRY__||{};return e.version=e.version||tn,e[tn]=e[tn]||{}}function Vs(A,e,t=Ae){const n=t.__SENTRY__=t.__SENTRY__||{},i=n[tn]=n[tn]||{};return i[A]||(i[A]=e())}const Wg=Object.prototype.toString;function $c(A){switch(Wg.call(A)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return IA(A,Error)}}function Hn(A,e){return Wg.call(A)===`[object ${e}]`}function Jg(A){return Hn(A,"ErrorEvent")}function Xg(A){return Hn(A,"DOMError")}function yT(A){return Hn(A,"DOMException")}function zt(A){return Hn(A,"String")}function Wc(A){return typeof A=="object"&&A!==null&&"__sentry_template_string__"in A&&"__sentry_template_values__"in A}function Jc(A){return A===null||Wc(A)||typeof A!="object"&&typeof A!="function"}function Li(A){return Hn(A,"Object")}function Gs(A){return typeof Event<"u"&&IA(A,Event)}function bT(A){return typeof Element<"u"&&IA(A,Element)}function ET(A){return Hn(A,"RegExp")}function js(A){return!!(A?.then&&typeof A.then=="function")}function ST(A){return Li(A)&&"nativeEvent"in A&&"preventDefault"in A&&"stopPropagation"in A}function IA(A,e){try{return A instanceof e}catch{return!1}}function qg(A){return!!(typeof A=="object"&&A!==null&&(A.__isVue||A._isVue))}function UT(A){return typeof Request<"u"&&IA(A,Request)}const Xc=Ae,TT=80;function Yg(A,e={}){if(!A)return"<unknown>";try{let t=A;const n=5,i=[];let r=0,s=0;const o=" > ",a=o.length;let c;const l=Array.isArray(e)?e:e.keyAttrs,u=!Array.isArray(e)&&e.maxStringLength||TT;for(;t&&r++<n&&(c=QT(t,l),!(c==="html"||r>1&&s+i.length*a+c.length>=u));)i.push(c),s+=c.length,t=t.parentNode;return i.reverse().join(o)}catch{return"<unknown>"}}function QT(A,e){const t=A,n=[];if(!t?.tagName)return"";if(Xc.HTMLElement&&t instanceof HTMLElement&&t.dataset){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}n.push(t.tagName.toLowerCase());const i=e?.length?e.filter(s=>t.getAttribute(s)).map(s=>[s,t.getAttribute(s)]):null;if(i?.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{t.id&&n.push(`#${t.id}`);const s=t.className;if(s&&zt(s)){const o=s.split(/\s+/);for(const a of o)n.push(`.${a}`)}}const r=["aria-label","type","name","title","alt"];for(const s of r){const o=t.getAttribute(s);o&&n.push(`[${s}="${o}"]`)}return n.join("")}function zg(){try{return Xc.document.location.href}catch{return""}}function FT(A){if(!Xc.HTMLElement)return null;let e=A;const t=5;for(let n=0;n<t;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}const kT="Sentry Logger ",qc=["debug","info","warn","error","log","assert","trace"],$s={};function Ws(A){if(!("console"in Ae))return A();const e=Ae.console,t={},n=Object.keys($s);n.forEach(i=>{const r=$s[i];t[i]=e[i],e[i]=r});try{return A()}finally{n.forEach(i=>{e[i]=t[i]})}}function IT(){let A=!1;const e={enable:()=>{A=!0},disable:()=>{A=!1},isEnabled:()=>A};return X?qc.forEach(t=>{e[t]=(...n)=>{A&&Ws(()=>{Ae.console[t](`${kT}[${t}]:`,...n)})}}):qc.forEach(t=>{e[t]=()=>{}}),e}const N=Vs("logger",IT);function Js(A,e=0){return typeof A!="string"||e===0||A.length<=e?A:`${A.slice(0,e)}...`}function Zg(A,e){if(!Array.isArray(A))return"";const t=[];for(let n=0;n<A.length;n++){const i=A[n];try{qg(i)?t.push("[VueViewModel]"):t.push(String(i))}catch{t.push("[value cannot be serialized]")}}return t.join(e)}function _T(A,e,t=!1){return zt(A)?ET(e)?e.test(A):zt(e)?t?A===e:A.includes(e):!1:!1}function Xs(A,e=[],t=!1){return e.some(n=>_T(A,n,t))}function rt(A,e,t){if(!(e in A))return;const n=A[e];if(typeof n!="function")return;const i=t(n);typeof i=="function"&&ep(i,n);try{A[e]=i}catch{X&&N.log(`Failed to replace method "${e}" in object`,A)}}function An(A,e,t){try{Object.defineProperty(A,e,{value:t,writable:!0,configurable:!0})}catch{X&&N.log(`Failed to add non-enumerable property "${e}" to object`,A)}}function ep(A,e){try{const t=e.prototype||{};A.prototype=e.prototype=t,An(A,"__sentry_original__",e)}catch{}}function Yc(A){return A.__sentry_original__}function tp(A){if($c(A))return{message:A.message,name:A.name,stack:A.stack,...np(A)};if(Gs(A)){const e={type:A.type,target:Ap(A.target),currentTarget:Ap(A.currentTarget),...np(A)};return typeof CustomEvent<"u"&&IA(A,CustomEvent)&&(e.detail=A.detail),e}else return A}function Ap(A){try{return bT(A)?Yg(A):Object.prototype.toString.call(A)}catch{return"<unknown>"}}function np(A){if(typeof A=="object"&&A!==null){const e={};for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&(e[t]=A[t]);return e}else return{}}function xT(A,e=40){const t=Object.keys(tp(A));t.sort();const n=t[0];if(!n)return"[object has no keys]";if(n.length>=e)return Js(n,e);for(let i=t.length;i>0;i--){const r=t.slice(0,i).join(", ");if(!(r.length>e))return i===t.length?r:Js(r,e)}return""}function RT(){const A=Ae;return A.crypto||A.msCrypto}function ht(A=RT()){let e=()=>Math.random()*16;try{if(A?.randomUUID)return A.randomUUID().replace(/-/g,"");A?.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return A.getRandomValues(t),t[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,t=>(t^(e()&15)>>t/4).toString(16))}function ip(A){return A.exception?.values?.[0]}function nn(A){const{message:e,event_id:t}=A;if(e)return e;const n=ip(A);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||t||"<unknown>":t||"<unknown>"}function zc(A,e,t){const n=A.exception=A.exception||{},i=n.values=n.values||[],r=i[0]=i[0]||{};r.value||(r.value=e||""),r.type||(r.type=t||"Error")}function Mn(A,e){const t=ip(A);if(!t)return;const n={type:"generic",handled:!0},i=t.mechanism;if(t.mechanism={...n,...i,...e},e&&"data"in e){const r={...i?.data,...e.data};t.mechanism.data=r}}function rp(A){if(PT(A))return!0;try{An(A,"__sentry_captured__",!0)}catch{}return!1}function PT(A){try{return A.__sentry_captured__}catch{}}const sp=1e3;function Di(){return Date.now()/sp}function LT(){const{performance:A}=Ae;if(!A?.now)return Di;const e=Date.now()-A.now(),t=A.timeOrigin==null?e:A.timeOrigin;return()=>(t+A.now())/sp}const Zt=LT();function DT(A){const e=Zt(),t={sid:ht(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>HT(t)};return A&&Nn(t,A),t}function Nn(A,e={}){if(e.user&&(!A.ipAddress&&e.user.ip_address&&(A.ipAddress=e.user.ip_address),!A.did&&!e.did&&(A.did=e.user.id||e.user.email||e.user.username)),A.timestamp=e.timestamp||Zt(),e.abnormal_mechanism&&(A.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(A.ignoreDuration=e.ignoreDuration),e.sid&&(A.sid=e.sid.length===32?e.sid:ht()),e.init!==void 0&&(A.init=e.init),!A.did&&e.did&&(A.did=`${e.did}`),typeof e.started=="number"&&(A.started=e.started),A.ignoreDuration)A.duration=void 0;else if(typeof e.duration=="number")A.duration=e.duration;else{const t=A.timestamp-A.started;A.duration=t>=0?t:0}e.release&&(A.release=e.release),e.environment&&(A.environment=e.environment),!A.ipAddress&&e.ipAddress&&(A.ipAddress=e.ipAddress),!A.userAgent&&e.userAgent&&(A.userAgent=e.userAgent),typeof e.errors=="number"&&(A.errors=e.errors),e.status&&(A.status=e.status)}function OT(A,e){let t={};e?t={status:e}:A.status==="ok"&&(t={status:"exited"}),Nn(A,t)}function HT(A){return{sid:`${A.sid}`,init:A.init,started:new Date(A.started*1e3).toISOString(),timestamp:new Date(A.timestamp*1e3).toISOString(),status:A.status,errors:A.errors,did:typeof A.did=="number"||typeof A.did=="string"?`${A.did}`:void 0,duration:A.duration,abnormal_mechanism:A.abnormal_mechanism,attrs:{release:A.release,environment:A.environment,ip_address:A.ipAddress,user_agent:A.userAgent}}}function Oi(A,e,t=2){if(!e||typeof e!="object"||t<=0)return e;if(A&&Object.keys(e).length===0)return A;const n={...A};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Oi(n[i],e[i],t-1));return n}const Zc="_sentrySpan";function op(A,e){e?An(A,Zc,e):delete A[Zc]}function ap(A){return A[Zc]}function cp(){return ht()}function lp(){return ht().substring(16)}const MT=100;class Tt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:cp(),sampleRand:Math.random()}}clone(){const e=new Tt;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,op(e,ap(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Nn(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t=typeof e=="function"?e(this):e,n=t instanceof Tt?t.getScopeData():Li(t)?e:void 0,{tags:i,extra:r,user:s,contexts:o,level:a,fingerprint:c=[],propagationContext:l}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...r},this._contexts={...this._contexts,...o},s&&Object.keys(s).length&&(this._user=s),a&&(this._level=a),c.length&&(this._fingerprint=c),l&&(this._propagationContext=l),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,op(this,void 0),this._attachments=[],this.setPropagationContext({traceId:cp(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n=typeof t=="number"?t:MT;if(n<=0)return this;const i={timestamp:Di(),...e,message:e.message?Js(e.message,2048):e.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ap(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Oi(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t?.event_id||ht();if(!this._client)return N.warn("No client configured on scope - will not capture exception!"),n;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...t,event_id:n},this),n}captureMessage(e,t,n){const i=n?.event_id||ht();if(!this._client)return N.warn("No client configured on scope - will not capture message!"),i;const r=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:r,...n,event_id:i},this),i}captureEvent(e,t){const n=t?.event_id||ht();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(N.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function NT(){return Vs("defaultCurrentScope",()=>new Tt)}function KT(){return Vs("defaultIsolationScope",()=>new Tt)}class VT{constructor(e,t){let n;e?n=e:n=new Tt;let i;t?i=t:i=new Tt,this._stack=[{scope:n}],this._isolationScope=i}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(i){throw this._popScope(),i}return js(n)?n.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Kn(){const A=Ns(),e=Ks(A);return e.stack=e.stack||new VT(NT(),KT())}function GT(A){return Kn().withScope(A)}function jT(A,e){const t=Kn();return t.withScope(()=>(t.getStackTop().scope=A,e(A)))}function up(A){return Kn().withScope(()=>A(Kn().getIsolationScope()))}function $T(){return{withIsolationScope:up,withScope:GT,withSetScope:jT,withSetIsolationScope:(A,e)=>up(e),getCurrentScope:()=>Kn().getScope(),getIsolationScope:()=>Kn().getIsolationScope()}}function el(A){const e=Ks(A);return e.acs?e.acs:$T()}function Vn(){const A=Ns();return el(A).getCurrentScope()}function Hi(){const A=Ns();return el(A).getIsolationScope()}function WT(){return Vs("globalScope",()=>new Tt)}function dp(...A){const e=Ns(),t=el(e);if(A.length===2){const[n,i]=A;return n?t.withSetScope(n,i):t.withScope(i)}return t.withScope(A[0])}function Ve(){return Vn().getClient()}function JT(A){const e=A.getPropagationContext(),{traceId:t,parentSpanId:n,propagationSpanId:i}=e,r={trace_id:t,span_id:i||lp()};return n&&(r.parent_span_id=n),r}const XT="sentry.source",qT="sentry.sample_rate",YT="sentry.previous_trace_sample_rate",zT="sentry.op",ZT="sentry.origin",hp="sentry.profile_id",fp="sentry.exclusive_time",eQ=0,tQ=1,AQ="_sentryScope",nQ="_sentryIsolationScope";function gp(A){return{scope:A[AQ],isolationScope:A[nQ]}}function iQ(A){if(typeof A=="boolean")return Number(A);const e=typeof A=="string"?parseFloat(A):A;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const rQ="sentry-",sQ=/^sentry-/;function oQ(A){const e=aQ(A);if(!e)return;const t=Object.entries(e).reduce((n,[i,r])=>{if(i.match(sQ)){const s=i.slice(rQ.length);n[s]=r}return n},{});if(Object.keys(t).length>0)return t}function aQ(A){if(!(!A||!zt(A)&&!Array.isArray(A)))return Array.isArray(A)?A.reduce((e,t)=>{const n=pp(t);return Object.entries(n).forEach(([i,r])=>{e[i]=r}),e},{}):pp(A)}function pp(A){return A.split(",").map(e=>e.split("=").map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}const mp=1;let Bp=!1;function cQ(A){const{spanId:e,traceId:t,isRemote:n}=A.spanContext(),i=n?e:tl(A).parent_span_id,r=gp(A).scope,s=n?r?.getPropagationContext().propagationSpanId||lp():e;return{parent_span_id:i,span_id:s,trace_id:t}}function lQ(A){if(A&&A.length>0)return A.map(({context:{spanId:e,traceId:t,traceFlags:n,...i},attributes:r})=>({span_id:e,trace_id:t,sampled:n===mp,attributes:r,...i}))}function vp(A){return typeof A=="number"?Cp(A):Array.isArray(A)?A[0]+A[1]/1e9:A instanceof Date?Cp(A.getTime()):Zt()}function Cp(A){return A>9999999999?A/1e3:A}function tl(A){if(dQ(A))return A.getSpanJSON();const{spanId:e,traceId:t}=A.spanContext();if(uQ(A)){const{attributes:n,startTime:i,name:r,endTime:s,status:o,links:a}=A,c="parentSpanId"in A?A.parentSpanId:"parentSpanContext"in A?A.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:t,data:n,description:r,parent_span_id:c,start_timestamp:vp(i),timestamp:vp(s)||void 0,status:fQ(o),op:n[zT],origin:n[ZT],links:lQ(a)}}return{span_id:e,trace_id:t,start_timestamp:0,data:{}}}function uQ(A){const e=A;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function dQ(A){return typeof A.getSpanJSON=="function"}function hQ(A){const{traceFlags:e}=A.spanContext();return e===mp}function fQ(A){if(!(!A||A.code===eQ))return A.code===tQ?"ok":A.message||"unknown_error"}const gQ="_sentryRootSpan";function wp(A){return A[gQ]||A}function yp(){Bp||(Ws(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),Bp=!0)}const bp=50,rn="?",Ep=/\(error: (.*)\)/,Sp=/captureMessage|captureException/;function pQ(...A){const e=A.sort((t,n)=>t[0]-n[0]).map(t=>t[1]);return(t,n=0,i=0)=>{const r=[],s=t.split(`
111
+ `);for(let o=n;o<s.length;o++){const a=s[o];if(a.length>1024)continue;const c=Ep.test(a)?a.replace(Ep,"$1"):a;if(!c.match(/\S*Error: /)){for(const l of e){const u=l(c);if(u){r.push(u);break}}if(r.length>=bp+i)break}}return mQ(r.slice(i))}}function mQ(A){if(!A.length)return[];const e=Array.from(A);return/sentryWrapped/.test(qs(e).function||"")&&e.pop(),e.reverse(),Sp.test(qs(e).function||"")&&(e.pop(),Sp.test(qs(e).function||"")&&e.pop()),e.slice(0,bp).map(t=>({...t,filename:t.filename||qs(e).filename,function:t.function||rn}))}function qs(A){return A[A.length-1]||{}}const Al="<anonymous>";function _A(A){try{return!A||typeof A!="function"?Al:A.name||Al}catch{return Al}}function Up(A){const e=A.exception;if(e){const t=[];try{return e.values.forEach(n=>{n.stacktrace.frames&&t.push(...n.stacktrace.frames)}),t}catch{return}}}const Ys={},Tp={};function sn(A,e){Ys[A]=Ys[A]||[],Ys[A].push(e)}function on(A,e){if(!Tp[A]){Tp[A]=!0;try{e()}catch(t){X&&N.error(`Error while instrumenting ${A}`,t)}}}function Qt(A,e){const t=A&&Ys[A];if(t)for(const n of t)try{n(e)}catch(i){X&&N.error(`Error while triggering instrumentation handler.
112
112
  Type: ${A}
113
113
  Name: ${_A(n)}
114
- Error:`,i)}}let nl=null;function BQ(A){const e="error";rn(e,A),sn(e,vQ)}function vQ(){nl=Ae.onerror,Ae.onerror=function(A,e,t,n,i){return Qt("error",{column:n,error:i,line:t,msg:A,url:e}),nl?nl.apply(this,arguments):!1},Ae.onerror.__SENTRY_INSTRUMENTED__=!0}let il=null;function CQ(A){const e="unhandledrejection";rn(e,A),sn(e,wQ)}function wQ(){il=Ae.onunhandledrejection,Ae.onunhandledrejection=function(A){return Qt("unhandledrejection",A),il?il.apply(this,arguments):!0},Ae.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function yQ(A){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=A||Ge()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const rl="production",bQ=/^o(\d+)\./,EQ=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function SQ(A){return A==="http"||A==="https"}function zs(A,e=!1){const{host:t,path:n,pass:i,port:r,projectId:s,protocol:o,publicKey:a}=A;return`${o}://${a}${e&&i?`:${i}`:""}@${t}${r?`:${r}`:""}/${n&&`${n}/`}${s}`}function UQ(A){const e=EQ.exec(A);if(!e){Ws(()=>{console.error(`Invalid Sentry Dsn: ${A}`)});return}const[t,n,i="",r="",s="",o=""]=e.slice(1);let a="",c=o;const l=c.split("/");if(l.length>1&&(a=l.slice(0,-1).join("/"),c=l.pop()),c){const u=c.match(/^\d+/);u&&(c=u[0])}return Qp({host:r,pass:i,path:a,projectId:c,port:s,protocol:t,publicKey:n})}function Qp(A){return{protocol:A.protocol,publicKey:A.publicKey||"",pass:A.pass||"",host:A.host,port:A.port||"",path:A.path||"",projectId:A.projectId}}function TQ(A){if(!X)return!0;const{port:e,projectId:t,protocol:n}=A;return["protocol","publicKey","host","projectId"].find(s=>A[s]?!1:(N.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:t.match(/^\d+$/)?SQ(n)?e&&isNaN(parseInt(e,10))?(N.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(N.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(N.error(`Invalid Sentry Dsn: Invalid projectId ${t}`),!1)}function QQ(A){return A.match(bQ)?.[1]}function FQ(A){const e=typeof A=="string"?UQ(A):Qp(A);if(!(!e||!TQ(e)))return e}const kQ="_frozenDsc";function Fp(A,e){const t=e.getOptions(),{publicKey:n,host:i}=e.getDsn()||{};let r;t.orgId?r=String(t.orgId):i&&(r=QQ(i));const s={environment:t.environment||rl,release:t.release,public_key:n,trace_id:A,org_id:r};return e.emit("createDsc",s),s}function IQ(A,e){const t=e.getPropagationContext();return t.dsc||Fp(t.traceId,A)}function _Q(A){const e=Ge();if(!e)return{};const t=wp(A),n=tl(t),i=n.data,r=t.spanContext().traceState,s=r?.get("sentry.sample_rate")??i[qT]??i[YT];function o(f){return(typeof s=="number"||typeof s=="string")&&(f.sample_rate=`${s}`),f}const a=t[kQ];if(a)return o(a);const c=r?.get("sentry.dsc"),l=c&&oQ(c);if(l)return o(l);const u=Fp(A.spanContext().traceId,e),d=i[XT],h=n.description;return d!=="url"&&h&&(u.transaction=h),yQ()&&(u.sampled=String(hQ(t)),u.sample_rand=r?.get("sentry.sample_rand")??gp(t).scope?.getPropagationContext().sampleRand.toString()),o(u),e.emit("createDsc",u,t),u}function Zt(A,e=100,t=1/0){try{return sl("",A,e,t)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function kp(A,e=3,t=100*1024){const n=Zt(A,e);return LQ(n)>t?kp(A,e-1,t):n}function sl(A,e,t=1/0,n=1/0,i=DQ()){const[r,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const o=xQ(A,e);if(!o.startsWith("[object "))return o;if(e.__sentry_skip_normalization__)return e;const a=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:t;if(a===0)return o.replace("object ","");if(r(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{const h=c.toJSON();return sl("",h,a-1,n,i)}catch{}const l=Array.isArray(e)?[]:{};let u=0;const d=tp(e);for(const h in d){if(!Object.prototype.hasOwnProperty.call(d,h))continue;if(u>=n){l[h]="[MaxProperties ~]";break}const f=d[h];l[h]=sl(h,f,a-1,n,i),u++}return s(e),l}function xQ(A,e){try{if(A==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(A==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(qg(e))return"[VueViewModel]";if(ST(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${_A(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const t=RQ(e);return/^HTML(\w*)Element$/.test(t)?`[HTMLElement: ${t}]`:`[object ${t}]`}catch(t){return`**non-serializable** (${t})`}}function RQ(A){const e=Object.getPrototypeOf(A);return e?.constructor?e.constructor.name:"null prototype"}function PQ(A){return~-encodeURI(A).split(/%..|./).length}function LQ(A){return PQ(JSON.stringify(A))}function DQ(){const A=new WeakSet;function e(n){return A.has(n)?!0:(A.add(n),!1)}function t(n){A.delete(n)}return[e,t]}function Mi(A,e=[]){return[A,e]}function OQ(A,e){const[t,n]=A;return[t,[...n,e]]}function Ip(A,e){const t=A[1];for(const n of t){const i=n[0].type;if(e(n,i))return!0}return!1}function ol(A){const e=Ks(Ae);return e.encodePolyfill?e.encodePolyfill(A):new TextEncoder().encode(A)}function HQ(A){const[e,t]=A;let n=JSON.stringify(e);function i(r){typeof n=="string"?n=typeof r=="string"?n+r:[ol(n),r]:n.push(typeof r=="string"?ol(r):r)}for(const r of t){const[s,o]=r;if(i(`
114
+ Error:`,i)}}let nl=null;function BQ(A){const e="error";sn(e,A),on(e,vQ)}function vQ(){nl=Ae.onerror,Ae.onerror=function(A,e,t,n,i){return Qt("error",{column:n,error:i,line:t,msg:A,url:e}),nl?nl.apply(this,arguments):!1},Ae.onerror.__SENTRY_INSTRUMENTED__=!0}let il=null;function CQ(A){const e="unhandledrejection";sn(e,A),on(e,wQ)}function wQ(){il=Ae.onunhandledrejection,Ae.onunhandledrejection=function(A){return Qt("unhandledrejection",A),il?il.apply(this,arguments):!0},Ae.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function yQ(A){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=A||Ve()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const rl="production",bQ=/^o(\d+)\./,EQ=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function SQ(A){return A==="http"||A==="https"}function zs(A,e=!1){const{host:t,path:n,pass:i,port:r,projectId:s,protocol:o,publicKey:a}=A;return`${o}://${a}${e&&i?`:${i}`:""}@${t}${r?`:${r}`:""}/${n&&`${n}/`}${s}`}function UQ(A){const e=EQ.exec(A);if(!e){Ws(()=>{console.error(`Invalid Sentry Dsn: ${A}`)});return}const[t,n,i="",r="",s="",o=""]=e.slice(1);let a="",c=o;const l=c.split("/");if(l.length>1&&(a=l.slice(0,-1).join("/"),c=l.pop()),c){const u=c.match(/^\d+/);u&&(c=u[0])}return Qp({host:r,pass:i,path:a,projectId:c,port:s,protocol:t,publicKey:n})}function Qp(A){return{protocol:A.protocol,publicKey:A.publicKey||"",pass:A.pass||"",host:A.host,port:A.port||"",path:A.path||"",projectId:A.projectId}}function TQ(A){if(!X)return!0;const{port:e,projectId:t,protocol:n}=A;return["protocol","publicKey","host","projectId"].find(s=>A[s]?!1:(N.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:t.match(/^\d+$/)?SQ(n)?e&&isNaN(parseInt(e,10))?(N.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(N.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(N.error(`Invalid Sentry Dsn: Invalid projectId ${t}`),!1)}function QQ(A){return A.match(bQ)?.[1]}function FQ(A){const e=typeof A=="string"?UQ(A):Qp(A);if(!(!e||!TQ(e)))return e}const kQ="_frozenDsc";function Fp(A,e){const t=e.getOptions(),{publicKey:n,host:i}=e.getDsn()||{};let r;t.orgId?r=String(t.orgId):i&&(r=QQ(i));const s={environment:t.environment||rl,release:t.release,public_key:n,trace_id:A,org_id:r};return e.emit("createDsc",s),s}function IQ(A,e){const t=e.getPropagationContext();return t.dsc||Fp(t.traceId,A)}function _Q(A){const e=Ve();if(!e)return{};const t=wp(A),n=tl(t),i=n.data,r=t.spanContext().traceState,s=r?.get("sentry.sample_rate")??i[qT]??i[YT];function o(f){return(typeof s=="number"||typeof s=="string")&&(f.sample_rate=`${s}`),f}const a=t[kQ];if(a)return o(a);const c=r?.get("sentry.dsc"),l=c&&oQ(c);if(l)return o(l);const u=Fp(A.spanContext().traceId,e),d=i[XT],h=n.description;return d!=="url"&&h&&(u.transaction=h),yQ()&&(u.sampled=String(hQ(t)),u.sample_rand=r?.get("sentry.sample_rand")??gp(t).scope?.getPropagationContext().sampleRand.toString()),o(u),e.emit("createDsc",u,t),u}function eA(A,e=100,t=1/0){try{return sl("",A,e,t)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function kp(A,e=3,t=100*1024){const n=eA(A,e);return LQ(n)>t?kp(A,e-1,t):n}function sl(A,e,t=1/0,n=1/0,i=DQ()){const[r,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const o=xQ(A,e);if(!o.startsWith("[object "))return o;if(e.__sentry_skip_normalization__)return e;const a=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:t;if(a===0)return o.replace("object ","");if(r(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{const h=c.toJSON();return sl("",h,a-1,n,i)}catch{}const l=Array.isArray(e)?[]:{};let u=0;const d=tp(e);for(const h in d){if(!Object.prototype.hasOwnProperty.call(d,h))continue;if(u>=n){l[h]="[MaxProperties ~]";break}const f=d[h];l[h]=sl(h,f,a-1,n,i),u++}return s(e),l}function xQ(A,e){try{if(A==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(A==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(qg(e))return"[VueViewModel]";if(ST(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${_A(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const t=RQ(e);return/^HTML(\w*)Element$/.test(t)?`[HTMLElement: ${t}]`:`[object ${t}]`}catch(t){return`**non-serializable** (${t})`}}function RQ(A){const e=Object.getPrototypeOf(A);return e?.constructor?e.constructor.name:"null prototype"}function PQ(A){return~-encodeURI(A).split(/%..|./).length}function LQ(A){return PQ(JSON.stringify(A))}function DQ(){const A=new WeakSet;function e(n){return A.has(n)?!0:(A.add(n),!1)}function t(n){A.delete(n)}return[e,t]}function Mi(A,e=[]){return[A,e]}function OQ(A,e){const[t,n]=A;return[t,[...n,e]]}function Ip(A,e){const t=A[1];for(const n of t){const i=n[0].type;if(e(n,i))return!0}return!1}function ol(A){const e=Ks(Ae);return e.encodePolyfill?e.encodePolyfill(A):new TextEncoder().encode(A)}function HQ(A){const[e,t]=A;let n=JSON.stringify(e);function i(r){typeof n=="string"?n=typeof r=="string"?n+r:[ol(n),r]:n.push(typeof r=="string"?ol(r):r)}for(const r of t){const[s,o]=r;if(i(`
115
115
  ${JSON.stringify(s)}
116
- `),typeof o=="string"||o instanceof Uint8Array)i(o);else{let a;try{a=JSON.stringify(o)}catch{a=JSON.stringify(Zt(o))}i(a)}}return typeof n=="string"?n:MQ(n)}function MQ(A){const e=A.reduce((i,r)=>i+r.length,0),t=new Uint8Array(e);let n=0;for(const i of A)t.set(i,n),n+=i.length;return t}function NQ(A){const e=typeof A.data=="string"?ol(A.data):A.data;return[{type:"attachment",length:e.length,filename:A.filename,content_type:A.contentType,attachment_type:A.attachmentType},e]}const KQ={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function _p(A){return KQ[A]}function xp(A){if(!A?.sdk)return;const{name:e,version:t}=A.sdk;return{name:e,version:t}}function GQ(A,e,t,n){const i=A.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:A.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!t&&n&&{dsn:zs(n)},...i&&{trace:i}}}function VQ(A,e){return e&&(A.sdk=A.sdk||{},A.sdk.name=A.sdk.name||e.name,A.sdk.version=A.sdk.version||e.version,A.sdk.integrations=[...A.sdk.integrations||[],...e.integrations||[]],A.sdk.packages=[...A.sdk.packages||[],...e.packages||[]]),A}function jQ(A,e,t,n){const i=xp(t),r={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!n&&e&&{dsn:zs(e)}},s="aggregates"in A?[{type:"sessions"},A]:[{type:"session"},A.toJSON()];return Mi(r,[s])}function $Q(A,e,t,n){const i=xp(t),r=A.type&&A.type!=="replay_event"?A.type:"event";VQ(A,t?.sdk);const s=GQ(A,i,n,e);return delete A.sdkProcessingMetadata,Mi(s,[[{type:r},A]])}var eA;(function(A){A[A.PENDING=0]="PENDING";const t=1;A[A.RESOLVED=t]="RESOLVED";const n=2;A[A.REJECTED=n]="REJECTED"})(eA||(eA={}));function on(A){return new xA(e=>{e(A)})}function Zs(A){return new xA((e,t)=>{t(A)})}class xA{constructor(e){this._state=eA.PENDING,this._handlers=[],this._runExecutor(e)}then(e,t){return new xA((n,i)=>{this._handlers.push([!1,r=>{if(!e)n(r);else try{n(e(r))}catch(s){i(s)}},r=>{if(!t)i(r);else try{n(t(r))}catch(s){i(s)}}]),this._executeHandlers()})}catch(e){return this.then(t=>t,e)}finally(e){return new xA((t,n)=>{let i,r;return this.then(s=>{r=!1,i=s,e&&e()},s=>{r=!0,i=s,e&&e()}).then(()=>{if(r){n(i);return}t(i)})})}_executeHandlers(){if(this._state===eA.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(t=>{t[0]||(this._state===eA.RESOLVED&&t[1](this._value),this._state===eA.REJECTED&&t[2](this._value),t[0]=!0)})}_runExecutor(e){const t=(r,s)=>{if(this._state===eA.PENDING){if(js(s)){s.then(n,i);return}this._state=r,this._value=s,this._executeHandlers()}},n=r=>{t(eA.RESOLVED,r)},i=r=>{t(eA.REJECTED,r)};try{e(n,i)}catch(r){i(r)}}}function al(A,e,t,n=0){return new xA((i,r)=>{const s=A[n];if(e===null||typeof s!="function")i(e);else{const o=s({...e},t);X&&s.id&&o===null&&N.log(`Event processor "${s.id}" dropped event`),js(o)?o.then(a=>al(A,a,t,n+1).then(i)).then(null,r):al(A,o,t,n+1).then(i).then(null,r)}})}let eo,Rp,to;function WQ(A){const e=Ae._sentryDebugIds;if(!e)return{};const t=Object.keys(e);return to&&t.length===Rp||(Rp=t.length,to=t.reduce((n,i)=>{eo||(eo={});const r=eo[i];if(r)n[r[0]]=r[1];else{const s=A(i);for(let o=s.length-1;o>=0;o--){const c=s[o]?.filename,l=e[i];if(c&&l){n[c]=l,eo[i]=[c,l];break}}}return n},{})),to}function JQ(A,e){const{fingerprint:t,span:n,breadcrumbs:i,sdkProcessingMetadata:r}=e;XQ(A,e),n&&zQ(A,n),ZQ(A,t),qQ(A,i),YQ(A,r)}function Pp(A,e){const{extra:t,tags:n,user:i,contexts:r,level:s,sdkProcessingMetadata:o,breadcrumbs:a,fingerprint:c,eventProcessors:l,attachments:u,propagationContext:d,transactionName:h,span:f}=e;Ao(A,"extra",t),Ao(A,"tags",n),Ao(A,"user",i),Ao(A,"contexts",r),A.sdkProcessingMetadata=Oi(A.sdkProcessingMetadata,o,2),s&&(A.level=s),h&&(A.transactionName=h),f&&(A.span=f),a.length&&(A.breadcrumbs=[...A.breadcrumbs,...a]),c.length&&(A.fingerprint=[...A.fingerprint,...c]),l.length&&(A.eventProcessors=[...A.eventProcessors,...l]),u.length&&(A.attachments=[...A.attachments,...u]),A.propagationContext={...A.propagationContext,...d}}function Ao(A,e,t){A[e]=Oi(A[e],t,1)}function XQ(A,e){const{extra:t,tags:n,user:i,contexts:r,level:s,transactionName:o}=e;Object.keys(t).length&&(A.extra={...t,...A.extra}),Object.keys(n).length&&(A.tags={...n,...A.tags}),Object.keys(i).length&&(A.user={...i,...A.user}),Object.keys(r).length&&(A.contexts={...r,...A.contexts}),s&&(A.level=s),o&&A.type!=="transaction"&&(A.transaction=o)}function qQ(A,e){const t=[...A.breadcrumbs||[],...e];A.breadcrumbs=t.length?t:void 0}function YQ(A,e){A.sdkProcessingMetadata={...A.sdkProcessingMetadata,...e}}function zQ(A,e){A.contexts={trace:cQ(e),...A.contexts},A.sdkProcessingMetadata={dynamicSamplingContext:_Q(e),...A.sdkProcessingMetadata};const t=wp(e),n=tl(t).description;n&&!A.transaction&&A.type==="transaction"&&(A.transaction=n)}function ZQ(A,e){A.fingerprint=A.fingerprint?Array.isArray(A.fingerprint)?A.fingerprint:[A.fingerprint]:[],e&&(A.fingerprint=A.fingerprint.concat(e)),A.fingerprint.length||delete A.fingerprint}function eF(A,e,t,n,i,r){const{normalizeDepth:s=3,normalizeMaxBreadth:o=1e3}=A,a={...e,event_id:e.event_id||t.event_id||ht(),timestamp:e.timestamp||Di()},c=t.integrations||A.integrations.map(p=>p.name);tF(a,A),iF(a,c),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&AF(a,A.stackParser);const l=sF(n,t.captureContext);t.mechanism&&Mn(a,t.mechanism);const u=i?i.getEventProcessors():[],d=WT().getScopeData();if(r){const p=r.getScopeData();Pp(d,p)}if(l){const p=l.getScopeData();Pp(d,p)}const h=[...t.attachments||[],...d.attachments];h.length&&(t.attachments=h),JQ(a,d);const f=[...u,...d.eventProcessors];return al(f,a,t).then(p=>(p&&nF(p),typeof s=="number"&&s>0?rF(p,s,o):p))}function tF(A,e){const{environment:t,release:n,dist:i,maxValueLength:r=250}=e;A.environment=A.environment||t||rl,!A.release&&n&&(A.release=n),!A.dist&&i&&(A.dist=i);const s=A.request;s?.url&&(s.url=Js(s.url,r))}function AF(A,e){const t=WQ(e);A.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=t[i.filename])})})}function nF(A){const e={};if(A.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(e).length===0)return;A.debug_meta=A.debug_meta||{},A.debug_meta.images=A.debug_meta.images||[];const t=A.debug_meta.images;Object.entries(e).forEach(([n,i])=>{t.push({type:"sourcemap",code_file:n,debug_id:i})})}function iF(A,e){e.length>0&&(A.sdk=A.sdk||{},A.sdk.integrations=[...A.sdk.integrations||[],...e])}function rF(A,e,t){if(!A)return null;const n={...A,...A.breadcrumbs&&{breadcrumbs:A.breadcrumbs.map(i=>({...i,...i.data&&{data:Zt(i.data,e,t)}}))},...A.user&&{user:Zt(A.user,e,t)},...A.contexts&&{contexts:Zt(A.contexts,e,t)},...A.extra&&{extra:Zt(A.extra,e,t)}};return A.contexts?.trace&&n.contexts&&(n.contexts.trace=A.contexts.trace,A.contexts.trace.data&&(n.contexts.trace.data=Zt(A.contexts.trace.data,e,t))),A.spans&&(n.spans=A.spans.map(i=>({...i,...i.data&&{data:Zt(i.data,e,t)}}))),A.contexts?.flags&&n.contexts&&(n.contexts.flags=Zt(A.contexts.flags,3,t)),n}function sF(A,e){if(!e)return A;const t=A?A.clone():new Tt;return t.update(e),t}function oF(A){if(A)return aF(A)?{captureContext:A}:lF(A)?{captureContext:A}:A}function aF(A){return A instanceof Tt||typeof A=="function"}const cF=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function lF(A){return Object.keys(A).some(e=>cF.includes(e))}function uF(A,e){return Gn().captureException(A,oF(e))}function Lp(A,e){return Gn().captureEvent(A,e)}function Dp(A){const e=Hi(),t=Gn(),{userAgent:n}=Ae.navigator||{},i=DT({user:t.getUser()||e.getUser(),...n&&{userAgent:n},...A}),r=e.getSession();return r?.status==="ok"&&Nn(r,{status:"exited"}),Op(),e.setSession(i),i}function Op(){const A=Hi(),t=Gn().getSession()||A.getSession();t&&OT(t),Hp(),A.setSession()}function Hp(){const A=Hi(),e=Ge(),t=A.getSession();t&&e&&e.captureSession(t)}function Mp(A=!1){if(A){Op();return}Hp()}const dF="7";function hF(A){const e=A.protocol?`${A.protocol}:`:"",t=A.port?`:${A.port}`:"";return`${e}//${A.host}${t}${A.path?`/${A.path}`:""}/api/`}function fF(A){return`${hF(A)}${A.projectId}/envelope/`}function gF(A,e){const t={sentry_version:dF};return A.publicKey&&(t.sentry_key=A.publicKey),e&&(t.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(t).toString()}function pF(A,e,t){return e||`${fF(A)}?${gF(A,t)}`}const Np=[];function mF(A,e){const t={};return e.forEach(n=>{n&&Gp(A,n,t)}),t}function Kp(A,e){for(const t of e)t?.afterAllSetup&&t.afterAllSetup(A)}function Gp(A,e,t){if(t[e.name]){X&&N.log(`Integration skipped because it was already installed: ${e.name}`);return}if(t[e.name]=e,Np.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Np.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(A),typeof e.preprocessEvent=="function"){const n=e.preprocessEvent.bind(e);A.on("preprocessEvent",(i,r)=>n(i,r,A))}if(typeof e.processEvent=="function"){const n=e.processEvent.bind(e),i=Object.assign((r,s)=>n(r,s,A),{id:e.name});A.addEventProcessor(i)}X&&N.log(`Integration installed: ${e.name}`)}function __(A){return A}function Vp(A){const e=[];A.message&&e.push(A.message);try{const t=A.exception.values[A.exception.values.length-1];t?.value&&(e.push(t.value),t.type&&e.push(`${t.type}: ${t.value}`))}catch{}return e}function BF(A){const{trace_id:e,parent_span_id:t,span_id:n,status:i,origin:r,data:s,op:o}=A.contexts?.trace??{};return{data:s??{},description:A.transaction,op:o,parent_span_id:t,span_id:n??"",start_timestamp:A.start_timestamp??0,status:i,timestamp:A.timestamp,trace_id:e??"",origin:r,profile_id:s?.[hp],exclusive_time:s?.[fp],measurements:A.measurements,is_segment:!0}}function vF(A){return{type:"transaction",timestamp:A.timestamp,start_timestamp:A.start_timestamp,transaction:A.description,contexts:{trace:{trace_id:A.trace_id,span_id:A.span_id,parent_span_id:A.parent_span_id,op:A.op,status:A.status,origin:A.origin,data:{...A.data,...A.profile_id&&{[hp]:A.profile_id},...A.exclusive_time&&{[fp]:A.exclusive_time}}}},measurements:A.measurements}}function CF(A,e,t){const n=[{type:"client_report"},{timestamp:t||Di(),discarded_events:A}];return Mi(e?{dsn:e}:{},[n])}const jp="Not capturing exception because it's already been captured.",$p="Discarded session because of missing or non-string release",Wp=Symbol.for("SentryInternalError"),Jp=Symbol.for("SentryDoNotSendEventError");function no(A){return{message:A,[Wp]:!0}}function cl(A){return{message:A,[Jp]:!0}}function Xp(A){return!!A&&typeof A=="object"&&Wp in A}function qp(A){return!!A&&typeof A=="object"&&Jp in A}class wF{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=FQ(e.dsn):X&&N.warn("No DSN provided, client will not send events."),this._dsn){const t=pF(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,n){const i=ht();if(rp(e))return X&&N.log(jp),i;const r={event_id:i,...t};return this._process(this.eventFromException(e,r).then(s=>this._captureEvent(s,r,n))),r.event_id}captureMessage(e,t,n,i){const r={event_id:ht(),...n},s=Wc(e)?e:String(e),o=Jc(e)?this.eventFromMessage(s,t,r):this.eventFromException(e,r);return this._process(o.then(a=>this._captureEvent(a,r,i))),r.event_id}captureEvent(e,t,n){const i=ht();if(t?.originalException&&rp(t.originalException))return X&&N.log(jp),i;const r={event_id:i,...t},s=e.sdkProcessingMetadata||{},o=s.capturedSpanScope,a=s.capturedSpanIsolationScope;return this._process(this._captureEvent(e,r,o||n,a)),r.event_id}captureSession(e){this.sendSession(e),Nn(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.emit("flush"),this._isClientDoneProcessing(e).then(n=>t.flush(e).then(i=>n&&i))):on(!0)}close(e){return this.flush(e).then(t=>(this.getOptions().enabled=!1,this.emit("close"),t))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];Gp(this,e,this._integrations),t||Kp(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=$Q(e,this._dsn,this._options._metadata,this._options.tunnel);for(const r of t.attachments||[])n=OQ(n,NQ(r));const i=this.sendEnvelope(n);i&&i.then(r=>this.emit("afterSendEvent",e,r),null)}sendSession(e){const{release:t,environment:n=rl}=this._options;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t){X&&N.warn($p);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){X&&N.warn($p);return}e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const i=jQ(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){const i=`${e}:${t}`;X&&N.log(`Recording outcome: "${i}"${n>1?` (${n} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+n}}on(e,t){const n=this._hooks[e]=this._hooks[e]||[];return n.push(t),()=>{const i=n.indexOf(t);i>-1&&n.splice(i,1)}}emit(e,...t){const n=this._hooks[e];n&&n.forEach(i=>i(...t))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,t=>(X&&N.error("Error while sending envelope:",t),t)):(X&&N.error("Transport disabled"),on({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=mF(this,e),Kp(this,e)}_updateSessionFromEvent(e,t){let n=t.level==="fatal",i=!1;const r=t.exception?.values;if(r){i=!0;for(const a of r)if(a.mechanism?.handled===!1){n=!0;break}}const s=e.status==="ok";(s&&e.errors===0||s&&n)&&(Nn(e,{...n&&{status:"crashed"},errors:e.errors||Number(i||n)}),this.captureSession(e))}_isClientDoneProcessing(e){return new xA(t=>{let n=0;const i=1,r=setInterval(()=>{this._numProcessing==0?(clearInterval(r),t(!0)):(n+=i,e&&n>=e&&(clearInterval(r),t(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,i){const r=this.getOptions(),s=Object.keys(this._integrations);return!t.integrations&&s?.length&&(t.integrations=s),this.emit("preprocessEvent",e,t),e.type||i.setLastEventId(e.event_id||t.event_id),eF(r,e,t,n,this,i).then(o=>{if(o===null)return o;this.emit("postprocessEvent",o,t),o.contexts={trace:JT(n),...o.contexts};const a=IQ(this,n);return o.sdkProcessingMetadata={dynamicSamplingContext:a,...o.sdkProcessingMetadata},o})}_captureEvent(e,t={},n=Gn(),i=Hi()){return X&&ll(e)&&N.log(`Captured error event \`${Vp(e)[0]||"<unknown>"}\``),this._processEvent(e,t,n,i).then(r=>r.event_id,r=>{X&&(qp(r)?N.log(r.message):Xp(r)?N.warn(r.message):N.warn(r))})}_processEvent(e,t,n,i){const r=this.getOptions(),{sampleRate:s}=r,o=Yp(e),a=ll(e),c=e.type||"error",l=`before send for type \`${c}\``,u=typeof s>"u"?void 0:iQ(s);if(a&&typeof u=="number"&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error"),Zs(cl(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));const d=c==="replay_event"?"replay":c;return this._prepareEvent(e,t,n,i).then(h=>{if(h===null)throw this.recordDroppedEvent("event_processor",d),cl("An event processor returned `null`, will not send event.");if(t.data&&t.data.__sentry__===!0)return h;const g=bF(this,r,h,t);return yF(g,l)}).then(h=>{if(h===null){if(this.recordDroppedEvent("before_send",d),o){const B=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",B)}throw cl(`${l} returned \`null\`, will not send event.`)}const f=n.getSession()||i.getSession();if(a&&f&&this._updateSessionFromEvent(f,h),o){const p=h.sdkProcessingMetadata?.spanCountBeforeProcessing||0,B=h.spans?h.spans.length:0,y=p-B;y>0&&this.recordDroppedEvent("before_send","span",y)}const g=h.transaction_info;if(o&&g&&h.transaction!==e.transaction){const p="custom";h.transaction_info={...g,source:p}}return this.sendEvent(h,t),h}).then(null,h=>{throw qp(h)||Xp(h)?h:(this.captureException(h,{data:{__sentry__:!0},originalException:h}),no(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
117
- Reason: ${h}`))})}_process(e){this._numProcessing++,e.then(t=>(this._numProcessing--,t),t=>(this._numProcessing--,t))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([t,n])=>{const[i,r]=t.split(":");return{reason:i,category:r,quantity:n}})}_flushOutcomes(){X&&N.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){X&&N.log("No outcomes to send");return}if(!this._dsn){X&&N.log("No dsn provided, will not send outcomes");return}X&&N.log("Sending outcomes:",e);const t=CF(e,this._options.tunnel&&zs(this._dsn));this.sendEnvelope(t)}}function yF(A,e){const t=`${e} must return \`null\` or a valid event.`;if(js(A))return A.then(n=>{if(!Li(n)&&n!==null)throw no(t);return n},n=>{throw no(`${e} rejected with ${n}`)});if(!Li(A)&&A!==null)throw no(t);return A}function bF(A,e,t,n){const{beforeSend:i,beforeSendTransaction:r,beforeSendSpan:s}=e;let o=t;if(ll(o)&&i)return i(o,n);if(Yp(o)){if(s){const a=s(BF(o));if(a?o=Oi(t,vF(a)):yp(),o.spans){const c=[];for(const l of o.spans){const u=s(l);u?c.push(u):(yp(),c.push(l))}o.spans=c}}if(r){if(o.spans){const a=o.spans.length;o.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:a}}return r(o,n)}}return o}function ll(A){return A.type===void 0}function Yp(A){return A.type==="transaction"}function EF(A){return[{type:"log",item_count:A.length,content_type:"application/vnd.sentry.items.log+json"},{items:A}]}function SF(A,e,t,n){const i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),t&&n&&(i.dsn=zs(n)),Mi(i,[EF(A)])}Ae._sentryClientToLogBufferMap=new WeakMap;function ul(A,e){const t=e??UF(A)??[];if(t.length===0)return;const n=A.getOptions(),i=SF(t,n._metadata,n.tunnel,A.getDsn());Ae._sentryClientToLogBufferMap?.set(A,[]),A.emit("flushLogs"),A.sendEnvelope(i)}function UF(A){return Ae._sentryClientToLogBufferMap?.get(A)}const zp=Symbol.for("SentryBufferFullError");function TF(A){const e=[];function t(){return A===void 0||e.length<A}function n(s){return e.splice(e.indexOf(s),1)[0]||Promise.resolve(void 0)}function i(s){if(!t())return Zs(zp);const o=s();return e.indexOf(o)===-1&&e.push(o),o.then(()=>n(o)).then(null,()=>n(o).then(null,()=>{})),o}function r(s){return new xA((o,a)=>{let c=e.length;if(!c)return o(!0);const l=setTimeout(()=>{s&&s>0&&o(!1)},s);e.forEach(u=>{on(u).then(()=>{--c||(clearTimeout(l),o(!0))},a)})})}return{$:e,add:i,drain:r}}const QF=60*1e3;function FF(A,e=Date.now()){const t=parseInt(`${A}`,10);if(!isNaN(t))return t*1e3;const n=Date.parse(`${A}`);return isNaN(n)?QF:n-e}function kF(A,e){return A[e]||A.all||0}function IF(A,e,t=Date.now()){return kF(A,e)>t}function _F(A,{statusCode:e,headers:t},n=Date.now()){const i={...A},r=t?.["x-sentry-rate-limits"],s=t?.["retry-after"];if(r)for(const o of r.trim().split(",")){const[a,c,,,l]=o.split(":",5),u=parseInt(a,10),d=(isNaN(u)?60:u)*1e3;if(!c)i.all=n+d;else for(const h of c.split(";"))h==="metric_bucket"?(!l||l.split(";").includes("custom"))&&(i[h]=n+d):i[h]=n+d}else s?i.all=n+FF(s,n):e===429&&(i.all=n+60*1e3);return i}const xF=64;function RF(A,e,t=TF(A.bufferSize||xF)){let n={};const i=s=>t.drain(s);function r(s){const o=[];if(Ip(s,(u,d)=>{const h=_p(d);IF(n,h)?A.recordDroppedEvent("ratelimit_backoff",h):o.push(u)}),o.length===0)return on({});const a=Mi(s[0],o),c=u=>{Ip(a,(d,h)=>{A.recordDroppedEvent(u,_p(h))})},l=()=>e({body:HQ(a)}).then(u=>(u.statusCode!==void 0&&(u.statusCode<200||u.statusCode>=300)&&X&&N.warn(`Sentry responded with status code ${u.statusCode} to sent event.`),n=_F(n,u),u),u=>{throw c("network_error"),X&&N.error("Encountered error running transport request:",u),u});return t.add(l).then(u=>u,u=>{if(u===zp)return X&&N.error("Skipped sending event because buffer is full."),c("queue_overflow"),on({});throw u})}return{send:r,flush:i}}function PF(A){A.user?.ip_address===void 0&&(A.user={...A.user,ip_address:"{{auto}}"})}function LF(A){"aggregates"in A?A.attrs?.ip_address===void 0&&(A.attrs={...A.attrs,ip_address:"{{auto}}"}):A.ipAddress===void 0&&(A.ipAddress="{{auto}}")}function DF(A,e,t=[e],n="npm"){const i=A._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:t.map(r=>({name:`${n}:@sentry/${r}`,version:en})),version:en}),A._metadata=i}const OF=100;function an(A,e){const t=Ge(),n=Hi();if(!t)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:r=OF}=t.getOptions();if(r<=0)return;const o={timestamp:Di(),...A},a=i?Ws(()=>i(o,e)):o;a!==null&&(t.emit&&t.emit("beforeAddBreadcrumb",a,e),n.addBreadcrumb(a,r))}let Zp;const HF="FunctionToString",em=new WeakMap,MF=()=>({name:HF,setupOnce(){Zp=Function.prototype.toString;try{Function.prototype.toString=function(...A){const e=Yc(this),t=em.has(Ge())&&e!==void 0?e:this;return Zp.apply(t,A)}}catch{}},setup(A){em.set(A,!0)}}),NF=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],KF="EventFilters",GF=(A={})=>{let e;return{name:KF,setup(t){const n=t.getOptions();e=tm(A,n)},processEvent(t,n,i){if(!e){const r=i.getOptions();e=tm(A,r)}return jF(t,e)?null:t}}},VF=(A={})=>({...GF(A),name:"InboundFilters"});function tm(A={},e={}){return{allowUrls:[...A.allowUrls||[],...e.allowUrls||[]],denyUrls:[...A.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...A.ignoreErrors||[],...e.ignoreErrors||[],...A.disableErrorDefaults?[]:NF],ignoreTransactions:[...A.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function jF(A,e){if(A.type){if(A.type==="transaction"&&WF(A,e.ignoreTransactions))return X&&N.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
118
- Event: ${An(A)}`),!0}else{if($F(A,e.ignoreErrors))return X&&N.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
119
- Event: ${An(A)}`),!0;if(YF(A))return X&&N.warn(`Event dropped due to not having an error message, error type or stacktrace.
120
- Event: ${An(A)}`),!0;if(JF(A,e.denyUrls))return X&&N.warn(`Event dropped due to being matched by \`denyUrls\` option.
121
- Event: ${An(A)}.
116
+ `),typeof o=="string"||o instanceof Uint8Array)i(o);else{let a;try{a=JSON.stringify(o)}catch{a=JSON.stringify(eA(o))}i(a)}}return typeof n=="string"?n:MQ(n)}function MQ(A){const e=A.reduce((i,r)=>i+r.length,0),t=new Uint8Array(e);let n=0;for(const i of A)t.set(i,n),n+=i.length;return t}function NQ(A){const e=typeof A.data=="string"?ol(A.data):A.data;return[{type:"attachment",length:e.length,filename:A.filename,content_type:A.contentType,attachment_type:A.attachmentType},e]}const KQ={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function _p(A){return KQ[A]}function xp(A){if(!A?.sdk)return;const{name:e,version:t}=A.sdk;return{name:e,version:t}}function VQ(A,e,t,n){const i=A.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:A.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!t&&n&&{dsn:zs(n)},...i&&{trace:i}}}function GQ(A,e){return e&&(A.sdk=A.sdk||{},A.sdk.name=A.sdk.name||e.name,A.sdk.version=A.sdk.version||e.version,A.sdk.integrations=[...A.sdk.integrations||[],...e.integrations||[]],A.sdk.packages=[...A.sdk.packages||[],...e.packages||[]]),A}function jQ(A,e,t,n){const i=xp(t),r={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!n&&e&&{dsn:zs(e)}},s="aggregates"in A?[{type:"sessions"},A]:[{type:"session"},A.toJSON()];return Mi(r,[s])}function $Q(A,e,t,n){const i=xp(t),r=A.type&&A.type!=="replay_event"?A.type:"event";GQ(A,t?.sdk);const s=VQ(A,i,n,e);return delete A.sdkProcessingMetadata,Mi(s,[[{type:r},A]])}var tA;(function(A){A[A.PENDING=0]="PENDING";const t=1;A[A.RESOLVED=t]="RESOLVED";const n=2;A[A.REJECTED=n]="REJECTED"})(tA||(tA={}));function an(A){return new xA(e=>{e(A)})}function Zs(A){return new xA((e,t)=>{t(A)})}class xA{constructor(e){this._state=tA.PENDING,this._handlers=[],this._runExecutor(e)}then(e,t){return new xA((n,i)=>{this._handlers.push([!1,r=>{if(!e)n(r);else try{n(e(r))}catch(s){i(s)}},r=>{if(!t)i(r);else try{n(t(r))}catch(s){i(s)}}]),this._executeHandlers()})}catch(e){return this.then(t=>t,e)}finally(e){return new xA((t,n)=>{let i,r;return this.then(s=>{r=!1,i=s,e&&e()},s=>{r=!0,i=s,e&&e()}).then(()=>{if(r){n(i);return}t(i)})})}_executeHandlers(){if(this._state===tA.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(t=>{t[0]||(this._state===tA.RESOLVED&&t[1](this._value),this._state===tA.REJECTED&&t[2](this._value),t[0]=!0)})}_runExecutor(e){const t=(r,s)=>{if(this._state===tA.PENDING){if(js(s)){s.then(n,i);return}this._state=r,this._value=s,this._executeHandlers()}},n=r=>{t(tA.RESOLVED,r)},i=r=>{t(tA.REJECTED,r)};try{e(n,i)}catch(r){i(r)}}}function al(A,e,t,n=0){return new xA((i,r)=>{const s=A[n];if(e===null||typeof s!="function")i(e);else{const o=s({...e},t);X&&s.id&&o===null&&N.log(`Event processor "${s.id}" dropped event`),js(o)?o.then(a=>al(A,a,t,n+1).then(i)).then(null,r):al(A,o,t,n+1).then(i).then(null,r)}})}let eo,Rp,to;function WQ(A){const e=Ae._sentryDebugIds;if(!e)return{};const t=Object.keys(e);return to&&t.length===Rp||(Rp=t.length,to=t.reduce((n,i)=>{eo||(eo={});const r=eo[i];if(r)n[r[0]]=r[1];else{const s=A(i);for(let o=s.length-1;o>=0;o--){const c=s[o]?.filename,l=e[i];if(c&&l){n[c]=l,eo[i]=[c,l];break}}}return n},{})),to}function JQ(A,e){const{fingerprint:t,span:n,breadcrumbs:i,sdkProcessingMetadata:r}=e;XQ(A,e),n&&zQ(A,n),ZQ(A,t),qQ(A,i),YQ(A,r)}function Pp(A,e){const{extra:t,tags:n,user:i,contexts:r,level:s,sdkProcessingMetadata:o,breadcrumbs:a,fingerprint:c,eventProcessors:l,attachments:u,propagationContext:d,transactionName:h,span:f}=e;Ao(A,"extra",t),Ao(A,"tags",n),Ao(A,"user",i),Ao(A,"contexts",r),A.sdkProcessingMetadata=Oi(A.sdkProcessingMetadata,o,2),s&&(A.level=s),h&&(A.transactionName=h),f&&(A.span=f),a.length&&(A.breadcrumbs=[...A.breadcrumbs,...a]),c.length&&(A.fingerprint=[...A.fingerprint,...c]),l.length&&(A.eventProcessors=[...A.eventProcessors,...l]),u.length&&(A.attachments=[...A.attachments,...u]),A.propagationContext={...A.propagationContext,...d}}function Ao(A,e,t){A[e]=Oi(A[e],t,1)}function XQ(A,e){const{extra:t,tags:n,user:i,contexts:r,level:s,transactionName:o}=e;Object.keys(t).length&&(A.extra={...t,...A.extra}),Object.keys(n).length&&(A.tags={...n,...A.tags}),Object.keys(i).length&&(A.user={...i,...A.user}),Object.keys(r).length&&(A.contexts={...r,...A.contexts}),s&&(A.level=s),o&&A.type!=="transaction"&&(A.transaction=o)}function qQ(A,e){const t=[...A.breadcrumbs||[],...e];A.breadcrumbs=t.length?t:void 0}function YQ(A,e){A.sdkProcessingMetadata={...A.sdkProcessingMetadata,...e}}function zQ(A,e){A.contexts={trace:cQ(e),...A.contexts},A.sdkProcessingMetadata={dynamicSamplingContext:_Q(e),...A.sdkProcessingMetadata};const t=wp(e),n=tl(t).description;n&&!A.transaction&&A.type==="transaction"&&(A.transaction=n)}function ZQ(A,e){A.fingerprint=A.fingerprint?Array.isArray(A.fingerprint)?A.fingerprint:[A.fingerprint]:[],e&&(A.fingerprint=A.fingerprint.concat(e)),A.fingerprint.length||delete A.fingerprint}function eF(A,e,t,n,i,r){const{normalizeDepth:s=3,normalizeMaxBreadth:o=1e3}=A,a={...e,event_id:e.event_id||t.event_id||ht(),timestamp:e.timestamp||Di()},c=t.integrations||A.integrations.map(p=>p.name);tF(a,A),iF(a,c),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&AF(a,A.stackParser);const l=sF(n,t.captureContext);t.mechanism&&Mn(a,t.mechanism);const u=i?i.getEventProcessors():[],d=WT().getScopeData();if(r){const p=r.getScopeData();Pp(d,p)}if(l){const p=l.getScopeData();Pp(d,p)}const h=[...t.attachments||[],...d.attachments];h.length&&(t.attachments=h),JQ(a,d);const f=[...u,...d.eventProcessors];return al(f,a,t).then(p=>(p&&nF(p),typeof s=="number"&&s>0?rF(p,s,o):p))}function tF(A,e){const{environment:t,release:n,dist:i,maxValueLength:r=250}=e;A.environment=A.environment||t||rl,!A.release&&n&&(A.release=n),!A.dist&&i&&(A.dist=i);const s=A.request;s?.url&&(s.url=Js(s.url,r))}function AF(A,e){const t=WQ(e);A.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=t[i.filename])})})}function nF(A){const e={};if(A.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(e).length===0)return;A.debug_meta=A.debug_meta||{},A.debug_meta.images=A.debug_meta.images||[];const t=A.debug_meta.images;Object.entries(e).forEach(([n,i])=>{t.push({type:"sourcemap",code_file:n,debug_id:i})})}function iF(A,e){e.length>0&&(A.sdk=A.sdk||{},A.sdk.integrations=[...A.sdk.integrations||[],...e])}function rF(A,e,t){if(!A)return null;const n={...A,...A.breadcrumbs&&{breadcrumbs:A.breadcrumbs.map(i=>({...i,...i.data&&{data:eA(i.data,e,t)}}))},...A.user&&{user:eA(A.user,e,t)},...A.contexts&&{contexts:eA(A.contexts,e,t)},...A.extra&&{extra:eA(A.extra,e,t)}};return A.contexts?.trace&&n.contexts&&(n.contexts.trace=A.contexts.trace,A.contexts.trace.data&&(n.contexts.trace.data=eA(A.contexts.trace.data,e,t))),A.spans&&(n.spans=A.spans.map(i=>({...i,...i.data&&{data:eA(i.data,e,t)}}))),A.contexts?.flags&&n.contexts&&(n.contexts.flags=eA(A.contexts.flags,3,t)),n}function sF(A,e){if(!e)return A;const t=A?A.clone():new Tt;return t.update(e),t}function oF(A){if(A)return aF(A)?{captureContext:A}:lF(A)?{captureContext:A}:A}function aF(A){return A instanceof Tt||typeof A=="function"}const cF=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function lF(A){return Object.keys(A).some(e=>cF.includes(e))}function uF(A,e){return Vn().captureException(A,oF(e))}function Lp(A,e){return Vn().captureEvent(A,e)}function Dp(A){const e=Hi(),t=Vn(),{userAgent:n}=Ae.navigator||{},i=DT({user:t.getUser()||e.getUser(),...n&&{userAgent:n},...A}),r=e.getSession();return r?.status==="ok"&&Nn(r,{status:"exited"}),Op(),e.setSession(i),i}function Op(){const A=Hi(),t=Vn().getSession()||A.getSession();t&&OT(t),Hp(),A.setSession()}function Hp(){const A=Hi(),e=Ve(),t=A.getSession();t&&e&&e.captureSession(t)}function Mp(A=!1){if(A){Op();return}Hp()}const dF="7";function hF(A){const e=A.protocol?`${A.protocol}:`:"",t=A.port?`:${A.port}`:"";return`${e}//${A.host}${t}${A.path?`/${A.path}`:""}/api/`}function fF(A){return`${hF(A)}${A.projectId}/envelope/`}function gF(A,e){const t={sentry_version:dF};return A.publicKey&&(t.sentry_key=A.publicKey),e&&(t.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(t).toString()}function pF(A,e,t){return e||`${fF(A)}?${gF(A,t)}`}const Np=[];function mF(A,e){const t={};return e.forEach(n=>{n&&Vp(A,n,t)}),t}function Kp(A,e){for(const t of e)t?.afterAllSetup&&t.afterAllSetup(A)}function Vp(A,e,t){if(t[e.name]){X&&N.log(`Integration skipped because it was already installed: ${e.name}`);return}if(t[e.name]=e,Np.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Np.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(A),typeof e.preprocessEvent=="function"){const n=e.preprocessEvent.bind(e);A.on("preprocessEvent",(i,r)=>n(i,r,A))}if(typeof e.processEvent=="function"){const n=e.processEvent.bind(e),i=Object.assign((r,s)=>n(r,s,A),{id:e.name});A.addEventProcessor(i)}X&&N.log(`Integration installed: ${e.name}`)}function _1(A){return A}function Gp(A){const e=[];A.message&&e.push(A.message);try{const t=A.exception.values[A.exception.values.length-1];t?.value&&(e.push(t.value),t.type&&e.push(`${t.type}: ${t.value}`))}catch{}return e}function BF(A){const{trace_id:e,parent_span_id:t,span_id:n,status:i,origin:r,data:s,op:o}=A.contexts?.trace??{};return{data:s??{},description:A.transaction,op:o,parent_span_id:t,span_id:n??"",start_timestamp:A.start_timestamp??0,status:i,timestamp:A.timestamp,trace_id:e??"",origin:r,profile_id:s?.[hp],exclusive_time:s?.[fp],measurements:A.measurements,is_segment:!0}}function vF(A){return{type:"transaction",timestamp:A.timestamp,start_timestamp:A.start_timestamp,transaction:A.description,contexts:{trace:{trace_id:A.trace_id,span_id:A.span_id,parent_span_id:A.parent_span_id,op:A.op,status:A.status,origin:A.origin,data:{...A.data,...A.profile_id&&{[hp]:A.profile_id},...A.exclusive_time&&{[fp]:A.exclusive_time}}}},measurements:A.measurements}}function CF(A,e,t){const n=[{type:"client_report"},{timestamp:t||Di(),discarded_events:A}];return Mi(e?{dsn:e}:{},[n])}const jp="Not capturing exception because it's already been captured.",$p="Discarded session because of missing or non-string release",Wp=Symbol.for("SentryInternalError"),Jp=Symbol.for("SentryDoNotSendEventError");function no(A){return{message:A,[Wp]:!0}}function cl(A){return{message:A,[Jp]:!0}}function Xp(A){return!!A&&typeof A=="object"&&Wp in A}function qp(A){return!!A&&typeof A=="object"&&Jp in A}class wF{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=FQ(e.dsn):X&&N.warn("No DSN provided, client will not send events."),this._dsn){const t=pF(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,n){const i=ht();if(rp(e))return X&&N.log(jp),i;const r={event_id:i,...t};return this._process(this.eventFromException(e,r).then(s=>this._captureEvent(s,r,n))),r.event_id}captureMessage(e,t,n,i){const r={event_id:ht(),...n},s=Wc(e)?e:String(e),o=Jc(e)?this.eventFromMessage(s,t,r):this.eventFromException(e,r);return this._process(o.then(a=>this._captureEvent(a,r,i))),r.event_id}captureEvent(e,t,n){const i=ht();if(t?.originalException&&rp(t.originalException))return X&&N.log(jp),i;const r={event_id:i,...t},s=e.sdkProcessingMetadata||{},o=s.capturedSpanScope,a=s.capturedSpanIsolationScope;return this._process(this._captureEvent(e,r,o||n,a)),r.event_id}captureSession(e){this.sendSession(e),Nn(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.emit("flush"),this._isClientDoneProcessing(e).then(n=>t.flush(e).then(i=>n&&i))):an(!0)}close(e){return this.flush(e).then(t=>(this.getOptions().enabled=!1,this.emit("close"),t))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];Vp(this,e,this._integrations),t||Kp(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=$Q(e,this._dsn,this._options._metadata,this._options.tunnel);for(const r of t.attachments||[])n=OQ(n,NQ(r));const i=this.sendEnvelope(n);i&&i.then(r=>this.emit("afterSendEvent",e,r),null)}sendSession(e){const{release:t,environment:n=rl}=this._options;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t){X&&N.warn($p);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){X&&N.warn($p);return}e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const i=jQ(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){const i=`${e}:${t}`;X&&N.log(`Recording outcome: "${i}"${n>1?` (${n} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+n}}on(e,t){const n=this._hooks[e]=this._hooks[e]||[];return n.push(t),()=>{const i=n.indexOf(t);i>-1&&n.splice(i,1)}}emit(e,...t){const n=this._hooks[e];n&&n.forEach(i=>i(...t))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,t=>(X&&N.error("Error while sending envelope:",t),t)):(X&&N.error("Transport disabled"),an({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=mF(this,e),Kp(this,e)}_updateSessionFromEvent(e,t){let n=t.level==="fatal",i=!1;const r=t.exception?.values;if(r){i=!0;for(const a of r)if(a.mechanism?.handled===!1){n=!0;break}}const s=e.status==="ok";(s&&e.errors===0||s&&n)&&(Nn(e,{...n&&{status:"crashed"},errors:e.errors||Number(i||n)}),this.captureSession(e))}_isClientDoneProcessing(e){return new xA(t=>{let n=0;const i=1,r=setInterval(()=>{this._numProcessing==0?(clearInterval(r),t(!0)):(n+=i,e&&n>=e&&(clearInterval(r),t(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,i){const r=this.getOptions(),s=Object.keys(this._integrations);return!t.integrations&&s?.length&&(t.integrations=s),this.emit("preprocessEvent",e,t),e.type||i.setLastEventId(e.event_id||t.event_id),eF(r,e,t,n,this,i).then(o=>{if(o===null)return o;this.emit("postprocessEvent",o,t),o.contexts={trace:JT(n),...o.contexts};const a=IQ(this,n);return o.sdkProcessingMetadata={dynamicSamplingContext:a,...o.sdkProcessingMetadata},o})}_captureEvent(e,t={},n=Vn(),i=Hi()){return X&&ll(e)&&N.log(`Captured error event \`${Gp(e)[0]||"<unknown>"}\``),this._processEvent(e,t,n,i).then(r=>r.event_id,r=>{X&&(qp(r)?N.log(r.message):Xp(r)?N.warn(r.message):N.warn(r))})}_processEvent(e,t,n,i){const r=this.getOptions(),{sampleRate:s}=r,o=Yp(e),a=ll(e),c=e.type||"error",l=`before send for type \`${c}\``,u=typeof s>"u"?void 0:iQ(s);if(a&&typeof u=="number"&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error"),Zs(cl(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));const d=c==="replay_event"?"replay":c;return this._prepareEvent(e,t,n,i).then(h=>{if(h===null)throw this.recordDroppedEvent("event_processor",d),cl("An event processor returned `null`, will not send event.");if(t.data&&t.data.__sentry__===!0)return h;const g=bF(this,r,h,t);return yF(g,l)}).then(h=>{if(h===null){if(this.recordDroppedEvent("before_send",d),o){const B=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",B)}throw cl(`${l} returned \`null\`, will not send event.`)}const f=n.getSession()||i.getSession();if(a&&f&&this._updateSessionFromEvent(f,h),o){const p=h.sdkProcessingMetadata?.spanCountBeforeProcessing||0,B=h.spans?h.spans.length:0,y=p-B;y>0&&this.recordDroppedEvent("before_send","span",y)}const g=h.transaction_info;if(o&&g&&h.transaction!==e.transaction){const p="custom";h.transaction_info={...g,source:p}}return this.sendEvent(h,t),h}).then(null,h=>{throw qp(h)||Xp(h)?h:(this.captureException(h,{data:{__sentry__:!0},originalException:h}),no(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
117
+ Reason: ${h}`))})}_process(e){this._numProcessing++,e.then(t=>(this._numProcessing--,t),t=>(this._numProcessing--,t))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([t,n])=>{const[i,r]=t.split(":");return{reason:i,category:r,quantity:n}})}_flushOutcomes(){X&&N.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){X&&N.log("No outcomes to send");return}if(!this._dsn){X&&N.log("No dsn provided, will not send outcomes");return}X&&N.log("Sending outcomes:",e);const t=CF(e,this._options.tunnel&&zs(this._dsn));this.sendEnvelope(t)}}function yF(A,e){const t=`${e} must return \`null\` or a valid event.`;if(js(A))return A.then(n=>{if(!Li(n)&&n!==null)throw no(t);return n},n=>{throw no(`${e} rejected with ${n}`)});if(!Li(A)&&A!==null)throw no(t);return A}function bF(A,e,t,n){const{beforeSend:i,beforeSendTransaction:r,beforeSendSpan:s}=e;let o=t;if(ll(o)&&i)return i(o,n);if(Yp(o)){if(s){const a=s(BF(o));if(a?o=Oi(t,vF(a)):yp(),o.spans){const c=[];for(const l of o.spans){const u=s(l);u?c.push(u):(yp(),c.push(l))}o.spans=c}}if(r){if(o.spans){const a=o.spans.length;o.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:a}}return r(o,n)}}return o}function ll(A){return A.type===void 0}function Yp(A){return A.type==="transaction"}function EF(A){return[{type:"log",item_count:A.length,content_type:"application/vnd.sentry.items.log+json"},{items:A}]}function SF(A,e,t,n){const i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),t&&n&&(i.dsn=zs(n)),Mi(i,[EF(A)])}Ae._sentryClientToLogBufferMap=new WeakMap;function ul(A,e){const t=e??UF(A)??[];if(t.length===0)return;const n=A.getOptions(),i=SF(t,n._metadata,n.tunnel,A.getDsn());Ae._sentryClientToLogBufferMap?.set(A,[]),A.emit("flushLogs"),A.sendEnvelope(i)}function UF(A){return Ae._sentryClientToLogBufferMap?.get(A)}const zp=Symbol.for("SentryBufferFullError");function TF(A){const e=[];function t(){return A===void 0||e.length<A}function n(s){return e.splice(e.indexOf(s),1)[0]||Promise.resolve(void 0)}function i(s){if(!t())return Zs(zp);const o=s();return e.indexOf(o)===-1&&e.push(o),o.then(()=>n(o)).then(null,()=>n(o).then(null,()=>{})),o}function r(s){return new xA((o,a)=>{let c=e.length;if(!c)return o(!0);const l=setTimeout(()=>{s&&s>0&&o(!1)},s);e.forEach(u=>{an(u).then(()=>{--c||(clearTimeout(l),o(!0))},a)})})}return{$:e,add:i,drain:r}}const QF=60*1e3;function FF(A,e=Date.now()){const t=parseInt(`${A}`,10);if(!isNaN(t))return t*1e3;const n=Date.parse(`${A}`);return isNaN(n)?QF:n-e}function kF(A,e){return A[e]||A.all||0}function IF(A,e,t=Date.now()){return kF(A,e)>t}function _F(A,{statusCode:e,headers:t},n=Date.now()){const i={...A},r=t?.["x-sentry-rate-limits"],s=t?.["retry-after"];if(r)for(const o of r.trim().split(",")){const[a,c,,,l]=o.split(":",5),u=parseInt(a,10),d=(isNaN(u)?60:u)*1e3;if(!c)i.all=n+d;else for(const h of c.split(";"))h==="metric_bucket"?(!l||l.split(";").includes("custom"))&&(i[h]=n+d):i[h]=n+d}else s?i.all=n+FF(s,n):e===429&&(i.all=n+60*1e3);return i}const xF=64;function RF(A,e,t=TF(A.bufferSize||xF)){let n={};const i=s=>t.drain(s);function r(s){const o=[];if(Ip(s,(u,d)=>{const h=_p(d);IF(n,h)?A.recordDroppedEvent("ratelimit_backoff",h):o.push(u)}),o.length===0)return an({});const a=Mi(s[0],o),c=u=>{Ip(a,(d,h)=>{A.recordDroppedEvent(u,_p(h))})},l=()=>e({body:HQ(a)}).then(u=>(u.statusCode!==void 0&&(u.statusCode<200||u.statusCode>=300)&&X&&N.warn(`Sentry responded with status code ${u.statusCode} to sent event.`),n=_F(n,u),u),u=>{throw c("network_error"),X&&N.error("Encountered error running transport request:",u),u});return t.add(l).then(u=>u,u=>{if(u===zp)return X&&N.error("Skipped sending event because buffer is full."),c("queue_overflow"),an({});throw u})}return{send:r,flush:i}}function PF(A){A.user?.ip_address===void 0&&(A.user={...A.user,ip_address:"{{auto}}"})}function LF(A){"aggregates"in A?A.attrs?.ip_address===void 0&&(A.attrs={...A.attrs,ip_address:"{{auto}}"}):A.ipAddress===void 0&&(A.ipAddress="{{auto}}")}function DF(A,e,t=[e],n="npm"){const i=A._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:t.map(r=>({name:`${n}:@sentry/${r}`,version:tn})),version:tn}),A._metadata=i}const OF=100;function cn(A,e){const t=Ve(),n=Hi();if(!t)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:r=OF}=t.getOptions();if(r<=0)return;const o={timestamp:Di(),...A},a=i?Ws(()=>i(o,e)):o;a!==null&&(t.emit&&t.emit("beforeAddBreadcrumb",a,e),n.addBreadcrumb(a,r))}let Zp;const HF="FunctionToString",em=new WeakMap,MF=()=>({name:HF,setupOnce(){Zp=Function.prototype.toString;try{Function.prototype.toString=function(...A){const e=Yc(this),t=em.has(Ve())&&e!==void 0?e:this;return Zp.apply(t,A)}}catch{}},setup(A){em.set(A,!0)}}),NF=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],KF="EventFilters",VF=(A={})=>{let e;return{name:KF,setup(t){const n=t.getOptions();e=tm(A,n)},processEvent(t,n,i){if(!e){const r=i.getOptions();e=tm(A,r)}return jF(t,e)?null:t}}},GF=(A={})=>({...VF(A),name:"InboundFilters"});function tm(A={},e={}){return{allowUrls:[...A.allowUrls||[],...e.allowUrls||[]],denyUrls:[...A.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...A.ignoreErrors||[],...e.ignoreErrors||[],...A.disableErrorDefaults?[]:NF],ignoreTransactions:[...A.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function jF(A,e){if(A.type){if(A.type==="transaction"&&WF(A,e.ignoreTransactions))return X&&N.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
118
+ Event: ${nn(A)}`),!0}else{if($F(A,e.ignoreErrors))return X&&N.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
119
+ Event: ${nn(A)}`),!0;if(YF(A))return X&&N.warn(`Event dropped due to not having an error message, error type or stacktrace.
120
+ Event: ${nn(A)}`),!0;if(JF(A,e.denyUrls))return X&&N.warn(`Event dropped due to being matched by \`denyUrls\` option.
121
+ Event: ${nn(A)}.
122
122
  Url: ${io(A)}`),!0;if(!XF(A,e.allowUrls))return X&&N.warn(`Event dropped due to not being matched by \`allowUrls\` option.
123
- Event: ${An(A)}.
124
- Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t,e)):!1}function WF(A,e){if(!e?.length)return!1;const t=A.transaction;return t?Xs(t,e):!1}function JF(A,e){if(!e?.length)return!1;const t=io(A);return t?Xs(t,e):!1}function XF(A,e){if(!e?.length)return!0;const t=io(A);return t?Xs(t,e):!0}function qF(A=[]){for(let e=A.length-1;e>=0;e--){const t=A[e];if(t&&t.filename!=="<anonymous>"&&t.filename!=="[native code]")return t.filename||null}return null}function io(A){try{const t=[...A.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return t?qF(t):null}catch{return X&&N.error(`Cannot extract url for event ${An(A)}`),null}}function YF(A){return A.exception?.values?.length?!A.message&&!A.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function zF(A,e,t,n,i,r){if(!i.exception?.values||!r||!IA(r.originalException,Error))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=dl(A,e,n,r.originalException,t,i.exception.values,s,0))}function dl(A,e,t,n,i,r,s,o){if(r.length>=t+1)return r;let a=[...r];if(IA(n[i],Error)){Am(s,o);const c=A(e,n[i]),l=a.length;nm(c,i,l,o),a=dl(A,e,t,n[i],i,[c,...a],c,l)}return Array.isArray(n.errors)&&n.errors.forEach((c,l)=>{if(IA(c,Error)){Am(s,o);const u=A(e,c),d=a.length;nm(u,`errors[${l}]`,d,o),a=dl(A,e,t,c,i,[u,...a],u,d)}}),a}function Am(A,e){A.mechanism=A.mechanism||{type:"generic",handled:!0},A.mechanism={...A.mechanism,...A.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function nm(A,e,t,n){A.mechanism=A.mechanism||{type:"generic",handled:!0},A.mechanism={...A.mechanism,type:"chained",source:e,exception_id:t,parent_id:n}}function ZF(A){const e="console";rn(e,A),sn(e,ek)}function ek(){"console"in Ae&&qc.forEach(function(A){A in Ae.console&&rt(Ae.console,A,function(e){return $s[A]=e,function(...t){Qt("console",{args:t,level:A}),$s[A]?.apply(Ae.console,t)}})})}function tk(A){return A==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(A)?A:"log"}const Ak="Dedupe",nk=()=>{let A;return{name:Ak,processEvent(e){if(e.type)return e;try{if(ik(e,A))return X&&N.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return A=e}}};function ik(A,e){return e?!!(rk(A,e)||sk(A,e)):!1}function rk(A,e){const t=A.message,n=e.message;return!(!t&&!n||t&&!n||!t&&n||t!==n||!rm(A,e)||!im(A,e))}function sk(A,e){const t=sm(e),n=sm(A);return!(!t||!n||t.type!==n.type||t.value!==n.value||!rm(A,e)||!im(A,e))}function im(A,e){let t=Up(A),n=Up(e);if(!t&&!n)return!0;if(t&&!n||!t&&n||(t=t,n=n,n.length!==t.length))return!1;for(let i=0;i<n.length;i++){const r=n[i],s=t[i];if(r.filename!==s.filename||r.lineno!==s.lineno||r.colno!==s.colno||r.function!==s.function)return!1}return!0}function rm(A,e){let t=A.fingerprint,n=e.fingerprint;if(!t&&!n)return!0;if(t&&!n||!t&&n)return!1;t=t,n=n;try{return t.join("")===n.join("")}catch{return!1}}function sm(A){return A.exception?.values&&A.exception.values[0]}function hl(A){if(!A)return{};const e=A.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const t=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:t,hash:n,relative:e[5]+t+n}}function om(A){if(A!==void 0)return A>=400&&A<500?"warning":A>=500?"error":void 0}const Ni=Ae;function ok(){return"history"in Ni&&!!Ni.history}function ak(){if(!("fetch"in Ni))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function fl(A){return A&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(A.toString())}function ck(){if(typeof EdgeRuntime=="string")return!0;if(!ak())return!1;if(fl(Ni.fetch))return!0;let A=!1;const e=Ni.document;if(e&&typeof e.createElement=="function")try{const t=e.createElement("iframe");t.hidden=!0,e.head.appendChild(t),t.contentWindow?.fetch&&(A=fl(t.contentWindow.fetch)),e.head.removeChild(t)}catch(t){X&&N.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return A}function lk(A,e){const t="fetch";rn(t,A),sn(t,()=>uk(void 0,e))}function uk(A,e=!1){e&&!ck()||rt(Ae,"fetch",function(t){return function(...n){const i=new Error,{method:r,url:s}=dk(n),o={args:n,fetchData:{method:r,url:s},startTimestamp:zt()*1e3,virtualError:i,headers:hk(n)};return A||Qt("fetch",{...o}),t.apply(Ae,n).then(async a=>(A?A(a):Qt("fetch",{...o,endTimestamp:zt()*1e3,response:a}),a),a=>{if(Qt("fetch",{...o,endTimestamp:zt()*1e3,error:a}),$c(a)&&a.stack===void 0&&(a.stack=i.stack,tn(a,"framesToPop",1)),a instanceof TypeError&&(a.message==="Failed to fetch"||a.message==="Load failed"||a.message==="NetworkError when attempting to fetch resource."))try{const c=new URL(o.fetchData.url);a.message=`${a.message} (${c.host})`}catch{}throw a})}})}function gl(A,e){return!!A&&typeof A=="object"&&!!A[e]}function am(A){return typeof A=="string"?A:A?gl(A,"url")?A.url:A.toString?A.toString():"":""}function dk(A){if(A.length===0)return{method:"GET",url:""};if(A.length===2){const[t,n]=A;return{url:am(t),method:gl(n,"method")?String(n.method).toUpperCase():"GET"}}const e=A[0];return{url:am(e),method:gl(e,"method")?String(e.method).toUpperCase():"GET"}}function hk(A){const[e,t]=A;try{if(typeof t=="object"&&t!==null&&"headers"in t&&t.headers)return new Headers(t.headers);if(UT(e))return new Headers(e.headers)}catch{}}function fk(){return"npm"}const Pe=Ae;let pl=0;function cm(){return pl>0}function gk(){pl++,setTimeout(()=>{pl--})}function Vn(A,e={}){function t(i){return typeof i=="function"}if(!t(A))return A;try{const i=A.__sentry_wrapped__;if(i)return typeof i=="function"?i:A;if(Yc(A))return A}catch{return A}const n=function(...i){try{const r=i.map(s=>Vn(s,e));return A.apply(this,r)}catch(r){throw gk(),dp(s=>{s.addEventProcessor(o=>(e.mechanism&&(zc(o,void 0,void 0),Mn(o,e.mechanism)),o.extra={...o.extra,arguments:i},o)),uF(r)}),r}};try{for(const i in A)Object.prototype.hasOwnProperty.call(A,i)&&(n[i]=A[i])}catch{}ep(n,A),tn(A,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return A.name}})}catch{}return n}function pk(){const A=zg(),{referrer:e}=Pe.document||{},{userAgent:t}=Pe.navigator||{},n={...e&&{Referer:e},...t&&{"User-Agent":t}};return{url:A,headers:n}}function ml(A,e){const t=vl(A,e),n={type:wk(e),value:yk(e)};return t.length&&(n.stacktrace={frames:t}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function mk(A,e,t,n){const r=Ge()?.getOptions().normalizeDepth,s=Tk(e),o={__serialized__:kp(e,r)};if(s)return{exception:{values:[ml(A,s)]},extra:o};const a={exception:{values:[{type:Vs(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Sk(e,{isUnhandledRejection:n})}]},extra:o};if(t){const c=vl(A,t);c.length&&(a.exception.values[0].stacktrace={frames:c})}return a}function Bl(A,e){return{exception:{values:[ml(A,e)]}}}function vl(A,e){const t=e.stacktrace||e.stack||"",n=vk(e),i=Ck(e);try{return A(t,n,i)}catch{}return[]}const Bk=/Minified React error #\d+;/i;function vk(A){return A&&Bk.test(A.message)?1:0}function Ck(A){return typeof A.framesToPop=="number"?A.framesToPop:0}function lm(A){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?A instanceof WebAssembly.Exception:!1}function wk(A){const e=A?.name;return!e&&lm(A)?A.message&&Array.isArray(A.message)&&A.message.length==2?A.message[0]:"WebAssembly.Exception":e}function yk(A){const e=A?.message;return lm(A)?Array.isArray(A.message)&&A.message.length==2?A.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function bk(A,e,t,n){const i=t?.syntheticException||void 0,r=Cl(A,e,i,n);return Mn(r),r.level="error",t?.event_id&&(r.event_id=t.event_id),on(r)}function Ek(A,e,t="info",n,i){const r=n?.syntheticException||void 0,s=wl(A,e,r,i);return s.level=t,n?.event_id&&(s.event_id=n.event_id),on(s)}function Cl(A,e,t,n,i){let r;if(Jg(e)&&e.error)return Bl(A,e.error);if(Xg(e)||yT(e)){const s=e;if("stack"in e)r=Bl(A,e);else{const o=s.name||(Xg(s)?"DOMError":"DOMException"),a=s.message?`${o}: ${s.message}`:o;r=wl(A,a,t,n),zc(r,a)}return"code"in s&&(r.tags={...r.tags,"DOMException.code":`${s.code}`}),r}return $c(e)?Bl(A,e):Li(e)||Vs(e)?(r=mk(A,e,t,i),Mn(r,{synthetic:!0}),r):(r=wl(A,e,t,n),zc(r,`${e}`,void 0),Mn(r,{synthetic:!0}),r)}function wl(A,e,t,n){const i={};if(n&&t){const r=vl(A,t);r.length&&(i.exception={values:[{value:e,stacktrace:{frames:r}}]}),Mn(i,{synthetic:!0})}if(Wc(e)){const{__sentry_template_string__:r,__sentry_template_values__:s}=e;return i.logentry={message:r,params:s},i}return i.message=e,i}function Sk(A,{isUnhandledRejection:e}){const t=xT(A),n=e?"promise rejection":"exception";return Jg(A)?`Event \`ErrorEvent\` captured as ${n} with message \`${A.message}\``:Vs(A)?`Event \`${Uk(A)}\` (type=${A.type}) captured as ${n}`:`Object captured as ${n} with keys: ${t}`}function Uk(A){try{const e=Object.getPrototypeOf(A);return e?e.constructor.name:void 0}catch{}}function Tk(A){for(const e in A)if(Object.prototype.hasOwnProperty.call(A,e)){const t=A[e];if(t instanceof Error)return t}}const Qk=5e3;class Fk extends wF{constructor(e){const t=kk(e),n=Pe.SENTRY_SDK_SOURCE||fk();DF(t,"browser",["browser"],n),super(t);const{sendDefaultPii:i,sendClientReports:r,_experiments:s}=this._options,o=s?.enableLogs;Pe.document&&(r||o)&&Pe.document.addEventListener("visibilitychange",()=>{Pe.document.visibilityState==="hidden"&&(r&&this._flushOutcomes(),o&&ul(this))}),o&&(this.on("flush",()=>{ul(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{ul(this)},Qk)})),i&&(this.on("postprocessEvent",PF),this.on("beforeSendSession",LF))}eventFromException(e,t){return bk(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return Ek(this._options.stackParser,e,t,n,this._options.attachStacktrace)}_prepareEvent(e,t,n,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n,i)}}function kk(A){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Pe.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...A}}const Ik=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ve=Ae,_k=1e3;let um,yl,bl;function xk(A){const e="dom";rn(e,A),sn(e,Rk)}function Rk(){if(!Ve.document)return;const A=Qt.bind(null,"dom"),e=dm(A,!0);Ve.document.addEventListener("click",e,!1),Ve.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(t=>{const i=Ve[t]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(rt(i,"addEventListener",function(r){return function(s,o,a){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},l=c[s]=c[s]||{refCount:0};if(!l.handler){const u=dm(A);l.handler=u,r.call(this,s,u,a)}l.refCount++}catch{}return r.call(this,s,o,a)}}),rt(i,"removeEventListener",function(r){return function(s,o,a){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__||{},l=c[s];l&&(l.refCount--,l.refCount<=0&&(r.call(this,s,l.handler,a),l.handler=void 0,delete c[s]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return r.call(this,s,o,a)}}))})}function Pk(A){if(A.type!==yl)return!1;try{if(!A.target||A.target._sentryId!==bl)return!1}catch{}return!0}function Lk(A,e){return A!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function dm(A,e=!1){return t=>{if(!t||t._sentryCaptured)return;const n=Dk(t);if(Lk(t.type,n))return;tn(t,"_sentryCaptured",!0),n&&!n._sentryId&&tn(n,"_sentryId",ht());const i=t.type==="keypress"?"input":t.type;Pk(t)||(A({event:t,name:i,global:e}),yl=t.type,bl=n?n._sentryId:void 0),clearTimeout(um),um=Ve.setTimeout(()=>{bl=void 0,yl=void 0},_k)}}function Dk(A){try{return A.target}catch{return null}}let ro;function hm(A){const e="history";rn(e,A),sn(e,Ok)}function Ok(){if(Ve.addEventListener("popstate",()=>{const e=Ve.location.href,t=ro;if(ro=e,t===e)return;Qt("history",{from:t,to:e})}),!ok())return;function A(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const i=ro,r=Hk(String(n));if(ro=r,i===r)return e.apply(this,t);Qt("history",{from:i,to:r})}return e.apply(this,t)}}rt(Ve.history,"pushState",A),rt(Ve.history,"replaceState",A)}function Hk(A){try{return new URL(A,Ve.location.origin).toString()}catch{return A}}const so={};function Mk(A){const e=so[A];if(e)return e;let t=Ve[A];if(fl(t))return so[A]=t.bind(Ve);const n=Ve.document;if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const r=i.contentWindow;r?.[A]&&(t=r[A]),n.head.removeChild(i)}catch(i){Ik&&N.warn(`Could not create sandbox iframe for ${A} check, bailing to window.${A}: `,i)}return t&&(so[A]=t.bind(Ve))}function fm(A){so[A]=void 0}const Ki="__sentry_xhr_v3__";function Nk(A){const e="xhr";rn(e,A),sn(e,Kk)}function Kk(){if(!Ve.XMLHttpRequest)return;const A=XMLHttpRequest.prototype;A.open=new Proxy(A.open,{apply(e,t,n){const i=new Error,r=zt()*1e3,s=Yt(n[0])?n[0].toUpperCase():void 0,o=Gk(n[1]);if(!s||!o)return e.apply(t,n);t[Ki]={method:s,url:o,request_headers:{}},s==="POST"&&o.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const a=()=>{const c=t[Ki];if(c&&t.readyState===4){try{c.status_code=t.status}catch{}const l={endTimestamp:zt()*1e3,startTimestamp:r,xhr:t,virtualError:i};Qt("xhr",l)}};return"onreadystatechange"in t&&typeof t.onreadystatechange=="function"?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(c,l,u){return a(),c.apply(l,u)}}):t.addEventListener("readystatechange",a),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(c,l,u){const[d,h]=u,f=l[Ki];return f&&Yt(d)&&Yt(h)&&(f.request_headers[d.toLowerCase()]=h),c.apply(l,u)}}),e.apply(t,n)}}),A.send=new Proxy(A.send,{apply(e,t,n){const i=t[Ki];if(!i)return e.apply(t,n);n[0]!==void 0&&(i.body=n[0]);const r={startTimestamp:zt()*1e3,xhr:t};return Qt("xhr",r),e.apply(t,n)}})}function Gk(A){if(Yt(A))return A;try{return A.toString()}catch{}}function Vk(A,e=Mk("fetch")){let t=0,n=0;function i(r){const s=r.body.length;t+=s,n++;const o={body:r.body,method:"POST",referrerPolicy:"strict-origin",headers:A.headers,keepalive:t<=6e4&&n<15,...A.fetchOptions};if(!e)return fm("fetch"),Zs("No fetch implementation available");try{return e(A.url,o).then(a=>(t-=s,n--,{statusCode:a.status,headers:{"x-sentry-rate-limits":a.headers.get("X-Sentry-Rate-Limits"),"retry-after":a.headers.get("Retry-After")}}))}catch(a){return fm("fetch"),t-=s,n--,Zs(a)}}return RF(A,i)}const jk=30,$k=50;function El(A,e,t,n){const i={filename:A,function:e==="<anonymous>"?nn:e,in_app:!0};return t!==void 0&&(i.lineno=t),n!==void 0&&(i.colno=n),i}const Wk=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Jk=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Xk=/\((\S*)(?::(\d+))(?::(\d+))\)/,qk=[jk,A=>{const e=Wk.exec(A);if(e){const[,n,i,r]=e;return El(n,nn,+i,+r)}const t=Jk.exec(A);if(t){if(t[2]&&t[2].indexOf("eval")===0){const s=Xk.exec(t[2]);s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3])}const[i,r]=gm(t[1]||nn,t[2]);return El(r,i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],Yk=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,zk=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Zk=pQ(...[qk,[$k,A=>{const e=Yk.exec(A);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=zk.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}let n=e[3],i=e[1]||nn;return[i,n]=gm(i,n),El(n,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]),gm=(A,e)=>{const t=A.indexOf("safari-extension")!==-1,n=A.indexOf("safari-web-extension")!==-1;return t||n?[A.indexOf("@")!==-1?A.split("@")[0]:nn,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[A,e]},Sl=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,oo=1024,eI="Breadcrumbs",tI=(A={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...A};return{name:eI,setup(t){e.console&&ZF(iI(t)),e.dom&&xk(nI(t,e.dom)),e.xhr&&Nk(rI(t)),e.fetch&&lk(sI(t)),e.history&&hm(oI(t)),e.sentry&&t.on("beforeSendEvent",AI(t))}}};function AI(A){return function(t){Ge()===A&&an({category:`sentry.${t.type==="transaction"?"transaction":"event"}`,event_id:t.event_id,level:t.level,message:An(t)},{event:t})}}function nI(A,e){return function(n){if(Ge()!==A)return;let i,r,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>oo&&(Sl&&N.warn(`\`dom.maxStringLength\` cannot exceed ${oo}, but a value of ${o} was configured. Sentry will use ${oo} instead.`),o=oo),typeof s=="string"&&(s=[s]);try{const c=n.event,l=aI(c)?c.target:c;i=Yg(l,{keyAttrs:s,maxStringLength:o}),r=FT(l)}catch{i="<unknown>"}if(i.length===0)return;const a={category:`ui.${n.name}`,message:i};r&&(a.data={"ui.component_name":r}),an(a,{event:n.event,name:n.name,global:n.global})}}function iI(A){return function(t){if(Ge()!==A)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:tk(t.level),message:Zg(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)n.message=`Assertion failed: ${Zg(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1);else return;an(n,{input:t.args,level:t.level})}}function rI(A){return function(t){if(Ge()!==A)return;const{startTimestamp:n,endTimestamp:i}=t,r=t.xhr[Ki];if(!n||!i||!r)return;const{method:s,url:o,status_code:a,body:c}=r,l={method:s,url:o,status_code:a},u={xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:i},d={category:"xhr",data:l,type:"http",level:om(a)};A.emit("beforeOutgoingRequestBreadcrumb",d,u),an(d,u)}}function sI(A){return function(t){if(Ge()!==A)return;const{startTimestamp:n,endTimestamp:i}=t;if(i&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"))if(t.fetchData.method,t.fetchData.url,t.error){const r=t.fetchData,s={data:t.error,input:t.args,startTimestamp:n,endTimestamp:i},o={category:"fetch",data:r,level:"error",type:"http"};A.emit("beforeOutgoingRequestBreadcrumb",o,s),an(o,s)}else{const r=t.response,s={...t.fetchData,status_code:r?.status};t.fetchData.request_body_size,t.fetchData.response_body_size,r?.status;const o={input:t.args,response:r,startTimestamp:n,endTimestamp:i},a={category:"fetch",data:s,type:"http",level:om(s.status_code)};A.emit("beforeOutgoingRequestBreadcrumb",a,o),an(a,o)}}}function oI(A){return function(t){if(Ge()!==A)return;let n=t.from,i=t.to;const r=hl(Pe.location.href);let s=n?hl(n):void 0;const o=hl(i);s?.path||(s=r),r.protocol===o.protocol&&r.host===o.host&&(i=o.relative),r.protocol===s.protocol&&r.host===s.host&&(n=s.relative),an({category:"navigation",data:{from:n,to:i}})}}function aI(A){return!!A&&!!A.target}const cI=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],lI="BrowserApiErrors",uI=(A={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...A};return{name:lI,setupOnce(){e.setTimeout&&rt(Pe,"setTimeout",pm),e.setInterval&&rt(Pe,"setInterval",pm),e.requestAnimationFrame&&rt(Pe,"requestAnimationFrame",dI),e.XMLHttpRequest&&"XMLHttpRequest"in Pe&&rt(XMLHttpRequest.prototype,"send",hI);const t=e.eventTarget;t&&(Array.isArray(t)?t:cI).forEach(fI)}}};function pm(A){return function(...e){const t=e[0];return e[0]=Vn(t,{mechanism:{data:{function:_A(A)},handled:!1,type:"instrument"}}),A.apply(this,e)}}function dI(A){return function(e){return A.apply(this,[Vn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:_A(A)},handled:!1,type:"instrument"}})])}}function hI(A){return function(...e){const t=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in t&&typeof t[i]=="function"&&rt(t,i,function(r){const s={mechanism:{data:{function:i,handler:_A(r)},handled:!1,type:"instrument"}},o=Yc(r);return o&&(s.mechanism.data.handler=_A(o)),Vn(r,s)})}),A.apply(this,e)}}function fI(A){const t=Pe[A]?.prototype;t?.hasOwnProperty?.("addEventListener")&&(rt(t,"addEventListener",function(n){return function(i,r,s){try{gI(r)&&(r.handleEvent=Vn(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:_A(r),target:A},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,Vn(r,{mechanism:{data:{function:"addEventListener",handler:_A(r),target:A},handled:!1,type:"instrument"}}),s])}}),rt(t,"removeEventListener",function(n){return function(i,r,s){try{const o=r.__sentry_wrapped__;o&&n.call(this,i,o,s)}catch{}return n.call(this,i,r,s)}}))}function gI(A){return typeof A.handleEvent=="function"}const pI=()=>({name:"BrowserSession",setupOnce(){if(typeof Pe.document>"u"){Sl&&N.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Dp({ignoreDuration:!0}),Mp(),hm(({from:A,to:e})=>{A!==void 0&&A!==e&&(Dp({ignoreDuration:!0}),Mp())})}}),mI="GlobalHandlers",BI=(A={})=>{const e={onerror:!0,onunhandledrejection:!0,...A};return{name:mI,setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(vI(t),mm("onerror")),e.onunhandledrejection&&(CI(t),mm("onunhandledrejection"))}}};function vI(A){BQ(e=>{const{stackParser:t,attachStacktrace:n}=Bm();if(Ge()!==A||cm())return;const{msg:i,url:r,line:s,column:o,error:a}=e,c=bI(Cl(t,a||i,void 0,n,!1),r,s,o);c.level="error",Lp(c,{originalException:a,mechanism:{handled:!1,type:"onerror"}})})}function CI(A){CQ(e=>{const{stackParser:t,attachStacktrace:n}=Bm();if(Ge()!==A||cm())return;const i=wI(e),r=Jc(i)?yI(i):Cl(t,i,void 0,n,!0);r.level="error",Lp(r,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function wI(A){if(Jc(A))return A;try{if("reason"in A)return A.reason;if("detail"in A&&"reason"in A.detail)return A.detail.reason}catch{}return A}function yI(A){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(A)}`}]}}}function bI(A,e,t,n){const i=A.exception=A.exception||{},r=i.values=i.values||[],s=r[0]=r[0]||{},o=s.stacktrace=s.stacktrace||{},a=o.frames=o.frames||[],c=n,l=t,u=Yt(e)&&e.length>0?e:zg();return a.length===0&&a.push({colno:c,filename:u,function:nn,in_app:!0,lineno:l}),A}function mm(A){Sl&&N.log(`Global Handler attached: ${A}`)}function Bm(){return Ge()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const EI=()=>({name:"HttpContext",preprocessEvent(A){if(!Pe.navigator&&!Pe.location&&!Pe.document)return;const e=pk(),t={...e.headers,...A.request?.headers};A.request={...e,...A.request,headers:t}}}),SI="cause",UI=5,TI="LinkedErrors",QI=(A={})=>{const e=A.limit||UI,t=A.key||SI;return{name:TI,preprocessEvent(n,i,r){const s=r.getOptions();zF(ml,s.stackParser,t,e,n,i)}}};function FI(A){return[VF(),MF(),uI(),tI(),BI(),QI(),nk(),EI(),pI()]}function kI(){const A=FI().filter(n=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers","HttpContext"].includes(n.name)),e=new Fk({dsn:"https://ac54bd10eac67be2dafbc346e704e4d4@o4507251798835200.ingest.us.sentry.io/4509409566392320",environment:"production",transport:Vk,stackParser:Zk,integrations:A,beforeSend(n,i){const r=i.originalException;return r instanceof Error&&(r.message.includes("Failed to fetch")||r.message.includes("Network request failed")||r.message.includes("Load failed")||r.message.includes("Permission denied")||r.message.includes("NotAllowedError"))?null:n},release:process.env.npm_package_version||"0.6.2"}),t=new Tt;return t.setClient(e),e.init(),t}let ao=null,st={};function II(){ao||(ao=kI())}function Me(A,e){{if(II(),!ao)return;dp(t=>{Object.entries(st).forEach(([n,i])=>{i!==void 0&&t.setTag(n,String(i))}),e&&(Object.entries(e).forEach(([n,i])=>{i!==void 0&&t.setTag(n,String(i))}),(e.userId||e.userEmail)&&t.setUser({id:e.userId,email:e.userEmail,...e.userMetadata}),(e.eventType||e.eventData||e.userJourney)&&t.setContext("eventContext",{eventType:e.eventType,eventData:e.eventData,userJourney:e.userJourney,timestamp:new Date().toISOString()})),ao.captureException(A)})}}function ie(A,e,t){st.eventType=A,st.eventData=e,st.userJourney||(st.userJourney=[]);const n=`${new Date().toISOString()}: ${A}${t?` (${t})`:""}`;st.userJourney.push(n),st.userJourney.length>10&&(st.userJourney=st.userJourney.slice(-10))}function Gi(A){st={...st,...A}}function Vi(A,e,t){return async(...n)=>{try{ie(`${e}_started`,{componentName:t},t);const i=await A(...n);return ie(`${e}_completed`,{componentName:t},t),i}catch(i){throw Me(i,{...st,componentName:t,handlerName:e,eventType:`${e}_failed`,eventData:{error:i instanceof Error?i.message:String(i)}}),i}}}function _I(A,e,t){return(...n)=>{try{ie(`${e}_started`,{componentName:t},t);const i=A(...n);return ie(`${e}_completed`,{componentName:t},t),i}catch(i){throw Me(i,{...st,componentName:t,handlerName:e,eventType:`${e}_failed`,eventData:{error:i instanceof Error?i.message:String(i)}}),i}}}function vm(A){return{trackLifecycle:(e,t)=>{try{ie(`${A}_${e}`,{},A),t()}catch(n){throw Me(n,{componentName:A,lifecycle:e,eventType:`${A}_${e}_failed`}),n}},trackRender:e=>{try{return e()}catch(t){return Me(t,{componentName:A,lifecycle:"render",eventType:`${A}_render_failed`}),L.html`<div>Error rendering ${A}</div>`}},setContext:()=>{Gi({componentName:A}),ie(`${A}_initialized`,{},A)}}}class xI{constructor(e){this.namespace=e}getItem(e){return localStorage.getItem(`${this.namespace}.${e}`)}setItem(e,t){localStorage.setItem(`${this.namespace}.${e}`,t)}removeItem(e){localStorage.removeItem(`${this.namespace}.${e}`)}clear(){for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);t&&t.startsWith(`${this.namespace}.`)&&localStorage.removeItem(t)}}}const Ul={SESSION_DATA:"session_data"},Tl=new xI("io.obi.widget");function RI(A){let e=A.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function PI(A,e){if(!e||e.length===0)return!1;const t=A.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(n=>{try{const i=RI(n);return i.test(t)||i.test(A)}catch(i){return console.warn(`Invalid URL pattern: ${n}`,i),!1}})}function co(A){if(!A||A.length===0)return!1;const e=window.location.origin+window.location.pathname;return PI(e,A)}var LI=Object.defineProperty,DI=Object.getOwnPropertyDescriptor,lo=(A,e,t,n)=>{for(var i=n>1?void 0:n?DI(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&LI(e,t,i),i};class jn extends L.LitElement{constructor(){super(...arguments),this.id="",this.isActive=!1,this.isSpecial=!1}handleClick(e){e.preventDefault(),e.stopPropagation();const t=new CustomEvent("obi-nav-icon-click",{detail:{id:this.id,isActive:!this.isActive},bubbles:!0,composed:!0});this.dispatchEvent(t),this.onClick&&this.onClick(this.id,!this.isActive)}render(){return L.html`
123
+ Event: ${nn(A)}.
124
+ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Gp(A).some(t=>Xs(t,e)):!1}function WF(A,e){if(!e?.length)return!1;const t=A.transaction;return t?Xs(t,e):!1}function JF(A,e){if(!e?.length)return!1;const t=io(A);return t?Xs(t,e):!1}function XF(A,e){if(!e?.length)return!0;const t=io(A);return t?Xs(t,e):!0}function qF(A=[]){for(let e=A.length-1;e>=0;e--){const t=A[e];if(t&&t.filename!=="<anonymous>"&&t.filename!=="[native code]")return t.filename||null}return null}function io(A){try{const t=[...A.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return t?qF(t):null}catch{return X&&N.error(`Cannot extract url for event ${nn(A)}`),null}}function YF(A){return A.exception?.values?.length?!A.message&&!A.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function zF(A,e,t,n,i,r){if(!i.exception?.values||!r||!IA(r.originalException,Error))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=dl(A,e,n,r.originalException,t,i.exception.values,s,0))}function dl(A,e,t,n,i,r,s,o){if(r.length>=t+1)return r;let a=[...r];if(IA(n[i],Error)){Am(s,o);const c=A(e,n[i]),l=a.length;nm(c,i,l,o),a=dl(A,e,t,n[i],i,[c,...a],c,l)}return Array.isArray(n.errors)&&n.errors.forEach((c,l)=>{if(IA(c,Error)){Am(s,o);const u=A(e,c),d=a.length;nm(u,`errors[${l}]`,d,o),a=dl(A,e,t,c,i,[u,...a],u,d)}}),a}function Am(A,e){A.mechanism=A.mechanism||{type:"generic",handled:!0},A.mechanism={...A.mechanism,...A.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function nm(A,e,t,n){A.mechanism=A.mechanism||{type:"generic",handled:!0},A.mechanism={...A.mechanism,type:"chained",source:e,exception_id:t,parent_id:n}}function ZF(A){const e="console";sn(e,A),on(e,ek)}function ek(){"console"in Ae&&qc.forEach(function(A){A in Ae.console&&rt(Ae.console,A,function(e){return $s[A]=e,function(...t){Qt("console",{args:t,level:A}),$s[A]?.apply(Ae.console,t)}})})}function tk(A){return A==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(A)?A:"log"}const Ak="Dedupe",nk=()=>{let A;return{name:Ak,processEvent(e){if(e.type)return e;try{if(ik(e,A))return X&&N.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return A=e}}};function ik(A,e){return e?!!(rk(A,e)||sk(A,e)):!1}function rk(A,e){const t=A.message,n=e.message;return!(!t&&!n||t&&!n||!t&&n||t!==n||!rm(A,e)||!im(A,e))}function sk(A,e){const t=sm(e),n=sm(A);return!(!t||!n||t.type!==n.type||t.value!==n.value||!rm(A,e)||!im(A,e))}function im(A,e){let t=Up(A),n=Up(e);if(!t&&!n)return!0;if(t&&!n||!t&&n||(t=t,n=n,n.length!==t.length))return!1;for(let i=0;i<n.length;i++){const r=n[i],s=t[i];if(r.filename!==s.filename||r.lineno!==s.lineno||r.colno!==s.colno||r.function!==s.function)return!1}return!0}function rm(A,e){let t=A.fingerprint,n=e.fingerprint;if(!t&&!n)return!0;if(t&&!n||!t&&n)return!1;t=t,n=n;try{return t.join("")===n.join("")}catch{return!1}}function sm(A){return A.exception?.values&&A.exception.values[0]}function hl(A){if(!A)return{};const e=A.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const t=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:t,hash:n,relative:e[5]+t+n}}function om(A){if(A!==void 0)return A>=400&&A<500?"warning":A>=500?"error":void 0}const Ni=Ae;function ok(){return"history"in Ni&&!!Ni.history}function ak(){if(!("fetch"in Ni))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function fl(A){return A&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(A.toString())}function ck(){if(typeof EdgeRuntime=="string")return!0;if(!ak())return!1;if(fl(Ni.fetch))return!0;let A=!1;const e=Ni.document;if(e&&typeof e.createElement=="function")try{const t=e.createElement("iframe");t.hidden=!0,e.head.appendChild(t),t.contentWindow?.fetch&&(A=fl(t.contentWindow.fetch)),e.head.removeChild(t)}catch(t){X&&N.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return A}function lk(A,e){const t="fetch";sn(t,A),on(t,()=>uk(void 0,e))}function uk(A,e=!1){e&&!ck()||rt(Ae,"fetch",function(t){return function(...n){const i=new Error,{method:r,url:s}=dk(n),o={args:n,fetchData:{method:r,url:s},startTimestamp:Zt()*1e3,virtualError:i,headers:hk(n)};return A||Qt("fetch",{...o}),t.apply(Ae,n).then(async a=>(A?A(a):Qt("fetch",{...o,endTimestamp:Zt()*1e3,response:a}),a),a=>{if(Qt("fetch",{...o,endTimestamp:Zt()*1e3,error:a}),$c(a)&&a.stack===void 0&&(a.stack=i.stack,An(a,"framesToPop",1)),a instanceof TypeError&&(a.message==="Failed to fetch"||a.message==="Load failed"||a.message==="NetworkError when attempting to fetch resource."))try{const c=new URL(o.fetchData.url);a.message=`${a.message} (${c.host})`}catch{}throw a})}})}function gl(A,e){return!!A&&typeof A=="object"&&!!A[e]}function am(A){return typeof A=="string"?A:A?gl(A,"url")?A.url:A.toString?A.toString():"":""}function dk(A){if(A.length===0)return{method:"GET",url:""};if(A.length===2){const[t,n]=A;return{url:am(t),method:gl(n,"method")?String(n.method).toUpperCase():"GET"}}const e=A[0];return{url:am(e),method:gl(e,"method")?String(e.method).toUpperCase():"GET"}}function hk(A){const[e,t]=A;try{if(typeof t=="object"&&t!==null&&"headers"in t&&t.headers)return new Headers(t.headers);if(UT(e))return new Headers(e.headers)}catch{}}function fk(){return"npm"}const Pe=Ae;let pl=0;function cm(){return pl>0}function gk(){pl++,setTimeout(()=>{pl--})}function Gn(A,e={}){function t(i){return typeof i=="function"}if(!t(A))return A;try{const i=A.__sentry_wrapped__;if(i)return typeof i=="function"?i:A;if(Yc(A))return A}catch{return A}const n=function(...i){try{const r=i.map(s=>Gn(s,e));return A.apply(this,r)}catch(r){throw gk(),dp(s=>{s.addEventProcessor(o=>(e.mechanism&&(zc(o,void 0,void 0),Mn(o,e.mechanism)),o.extra={...o.extra,arguments:i},o)),uF(r)}),r}};try{for(const i in A)Object.prototype.hasOwnProperty.call(A,i)&&(n[i]=A[i])}catch{}ep(n,A),An(A,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return A.name}})}catch{}return n}function pk(){const A=zg(),{referrer:e}=Pe.document||{},{userAgent:t}=Pe.navigator||{},n={...e&&{Referer:e},...t&&{"User-Agent":t}};return{url:A,headers:n}}function ml(A,e){const t=vl(A,e),n={type:wk(e),value:yk(e)};return t.length&&(n.stacktrace={frames:t}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function mk(A,e,t,n){const r=Ve()?.getOptions().normalizeDepth,s=Tk(e),o={__serialized__:kp(e,r)};if(s)return{exception:{values:[ml(A,s)]},extra:o};const a={exception:{values:[{type:Gs(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:Sk(e,{isUnhandledRejection:n})}]},extra:o};if(t){const c=vl(A,t);c.length&&(a.exception.values[0].stacktrace={frames:c})}return a}function Bl(A,e){return{exception:{values:[ml(A,e)]}}}function vl(A,e){const t=e.stacktrace||e.stack||"",n=vk(e),i=Ck(e);try{return A(t,n,i)}catch{}return[]}const Bk=/Minified React error #\d+;/i;function vk(A){return A&&Bk.test(A.message)?1:0}function Ck(A){return typeof A.framesToPop=="number"?A.framesToPop:0}function lm(A){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?A instanceof WebAssembly.Exception:!1}function wk(A){const e=A?.name;return!e&&lm(A)?A.message&&Array.isArray(A.message)&&A.message.length==2?A.message[0]:"WebAssembly.Exception":e}function yk(A){const e=A?.message;return lm(A)?Array.isArray(A.message)&&A.message.length==2?A.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function bk(A,e,t,n){const i=t?.syntheticException||void 0,r=Cl(A,e,i,n);return Mn(r),r.level="error",t?.event_id&&(r.event_id=t.event_id),an(r)}function Ek(A,e,t="info",n,i){const r=n?.syntheticException||void 0,s=wl(A,e,r,i);return s.level=t,n?.event_id&&(s.event_id=n.event_id),an(s)}function Cl(A,e,t,n,i){let r;if(Jg(e)&&e.error)return Bl(A,e.error);if(Xg(e)||yT(e)){const s=e;if("stack"in e)r=Bl(A,e);else{const o=s.name||(Xg(s)?"DOMError":"DOMException"),a=s.message?`${o}: ${s.message}`:o;r=wl(A,a,t,n),zc(r,a)}return"code"in s&&(r.tags={...r.tags,"DOMException.code":`${s.code}`}),r}return $c(e)?Bl(A,e):Li(e)||Gs(e)?(r=mk(A,e,t,i),Mn(r,{synthetic:!0}),r):(r=wl(A,e,t,n),zc(r,`${e}`,void 0),Mn(r,{synthetic:!0}),r)}function wl(A,e,t,n){const i={};if(n&&t){const r=vl(A,t);r.length&&(i.exception={values:[{value:e,stacktrace:{frames:r}}]}),Mn(i,{synthetic:!0})}if(Wc(e)){const{__sentry_template_string__:r,__sentry_template_values__:s}=e;return i.logentry={message:r,params:s},i}return i.message=e,i}function Sk(A,{isUnhandledRejection:e}){const t=xT(A),n=e?"promise rejection":"exception";return Jg(A)?`Event \`ErrorEvent\` captured as ${n} with message \`${A.message}\``:Gs(A)?`Event \`${Uk(A)}\` (type=${A.type}) captured as ${n}`:`Object captured as ${n} with keys: ${t}`}function Uk(A){try{const e=Object.getPrototypeOf(A);return e?e.constructor.name:void 0}catch{}}function Tk(A){for(const e in A)if(Object.prototype.hasOwnProperty.call(A,e)){const t=A[e];if(t instanceof Error)return t}}const Qk=5e3;class Fk extends wF{constructor(e){const t=kk(e),n=Pe.SENTRY_SDK_SOURCE||fk();DF(t,"browser",["browser"],n),super(t);const{sendDefaultPii:i,sendClientReports:r,_experiments:s}=this._options,o=s?.enableLogs;Pe.document&&(r||o)&&Pe.document.addEventListener("visibilitychange",()=>{Pe.document.visibilityState==="hidden"&&(r&&this._flushOutcomes(),o&&ul(this))}),o&&(this.on("flush",()=>{ul(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{ul(this)},Qk)})),i&&(this.on("postprocessEvent",PF),this.on("beforeSendSession",LF))}eventFromException(e,t){return bk(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return Ek(this._options.stackParser,e,t,n,this._options.attachStacktrace)}_prepareEvent(e,t,n,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n,i)}}function kk(A){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Pe.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...A}}const Ik=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ge=Ae,_k=1e3;let um,yl,bl;function xk(A){const e="dom";sn(e,A),on(e,Rk)}function Rk(){if(!Ge.document)return;const A=Qt.bind(null,"dom"),e=dm(A,!0);Ge.document.addEventListener("click",e,!1),Ge.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(t=>{const i=Ge[t]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(rt(i,"addEventListener",function(r){return function(s,o,a){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},l=c[s]=c[s]||{refCount:0};if(!l.handler){const u=dm(A);l.handler=u,r.call(this,s,u,a)}l.refCount++}catch{}return r.call(this,s,o,a)}}),rt(i,"removeEventListener",function(r){return function(s,o,a){if(s==="click"||s=="keypress")try{const c=this.__sentry_instrumentation_handlers__||{},l=c[s];l&&(l.refCount--,l.refCount<=0&&(r.call(this,s,l.handler,a),l.handler=void 0,delete c[s]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return r.call(this,s,o,a)}}))})}function Pk(A){if(A.type!==yl)return!1;try{if(!A.target||A.target._sentryId!==bl)return!1}catch{}return!0}function Lk(A,e){return A!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function dm(A,e=!1){return t=>{if(!t||t._sentryCaptured)return;const n=Dk(t);if(Lk(t.type,n))return;An(t,"_sentryCaptured",!0),n&&!n._sentryId&&An(n,"_sentryId",ht());const i=t.type==="keypress"?"input":t.type;Pk(t)||(A({event:t,name:i,global:e}),yl=t.type,bl=n?n._sentryId:void 0),clearTimeout(um),um=Ge.setTimeout(()=>{bl=void 0,yl=void 0},_k)}}function Dk(A){try{return A.target}catch{return null}}let ro;function hm(A){const e="history";sn(e,A),on(e,Ok)}function Ok(){if(Ge.addEventListener("popstate",()=>{const e=Ge.location.href,t=ro;if(ro=e,t===e)return;Qt("history",{from:t,to:e})}),!ok())return;function A(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const i=ro,r=Hk(String(n));if(ro=r,i===r)return e.apply(this,t);Qt("history",{from:i,to:r})}return e.apply(this,t)}}rt(Ge.history,"pushState",A),rt(Ge.history,"replaceState",A)}function Hk(A){try{return new URL(A,Ge.location.origin).toString()}catch{return A}}const so={};function Mk(A){const e=so[A];if(e)return e;let t=Ge[A];if(fl(t))return so[A]=t.bind(Ge);const n=Ge.document;if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const r=i.contentWindow;r?.[A]&&(t=r[A]),n.head.removeChild(i)}catch(i){Ik&&N.warn(`Could not create sandbox iframe for ${A} check, bailing to window.${A}: `,i)}return t&&(so[A]=t.bind(Ge))}function fm(A){so[A]=void 0}const Ki="__sentry_xhr_v3__";function Nk(A){const e="xhr";sn(e,A),on(e,Kk)}function Kk(){if(!Ge.XMLHttpRequest)return;const A=XMLHttpRequest.prototype;A.open=new Proxy(A.open,{apply(e,t,n){const i=new Error,r=Zt()*1e3,s=zt(n[0])?n[0].toUpperCase():void 0,o=Vk(n[1]);if(!s||!o)return e.apply(t,n);t[Ki]={method:s,url:o,request_headers:{}},s==="POST"&&o.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const a=()=>{const c=t[Ki];if(c&&t.readyState===4){try{c.status_code=t.status}catch{}const l={endTimestamp:Zt()*1e3,startTimestamp:r,xhr:t,virtualError:i};Qt("xhr",l)}};return"onreadystatechange"in t&&typeof t.onreadystatechange=="function"?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(c,l,u){return a(),c.apply(l,u)}}):t.addEventListener("readystatechange",a),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(c,l,u){const[d,h]=u,f=l[Ki];return f&&zt(d)&&zt(h)&&(f.request_headers[d.toLowerCase()]=h),c.apply(l,u)}}),e.apply(t,n)}}),A.send=new Proxy(A.send,{apply(e,t,n){const i=t[Ki];if(!i)return e.apply(t,n);n[0]!==void 0&&(i.body=n[0]);const r={startTimestamp:Zt()*1e3,xhr:t};return Qt("xhr",r),e.apply(t,n)}})}function Vk(A){if(zt(A))return A;try{return A.toString()}catch{}}function Gk(A,e=Mk("fetch")){let t=0,n=0;function i(r){const s=r.body.length;t+=s,n++;const o={body:r.body,method:"POST",referrerPolicy:"strict-origin",headers:A.headers,keepalive:t<=6e4&&n<15,...A.fetchOptions};if(!e)return fm("fetch"),Zs("No fetch implementation available");try{return e(A.url,o).then(a=>(t-=s,n--,{statusCode:a.status,headers:{"x-sentry-rate-limits":a.headers.get("X-Sentry-Rate-Limits"),"retry-after":a.headers.get("Retry-After")}}))}catch(a){return fm("fetch"),t-=s,n--,Zs(a)}}return RF(A,i)}const jk=30,$k=50;function El(A,e,t,n){const i={filename:A,function:e==="<anonymous>"?rn:e,in_app:!0};return t!==void 0&&(i.lineno=t),n!==void 0&&(i.colno=n),i}const Wk=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Jk=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Xk=/\((\S*)(?::(\d+))(?::(\d+))\)/,qk=[jk,A=>{const e=Wk.exec(A);if(e){const[,n,i,r]=e;return El(n,rn,+i,+r)}const t=Jk.exec(A);if(t){if(t[2]&&t[2].indexOf("eval")===0){const s=Xk.exec(t[2]);s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3])}const[i,r]=gm(t[1]||rn,t[2]);return El(r,i,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],Yk=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,zk=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Zk=pQ(...[qk,[$k,A=>{const e=Yk.exec(A);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const r=zk.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}let n=e[3],i=e[1]||rn;return[i,n]=gm(i,n),El(n,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]),gm=(A,e)=>{const t=A.indexOf("safari-extension")!==-1,n=A.indexOf("safari-web-extension")!==-1;return t||n?[A.indexOf("@")!==-1?A.split("@")[0]:rn,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[A,e]},Sl=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,oo=1024,eI="Breadcrumbs",tI=(A={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...A};return{name:eI,setup(t){e.console&&ZF(iI(t)),e.dom&&xk(nI(t,e.dom)),e.xhr&&Nk(rI(t)),e.fetch&&lk(sI(t)),e.history&&hm(oI(t)),e.sentry&&t.on("beforeSendEvent",AI(t))}}};function AI(A){return function(t){Ve()===A&&cn({category:`sentry.${t.type==="transaction"?"transaction":"event"}`,event_id:t.event_id,level:t.level,message:nn(t)},{event:t})}}function nI(A,e){return function(n){if(Ve()!==A)return;let i,r,s=typeof e=="object"?e.serializeAttribute:void 0,o=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;o&&o>oo&&(Sl&&N.warn(`\`dom.maxStringLength\` cannot exceed ${oo}, but a value of ${o} was configured. Sentry will use ${oo} instead.`),o=oo),typeof s=="string"&&(s=[s]);try{const c=n.event,l=aI(c)?c.target:c;i=Yg(l,{keyAttrs:s,maxStringLength:o}),r=FT(l)}catch{i="<unknown>"}if(i.length===0)return;const a={category:`ui.${n.name}`,message:i};r&&(a.data={"ui.component_name":r}),cn(a,{event:n.event,name:n.name,global:n.global})}}function iI(A){return function(t){if(Ve()!==A)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:tk(t.level),message:Zg(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)n.message=`Assertion failed: ${Zg(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1);else return;cn(n,{input:t.args,level:t.level})}}function rI(A){return function(t){if(Ve()!==A)return;const{startTimestamp:n,endTimestamp:i}=t,r=t.xhr[Ki];if(!n||!i||!r)return;const{method:s,url:o,status_code:a,body:c}=r,l={method:s,url:o,status_code:a},u={xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:i},d={category:"xhr",data:l,type:"http",level:om(a)};A.emit("beforeOutgoingRequestBreadcrumb",d,u),cn(d,u)}}function sI(A){return function(t){if(Ve()!==A)return;const{startTimestamp:n,endTimestamp:i}=t;if(i&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"))if(t.fetchData.method,t.fetchData.url,t.error){const r=t.fetchData,s={data:t.error,input:t.args,startTimestamp:n,endTimestamp:i},o={category:"fetch",data:r,level:"error",type:"http"};A.emit("beforeOutgoingRequestBreadcrumb",o,s),cn(o,s)}else{const r=t.response,s={...t.fetchData,status_code:r?.status};t.fetchData.request_body_size,t.fetchData.response_body_size,r?.status;const o={input:t.args,response:r,startTimestamp:n,endTimestamp:i},a={category:"fetch",data:s,type:"http",level:om(s.status_code)};A.emit("beforeOutgoingRequestBreadcrumb",a,o),cn(a,o)}}}function oI(A){return function(t){if(Ve()!==A)return;let n=t.from,i=t.to;const r=hl(Pe.location.href);let s=n?hl(n):void 0;const o=hl(i);s?.path||(s=r),r.protocol===o.protocol&&r.host===o.host&&(i=o.relative),r.protocol===s.protocol&&r.host===s.host&&(n=s.relative),cn({category:"navigation",data:{from:n,to:i}})}}function aI(A){return!!A&&!!A.target}const cI=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],lI="BrowserApiErrors",uI=(A={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...A};return{name:lI,setupOnce(){e.setTimeout&&rt(Pe,"setTimeout",pm),e.setInterval&&rt(Pe,"setInterval",pm),e.requestAnimationFrame&&rt(Pe,"requestAnimationFrame",dI),e.XMLHttpRequest&&"XMLHttpRequest"in Pe&&rt(XMLHttpRequest.prototype,"send",hI);const t=e.eventTarget;t&&(Array.isArray(t)?t:cI).forEach(fI)}}};function pm(A){return function(...e){const t=e[0];return e[0]=Gn(t,{mechanism:{data:{function:_A(A)},handled:!1,type:"instrument"}}),A.apply(this,e)}}function dI(A){return function(e){return A.apply(this,[Gn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:_A(A)},handled:!1,type:"instrument"}})])}}function hI(A){return function(...e){const t=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in t&&typeof t[i]=="function"&&rt(t,i,function(r){const s={mechanism:{data:{function:i,handler:_A(r)},handled:!1,type:"instrument"}},o=Yc(r);return o&&(s.mechanism.data.handler=_A(o)),Gn(r,s)})}),A.apply(this,e)}}function fI(A){const t=Pe[A]?.prototype;t?.hasOwnProperty?.("addEventListener")&&(rt(t,"addEventListener",function(n){return function(i,r,s){try{gI(r)&&(r.handleEvent=Gn(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:_A(r),target:A},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[i,Gn(r,{mechanism:{data:{function:"addEventListener",handler:_A(r),target:A},handled:!1,type:"instrument"}}),s])}}),rt(t,"removeEventListener",function(n){return function(i,r,s){try{const o=r.__sentry_wrapped__;o&&n.call(this,i,o,s)}catch{}return n.call(this,i,r,s)}}))}function gI(A){return typeof A.handleEvent=="function"}const pI=()=>({name:"BrowserSession",setupOnce(){if(typeof Pe.document>"u"){Sl&&N.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Dp({ignoreDuration:!0}),Mp(),hm(({from:A,to:e})=>{A!==void 0&&A!==e&&(Dp({ignoreDuration:!0}),Mp())})}}),mI="GlobalHandlers",BI=(A={})=>{const e={onerror:!0,onunhandledrejection:!0,...A};return{name:mI,setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(vI(t),mm("onerror")),e.onunhandledrejection&&(CI(t),mm("onunhandledrejection"))}}};function vI(A){BQ(e=>{const{stackParser:t,attachStacktrace:n}=Bm();if(Ve()!==A||cm())return;const{msg:i,url:r,line:s,column:o,error:a}=e,c=bI(Cl(t,a||i,void 0,n,!1),r,s,o);c.level="error",Lp(c,{originalException:a,mechanism:{handled:!1,type:"onerror"}})})}function CI(A){CQ(e=>{const{stackParser:t,attachStacktrace:n}=Bm();if(Ve()!==A||cm())return;const i=wI(e),r=Jc(i)?yI(i):Cl(t,i,void 0,n,!0);r.level="error",Lp(r,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function wI(A){if(Jc(A))return A;try{if("reason"in A)return A.reason;if("detail"in A&&"reason"in A.detail)return A.detail.reason}catch{}return A}function yI(A){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(A)}`}]}}}function bI(A,e,t,n){const i=A.exception=A.exception||{},r=i.values=i.values||[],s=r[0]=r[0]||{},o=s.stacktrace=s.stacktrace||{},a=o.frames=o.frames||[],c=n,l=t,u=zt(e)&&e.length>0?e:zg();return a.length===0&&a.push({colno:c,filename:u,function:rn,in_app:!0,lineno:l}),A}function mm(A){Sl&&N.log(`Global Handler attached: ${A}`)}function Bm(){return Ve()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const EI=()=>({name:"HttpContext",preprocessEvent(A){if(!Pe.navigator&&!Pe.location&&!Pe.document)return;const e=pk(),t={...e.headers,...A.request?.headers};A.request={...e,...A.request,headers:t}}}),SI="cause",UI=5,TI="LinkedErrors",QI=(A={})=>{const e=A.limit||UI,t=A.key||SI;return{name:TI,preprocessEvent(n,i,r){const s=r.getOptions();zF(ml,s.stackParser,t,e,n,i)}}};function FI(A){return[GF(),MF(),uI(),tI(),BI(),QI(),nk(),EI(),pI()]}function kI(){const A=FI().filter(n=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers","HttpContext"].includes(n.name)),e=new Fk({dsn:"https://ac54bd10eac67be2dafbc346e704e4d4@o4507251798835200.ingest.us.sentry.io/4509409566392320",environment:"production",transport:Gk,stackParser:Zk,integrations:A,beforeSend(n,i){const r=i.originalException;return r instanceof Error&&(r.message.includes("Failed to fetch")||r.message.includes("Network request failed")||r.message.includes("Load failed")||r.message.includes("Permission denied")||r.message.includes("NotAllowedError"))?null:n},release:process.env.npm_package_version||"0.6.2"}),t=new Tt;return t.setClient(e),e.init(),t}let ao=null,st={};function II(){ao||(ao=kI())}function Me(A,e){{if(II(),!ao)return;dp(t=>{Object.entries(st).forEach(([n,i])=>{i!==void 0&&t.setTag(n,String(i))}),e&&(Object.entries(e).forEach(([n,i])=>{i!==void 0&&t.setTag(n,String(i))}),(e.userId||e.userEmail)&&t.setUser({id:e.userId,email:e.userEmail,...e.userMetadata}),(e.eventType||e.eventData||e.userJourney)&&t.setContext("eventContext",{eventType:e.eventType,eventData:e.eventData,userJourney:e.userJourney,timestamp:new Date().toISOString()})),ao.captureException(A)})}}function ie(A,e,t){st.eventType=A,st.eventData=e,st.userJourney||(st.userJourney=[]);const n=`${new Date().toISOString()}: ${A}${t?` (${t})`:""}`;st.userJourney.push(n),st.userJourney.length>10&&(st.userJourney=st.userJourney.slice(-10))}function Vi(A){st={...st,...A}}function Gi(A,e,t){return async(...n)=>{try{ie(`${e}_started`,{componentName:t},t);const i=await A(...n);return ie(`${e}_completed`,{componentName:t},t),i}catch(i){throw Me(i,{...st,componentName:t,handlerName:e,eventType:`${e}_failed`,eventData:{error:i instanceof Error?i.message:String(i)}}),i}}}function _I(A,e,t){return(...n)=>{try{ie(`${e}_started`,{componentName:t},t);const i=A(...n);return ie(`${e}_completed`,{componentName:t},t),i}catch(i){throw Me(i,{...st,componentName:t,handlerName:e,eventType:`${e}_failed`,eventData:{error:i instanceof Error?i.message:String(i)}}),i}}}function vm(A){return{trackLifecycle:(e,t)=>{try{ie(`${A}_${e}`,{},A),t()}catch(n){throw Me(n,{componentName:A,lifecycle:e,eventType:`${A}_${e}_failed`}),n}},trackRender:e=>{try{return e()}catch(t){return Me(t,{componentName:A,lifecycle:"render",eventType:`${A}_render_failed`}),L.html`<div>Error rendering ${A}</div>`}},setContext:()=>{Vi({componentName:A}),ie(`${A}_initialized`,{},A)}}}class xI{constructor(e){this.namespace=e}getItem(e){return localStorage.getItem(`${this.namespace}.${e}`)}setItem(e,t){localStorage.setItem(`${this.namespace}.${e}`,t)}removeItem(e){localStorage.removeItem(`${this.namespace}.${e}`)}clear(){for(let e=0;e<localStorage.length;e++){const t=localStorage.key(e);t&&t.startsWith(`${this.namespace}.`)&&localStorage.removeItem(t)}}}const Ul={SESSION_DATA:"session_data"},Tl=new xI("io.obi.widget");function RI(A){let e=A.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function PI(A,e){if(!e||e.length===0)return!1;const t=A.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(n=>{try{const i=RI(n);return i.test(t)||i.test(A)}catch(i){return console.warn(`Invalid URL pattern: ${n}`,i),!1}})}function co(A){if(!A||A.length===0)return!1;const e=window.location.origin+window.location.pathname;return PI(e,A)}var LI=Object.defineProperty,DI=Object.getOwnPropertyDescriptor,lo=(A,e,t,n)=>{for(var i=n>1?void 0:n?DI(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&LI(e,t,i),i};class jn extends L.LitElement{constructor(){super(...arguments),this.id="",this.isActive=!1,this.isSpecial=!1}handleClick(e){e.preventDefault(),e.stopPropagation();const t=new CustomEvent("obi-nav-icon-click",{detail:{id:this.id,isActive:!this.isActive},bubbles:!0,composed:!0});this.dispatchEvent(t),this.onClick&&this.onClick(this.id,!this.isActive)}render(){return L.html`
125
125
  <button
126
126
  id="obi-nav-${this.id}"
127
127
  class=${this.isSpecial?"special":""}
@@ -183,7 +183,7 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
183
183
  width: 18px;
184
184
  height: 18px;
185
185
  }
186
- `,lo([ee({type:String})],jn.prototype,"id",2),lo([ee({type:Boolean})],jn.prototype,"isActive",2),lo([ee({type:Boolean})],jn.prototype,"isSpecial",2),lo([ee({type:Function})],jn.prototype,"onClick",2),customElements.get("obi-nav-icon")||customElements.define("obi-nav-icon",jn);const ji=A=>L.html`
186
+ `,lo([Z({type:String})],jn.prototype,"id",2),lo([Z({type:Boolean})],jn.prototype,"isActive",2),lo([Z({type:Boolean})],jn.prototype,"isSpecial",2),lo([Z({type:Function})],jn.prototype,"onClick",2),customElements.get("obi-nav-icon")||customElements.define("obi-nav-icon",jn);const ji=A=>L.html`
187
187
  <svg
188
188
  xmlns="http://www.w3.org/2000/svg"
189
189
  width="24"
@@ -219,7 +219,7 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
219
219
  </svg>`)}"
220
220
  alt="Obi Icon"
221
221
  />
222
- `;var GI=Object.defineProperty,VI=Object.getOwnPropertyDescriptor,$n=(A,e,t,n)=>{for(var i=n>1?void 0:n?VI(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&GI(e,t,i),i};class RA extends L.LitElement{constructor(){super(),this.isActive=!1,this.isScreenActive=!1,this.position={top:0,left:0},this.currentState=O.READY,this.direction="up"}connectedCallback(){super.connectedCallback()}handleIconClick(e,t){this.onItemSelect&&this.onItemSelect(e,t)}render(){return L.html`
222
+ `;var VI=Object.defineProperty,GI=Object.getOwnPropertyDescriptor,$n=(A,e,t,n)=>{for(var i=n>1?void 0:n?GI(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&VI(e,t,i),i};class RA extends L.LitElement{constructor(){super(),this.isActive=!1,this.isScreenActive=!1,this.position={top:0,left:0},this.currentState=O.READY,this.direction="up"}connectedCallback(){super.connectedCallback()}handleIconClick(e,t){this.onItemSelect&&this.onItemSelect(e,t)}render(){return L.html`
223
223
  ${this.isActive?L.html`
224
224
  <obi-nav-icon
225
225
  id="pause"
@@ -267,7 +267,7 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
267
267
  bottom: auto;
268
268
  flex-direction: column;
269
269
  }
270
- `,$n([ee({type:Boolean})],RA.prototype,"isActive",2),$n([ee({type:Boolean})],RA.prototype,"isScreenActive",2),$n([ee({type:Object})],RA.prototype,"position",2),$n([ee({type:String})],RA.prototype,"currentState",2),$n([ee({type:String})],RA.prototype,"direction",2),$n([ee({type:Function})],RA.prototype,"onItemSelect",2),customElements.get("obi-navigation-bar")||customElements.define("obi-navigation-bar",RA);var jI=Object.defineProperty,$I=Object.getOwnPropertyDescriptor,tA=(A,e,t,n)=>{for(var i=n>1?void 0:n?$I(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&jI(e,t,i),i};class cn extends L.LitElement{constructor(){super(),this.id="",this.name="",this.description="",this.duration=10,this.selected=!1,this.handleClick=_I(()=>{ie("course_clicked",{courseId:this.id,courseName:this.name},"Course"),this.dispatchEvent(new CustomEvent("course-card-click",{detail:{id:this.id,name:this.name,description:this.description,duration:this.duration},bubbles:!0,composed:!0}))},"handleClick","Course");try{vm("Course").setContext()}catch(e){Me(e,{componentName:"Course",lifecycle:"constructor"})}}render(){return L.html`
270
+ `,$n([Z({type:Boolean})],RA.prototype,"isActive",2),$n([Z({type:Boolean})],RA.prototype,"isScreenActive",2),$n([Z({type:Object})],RA.prototype,"position",2),$n([Z({type:String})],RA.prototype,"currentState",2),$n([Z({type:String})],RA.prototype,"direction",2),$n([Z({type:Function})],RA.prototype,"onItemSelect",2),customElements.get("obi-navigation-bar")||customElements.define("obi-navigation-bar",RA);var jI=Object.defineProperty,$I=Object.getOwnPropertyDescriptor,Kt=(A,e,t,n)=>{for(var i=n>1?void 0:n?$I(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&jI(e,t,i),i};class PA extends L.LitElement{constructor(){super(),this.id="",this.name="",this.description="",this.duration=10,this.order=0,this.selected=!1,this.handleClick=_I(()=>{ie("course_clicked",{courseId:this.id,courseName:this.name},"Course"),this.dispatchEvent(new CustomEvent("course-card-click",{detail:{id:this.id,name:this.name,description:this.description,duration:this.duration},bubbles:!0,composed:!0}))},"handleClick","Course");try{vm("Course").setContext()}catch(e){Me(e,{componentName:"Course",lifecycle:"constructor"})}}render(){return L.html`
271
271
  <div class="course-container ${this.selected?"selected":""}" @click=${this.handleClick}>
272
272
  <div class="header-row">
273
273
  <h2 class="course-title">${this.name}</h2>
@@ -275,7 +275,7 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
275
275
  </div>
276
276
  ${this.description?L.html`<p class="course-description">${this.description}</p>`:""}
277
277
  </div>
278
- `}}cn.styles=L.css`
278
+ `}}PA.styles=L.css`
279
279
  :host {
280
280
  display: block;
281
281
  }
@@ -374,17 +374,18 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
374
374
  -webkit-box-orient: vertical;
375
375
  text-align: left;
376
376
  }
377
- `,tA([ee({type:String})],cn.prototype,"id",2),tA([ee({type:String})],cn.prototype,"name",2),tA([ee({type:String})],cn.prototype,"description",2),tA([ee({type:Number})],cn.prototype,"duration",2),tA([ee({type:Boolean})],cn.prototype,"selected",2);class Wn extends L.LitElement{constructor(){super(...arguments),this.courses=[],this.selectedCourseId=null,this.loading=!1,this.error=""}render(){return this.loading?L.html`<div class="loading">Loading...</div>`:this.error?L.html`<div class="error">${this.error}</div>`:!this.courses||this.courses.length===0?L.html`<div class="empty">No courses available</div>`:L.html`
377
+ `,Kt([Z({type:String})],PA.prototype,"id",2),Kt([Z({type:String})],PA.prototype,"name",2),Kt([Z({type:String})],PA.prototype,"description",2),Kt([Z({type:Number})],PA.prototype,"duration",2),Kt([Z({type:Number})],PA.prototype,"order",2),Kt([Z({type:Boolean})],PA.prototype,"selected",2);class Wn extends L.LitElement{constructor(){super(...arguments),this.courses=[],this.selectedCourseId=null,this.loading=!1,this.error=""}render(){return this.loading?L.html`<div class="loading">Loading...</div>`:this.error?L.html`<div class="error">${this.error}</div>`:!this.courses||this.courses.length===0?L.html`<div class="empty">No courses available</div>`:L.html`
378
378
  <div class="course-grid">
379
- ${this.courses.map(e=>{const t=e.id===this.selectedCourseId;return L.html`
380
- <obi-course
381
- id=${e.id}
382
- name=${e.name}
383
- description=${e.description||""}
384
- duration=${e.duration}
385
- ?selected=${t}
386
- ></obi-course>
387
- `})}
379
+ ${this.courses.sort((e,t)=>(e.order||0)-(t.order||0)).map(e=>{const t=e.id===this.selectedCourseId;return L.html`
380
+ <obi-course
381
+ id=${e.id}
382
+ name=${e.name}
383
+ description=${e.description||""}
384
+ duration=${e.duration}
385
+ order=${e.order||0}
386
+ ?selected=${t}
387
+ ></obi-course>
388
+ `})}
388
389
  </div>
389
390
  `}}Wn.styles=L.css`
390
391
  :host {
@@ -419,7 +420,7 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
419
420
  .error {
420
421
  color: #ef4444;
421
422
  }
422
- `,tA([ee({type:Array})],Wn.prototype,"courses",2),tA([ee({type:String})],Wn.prototype,"selectedCourseId",2),tA([ee({type:Boolean})],Wn.prototype,"loading",2),tA([ee({type:String})],Wn.prototype,"error",2),customElements.get("obi-course")||customElements.define("obi-course",cn),customElements.get("obi-course-list")||customElements.define("obi-course-list",Wn);var WI=Object.defineProperty,JI=Object.getOwnPropertyDescriptor,PA=(A,e,t,n)=>{for(var i=n>1?void 0:n?JI(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&WI(e,t,i),i};let Ft=class extends L.LitElement{constructor(){super(...arguments),this.courses=[],this.loading=!0,this.error="",this.apiKey="",this.apiBaseUrl="",this.selectedCourse=null,this.agentName=""}handleClose(){this.onClose&&this.onClose()}handleGetStarted(){this.selectedCourse&&this.dispatchEvent(new CustomEvent("course-select",{detail:this.selectedCourse,bubbles:!0,composed:!0}))}async fetchCourses(){try{this.loading=!0,console.log("[CourseModal] Fetching sessions from API",{apiKey:this.apiKey?"present":"missing"});const e=await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`,{cache:"no-cache"});if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);const t=await e.json();let n="";const r=(t.sessions?.map(s=>(n||(n=s.onboarding_plan.product.agent_name),{id:s.uuid,name:s.onboarding_plan.name,description:s.onboarding_plan.description,duration:s.onboarding_plan.duration}))).filter(s=>!!s.name);this.agentName=n||"Obi",this.courses=[...r],this.error="",console.log("[CourseModal] Sessions fetched successfully",{sessionCount:r.length,sessions:r.map(s=>({id:s.id,name:s.name}))}),this.requestUpdate()}catch(e){console.error("[CourseModal] Fetch error:",e),this.error=`Failed to fetch courses: ${e instanceof Error?e.message:"Unknown error"}`}finally{this.loading=!1,this.requestUpdate()}}handleCourseCardClick(e){const{id:t,name:n,description:i,duration:r}=e.detail;this.selectedCourse={id:t,name:n,description:i,duration:r}}connectedCallback(){super.connectedCallback(),window.obiWidgetConfig?.apiKey&&(this.apiKey=window.obiWidgetConfig.apiKey),this.apiBaseUrl=Ka,this.apiBaseUrl&&this.apiKey?this.fetchCourses():(this.loading=!1,this.error="API base URL or API key is missing")}render(){return L.html`
423
+ `,Kt([Z({type:Array})],Wn.prototype,"courses",2),Kt([Z({type:String})],Wn.prototype,"selectedCourseId",2),Kt([Z({type:Boolean})],Wn.prototype,"loading",2),Kt([Z({type:String})],Wn.prototype,"error",2),customElements.get("obi-course")||customElements.define("obi-course",PA),customElements.get("obi-course-list")||customElements.define("obi-course-list",Wn);var WI=Object.defineProperty,JI=Object.getOwnPropertyDescriptor,LA=(A,e,t,n)=>{for(var i=n>1?void 0:n?JI(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&WI(e,t,i),i};let Ft=class extends L.LitElement{constructor(){super(...arguments),this.courses=[],this.loading=!0,this.error="",this.apiKey="",this.apiBaseUrl="",this.selectedCourse=null,this.agentName=""}handleClose(){this.onClose&&this.onClose()}handleGetStarted(){this.selectedCourse&&this.dispatchEvent(new CustomEvent("course-select",{detail:this.selectedCourse,bubbles:!0,composed:!0}))}async fetchCourses(){try{this.loading=!0,console.log("[CourseModal] Fetching sessions from API",{apiKey:this.apiKey?"present":"missing"});const e=await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`,{cache:"no-cache"});if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);const t=await e.json();let n="";const r=(t.sessions?.map(s=>(n||(n=s.onboarding_plan.product.agent_name),{id:s.uuid,name:s.onboarding_plan.name,description:s.onboarding_plan.description,duration:s.onboarding_plan.duration,order:s.onboarding_plan.order}))).filter(s=>!!s.name);this.agentName=n||"Obi",this.courses=[...r],this.error="",console.log("[CourseModal] Sessions fetched successfully",{sessionCount:r.length,sessions:r.map(s=>({id:s.id,name:s.name}))}),this.requestUpdate()}catch(e){console.error("[CourseModal] Fetch error:",e),this.error=`Failed to fetch courses: ${e instanceof Error?e.message:"Unknown error"}`}finally{this.loading=!1,this.requestUpdate()}}handleCourseCardClick(e){const{id:t,name:n,description:i,duration:r}=e.detail;this.selectedCourse={id:t,name:n,description:i,duration:r}}connectedCallback(){super.connectedCallback(),window.obiWidgetConfig?.apiKey&&(this.apiKey=window.obiWidgetConfig.apiKey),this.apiBaseUrl=Ka,this.apiBaseUrl&&this.apiKey?this.fetchCourses():(this.loading=!1,this.error="API base URL or API key is missing")}render(){return L.html`
423
424
  <div class="backdrop"></div>
424
425
  <div class="container">
425
426
  <div class="header">
@@ -491,6 +492,25 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
491
492
  Sessions are securely recorded for quality improvement purposes.
492
493
  </p>
493
494
  </div>
495
+ <div class="powered-by-container">
496
+ <a href="https://getcor.ai/" target="_blank" class="powered-by-link">
497
+ <div style="display: flex; align-items: end; gap: 4px;">
498
+ <p class="powered-by">Powered by</p>
499
+ <svg
500
+ xmlns="http://www.w3.org/2000/svg"
501
+ width="59"
502
+ height="16"
503
+ viewBox="0 0 59 16"
504
+ fill="none"
505
+ >
506
+ <path
507
+ d="M43.1777 3.86914C46.7404 3.86914 48.9042 6.57952 48.9043 9.77051C48.9043 13.4206 46.7624 16 43.1777 16C39.5498 15.9998 37.4299 13.268 37.4297 9.90234C37.4297 6.40537 39.5714 3.86928 43.1777 3.86914ZM28.8398 0C30.7196 0 32.1619 0.852712 33.1455 1.98926L33.2988 1.07129C33.4518 0.481159 33.8017 0.28418 34.2607 0.28418C35.0036 0.284203 35.1345 0.459008 35.2656 1.11426L35.9658 4.93945C36.097 5.5733 35.9869 5.83598 35.4404 6.12012C34.8287 6.42584 34.4137 6.40382 34.0859 5.90137C32.4466 3.08185 30.9818 2.22949 29.0146 2.22949C25.9547 2.22959 24.2285 4.93988 24.2285 7.95605C24.2286 11.9994 26.6979 13.748 29.4082 13.748C31.5502 13.748 33.517 12.6986 34.5225 10.4912C34.8284 9.90123 35.2877 9.79169 35.834 10.0537C36.4241 10.316 36.4898 10.8626 36.2275 11.4746C35.2002 14.0974 32.7523 15.999 28.8398 15.999C24.0969 15.999 21.3428 12.4584 21.3428 8.30566C21.3428 3.49723 24.4684 5.99482e-05 28.8398 0ZM9.93945 0.0927734C10.9259 0.142615 11.7099 0.956225 11.71 1.95215C11.7098 2.97999 10.8746 3.81329 9.84375 3.81348H6.13086C4.88502 3.9007 3.88179 4.86388 3.73535 6.08887L3.73438 6.10059V9.94141L3.73535 9.9541C3.88896 11.2389 4.98549 12.2353 6.31543 12.2354H9.53613C10.971 12.2352 12.1338 11.0752 12.1338 9.64453V6.09766L12.1367 6.00195C12.1867 5.01847 13.0022 4.23648 14.001 4.23633C15.032 4.23637 15.8681 5.06962 15.8682 6.09766V9.95117L15.8662 10.043C15.8203 10.984 15.073 11.7415 14.1348 11.8076V11.8184C12.8383 11.9038 11.8024 12.9378 11.7168 14.2305H11.7051C11.6364 15.1959 10.8295 15.9578 9.84375 15.958H5.97852C4.94743 15.958 4.11137 15.1247 4.11133 14.0967C4.11133 14.0783 4.11177 14.0595 4.1123 14.041H4.10938C3.92516 12.8594 2.94081 11.9037 1.72559 11.8193V11.8076C0.76079 11.7355 3.38938e-05 10.9317 0 9.95117V6.09766L0.00195312 6.00488C0.0487124 5.05403 0.811457 4.29096 1.76367 4.23926C2.96095 4.13852 3.92677 3.20977 4.10938 2.04102L4.1123 2.02148V2.00293C4.11188 1.9871 4.11133 1.97019 4.11133 1.95215C4.11137 0.924114 4.94744 0.0908305 5.97852 0.0908203H9.84375L9.93945 0.0927734ZM57.3926 4.00684C58.0264 4.00684 58.4639 4.42303 58.4639 5.10059C58.4636 6.17112 57.6773 6.54308 56.541 7.00195C55.2296 7.54837 54.4202 8.26929 54.0049 9.14355V12.8809C54.0049 13.5803 54.2454 13.887 55.6006 14.2148C56.2126 14.4116 56.3438 14.5862 56.3438 15.0889C56.3437 15.5696 56.1687 15.7881 55.666 15.7881H50.5518C50.071 15.7881 49.8956 15.5914 49.8955 15.0889C49.8955 14.6299 50.0055 14.433 50.4863 14.2363C51.2949 13.9085 51.5566 13.5805 51.5566 12.8594V7.72266C51.5566 6.82676 51.4256 6.62971 50.3984 6.23633C49.9834 6.06155 49.8955 5.95228 49.8955 5.53711C49.8955 5.16578 50.0051 5.01258 50.3545 4.90332L52.5625 4.13867C53.4805 3.85454 53.9395 4.02928 53.9395 4.94727V7.02344C54.901 5.23148 56.4308 4.00723 57.3926 4.00684ZM42.8506 5.94629C40.9053 5.94629 39.8994 7.38883 39.8994 9.44336C39.8996 11.6725 41.1016 13.9236 43.5273 13.9238C45.1011 13.9238 46.457 12.7867 46.457 10.4043C46.4569 8.17514 45.189 5.94655 42.8506 5.94629Z"
508
+ fill="#18181B"
509
+ />
510
+ </svg>
511
+ </div>
512
+ </a>
513
+ </div>
494
514
  </div>
495
515
  `}};Ft.styles=L.css`
496
516
  :host {
@@ -711,29 +731,57 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
711
731
  height: 20px;
712
732
  width: 80%;
713
733
  }
714
- `,PA([ee({type:Array})],Ft.prototype,"courses",2),PA([ee({type:Boolean})],Ft.prototype,"loading",2),PA([ee({type:String})],Ft.prototype,"error",2),PA([ee({type:String})],Ft.prototype,"apiKey",2),PA([ee({type:Function})],Ft.prototype,"onClose",2),PA([oe()],Ft.prototype,"apiBaseUrl",2),PA([oe()],Ft.prototype,"selectedCourse",2),PA([oe()],Ft.prototype,"agentName",2),customElements.get("obi-course-modal")||customElements.define("obi-course-modal",Ft);/**
734
+
735
+ .powered-by-container {
736
+ position: absolute;
737
+ bottom: 32px;
738
+ right: 32px;
739
+ display: flex;
740
+ flex-direction: row;
741
+ align-items: end;
742
+ justify-content: center;
743
+ gap: 4px;
744
+ z-index: 10;
745
+ }
746
+
747
+ .powered-by-link {
748
+ text-decoration: none;
749
+ }
750
+
751
+ .powered-by {
752
+ color: #18181b;
753
+ text-align: center;
754
+ font-family: "Satoshi", sans-serif;
755
+ font-size: 12px;
756
+ font-style: normal;
757
+ font-weight: 400;
758
+ line-height: 100%;
759
+ letter-spacing: -0.12px;
760
+ margin: 0;
761
+ }
762
+ `,LA([Z({type:Array})],Ft.prototype,"courses",2),LA([Z({type:Boolean})],Ft.prototype,"loading",2),LA([Z({type:String})],Ft.prototype,"error",2),LA([Z({type:String})],Ft.prototype,"apiKey",2),LA([Z({type:Function})],Ft.prototype,"onClose",2),LA([oe()],Ft.prototype,"apiBaseUrl",2),LA([oe()],Ft.prototype,"selectedCourse",2),LA([oe()],Ft.prototype,"agentName",2),customElements.get("obi-course-modal")||customElements.define("obi-course-modal",Ft);/**
715
763
  * @license
716
764
  * Copyright 2017 Google LLC
717
765
  * SPDX-License-Identifier: BSD-3-Clause
718
- */const $i=globalThis,ho=$i.trustedTypes,Cm=ho?ho.createPolicy("lit-html",{createHTML:A=>A}):void 0,wm="$lit$",LA=`lit$${Math.random().toFixed(9).slice(2)}$`,ym="?"+LA,XI=`<${ym}>`,ln=document,fo=()=>ln.createComment(""),Wi=A=>A===null||typeof A!="object"&&typeof A!="function",Ql=Array.isArray,qI=A=>Ql(A)||typeof A?.[Symbol.iterator]=="function",Fl=`[
766
+ */const $i=globalThis,ho=$i.trustedTypes,Cm=ho?ho.createPolicy("lit-html",{createHTML:A=>A}):void 0,wm="$lit$",DA=`lit$${Math.random().toFixed(9).slice(2)}$`,ym="?"+DA,XI=`<${ym}>`,ln=document,fo=()=>ln.createComment(""),Wi=A=>A===null||typeof A!="object"&&typeof A!="function",Ql=Array.isArray,qI=A=>Ql(A)||typeof A?.[Symbol.iterator]=="function",Fl=`[
719
767
  \f\r]`,Ji=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bm=/-->/g,Em=/>/g,un=RegExp(`>|${Fl}(?:([^\\s"'>=/]+)(${Fl}*=${Fl}*(?:[^
720
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Sm=/'/g,Um=/"/g,Tm=/^(?:script|style|textarea|title)$/i,Xi=Symbol.for("lit-noChange"),be=Symbol.for("lit-nothing"),Qm=new WeakMap,dn=ln.createTreeWalker(ln,129);function Fm(A,e){if(!Ql(A)||!A.hasOwnProperty("raw"))throw Error("invalid template strings array");return Cm!==void 0?Cm.createHTML(e):e}const YI=(A,e)=>{const t=A.length-1,n=[];let i,r=e===2?"<svg>":e===3?"<math>":"",s=Ji;for(let o=0;o<t;o++){const a=A[o];let c,l,u=-1,d=0;for(;d<a.length&&(s.lastIndex=d,l=s.exec(a),l!==null);)d=s.lastIndex,s===Ji?l[1]==="!--"?s=bm:l[1]!==void 0?s=Em:l[2]!==void 0?(Tm.test(l[2])&&(i=RegExp("</"+l[2],"g")),s=un):l[3]!==void 0&&(s=un):s===un?l[0]===">"?(s=i??Ji,u=-1):l[1]===void 0?u=-2:(u=s.lastIndex-l[2].length,c=l[1],s=l[3]===void 0?un:l[3]==='"'?Um:Sm):s===Um||s===Sm?s=un:s===bm||s===Em?s=Ji:(s=un,i=void 0);const h=s===un&&A[o+1].startsWith("/>")?" ":"";r+=s===Ji?a+XI:u>=0?(n.push(c),a.slice(0,u)+wm+a.slice(u)+LA+h):a+LA+(u===-2?o:h)}return[Fm(A,r+(A[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};class qi{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let r=0,s=0;const o=e.length-1,a=this.parts,[c,l]=YI(e,t);if(this.el=qi.createElement(c,n),dn.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=dn.nextNode())!==null&&a.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(wm)){const d=l[s++],h=i.getAttribute(u).split(LA),f=/([.?@])?(.*)/.exec(d);a.push({type:1,index:r,name:f[2],strings:h,ctor:f[1]==="."?ZI:f[1]==="?"?e_:f[1]==="@"?t_:po}),i.removeAttribute(u)}else u.startsWith(LA)&&(a.push({type:6,index:r}),i.removeAttribute(u));if(Tm.test(i.tagName)){const u=i.textContent.split(LA),d=u.length-1;if(d>0){i.textContent=ho?ho.emptyScript:"";for(let h=0;h<d;h++)i.append(u[h],fo()),dn.nextNode(),a.push({type:2,index:++r});i.append(u[d],fo())}}}else if(i.nodeType===8)if(i.data===ym)a.push({type:2,index:r});else{let u=-1;for(;(u=i.data.indexOf(LA,u+1))!==-1;)a.push({type:7,index:r}),u+=LA.length-1}r++}}static createElement(e,t){const n=ln.createElement("template");return n.innerHTML=e,n}}function Jn(A,e,t=A,n){if(e===Xi)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const r=Wi(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(A),i._$AT(A,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=i:t._$Cl=i),i!==void 0&&(e=Jn(A,i._$AS(A,e.values),i,n)),e}class zI{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ln).importNode(t,!0);dn.currentNode=i;let r=dn.nextNode(),s=0,o=0,a=n[0];for(;a!==void 0;){if(s===a.index){let c;a.type===2?c=new go(r,r.nextSibling,this,e):a.type===1?c=new a.ctor(r,a.name,a.strings,this,e):a.type===6&&(c=new A_(r,this,e)),this._$AV.push(c),a=n[++o]}s!==a?.index&&(r=dn.nextNode(),s++)}return dn.currentNode=ln,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class go{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=be,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Jn(this,e,t),Wi(e)?e===be||e==null||e===""?(this._$AH!==be&&this._$AR(),this._$AH=be):e!==this._$AH&&e!==Xi&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):qI(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==be&&Wi(this._$AH)?this._$AA.nextSibling.data=e:this.T(ln.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=qi.createElement(Fm(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new zI(i,this),s=r.u(this.options);r.p(t),this.T(s),this._$AH=r}}_$AC(e){let t=Qm.get(e.strings);return t===void 0&&Qm.set(e.strings,t=new qi(e)),t}k(e){Ql(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new go(this.O(fo()),this.O(fo()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class po{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,r){this.type=1,this._$AH=be,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=be}_$AI(e,t=this,n,i){const r=this.strings;let s=!1;if(r===void 0)e=Jn(this,e,t,0),s=!Wi(e)||e!==this._$AH&&e!==Xi,s&&(this._$AH=e);else{const o=e;let a,c;for(e=r[0],a=0;a<r.length-1;a++)c=Jn(this,o[n+a],t,a),c===Xi&&(c=this._$AH[a]),s||(s=!Wi(c)||c!==this._$AH[a]),c===be?e=be:e!==be&&(e+=(c??"")+r[a+1]),this._$AH[a]=c}s&&!i&&this.j(e)}j(e){e===be?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ZI extends po{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===be?void 0:e}}class e_ extends po{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==be)}}class t_ extends po{constructor(e,t,n,i,r){super(e,t,n,i,r),this.type=5}_$AI(e,t=this){if((e=Jn(this,e,t,0)??be)===Xi)return;const n=this._$AH,i=e===be&&n!==be||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==be&&(n===be||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class A_{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Jn(this,e)}}const n_=$i.litHtmlPolyfillSupport;n_?.(qi,go),($i.litHtmlVersions??($i.litHtmlVersions=[])).push("3.3.0");/**
768
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Sm=/'/g,Um=/"/g,Tm=/^(?:script|style|textarea|title)$/i,Xi=Symbol.for("lit-noChange"),be=Symbol.for("lit-nothing"),Qm=new WeakMap,dn=ln.createTreeWalker(ln,129);function Fm(A,e){if(!Ql(A)||!A.hasOwnProperty("raw"))throw Error("invalid template strings array");return Cm!==void 0?Cm.createHTML(e):e}const YI=(A,e)=>{const t=A.length-1,n=[];let i,r=e===2?"<svg>":e===3?"<math>":"",s=Ji;for(let o=0;o<t;o++){const a=A[o];let c,l,u=-1,d=0;for(;d<a.length&&(s.lastIndex=d,l=s.exec(a),l!==null);)d=s.lastIndex,s===Ji?l[1]==="!--"?s=bm:l[1]!==void 0?s=Em:l[2]!==void 0?(Tm.test(l[2])&&(i=RegExp("</"+l[2],"g")),s=un):l[3]!==void 0&&(s=un):s===un?l[0]===">"?(s=i??Ji,u=-1):l[1]===void 0?u=-2:(u=s.lastIndex-l[2].length,c=l[1],s=l[3]===void 0?un:l[3]==='"'?Um:Sm):s===Um||s===Sm?s=un:s===bm||s===Em?s=Ji:(s=un,i=void 0);const h=s===un&&A[o+1].startsWith("/>")?" ":"";r+=s===Ji?a+XI:u>=0?(n.push(c),a.slice(0,u)+wm+a.slice(u)+DA+h):a+DA+(u===-2?o:h)}return[Fm(A,r+(A[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};class qi{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let r=0,s=0;const o=e.length-1,a=this.parts,[c,l]=YI(e,t);if(this.el=qi.createElement(c,n),dn.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=dn.nextNode())!==null&&a.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(wm)){const d=l[s++],h=i.getAttribute(u).split(DA),f=/([.?@])?(.*)/.exec(d);a.push({type:1,index:r,name:f[2],strings:h,ctor:f[1]==="."?ZI:f[1]==="?"?e1:f[1]==="@"?t1:po}),i.removeAttribute(u)}else u.startsWith(DA)&&(a.push({type:6,index:r}),i.removeAttribute(u));if(Tm.test(i.tagName)){const u=i.textContent.split(DA),d=u.length-1;if(d>0){i.textContent=ho?ho.emptyScript:"";for(let h=0;h<d;h++)i.append(u[h],fo()),dn.nextNode(),a.push({type:2,index:++r});i.append(u[d],fo())}}}else if(i.nodeType===8)if(i.data===ym)a.push({type:2,index:r});else{let u=-1;for(;(u=i.data.indexOf(DA,u+1))!==-1;)a.push({type:7,index:r}),u+=DA.length-1}r++}}static createElement(e,t){const n=ln.createElement("template");return n.innerHTML=e,n}}function Jn(A,e,t=A,n){if(e===Xi)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const r=Wi(e)?void 0:e._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),r===void 0?i=void 0:(i=new r(A),i._$AT(A,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=i:t._$Cl=i),i!==void 0&&(e=Jn(A,i._$AS(A,e.values),i,n)),e}class zI{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ln).importNode(t,!0);dn.currentNode=i;let r=dn.nextNode(),s=0,o=0,a=n[0];for(;a!==void 0;){if(s===a.index){let c;a.type===2?c=new go(r,r.nextSibling,this,e):a.type===1?c=new a.ctor(r,a.name,a.strings,this,e):a.type===6&&(c=new A1(r,this,e)),this._$AV.push(c),a=n[++o]}s!==a?.index&&(r=dn.nextNode(),s++)}return dn.currentNode=ln,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class go{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=be,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Jn(this,e,t),Wi(e)?e===be||e==null||e===""?(this._$AH!==be&&this._$AR(),this._$AH=be):e!==this._$AH&&e!==Xi&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):qI(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==be&&Wi(this._$AH)?this._$AA.nextSibling.data=e:this.T(ln.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=qi.createElement(Fm(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new zI(i,this),s=r.u(this.options);r.p(t),this.T(s),this._$AH=r}}_$AC(e){let t=Qm.get(e.strings);return t===void 0&&Qm.set(e.strings,t=new qi(e)),t}k(e){Ql(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new go(this.O(fo()),this.O(fo()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class po{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,r){this.type=1,this._$AH=be,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=be}_$AI(e,t=this,n,i){const r=this.strings;let s=!1;if(r===void 0)e=Jn(this,e,t,0),s=!Wi(e)||e!==this._$AH&&e!==Xi,s&&(this._$AH=e);else{const o=e;let a,c;for(e=r[0],a=0;a<r.length-1;a++)c=Jn(this,o[n+a],t,a),c===Xi&&(c=this._$AH[a]),s||(s=!Wi(c)||c!==this._$AH[a]),c===be?e=be:e!==be&&(e+=(c??"")+r[a+1]),this._$AH[a]=c}s&&!i&&this.j(e)}j(e){e===be?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ZI extends po{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===be?void 0:e}}class e1 extends po{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==be)}}class t1 extends po{constructor(e,t,n,i,r){super(e,t,n,i,r),this.type=5}_$AI(e,t=this){if((e=Jn(this,e,t,0)??be)===Xi)return;const n=this._$AH,i=e===be&&n!==be||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==be&&(n===be||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class A1{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Jn(this,e)}}const n1=$i.litHtmlPolyfillSupport;n1?.(qi,go),($i.litHtmlVersions??($i.litHtmlVersions=[])).push("3.3.0");/**
721
769
  * @license
722
770
  * Copyright 2020 Google LLC
723
771
  * SPDX-License-Identifier: BSD-3-Clause
724
- */const i_=A=>A.strings===void 0;/**
772
+ */const i1=A=>A.strings===void 0;/**
725
773
  * @license
726
774
  * Copyright 2017 Google LLC
727
775
  * SPDX-License-Identifier: BSD-3-Clause
728
- */const r_={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},s_=A=>(...e)=>({_$litDirective$:A,values:e});class o_{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
776
+ */const r1={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},s1=A=>(...e)=>({_$litDirective$:A,values:e});class o1{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
729
777
  * @license
730
778
  * Copyright 2017 Google LLC
731
779
  * SPDX-License-Identifier: BSD-3-Clause
732
- */const Yi=(A,e)=>{const t=A._$AN;if(t===void 0)return!1;for(const n of t)n._$AO?.(e,!1),Yi(n,e);return!0},mo=A=>{let e,t;do{if((e=A._$AM)===void 0)break;t=e._$AN,t.delete(A),A=e}while(t?.size===0)},km=A=>{for(let e;e=A._$AM;A=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(A))break;t.add(A),l_(e)}};function a_(A){this._$AN!==void 0?(mo(this),this._$AM=A,km(this)):this._$AM=A}function c_(A,e=!1,t=0){const n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let r=t;r<n.length;r++)Yi(n[r],!1),mo(n[r]);else n!=null&&(Yi(n,!1),mo(n));else Yi(this,A)}const l_=A=>{A.type==r_.CHILD&&(A._$AP??(A._$AP=c_),A._$AQ??(A._$AQ=a_))};class u_ extends o_{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),km(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Yi(this,e),mo(this))}setValue(e){if(i_(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
780
+ */const Yi=(A,e)=>{const t=A._$AN;if(t===void 0)return!1;for(const n of t)n._$AO?.(e,!1),Yi(n,e);return!0},mo=A=>{let e,t;do{if((e=A._$AM)===void 0)break;t=e._$AN,t.delete(A),A=e}while(t?.size===0)},km=A=>{for(let e;e=A._$AM;A=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(A))break;t.add(A),l1(e)}};function a1(A){this._$AN!==void 0?(mo(this),this._$AM=A,km(this)):this._$AM=A}function c1(A,e=!1,t=0){const n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let r=t;r<n.length;r++)Yi(n[r],!1),mo(n[r]);else n!=null&&(Yi(n,!1),mo(n));else Yi(this,A)}const l1=A=>{A.type==r1.CHILD&&(A._$AP??(A._$AP=c1),A._$AQ??(A._$AQ=a1))};class u1 extends o1{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),km(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Yi(this,e),mo(this))}setValue(e){if(i1(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
733
781
  * @license
734
782
  * Copyright 2020 Google LLC
735
783
  * SPDX-License-Identifier: BSD-3-Clause
736
- */const d_=()=>new h_;class h_{}const kl=new WeakMap,f_=s_(class extends u_{render(A){return be}update(A,[e]){const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=A.options?.host,this.rt(this.ct=A.element)),be}rt(A){if(this.isConnected||(A=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=kl.get(e);t===void 0&&(t=new WeakMap,kl.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,A),A!==void 0&&this.G.call(this.ht,A)}else this.G.value=A}get lt(){return typeof this.G=="function"?kl.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var g_=Object.defineProperty,p_=Object.getOwnPropertyDescriptor,Im=(A,e,t,n)=>{for(var i=n>1?void 0:n?p_(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&g_(e,t,i),i};let zi=class extends L.LitElement{constructor(){super(...arguments),this.volume={speaker:"ASSISTANT",volume:0,spectrum:[]},this.canvasRef=d_(),this.barCount=8,this.animationFrame=null,this.primaryColor=Mr}connectedCallback(){super.connectedCallback(),this.primaryColor=getComputedStyle(this).getPropertyValue("--obi-primary").trim()||Mr,this.startAnimation()}disconnectedCallback(){super.disconnectedCallback(),this.stopAnimation()}startAnimation(){const e=()=>{this.drawEqualizer(),this.animationFrame=requestAnimationFrame(e)};this.animationFrame=requestAnimationFrame(e)}stopAnimation(){this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null)}drawEqualizer(){const e=this.canvasRef.value;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=window.devicePixelRatio||1,i=e.clientWidth,r=e.clientHeight;e.width=Math.round(i*n),e.height=Math.round(r*n),t.scale(n,n),t.imageSmoothingEnabled=!1,t.clearRect(0,0,i,r);const s=3,o=Math.max(1,(i-(this.barCount-1)*s)/this.barCount),a=r/2,c=this.volume.speaker==="USER"?this.volume.volume:this.volume.volume,l=this.volume.speaker==="USER"?this.volume.spectrum:this.volume.spectrum;if(c===0)return;let u=[];if(l&&l.length>0){const d=l.length,h=Math.ceil(d/10);let f=[];for(let v=0;v<10;v++){const C=v*h,w=Math.min((v+1)*h,d);let S=0;for(let F=C;F<w;F++)S+=l[F]||0;f.push({region:v,startIdx:C,endIdx:w,energy:S})}f.sort((v,C)=>C.energy-v.energy);const g=f.slice(0,3),p=Math.min(...g.map(v=>v.startIdx)),B=Math.max(...g.map(v=>v.endIdx));if(B>p)for(let v=0;v<this.barCount;v++){const C=p+v/(this.barCount-1)*(B-p),w=Math.min(d-1,Math.floor(C));u[v]=l[w]||0}else for(let v=0;v<this.barCount;v++){const C=v/(this.barCount-1)*(d/2),w=Math.min(d-1,Math.floor(C));u[v]=l[w]||0}const y=Math.max(...u,1),b=this.volume.speaker==="USER"?.7:.6;u=u.map((v,C)=>{const w=v/y,S=b+C/(this.barCount-1)*.3;return Math.min(1,w*S)})}else if(this.volume.speaker!=="USER")for(let d=0;d<this.barCount;d++){const h=Date.now()*.002,f=.3+.2*Math.sin(h+d*.7);u[d]=f}for(let d=0;d<this.barCount;d++){const h=u.length>0&&u[d]!==void 0?u[d]:c;this.volume.speaker==="USER"?t.fillStyle=`${this.primaryColor}`:t.fillStyle="#FFFFFF";const f=Math.max(2,h*.8*a),g=i-(this.barCount-d)*(o+s),p=o/2;t.beginPath(),t.moveTo(g+p,r/2-f),t.lineTo(g+o-p,r/2-f),t.quadraticCurveTo(g+o,r/2-f,g+o,r/2-f+p),t.lineTo(g+o,r/2),t.lineTo(g,r/2),t.lineTo(g,r/2-f+p),t.quadraticCurveTo(g,r/2-f,g+p,r/2-f),t.fill(),t.beginPath(),t.moveTo(g,r/2),t.lineTo(g+o,r/2),t.lineTo(g+o,r/2+f-p),t.quadraticCurveTo(g+o,r/2+f,g+o-p,r/2+f),t.lineTo(g+p,r/2+f),t.quadraticCurveTo(g,r/2+f,g,r/2+f-p),t.lineTo(g,r/2),t.fill()}}render(){return L.html` <canvas ${f_(this.canvasRef)} width="40" height="40"></canvas> `}};zi.styles=L.css`
784
+ */const d1=()=>new h1;class h1{}const kl=new WeakMap,f1=s1(class extends u1{render(A){return be}update(A,[e]){const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=A.options?.host,this.rt(this.ct=A.element)),be}rt(A){if(this.isConnected||(A=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=kl.get(e);t===void 0&&(t=new WeakMap,kl.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,A),A!==void 0&&this.G.call(this.ht,A)}else this.G.value=A}get lt(){return typeof this.G=="function"?kl.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var g1=Object.defineProperty,p1=Object.getOwnPropertyDescriptor,Im=(A,e,t,n)=>{for(var i=n>1?void 0:n?p1(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&g1(e,t,i),i};let zi=class extends L.LitElement{constructor(){super(...arguments),this.volume={speaker:"ASSISTANT",volume:0,spectrum:[]},this.canvasRef=d1(),this.barCount=8,this.animationFrame=null,this.primaryColor=Mr}connectedCallback(){super.connectedCallback(),this.primaryColor=getComputedStyle(this).getPropertyValue("--obi-primary").trim()||Mr,this.startAnimation()}disconnectedCallback(){super.disconnectedCallback(),this.stopAnimation()}startAnimation(){const e=()=>{this.drawEqualizer(),this.animationFrame=requestAnimationFrame(e)};this.animationFrame=requestAnimationFrame(e)}stopAnimation(){this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null)}drawEqualizer(){const e=this.canvasRef.value;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=window.devicePixelRatio||1,i=e.clientWidth,r=e.clientHeight;e.width=Math.round(i*n),e.height=Math.round(r*n),t.scale(n,n),t.imageSmoothingEnabled=!1,t.clearRect(0,0,i,r);const s=3,o=Math.max(1,(i-(this.barCount-1)*s)/this.barCount),a=r/2,c=this.volume.speaker==="USER"?this.volume.volume:this.volume.volume,l=this.volume.speaker==="USER"?this.volume.spectrum:this.volume.spectrum;if(c===0)return;let u=[];if(l&&l.length>0){const d=l.length,h=Math.ceil(d/10);let f=[];for(let v=0;v<10;v++){const C=v*h,w=Math.min((v+1)*h,d);let S=0;for(let F=C;F<w;F++)S+=l[F]||0;f.push({region:v,startIdx:C,endIdx:w,energy:S})}f.sort((v,C)=>C.energy-v.energy);const g=f.slice(0,3),p=Math.min(...g.map(v=>v.startIdx)),B=Math.max(...g.map(v=>v.endIdx));if(B>p)for(let v=0;v<this.barCount;v++){const C=p+v/(this.barCount-1)*(B-p),w=Math.min(d-1,Math.floor(C));u[v]=l[w]||0}else for(let v=0;v<this.barCount;v++){const C=v/(this.barCount-1)*(d/2),w=Math.min(d-1,Math.floor(C));u[v]=l[w]||0}const y=Math.max(...u,1),b=this.volume.speaker==="USER"?.7:.6;u=u.map((v,C)=>{const w=v/y,S=b+C/(this.barCount-1)*.3;return Math.min(1,w*S)})}else if(this.volume.speaker!=="USER")for(let d=0;d<this.barCount;d++){const h=Date.now()*.002,f=.3+.2*Math.sin(h+d*.7);u[d]=f}for(let d=0;d<this.barCount;d++){const h=u.length>0&&u[d]!==void 0?u[d]:c;this.volume.speaker==="USER"?t.fillStyle=`${this.primaryColor}`:t.fillStyle="#FFFFFF";const f=Math.max(2,h*.8*a),g=i-(this.barCount-d)*(o+s),p=o/2;t.beginPath(),t.moveTo(g+p,r/2-f),t.lineTo(g+o-p,r/2-f),t.quadraticCurveTo(g+o,r/2-f,g+o,r/2-f+p),t.lineTo(g+o,r/2),t.lineTo(g,r/2),t.lineTo(g,r/2-f+p),t.quadraticCurveTo(g,r/2-f,g+p,r/2-f),t.fill(),t.beginPath(),t.moveTo(g,r/2),t.lineTo(g+o,r/2),t.lineTo(g+o,r/2+f-p),t.quadraticCurveTo(g+o,r/2+f,g+o-p,r/2+f),t.lineTo(g+p,r/2+f),t.quadraticCurveTo(g,r/2+f,g,r/2+f-p),t.lineTo(g,r/2),t.fill()}}render(){return L.html` <canvas ${f1(this.canvasRef)} width="40" height="40"></canvas> `}};zi.styles=L.css`
737
785
  :host {
738
786
  display: block;
739
787
  width: 40px;
@@ -745,7 +793,7 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
745
793
  width: 100%;
746
794
  height: 100%;
747
795
  }
748
- `,Im([ee({type:Object})],zi.prototype,"volume",2),Im([oe()],zi.prototype,"canvasRef",2),customElements.get("obi-audio-equalizer")||customElements.define("obi-audio-equalizer",zi);var m_=Object.defineProperty,B_=Object.getOwnPropertyDescriptor,v_=(A,e,t,n)=>{for(var i=n>1?void 0:n?B_(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&m_(e,t,i),i};let Bo=class extends L.LitElement{constructor(){super(...arguments),this.activeDots=Array(5).fill(!1),this.numDots=5,this.containerWidth=32,this.dotSize=2,this.bounceHeight=12,this.animationDuration=200,this.pauseDuration=300,this.overlapFactor=.7,this.color="#FFF",this.timeoutIds=[]}connectedCallback(){super.connectedCallback(),this.startAnimation(),this.style.setProperty("--dot-loader-width",`${this.containerWidth}px`),this.style.setProperty("--dot-size",`${this.dotSize}px`),this.style.setProperty("--dot-color",this.color)}disconnectedCallback(){super.disconnectedCallback(),this.stopAnimation()}startAnimation(){this.animateSequence()}stopAnimation(){this.timeoutIds.forEach(e=>window.clearTimeout(e)),this.timeoutIds=[]}animateSequence(){this.activeDots=Array(this.numDots).fill(!1);for(let t=0;t<this.numDots;t++){const n=t*(this.animationDuration*this.overlapFactor),i=window.setTimeout(()=>{this.activeDots=[...this.activeDots],this.activeDots[t]=!0;const r=window.setTimeout(()=>{this.activeDots=[...this.activeDots],this.activeDots[t]=!1},this.animationDuration);this.timeoutIds.push(r)},n);this.timeoutIds.push(i)}const e=window.setTimeout(()=>{this.animateSequence()},this.numDots*this.animationDuration*this.overlapFactor+this.pauseDuration);this.timeoutIds.push(e)}render(){return L.html`
796
+ `,Im([Z({type:Object})],zi.prototype,"volume",2),Im([oe()],zi.prototype,"canvasRef",2),customElements.get("obi-audio-equalizer")||customElements.define("obi-audio-equalizer",zi);var m1=Object.defineProperty,B1=Object.getOwnPropertyDescriptor,v1=(A,e,t,n)=>{for(var i=n>1?void 0:n?B1(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&m1(e,t,i),i};let Bo=class extends L.LitElement{constructor(){super(...arguments),this.activeDots=Array(5).fill(!1),this.numDots=5,this.containerWidth=32,this.dotSize=2,this.bounceHeight=12,this.animationDuration=200,this.pauseDuration=300,this.overlapFactor=.7,this.color="#FFF",this.timeoutIds=[]}connectedCallback(){super.connectedCallback(),this.startAnimation(),this.style.setProperty("--dot-loader-width",`${this.containerWidth}px`),this.style.setProperty("--dot-size",`${this.dotSize}px`),this.style.setProperty("--dot-color",this.color)}disconnectedCallback(){super.disconnectedCallback(),this.stopAnimation()}startAnimation(){this.animateSequence()}stopAnimation(){this.timeoutIds.forEach(e=>window.clearTimeout(e)),this.timeoutIds=[]}animateSequence(){this.activeDots=Array(this.numDots).fill(!1);for(let t=0;t<this.numDots;t++){const n=t*(this.animationDuration*this.overlapFactor),i=window.setTimeout(()=>{this.activeDots=[...this.activeDots],this.activeDots[t]=!0;const r=window.setTimeout(()=>{this.activeDots=[...this.activeDots],this.activeDots[t]=!1},this.animationDuration);this.timeoutIds.push(r)},n);this.timeoutIds.push(i)}const e=window.setTimeout(()=>{this.animateSequence()},this.numDots*this.animationDuration*this.overlapFactor+this.pauseDuration);this.timeoutIds.push(e)}render(){return L.html`
749
797
  <div class="dot-loader">
750
798
  ${this.activeDots.map(e=>L.html`
751
799
  <div
@@ -781,7 +829,7 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
781
829
  transition: transform 0.2s ease-in-out;
782
830
  opacity: 1;
783
831
  }
784
- `,v_([oe()],Bo.prototype,"activeDots",2),customElements.get("obi-dot-loader")||customElements.define("obi-dot-loader",Bo);let Il=class extends L.LitElement{render(){return L.html`
832
+ `,v1([oe()],Bo.prototype,"activeDots",2),customElements.get("obi-dot-loader")||customElements.define("obi-dot-loader",Bo);let Il=class extends L.LitElement{render(){return L.html`
785
833
  <obi-dot-loader loading style="margin-left: 2px"></obi-dot-loader>
786
834
  <span class="text">Searching the knowledge base</span>
787
835
  `}};Il.styles=L.css`
@@ -799,7 +847,7 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
799
847
  font-weight: 500;
800
848
  font-size: 14px;
801
849
  }
802
- `,customElements.get("obi-searching-loader")||customElements.define("obi-searching-loader",Il);var C_=Object.defineProperty,w_=Object.getOwnPropertyDescriptor,Xn=(A,e,t,n)=>{for(var i=n>1?void 0:n?w_(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&C_(e,t,i),i};class DA extends L.LitElement{constructor(){super(...arguments),this.isLoading=!1,this.error=null,this.startAttempts=0}async handleStart(){if(console.log("[SessionStartModal] Start button clicked",{sessionId:this.session?.id,hasOnStartCallback:!!this.onStart,hasSession:!!this.session,isLoading:this.isLoading,startAttempts:this.startAttempts,timestamp:new Date().toISOString()}),ie("session_start_modal_continue_clicked",{sessionId:this.session?.id,sessionName:this.session?.name},"SessionStartModal"),this.isLoading){console.warn("[SessionStartModal] Start already in progress, ignoring click");return}if(!this.session){const e="Session data is missing.";console.error("[SessionStartModal] Validation failed:",e),this.showError(e);return}if(!this.session.id){const e="Session ID is missing.";console.error("[SessionStartModal] Validation failed:",e,{session:this.session}),this.showError(e);return}if(!this.onStart){const e="Start callback is not defined.";console.error("[SessionStartModal] Validation failed:",e),Me(e,{componentName:"SessionStartModal",handlerName:"handleStart",sessionData:this.session,hasOnStart:!!this.onStart}),this.showError(e);return}this.startAttempts++,console.log("[SessionStartModal] Starting session attempt",{attempt:this.startAttempts,sessionId:this.session.id}),this.error=null,this.isLoading=!0;try{console.log("[SessionStartModal] Calling onStart callback",{sessionId:this.session.id,attempt:this.startAttempts}),ie("session_start_modal_calling_onStart",{sessionId:this.session.id},"SessionStartModal"),this.onStart(this.session.id),console.log("[SessionStartModal] Session start completed successfully",{sessionId:this.session.id,attempt:this.startAttempts}),ie("session_start_modal_onStart_called",{sessionId:this.session.id},"SessionStartModal"),setTimeout(()=>{this.isConnected&&Me(new Error("Session start modal did not close after Continue was clicked"),{componentName:"SessionStartModal",handlerName:"handleStart_timeout",sessionId:this.session?.id,modalStillVisible:!0})},2e3)}catch(e){console.error("[SessionStartModal] Session start failed",{sessionId:this.session.id,attempt:this.startAttempts,error:e instanceof Error?e.message:String(e),errorStack:e instanceof Error?e.stack:void 0}),Me(e,{componentName:"SessionStartModal",handlerName:"handleStart",sessionId:this.session?.id}),this.isLoading=!1,e instanceof Error?e.message.includes("network")||e.message.includes("fetch")?this.showError("Network connection failed. Please check your internet connection, refresh the page, and try again."):e.message.includes("unauthorized")||e.message.includes("403")?this.showError("Session access denied."):e.message.includes("session")&&e.message.includes("not found")?this.showError("Session not found."):this.showError(`Failed to start session: ${e.message}.`):this.showError("An unexpected error occurred while starting the session.")}}showError(e){this.error=e,console.error("[SessionStartModal] Displaying error to user:",e)}handleClose(){console.log("[SessionStartModal] Close button clicked",{sessionId:this.session?.id,isLoading:this.isLoading,startAttempts:this.startAttempts}),this.isLoading&&console.warn("[SessionStartModal] Attempted to close while loading"),this.onClose&&this.onClose()}render(){return L.html`
850
+ `,customElements.get("obi-searching-loader")||customElements.define("obi-searching-loader",Il);var C1=Object.defineProperty,w1=Object.getOwnPropertyDescriptor,Xn=(A,e,t,n)=>{for(var i=n>1?void 0:n?w1(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&C1(e,t,i),i};class OA extends L.LitElement{constructor(){super(...arguments),this.isLoading=!1,this.error=null,this.startAttempts=0}async handleStart(){if(console.log("[SessionStartModal] Start button clicked",{sessionId:this.session?.id,hasOnStartCallback:!!this.onStart,hasSession:!!this.session,isLoading:this.isLoading,startAttempts:this.startAttempts,timestamp:new Date().toISOString()}),ie("session_start_modal_continue_clicked",{sessionId:this.session?.id,sessionName:this.session?.name},"SessionStartModal"),this.isLoading){console.warn("[SessionStartModal] Start already in progress, ignoring click");return}if(!this.session){const e="Session data is missing.";console.error("[SessionStartModal] Validation failed:",e),this.showError(e);return}if(!this.session.id){const e="Session ID is missing.";console.error("[SessionStartModal] Validation failed:",e,{session:this.session}),this.showError(e);return}if(!this.onStart){const e="Start callback is not defined.";console.error("[SessionStartModal] Validation failed:",e),Me(e,{componentName:"SessionStartModal",handlerName:"handleStart",sessionData:this.session,hasOnStart:!!this.onStart}),this.showError(e);return}this.startAttempts++,console.log("[SessionStartModal] Starting session attempt",{attempt:this.startAttempts,sessionId:this.session.id}),this.error=null,this.isLoading=!0;try{console.log("[SessionStartModal] Calling onStart callback",{sessionId:this.session.id,attempt:this.startAttempts}),ie("session_start_modal_calling_onStart",{sessionId:this.session.id},"SessionStartModal"),this.onStart(this.session.id),console.log("[SessionStartModal] Session start completed successfully",{sessionId:this.session.id,attempt:this.startAttempts}),ie("session_start_modal_onStart_called",{sessionId:this.session.id},"SessionStartModal"),setTimeout(()=>{this.isConnected&&Me(new Error("Session start modal did not close after Continue was clicked"),{componentName:"SessionStartModal",handlerName:"handleStart_timeout",sessionId:this.session?.id,modalStillVisible:!0})},2e3)}catch(e){console.error("[SessionStartModal] Session start failed",{sessionId:this.session.id,attempt:this.startAttempts,error:e instanceof Error?e.message:String(e),errorStack:e instanceof Error?e.stack:void 0}),Me(e,{componentName:"SessionStartModal",handlerName:"handleStart",sessionId:this.session?.id}),this.isLoading=!1,e instanceof Error?e.message.includes("network")||e.message.includes("fetch")?this.showError("Network connection failed. Please check your internet connection, refresh the page, and try again."):e.message.includes("unauthorized")||e.message.includes("403")?this.showError("Session access denied."):e.message.includes("session")&&e.message.includes("not found")?this.showError("Session not found."):this.showError(`Failed to start session: ${e.message}.`):this.showError("An unexpected error occurred while starting the session.")}}showError(e){this.error=e,console.error("[SessionStartModal] Displaying error to user:",e)}handleClose(){console.log("[SessionStartModal] Close button clicked",{sessionId:this.session?.id,isLoading:this.isLoading,startAttempts:this.startAttempts}),this.isLoading&&console.warn("[SessionStartModal] Attempted to close while loading"),this.onClose&&this.onClose()}render(){return L.html`
803
851
  <div class="backdrop"></div>
804
852
  <div class="container">
805
853
  <button
@@ -834,7 +882,7 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
834
882
  </div>
835
883
  `:""}
836
884
  </div>
837
- `}}DA.styles=L.css`
885
+ `}}OA.styles=L.css`
838
886
  :host {
839
887
  display: block;
840
888
  font-family: "Inter", sans-serif;
@@ -1049,7 +1097,7 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
1049
1097
  opacity: 0.5;
1050
1098
  cursor: not-allowed;
1051
1099
  }
1052
- `,Xn([ee({type:Object})],DA.prototype,"session",2),Xn([ee({type:Function})],DA.prototype,"onStart",2),Xn([ee({type:Function})],DA.prototype,"onClose",2),Xn([oe()],DA.prototype,"isLoading",2),Xn([oe()],DA.prototype,"error",2),Xn([oe()],DA.prototype,"startAttempts",2),customElements.get("obi-session-start-modal")||customElements.define("obi-session-start-modal",DA);var y_=Object.defineProperty,b_=Object.getOwnPropertyDescriptor,Qe=(A,e,t,n)=>{for(var i=n>1?void 0:n?b_(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&y_(e,t,i),i};let Ce=class extends L.LitElement{constructor(){super(),this.apiKey="",this.isActive=!0,this.linkOnlyAccess=!1,this.urlBlacklist=[],this.position="bottom-right",this.user=null,this.state=O.READY,this.storedActiveState=void 0,this.showCourseModal=!1,this.showSessionStartModal=!1,this.selectedCourse=null,this.isHovering=!1,this.navVisible=!1,this.activeSession=null,this.volume={speaker:"ASSISTANT",volume:0,spectrum:[]},this.databaseConfig=null,this.configLoaded=!1,this.configAllInCode=!1,this.sessionToken=null,this.roomToken=null,this.roomUrl=null,this.boundSaveSessionData=null,this.obiClient=null,this.closeNavTimeoutRef=null,this.researchingTimeoutRef=null,this.urlCheckInterval=null,this.currentUrl="",this.connectObi=Vi(async e=>{if(this.activeSession){ie("connection_already_exists",{sessionToken:e},"ObiWidget"),console.log("Connection already exists");return}ie("session_connection_started",{sessionToken:e},"ObiWidget"),Gi({sessionId:e});try{const t=this.createSession(e);if(!t){this.handleSessionCreationFailure(()=>this.removeSessionUrlParams());return}this.setupSessionEventListeners(t,()=>this.removeSessionUrlParams()),t.on("screenCaptureRequested",Vi(async()=>{ie("screen_capture_requested",{},"ObiWidget");try{const r=(await vT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png");this.activeSession.emit("screenCaptureComplete",r),ie("screen_capture_completed",{},"ObiWidget")}catch(i){Me(i,{componentName:"ObiWidget",handlerName:"screenCaptureRequested",sessionToken:e}),console.error("[obi] error capturing screen:",i),this.activeSession.emit("screenCaptureComplete","error"),ie("screen_capture_failed",{error:i instanceof Error?i.message:String(i)},"ObiWidget")}},"screenCaptureRequested","ObiWidget"));const n=await t.connect();n&&(this.sessionToken=e,this.roomToken=n.token,this.roomUrl=n.url,Gi({sessionId:e,widgetState:this.state.toString()}),this.removeSessionUrlParams(),ie("session_connection_established",{sessionToken:e,hasRoomToken:!!n.token},"ObiWidget")),this.activeSession=t}catch(t){console.error("Failed to start session:",t),Me(t,{componentName:"ObiWidget",handlerName:"connectObi",sessionToken:e}),this.handleSessionCreationFailure(()=>this.removeSessionUrlParams())}},"connectObi","ObiWidget"),this.handleCloseModals=()=>{this.state=O.READY,this.showCourseModal=!1,this.showSessionStartModal=!1},this.handleCourseSelectEvent=e=>{const t=e;this.selectedCourse=t.detail,this.showCourseModal=!1,this.showSessionStartModal=!0},this.handleUrlSessionEvent=Vi(async e=>{ie("url_session_event",{sessionToken:e},"ObiWidget");try{if(!this.obiClient){const n=new Error("ObiClient not initialized");Me(n,{componentName:"ObiWidget",handlerName:"handleUrlSessionEvent",sessionToken:e}),console.error("ObiClient not initialized");return}const t=await this.obiClient.startSession(e,this.apiKey);if(t.data){const{session:n}=t.data;if(console.log("[obi-sdk] session:",n),ie("session_started",{sessionId:n?.id,sessionToken:e},"ObiWidget"),n){const i=n;this.selectedCourse={id:e,name:i.onboarding_plan?.name||"",description:i.onboarding_plan?.description||""},this.state=O.LOADING,this.showSessionStartModal=!0,ie("matching_session_found",{sessionToken:e,hasOnboardingPlan:!!i.onboarding_plan},"ObiWidget")}else console.log("[obi-sdk] no session found with token:",e),ie("no_matching_session",{sessionToken:e},"ObiWidget")}}catch(t){console.error("Failed to fetch session details:",t),Me(t,{componentName:"ObiWidget",handlerName:"handleUrlSessionEvent",sessionToken:e})}},"handleUrlSessionEvent","ObiWidget"),this.handleSessionStart=Vi(async e=>{ie("session_start_requested",{sessionToken:e},"ObiWidget"),this.activeSession&&(ie("session_start_blocked",{sessionToken:e},"ObiWidget"),Me(new Error("Session start blocked"),{componentName:"ObiWidget",handlerName:"handleSessionStart",sessionToken:e}),this.activeSession.disconnect(),this.activeSession=null),this.showSessionStartModal=!1,this.state=O.LOADING,Gi({widgetState:this.state.toString()}),await this.connectObi(e)},"handleSessionStart","ObiWidget"),this.checkExistingSession=Vi(async()=>{ie("checking_existing_session",{},"ObiWidget");try{const e=JSON.parse(Tl.getItem(Ul.SESSION_DATA)||"{}"),{sessionToken:t,roomToken:n,roomUrl:i,sessionExpiry:r,obiState:s}=e;if(!t||!n||!i){ie("no_existing_session_data",{},"ObiWidget");return}if(console.log("[obi-sdk] using existing session"),ie("existing_session_data_found",{sessionToken:t,hasExpiry:!!r,obiState:s},"ObiWidget"),r&&new Date(r)<new Date){this.clearSessionStorage(),ie("session_expired",{sessionToken:t},"ObiWidget");return}this.state=O.LOADING,Gi({sessionId:t,widgetState:this.state.toString()});const o=this.createSession(t);if(!o){this.handleSessionCreationFailure(()=>this.clearSessionStorage());return}this.setupSessionEventListeners(o,()=>this.clearSessionStorage()),await o.reconnect(i,n,s)?(this.activeSession=o,this.sessionToken=t,this.roomToken=n,this.roomUrl=i,this.state=s,this.storedActiveState=s,ie("session_reconnected",{sessionToken:t,obiState:s},"ObiWidget")):(this.clearSessionStorage(),ie("session_reconnection_failed",{sessionToken:t},"ObiWidget"))}catch(e){console.error("Error reconnecting to session:",e),Me(e,{componentName:"ObiWidget",handlerName:"checkExistingSession"}),this.handleSessionCreationFailure(()=>this.clearSessionStorage())}},"checkExistingSession","ObiWidget");try{vm("ObiWidget").setContext(),this.obiClient=new Qh({baseUrl:Ka}),this.currentUrl=window.location.href;const t=()=>{try{this.activeSession&&this.sessionToken&&this.roomToken&&this.roomUrl&&this.saveSessionData()}catch(n){Me(n,{componentName:"ObiWidget",handlerName:"handleUnload"})}};window.addEventListener("beforeunload",t),window.addEventListener("pagehide",t),ie("ObiWidget_constructor_completed",{},"ObiWidget")}catch(e){throw Me(e,{componentName:"ObiWidget",lifecycle:"constructor"}),e}}updateFromConfig(){if(window.obiWidgetConfig){this.apiKey=window.obiWidgetConfig.apiKey||this.apiKey,window.obiWidgetConfig.position!==void 0&&(this.position=window.obiWidgetConfig.position,this.setAttribute("position",this.position)),window.obiWidgetConfig.primaryColor!==void 0&&(this.style.setProperty("--obi-primary",window.obiWidgetConfig.primaryColor),this.generateColorVariables(window.obiWidgetConfig.primaryColor)),window.obiWidgetConfig.user!==void 0&&(this.user=window.obiWidgetConfig.user),window.obiWidgetConfig.isActive!==void 0&&(this.isActive=window.obiWidgetConfig.isActive),window.obiWidgetConfig.linkOnlyAccess!==void 0&&(this.linkOnlyAccess=window.obiWidgetConfig.linkOnlyAccess),window.obiWidgetConfig.urlBlacklist!==void 0&&(this.urlBlacklist=window.obiWidgetConfig.urlBlacklist);const e=window.obiWidgetConfig.position!==void 0,t=window.obiWidgetConfig.primaryColor!==void 0,n=window.obiWidgetConfig.linkOnlyAccess!==void 0,i=window.obiWidgetConfig.urlBlacklist!==void 0;this.configAllInCode=e&&t&&n&&i,this.configAllInCode?(this.configLoaded=!0,this.applyFinalConfiguration()):this.configLoaded||this.fetchDatabaseConfig(),window.obiWidgetConfig.showMenu===!0&&(this.state=O.LOADING,this.showCourseModal=!0,window.obiWidgetConfig.showMenu=!1)}else this.configLoaded||this.fetchDatabaseConfig()}generateColorVariables(e){try{const t=Ga(e,"#c4b5fd"),n=Ga(e,"#c76cff"),i=tw(e),r=Ga(e,"#A06DF9");this.style.setProperty("--obi-secondary",t),this.style.setProperty("--obi-course-selected",n),this.style.setProperty("--obi-course-selected-bg",i),this.style.setProperty("--obi-paused-pulse",r)}catch(t){console.warn("Failed to generate color variables:",t),this.style.setProperty("--obi-secondary","#c4b5fd"),this.style.setProperty("--obi-course-selected","#c76cff"),this.style.setProperty("--obi-course-selected-bg","#fbf3ff"),this.style.setProperty("--obi-paused-pulse","#A06DF9")}}removeSessionUrlParams(){const e=new URL(window.location.href);e.searchParams.delete(Ph),window.history.replaceState({},"",e.toString()),localStorage.removeItem("obi-url-params")}createSession(e){try{const t=new OC({sessionId:e,apiBaseUrl:Ka,...this.user&&{user:this.user}});return t||(console.error("Failed to create session"),null)}catch(t){return console.error("Error creating session:",t),null}}setupSessionEventListeners(e,t){e.on("stateChanged",n=>{if(n===O.RESEARCHING){this.researchingTimeoutRef&&window.clearTimeout(this.researchingTimeoutRef),this.state=n,this.researchingTimeoutRef=window.setTimeout(()=>{this.researchingTimeoutRef=null;const i=e.getCurrentState();this.state=i,i!==O.READY&&(this.storedActiveState=i)},1500),this.storedActiveState=n;return}this.researchingTimeoutRef===null&&(this.state=n,n!==O.READY&&(this.storedActiveState=n))}),e.on("volume",({speaker:n,spectrum:i,volume:r})=>{this.volume={speaker:n,spectrum:i,volume:r}}),e.on("error",n=>{console.error("Session error:",n),this.state=O.ERROR,this.activeSession=null,t&&t()})}handleSessionCreationFailure(e){this.state=O.ERROR,this.activeSession=null,e&&e()}clearSessionStorage(){Tl.removeItem(Ul.SESSION_DATA)}handleUrlChange(){this.requestUpdate(),co(this.urlBlacklist)&&this.activeSession&&this.terminateSession()}saveSessionData(){if(this.activeSession&&this.sessionToken&&this.roomToken&&this.roomUrl){const e=new Date;e.setMinutes(e.getMinutes()+5);const t={sessionToken:this.sessionToken,roomToken:this.roomToken,roomUrl:this.roomUrl,obiState:this.storedActiveState??this.state,sessionExpiry:e.toISOString()};Tl.setItem(Ul.SESSION_DATA,JSON.stringify(t))}}async sessionConnectionCheck(){const e=function(){let t={};return t=JSON.parse(localStorage.getItem("obi-url-params")||"{}"),Object.keys(t).length===0&&new URLSearchParams(window.location.search).forEach((i,r)=>{t[r]=i}),localStorage.removeItem("obi-url-params"),t[Ph]}();if(!e){await this.checkExistingSession();return}console.log("[obi-sdk] using magic link"),this.apiKey?await this.handleUrlSessionEvent(e):(console.log("[obi-sdk] API key not ready, retrying..."),setTimeout(()=>{this.apiKey&&this.handleUrlSessionEvent(e)},100))}connectedCallback(){super.connectedCallback(),this.updateFromConfig(),this.addEventListener("obi-config-updated",this.handleConfigUpdate.bind(this)),this.setAttribute("position",this.position),this.boundSaveSessionData=this.saveSessionData.bind(this),window.addEventListener("beforeunload",this.boundSaveSessionData),window.addEventListener("pagehide",this.boundSaveSessionData),this.isActive&&(this.urlCheckInterval=window.setInterval(()=>{this.currentUrl!==window.location.href&&(this.currentUrl=window.location.href,this.handleUrlChange())},1e3)),this.addEventListener("course-select",this.handleCourseSelectEvent)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("obi-config-updated",this.handleConfigUpdate.bind(this)),this.closeNavTimeoutRef!==null&&window.clearTimeout(this.closeNavTimeoutRef),this.researchingTimeoutRef!==null&&(window.clearTimeout(this.researchingTimeoutRef),this.researchingTimeoutRef=null),this.boundSaveSessionData&&(window.removeEventListener("beforeunload",this.boundSaveSessionData),window.removeEventListener("pagehide",this.boundSaveSessionData)),this.urlCheckInterval!==null&&(clearInterval(this.urlCheckInterval),this.urlCheckInterval=null),this.removeSessionUrlParams()}handleConfigUpdate(e){const i=e.detail.isActive&&!this.isActive;this.updateFromConfig(),i&&!co(this.urlBlacklist)&&this.sessionConnectionCheck(),this.requestUpdate()}handleMouseEnter(){this.isHovering=!0,this.navVisible=!0}handleMouseLeave(){this.isHovering=!1,this.closeNavTimeoutRef!==null&&window.clearTimeout(this.closeNavTimeoutRef),this.closeNavTimeoutRef=window.setTimeout(()=>{this.isHovering||(this.navVisible=!1),this.closeNavTimeoutRef=null},300)}terminateSession(){this.clearSessionStorage(),this.sessionToken=null,this.roomToken=null,this.roomUrl=null,this.researchingTimeoutRef!==null&&(window.clearTimeout(this.researchingTimeoutRef),this.researchingTimeoutRef=null),this.activeSession&&(this.activeSession.disconnect(),this.activeSession=null),this.state=O.READY}handleItemSelect(e,t){if(e==="experiences"){this.showCourseModal=!0;return}hi([e,t]).with(["pause",!0],()=>{this.activeSession?.pauseRecording()}).with(["pause",!1],()=>{this.activeSession?.resumeRecording()}).with(["activate",!1],()=>{this.terminateSession()}).otherwise(()=>{})}async fetchDatabaseConfig(){if(!this.apiKey){this.configLoaded=!0,this.applyFinalConfiguration();return}try{const e=`obi-widget-config-${this.apiKey}`,t=localStorage.getItem(e),n=localStorage.getItem(`${e}-timestamp`);if(t&&n){const a=Date.now()-parseInt(n,10),c=10*60*1e3;if(a<c){const l=JSON.parse(t);this.databaseConfig=l,this.configLoaded=!0,this.applyFinalConfiguration();return}}const i=new AbortController,r=setTimeout(()=>i.abort(),3e3),s=await this.obiClient.getOnboardeeWidgetConfig(this.apiKey,i.signal);if(clearTimeout(r),s.error){if(s.response?.status===404){localStorage.removeItem(e),localStorage.removeItem(`${e}-timestamp`),this.databaseConfig=null,this.configLoaded=!0,this.applyFinalConfiguration();return}throw new Error(`HTTP ${s.response?.status||"Unknown error"}`)}const o=s.data;localStorage.setItem(e,JSON.stringify(o)),localStorage.setItem(`${e}-timestamp`,Date.now().toString()),this.databaseConfig=o,this.configLoaded=!0,this.applyFinalConfiguration()}catch(e){e instanceof Error&&e.name==="AbortError"?console.warn("Widget config fetch timed out, using defaults"):console.warn("Failed to fetch widget config from database:",e),this.databaseConfig=null,this.configLoaded=!0,this.applyFinalConfiguration()}}applyFinalConfiguration(){const e=window.obiWidgetConfig,t=this.databaseConfig;this.user=e?.user||this.user,this.position=e?.position||t?.position||this.position,this.setAttribute("position",this.position),e?.isActive!==void 0&&(this.isActive=e.isActive),e?.linkOnlyAccess!==void 0?this.linkOnlyAccess=e.linkOnlyAccess:t?.linkOnlyAccess!==void 0&&(this.linkOnlyAccess=t.linkOnlyAccess);const n=e?.urlBlacklist||[],i=t?.urlBlacklist||[];if(n.length>0||i.length>0){const s=[...n,...i];this.urlBlacklist=[...new Set(s)]}const r=e?.primaryColor||t?.primaryColor||Mr;this.style.setProperty("--obi-primary",r),this.generateColorVariables(r),this.isActive&&!co(this.urlBlacklist)&&this.sessionConnectionCheck()}render(){if(!this.configLoaded||!this.isActive||this.linkOnlyAccess&&this.state===O.READY||co(this.urlBlacklist))return L.nothing;const e=hi(this.state).with(O.LOADING,()=>L.html`<obi-dot-loader></obi-dot-loader>`).with(O.RESEARCHING,()=>L.html`<obi-searching-loader></obi-searching-loader>`).with(UC.union(O.USER_SPEAKING,O.AGENT_SPEAKING),()=>L.html`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`).with(O.THINKING,()=>L.html`<obi-dot-loader></obi-dot-loader>`).with(O.PAUSED,()=>uo).otherwise(()=>uo),t=this.state===O.USER_SPEAKING||this.state===O.AGENT_SPEAKING,n=this.state===O.PAUSED,i=this.state===O.RESEARCHING,r=this.state===O.USER_SPEAKING,s=this.state!==O.READY||this.navVisible,o=this.state!==O.READY||this.navVisible,a=this.position.includes("top")?"down":"up",c=["widget-container",s?"rotated":"",t?"pulse":"",n?"paused-pulse":"",i?"researching":"",r?"user-speaking":""].filter(Boolean).join(" ");return L.html`
1100
+ `,Xn([Z({type:Object})],OA.prototype,"session",2),Xn([Z({type:Function})],OA.prototype,"onStart",2),Xn([Z({type:Function})],OA.prototype,"onClose",2),Xn([oe()],OA.prototype,"isLoading",2),Xn([oe()],OA.prototype,"error",2),Xn([oe()],OA.prototype,"startAttempts",2),customElements.get("obi-session-start-modal")||customElements.define("obi-session-start-modal",OA);var y1=Object.defineProperty,b1=Object.getOwnPropertyDescriptor,Qe=(A,e,t,n)=>{for(var i=n>1?void 0:n?b1(e,t):e,r=A.length-1,s;r>=0;r--)(s=A[r])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&y1(e,t,i),i};let Ce=class extends L.LitElement{constructor(){super(),this.apiKey="",this.isActive=!0,this.linkOnlyAccess=!1,this.urlBlacklist=[],this.position="bottom-right",this.user=null,this.state=O.READY,this.storedActiveState=void 0,this.showCourseModal=!1,this.showSessionStartModal=!1,this.selectedCourse=null,this.isHovering=!1,this.navVisible=!1,this.activeSession=null,this.volume={speaker:"ASSISTANT",volume:0,spectrum:[]},this.databaseConfig=null,this.configLoaded=!1,this.configAllInCode=!1,this.sessionToken=null,this.roomToken=null,this.roomUrl=null,this.boundSaveSessionData=null,this.obiClient=null,this.closeNavTimeoutRef=null,this.researchingTimeoutRef=null,this.urlCheckInterval=null,this.currentUrl="",this.connectObi=Gi(async e=>{if(this.activeSession){ie("connection_already_exists",{sessionToken:e},"ObiWidget"),console.log("Connection already exists");return}ie("session_connection_started",{sessionToken:e},"ObiWidget"),Vi({sessionId:e});try{const t=this.createSession(e);if(!t){this.handleSessionCreationFailure(()=>this.removeSessionUrlParams());return}this.setupSessionEventListeners(t,()=>this.removeSessionUrlParams()),t.on("screenCaptureRequested",Gi(async()=>{ie("screen_capture_requested",{},"ObiWidget");try{const r=(await vT(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png");this.activeSession.emit("screenCaptureComplete",r),ie("screen_capture_completed",{},"ObiWidget")}catch(i){Me(i,{componentName:"ObiWidget",handlerName:"screenCaptureRequested",sessionToken:e}),console.error("[obi] error capturing screen:",i),this.activeSession.emit("screenCaptureComplete","error"),ie("screen_capture_failed",{error:i instanceof Error?i.message:String(i)},"ObiWidget")}},"screenCaptureRequested","ObiWidget"));const n=await t.connect();n&&(this.sessionToken=e,this.roomToken=n.token,this.roomUrl=n.url,Vi({sessionId:e,widgetState:this.state.toString()}),this.removeSessionUrlParams(),ie("session_connection_established",{sessionToken:e,hasRoomToken:!!n.token},"ObiWidget")),this.activeSession=t}catch(t){console.error("Failed to start session:",t),Me(t,{componentName:"ObiWidget",handlerName:"connectObi",sessionToken:e}),this.handleSessionCreationFailure(()=>this.removeSessionUrlParams())}},"connectObi","ObiWidget"),this.handleCloseModals=()=>{this.state=O.READY,this.showCourseModal=!1,this.showSessionStartModal=!1},this.handleCourseSelectEvent=e=>{const t=e;this.selectedCourse=t.detail,this.showCourseModal=!1,this.showSessionStartModal=!0},this.handleUrlSessionEvent=Gi(async e=>{ie("url_session_event",{sessionToken:e},"ObiWidget");try{if(!this.obiClient){const n=new Error("ObiClient not initialized");Me(n,{componentName:"ObiWidget",handlerName:"handleUrlSessionEvent",sessionToken:e}),console.error("ObiClient not initialized");return}const t=await this.obiClient.startSession(e,this.apiKey);if(t.data){const{session:n}=t.data;if(console.log("[obi-sdk] session:",n),ie("session_started",{sessionId:n?.id,sessionToken:e},"ObiWidget"),n){const i=n;this.selectedCourse={id:e,name:i.onboarding_plan?.name||"",description:i.onboarding_plan?.description||""},this.state=O.LOADING,this.showSessionStartModal=!0,ie("matching_session_found",{sessionToken:e,hasOnboardingPlan:!!i.onboarding_plan},"ObiWidget")}else console.log("[obi-sdk] no session found with token:",e),ie("no_matching_session",{sessionToken:e},"ObiWidget")}}catch(t){console.error("Failed to fetch session details:",t),Me(t,{componentName:"ObiWidget",handlerName:"handleUrlSessionEvent",sessionToken:e})}},"handleUrlSessionEvent","ObiWidget"),this.handleSessionStart=Gi(async e=>{ie("session_start_requested",{sessionToken:e},"ObiWidget"),this.activeSession&&(ie("session_start_blocked",{sessionToken:e},"ObiWidget"),Me(new Error("Session start blocked"),{componentName:"ObiWidget",handlerName:"handleSessionStart",sessionToken:e}),this.activeSession.disconnect(),this.activeSession=null),this.showSessionStartModal=!1,this.state=O.LOADING,Vi({widgetState:this.state.toString()}),await this.connectObi(e)},"handleSessionStart","ObiWidget"),this.checkExistingSession=Gi(async()=>{ie("checking_existing_session",{},"ObiWidget");try{const e=JSON.parse(Tl.getItem(Ul.SESSION_DATA)||"{}"),{sessionToken:t,roomToken:n,roomUrl:i,sessionExpiry:r,obiState:s}=e;if(!t||!n||!i){ie("no_existing_session_data",{},"ObiWidget");return}if(console.log("[obi-sdk] using existing session"),ie("existing_session_data_found",{sessionToken:t,hasExpiry:!!r,obiState:s},"ObiWidget"),r&&new Date(r)<new Date){this.clearSessionStorage(),ie("session_expired",{sessionToken:t},"ObiWidget");return}this.state=O.LOADING,Vi({sessionId:t,widgetState:this.state.toString()});const o=this.createSession(t);if(!o){this.handleSessionCreationFailure(()=>this.clearSessionStorage());return}this.setupSessionEventListeners(o,()=>this.clearSessionStorage()),await o.reconnect(i,n,s)?(this.activeSession=o,this.sessionToken=t,this.roomToken=n,this.roomUrl=i,this.state=s,this.storedActiveState=s,ie("session_reconnected",{sessionToken:t,obiState:s},"ObiWidget")):(this.clearSessionStorage(),ie("session_reconnection_failed",{sessionToken:t},"ObiWidget"))}catch(e){console.error("Error reconnecting to session:",e),Me(e,{componentName:"ObiWidget",handlerName:"checkExistingSession"}),this.handleSessionCreationFailure(()=>this.clearSessionStorage())}},"checkExistingSession","ObiWidget");try{vm("ObiWidget").setContext(),this.obiClient=new Qh({baseUrl:Ka}),this.currentUrl=window.location.href;const t=()=>{try{this.activeSession&&this.sessionToken&&this.roomToken&&this.roomUrl&&this.saveSessionData()}catch(n){Me(n,{componentName:"ObiWidget",handlerName:"handleUnload"})}};window.addEventListener("beforeunload",t),window.addEventListener("pagehide",t),ie("ObiWidget_constructor_completed",{},"ObiWidget")}catch(e){throw Me(e,{componentName:"ObiWidget",lifecycle:"constructor"}),e}}updateFromConfig(){if(window.obiWidgetConfig){this.apiKey=window.obiWidgetConfig.apiKey||this.apiKey,window.obiWidgetConfig.position!==void 0&&(this.position=window.obiWidgetConfig.position,this.setAttribute("position",this.position)),window.obiWidgetConfig.primaryColor!==void 0&&(this.style.setProperty("--obi-primary",window.obiWidgetConfig.primaryColor),this.generateColorVariables(window.obiWidgetConfig.primaryColor)),window.obiWidgetConfig.user!==void 0&&(this.user=window.obiWidgetConfig.user),window.obiWidgetConfig.isActive!==void 0&&(this.isActive=window.obiWidgetConfig.isActive),window.obiWidgetConfig.linkOnlyAccess!==void 0&&(this.linkOnlyAccess=window.obiWidgetConfig.linkOnlyAccess),window.obiWidgetConfig.urlBlacklist!==void 0&&(this.urlBlacklist=window.obiWidgetConfig.urlBlacklist);const e=window.obiWidgetConfig.position!==void 0,t=window.obiWidgetConfig.primaryColor!==void 0,n=window.obiWidgetConfig.linkOnlyAccess!==void 0,i=window.obiWidgetConfig.urlBlacklist!==void 0;this.configAllInCode=e&&t&&n&&i,this.configAllInCode?(this.configLoaded=!0,this.applyFinalConfiguration()):this.configLoaded||this.fetchDatabaseConfig(),window.obiWidgetConfig.showMenu===!0&&(this.state=O.LOADING,this.showCourseModal=!0,window.obiWidgetConfig.showMenu=!1)}else this.configLoaded||this.fetchDatabaseConfig()}generateColorVariables(e){try{const t=Va(e,"#c4b5fd"),n=Va(e,"#c76cff"),i=tw(e),r=Va(e,"#A06DF9");this.style.setProperty("--obi-secondary",t),this.style.setProperty("--obi-course-selected",n),this.style.setProperty("--obi-course-selected-bg",i),this.style.setProperty("--obi-paused-pulse",r)}catch(t){console.warn("Failed to generate color variables:",t),this.style.setProperty("--obi-secondary","#c4b5fd"),this.style.setProperty("--obi-course-selected","#c76cff"),this.style.setProperty("--obi-course-selected-bg","#fbf3ff"),this.style.setProperty("--obi-paused-pulse","#A06DF9")}}removeSessionUrlParams(){const e=new URL(window.location.href);e.searchParams.delete(Ph),window.history.replaceState({},"",e.toString()),localStorage.removeItem("obi-url-params")}createSession(e){try{const t=new OC({sessionId:e,apiBaseUrl:Ka,...this.user&&{user:this.user}});return t||(console.error("Failed to create session"),null)}catch(t){return console.error("Error creating session:",t),null}}setupSessionEventListeners(e,t){e.on("stateChanged",n=>{if(n===O.RESEARCHING){this.researchingTimeoutRef&&window.clearTimeout(this.researchingTimeoutRef),this.state=n,this.researchingTimeoutRef=window.setTimeout(()=>{this.researchingTimeoutRef=null;const i=e.getCurrentState();this.state=i,i!==O.READY&&(this.storedActiveState=i)},1500),this.storedActiveState=n;return}this.researchingTimeoutRef===null&&(this.state=n,n!==O.READY&&(this.storedActiveState=n))}),e.on("volume",({speaker:n,spectrum:i,volume:r})=>{this.volume={speaker:n,spectrum:i,volume:r}}),e.on("error",n=>{console.error("Session error:",n),this.state=O.ERROR,this.activeSession=null,t&&t()})}handleSessionCreationFailure(e){this.state=O.ERROR,this.activeSession=null,e&&e()}clearSessionStorage(){Tl.removeItem(Ul.SESSION_DATA)}handleUrlChange(){this.requestUpdate(),co(this.urlBlacklist)&&this.activeSession&&this.terminateSession()}saveSessionData(){if(this.activeSession&&this.sessionToken&&this.roomToken&&this.roomUrl){const e=new Date;e.setMinutes(e.getMinutes()+5);const t={sessionToken:this.sessionToken,roomToken:this.roomToken,roomUrl:this.roomUrl,obiState:this.storedActiveState??this.state,sessionExpiry:e.toISOString()};Tl.setItem(Ul.SESSION_DATA,JSON.stringify(t))}}async sessionConnectionCheck(){const e=function(){let t={};return t=JSON.parse(localStorage.getItem("obi-url-params")||"{}"),Object.keys(t).length===0&&new URLSearchParams(window.location.search).forEach((i,r)=>{t[r]=i}),localStorage.removeItem("obi-url-params"),t[Ph]}();if(!e){await this.checkExistingSession();return}console.log("[obi-sdk] using magic link"),this.apiKey?await this.handleUrlSessionEvent(e):(console.log("[obi-sdk] API key not ready, retrying..."),setTimeout(()=>{this.apiKey&&this.handleUrlSessionEvent(e)},100))}connectedCallback(){super.connectedCallback(),this.updateFromConfig(),this.addEventListener("obi-config-updated",this.handleConfigUpdate.bind(this)),this.setAttribute("position",this.position),this.boundSaveSessionData=this.saveSessionData.bind(this),window.addEventListener("beforeunload",this.boundSaveSessionData),window.addEventListener("pagehide",this.boundSaveSessionData),this.isActive&&(this.urlCheckInterval=window.setInterval(()=>{this.currentUrl!==window.location.href&&(this.currentUrl=window.location.href,this.handleUrlChange())},1e3)),this.addEventListener("course-select",this.handleCourseSelectEvent)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("obi-config-updated",this.handleConfigUpdate.bind(this)),this.closeNavTimeoutRef!==null&&window.clearTimeout(this.closeNavTimeoutRef),this.researchingTimeoutRef!==null&&(window.clearTimeout(this.researchingTimeoutRef),this.researchingTimeoutRef=null),this.boundSaveSessionData&&(window.removeEventListener("beforeunload",this.boundSaveSessionData),window.removeEventListener("pagehide",this.boundSaveSessionData)),this.urlCheckInterval!==null&&(clearInterval(this.urlCheckInterval),this.urlCheckInterval=null),this.removeSessionUrlParams()}handleConfigUpdate(e){const i=e.detail.isActive&&!this.isActive;this.updateFromConfig(),i&&!co(this.urlBlacklist)&&!this.activeSession&&this.sessionConnectionCheck(),this.requestUpdate()}handleMouseEnter(){this.isHovering=!0,this.navVisible=!0}handleMouseLeave(){this.isHovering=!1,this.closeNavTimeoutRef!==null&&window.clearTimeout(this.closeNavTimeoutRef),this.closeNavTimeoutRef=window.setTimeout(()=>{this.isHovering||(this.navVisible=!1),this.closeNavTimeoutRef=null},300)}terminateSession(){this.clearSessionStorage(),this.sessionToken=null,this.roomToken=null,this.roomUrl=null,this.researchingTimeoutRef!==null&&(window.clearTimeout(this.researchingTimeoutRef),this.researchingTimeoutRef=null),this.activeSession&&(this.activeSession.disconnect(),this.activeSession=null),this.state=O.READY}handleItemSelect(e,t){if(e==="experiences"){this.showCourseModal=!0;return}hi([e,t]).with(["pause",!0],()=>{this.activeSession?.pauseRecording()}).with(["pause",!1],()=>{this.activeSession?.resumeRecording()}).with(["activate",!1],()=>{this.terminateSession()}).otherwise(()=>{})}async fetchDatabaseConfig(){if(!this.apiKey){this.configLoaded=!0,this.applyFinalConfiguration();return}try{const e=`obi-widget-config-${this.apiKey}`,t=localStorage.getItem(e),n=localStorage.getItem(`${e}-timestamp`);if(t&&n){const a=Date.now()-parseInt(n,10),c=10*60*1e3;if(a<c){const l=JSON.parse(t);this.databaseConfig=l,this.configLoaded=!0,this.applyFinalConfiguration();return}}const i=new AbortController,r=setTimeout(()=>i.abort(),3e3),s=await this.obiClient.getOnboardeeWidgetConfig(this.apiKey,i.signal);if(clearTimeout(r),s.error){if(s.response?.status===404){localStorage.removeItem(e),localStorage.removeItem(`${e}-timestamp`),this.databaseConfig=null,this.configLoaded=!0,this.applyFinalConfiguration();return}throw new Error(`HTTP ${s.response?.status||"Unknown error"}`)}const o=s.data;localStorage.setItem(e,JSON.stringify(o)),localStorage.setItem(`${e}-timestamp`,Date.now().toString()),this.databaseConfig=o,this.configLoaded=!0,this.applyFinalConfiguration()}catch(e){e instanceof Error&&e.name==="AbortError"?console.warn("Widget config fetch timed out, using defaults"):console.warn("Failed to fetch widget config from database:",e),this.databaseConfig=null,this.configLoaded=!0,this.applyFinalConfiguration()}}applyFinalConfiguration(){const e=window.obiWidgetConfig,t=this.databaseConfig;this.user=e?.user||this.user,this.position=e?.position||t?.position||this.position,this.setAttribute("position",this.position),e?.isActive!==void 0&&(this.isActive=e.isActive),e?.linkOnlyAccess!==void 0?this.linkOnlyAccess=e.linkOnlyAccess:t?.linkOnlyAccess!==void 0&&(this.linkOnlyAccess=t.linkOnlyAccess);const n=e?.urlBlacklist||[],i=t?.urlBlacklist||[];if(n.length>0||i.length>0){const s=[...n,...i];this.urlBlacklist=[...new Set(s)]}const r=e?.primaryColor||t?.primaryColor||Mr;this.style.setProperty("--obi-primary",r),this.generateColorVariables(r),this.isActive&&!co(this.urlBlacklist)&&!this.activeSession&&this.sessionConnectionCheck()}render(){if(!this.configLoaded||!this.isActive||this.linkOnlyAccess&&this.state===O.READY||co(this.urlBlacklist))return L.nothing;const e=hi(this.state).with(O.LOADING,()=>L.html`<obi-dot-loader></obi-dot-loader>`).with(O.RESEARCHING,()=>L.html`<obi-searching-loader></obi-searching-loader>`).with(UC.union(O.USER_SPEAKING,O.AGENT_SPEAKING),()=>L.html`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`).with(O.THINKING,()=>L.html`<obi-dot-loader></obi-dot-loader>`).with(O.PAUSED,()=>uo).otherwise(()=>uo),t=this.state===O.USER_SPEAKING||this.state===O.AGENT_SPEAKING,n=this.state===O.PAUSED,i=this.state===O.RESEARCHING,r=this.state===O.USER_SPEAKING,s=this.state!==O.READY||this.navVisible,o=this.state!==O.READY||this.navVisible,a=this.position.includes("top")?"down":"up",c=["widget-container",s?"rotated":"",t?"pulse":"",n?"paused-pulse":"",i?"researching":"",r?"user-speaking":""].filter(Boolean).join(" ");return L.html`
1053
1101
  <div
1054
1102
  class="${c}"
1055
1103
  @mouseenter=${this.handleMouseEnter}
@@ -1225,5 +1273,5 @@ Url: ${io(A)}`),!0}return!1}function $F(A,e){return e?.length?Vp(A).some(t=>Xs(t
1225
1273
  box-shadow: 0px 0px 18px 6px
1226
1274
  color-mix(in srgb, var(--obi-paused-pulse, #a06df9) 75%, transparent);
1227
1275
  }
1228
- `,Qe([oe()],Ce.prototype,"apiKey",2),Qe([oe()],Ce.prototype,"isActive",2),Qe([oe()],Ce.prototype,"linkOnlyAccess",2),Qe([oe()],Ce.prototype,"urlBlacklist",2),Qe([oe()],Ce.prototype,"position",2),Qe([oe()],Ce.prototype,"user",2),Qe([oe()],Ce.prototype,"state",2),Qe([oe()],Ce.prototype,"storedActiveState",2),Qe([oe()],Ce.prototype,"showCourseModal",2),Qe([oe()],Ce.prototype,"showSessionStartModal",2),Qe([oe()],Ce.prototype,"selectedCourse",2),Qe([oe()],Ce.prototype,"isHovering",2),Qe([oe()],Ce.prototype,"navVisible",2),Qe([oe()],Ce.prototype,"activeSession",2),Qe([oe()],Ce.prototype,"volume",2),Qe([oe()],Ce.prototype,"databaseConfig",2),Qe([oe()],Ce.prototype,"configLoaded",2),Qe([oe()],Ce.prototype,"configAllInCode",2),customElements.get("obi-widget")||customElements.define("obi-widget",Ce);const E_=zn({tagName:"obi-course-modal",elementClass:Ft,react:Kt}),S_=zn({tagName:"obi-audio-equalizer",elementClass:zi,react:Kt}),U_=zn({tagName:"obi-dot-loader",elementClass:Bo,react:Kt}),T_=zn({tagName:"obi-searching-loader",elementClass:Il,react:Kt}),Q_=zn({tagName:"obi-widget",elementClass:Ce,react:Kt});ot.AudioEqualizer=S_,ot.CourseModal=E_,ot.DotLoader=U_,ot.ObiWidget=Q_,ot.SearchingLoader=T_,Object.defineProperty(ot,Symbol.toStringTag,{value:"Module"})});
1276
+ `,Qe([oe()],Ce.prototype,"apiKey",2),Qe([oe()],Ce.prototype,"isActive",2),Qe([oe()],Ce.prototype,"linkOnlyAccess",2),Qe([oe()],Ce.prototype,"urlBlacklist",2),Qe([oe()],Ce.prototype,"position",2),Qe([oe()],Ce.prototype,"user",2),Qe([oe()],Ce.prototype,"state",2),Qe([oe()],Ce.prototype,"storedActiveState",2),Qe([oe()],Ce.prototype,"showCourseModal",2),Qe([oe()],Ce.prototype,"showSessionStartModal",2),Qe([oe()],Ce.prototype,"selectedCourse",2),Qe([oe()],Ce.prototype,"isHovering",2),Qe([oe()],Ce.prototype,"navVisible",2),Qe([oe()],Ce.prototype,"activeSession",2),Qe([oe()],Ce.prototype,"volume",2),Qe([oe()],Ce.prototype,"databaseConfig",2),Qe([oe()],Ce.prototype,"configLoaded",2),Qe([oe()],Ce.prototype,"configAllInCode",2),customElements.get("obi-widget")||customElements.define("obi-widget",Ce);const E1=zn({tagName:"obi-course-modal",elementClass:Ft,react:Vt}),S1=zn({tagName:"obi-audio-equalizer",elementClass:zi,react:Vt}),U1=zn({tagName:"obi-dot-loader",elementClass:Bo,react:Vt}),T1=zn({tagName:"obi-searching-loader",elementClass:Il,react:Vt}),Q1=zn({tagName:"obi-widget",elementClass:Ce,react:Vt});ot.AudioEqualizer=S1,ot.CourseModal=E1,ot.DotLoader=U1,ot.ObiWidget=Q1,ot.SearchingLoader=T1,Object.defineProperty(ot,Symbol.toStringTag,{value:"Module"})});
1229
1277
  //# sourceMappingURL=react.umd.js.map